82#include "common/tools_common.h"
83#include "common/video_reader.h"
85static const char *exec_name;
87void usage_exit(
void) {
88 fprintf(stderr,
"Usage: %s <infile> <outfile>\n", exec_name);
92int main(
int argc,
char **argv) {
95 AvxVideoReader *reader = NULL;
96 const AvxVideoInfo *info = NULL;
100 if (argc != 3) die(
"Invalid number of arguments.");
102 reader = aom_video_reader_open(argv[1]);
103 if (!reader) die(
"Failed to open %s for reading.", argv[1]);
105 if (!(outfile = fopen(argv[2],
"wb")))
106 die(
"Failed to open %s for writing.", argv[2]);
108 info = aom_video_reader_get_info(reader);
111 if (!decoder) die(
"Unknown input codec.");
117 die(
"Failed to initialize decoder.");
119 while (aom_video_reader_read_frame(reader)) {
122 size_t frame_size = 0;
123 const unsigned char *frame =
124 aom_video_reader_get_frame(reader, &frame_size);
126 die_codec(&codec,
"Failed to decode frame.");
129 aom_img_write(img, outfile);
134 printf(
"Processed %d frames.\n", frame_cnt);
137 printf(
"Play: ffplay -f rawvideo -pix_fmt yuv420p -s %dx%d %s\n",
138 info->frame_width, info->frame_height, argv[2]);
140 aom_video_reader_close(reader);
Describes the decoder algorithm interface to applications.
const char * aom_codec_iface_name(aom_codec_iface_t *iface)
Return the name for a given interface.
const struct aom_codec_iface aom_codec_iface_t
Codec interface structure.
Definition aom_codec.h:271
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:305
aom_image_t * aom_codec_get_frame(aom_codec_ctx_t *ctx, aom_codec_iter_t *iter)
Decoded frames iterator.
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:129
Codec context structure.
Definition aom_codec.h:315
Image Descriptor.
Definition aom_image.h:182