int file_is_raw(struct VpxInputContext *input) { uint8_t buf[32]; int is_raw = 0; vpx_codec_stream_info_t si; si.sz = sizeof(si); if (fread(buf, 1, 32, input->file) == 32) { int i; if (mem_get_le32(buf) < 256 * 1024 * 1024) { for (i = 0; i < get_vpx_decoder_count(); ++i) { const VpxInterface *const decoder = get_vpx_decoder_by_index(i); if (!vpx_codec_peek_stream_info(decoder->interface(), buf + 4, 32 - 4, &si)) { is_raw = 1; input->fourcc = decoder->fourcc; input->width = si.w; input->height = si.h; input->framerate.numerator = 30; input->framerate.denominator = 1; break; } } } } rewind(input->file); return is_raw; }
void usage_exit() { int i; fprintf(stderr, "Usage: %s <options> filename\n\n" "Options:\n", exec_name); arg_show_usage(stderr, all_args); #if CONFIG_VP8_DECODER fprintf(stderr, "\nVP8 Postprocessing Options:\n"); arg_show_usage(stderr, vp8_pp_args); #endif fprintf(stderr, "\nOutput File Patterns:\n\n" " The -o argument specifies the name of the file(s) to " "write to. If the\n argument does not include any escape " "characters, the output will be\n written to a single file. " "Otherwise, the filename will be calculated by\n expanding " "the following escape characters:\n"); fprintf(stderr, "\n\t%%w - Frame width" "\n\t%%h - Frame height" "\n\t%%<n> - Frame number, zero padded to <n> places (1..9)" "\n\n Pattern arguments are only supported in conjunction " "with the --yv12 and\n --i420 options. If the -o option is " "not specified, the output will be\n directed to stdout.\n" ); fprintf(stderr, "\nIncluded decoders:\n\n"); for (i = 0; i < get_vpx_decoder_count(); ++i) { const VpxInterface *const decoder = get_vpx_decoder_by_index(i); fprintf(stderr, " %-6s - %s\n", decoder->name, vpx_codec_iface_name(decoder->interface())); } exit(EXIT_FAILURE); }
const VpxInterface *get_vpx_decoder_by_fourcc(uint32_t fourcc) { int i; for (i = 0; i < get_vpx_decoder_count(); ++i) { const VpxInterface *const decoder = get_vpx_decoder_by_index(i); if (decoder->fourcc == fourcc) return decoder; } return NULL; }
const VpxInterface *get_vpx_decoder_by_name(const char *name) { int i; for (i = 0; i < get_vpx_decoder_count(); ++i) { const VpxInterface *const decoder = get_vpx_decoder_by_index(i); if (strcmp(decoder->name, name) == 0) return decoder; } return NULL; }