82 #include "common/tools_common.h" 83 #include "common/video_reader.h" 85 static const char *exec_name;
87 void usage_exit(
void) {
88 fprintf(stderr,
"Usage: %s <infile> <outfile>\n", exec_name);
92 int main(
int argc,
char **argv) {
96 AvxVideoReader *reader = NULL;
97 const AvxInterface *decoder = NULL;
98 const AvxVideoInfo *info = NULL;
102 if (argc != 3) die(
"Invalid number of arguments.");
104 reader = aom_video_reader_open(argv[1]);
105 if (!reader) die(
"Failed to open %s for reading.", argv[1]);
107 if (!(outfile = fopen(argv[2],
"wb")))
108 die(
"Failed to open %s for writing.", argv[2]);
110 info = aom_video_reader_get_info(reader);
112 decoder = get_aom_decoder_by_fourcc(info->codec_fourcc);
113 if (!decoder) die(
"Unknown input codec.");
118 die_codec(&codec,
"Failed to initialize decoder.");
120 while (aom_video_reader_read_frame(reader)) {
123 size_t frame_size = 0;
124 const unsigned char *frame =
125 aom_video_reader_get_frame(reader, &frame_size);
127 die_codec(&codec,
"Failed to decode frame.");
130 aom_img_write(img, outfile);
135 printf(
"Processed %d frames.\n", frame_cnt);
138 printf(
"Play: ffplay -f rawvideo -pix_fmt yuv420p -s %dx%d %s\n",
139 info->frame_width, info->frame_height, argv[2]);
141 aom_video_reader_close(reader);
aom_image_t * aom_codec_get_frame(aom_codec_ctx_t *ctx, aom_codec_iter_t *iter)
Decoded frames iterator.
Codec context structure.
Definition: aom_codec.h:204
Describes the decoder algorithm interface to applications.
Image Descriptor.
Definition: aom_image.h:141
aom_codec_err_t aom_codec_decode(aom_codec_ctx_t *ctx, const uint8_t *data, size_t data_sz, void *user_priv)
Decode data.
#define aom_codec_dec_init(ctx, iface, cfg, flags)
Convenience macro for aom_codec_dec_init_ver()
Definition: aom_decoder.h:142
const char * aom_codec_iface_name(aom_codec_iface_t *iface)
Return the name for a given interface.
aom_codec_err_t aom_codec_destroy(aom_codec_ctx_t *ctx)
Destroy a codec instance.
const void * aom_codec_iter_t
Iterator.
Definition: aom_codec.h:194