diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-09-22 19:56:35 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-09-22 19:56:35 +0400 |
commit | bad953bc2df5e97a3c02ecff0d652bb4626512e8 (patch) | |
tree | 83c602c635204894e24e55ba492343ed6d7ba3f6 /ffmpeg_opt.c | |
parent | 8364bde02b24c26f4fd7e154149293c10ad8389a (diff) |
ffmpeg: fix overriding codecs with the new syntax
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg_opt.c')
-rw-r--r-- | ffmpeg_opt.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c index f337a9186c..db5926ace3 100644 --- a/ffmpeg_opt.c +++ b/ffmpeg_opt.c @@ -54,6 +54,17 @@ }\ } +#define MATCH_PER_TYPE_OPT(name, type, outvar, fmtctx, mediatype)\ +{\ + int i, ret;\ + for (i = 0; i < o->nb_ ## name; i++) {\ + char *spec = o->name[i].specifier;\ + if (!strcmp(spec, mediatype) || !*spec)\ + outvar = o->name[i].u.type;\ + else if (ret < 0)\ + exit_program(1);\ + }\ +} char *vstats_filename; float audio_drift_threshold = 0.1; @@ -688,6 +699,9 @@ static int opt_input_file(void *optctx, const char *opt, const char *filename) uint8_t buf[128]; AVDictionary **opts; int orig_nb_streams; // number of streams before avformat_find_stream_info + char * video_codec_name = NULL; + char * audio_codec_name = NULL; + char *subtitle_codec_name = NULL; if (o->format) { if (!(file_iformat = av_find_input_format(o->format))) { @@ -740,6 +754,10 @@ static int opt_input_file(void *optctx, const char *opt, const char *filename) if (o->nb_frame_pix_fmts) av_dict_set(&format_opts, "pixel_format", o->frame_pix_fmts[o->nb_frame_pix_fmts - 1].u.str, 0); + MATCH_PER_TYPE_OPT(codec_names, str, video_codec_name, ic, "v"); + MATCH_PER_TYPE_OPT(codec_names, str, audio_codec_name, ic, "a"); + MATCH_PER_TYPE_OPT(codec_names, str, subtitle_codec_name, ic, "s"); + ic->video_codec_id = video_codec_name ? find_codec_or_die(video_codec_name , AVMEDIA_TYPE_VIDEO , 0)->id : AV_CODEC_ID_NONE; ic->audio_codec_id = audio_codec_name ? |