From d3ed1c9571c24d33fc485fba01bc2d6ed4de18b1 Mon Sep 17 00:00:00 2001 From: Martin Storsjö Date: Sat, 30 Jun 2012 01:28:02 +0300 Subject: cmdutils: Pass the actual chosen encoder to filter_codec_opts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows passing the right options to encoders when there's more than one encoder for a certain codec id. Signed-off-by: Martin Storsjö --- cmdutils.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'cmdutils.c') diff --git a/cmdutils.c b/cmdutils.c index abf89a3e43..6d13bd6b4d 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -948,17 +948,18 @@ int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec) } AVDictionary *filter_codec_opts(AVDictionary *opts, enum CodecID codec_id, - AVFormatContext *s, AVStream *st) + AVFormatContext *s, AVStream *st, AVCodec *codec) { AVDictionary *ret = NULL; AVDictionaryEntry *t = NULL; - AVCodec *codec = s->oformat ? avcodec_find_encoder(codec_id) - : avcodec_find_decoder(codec_id); int flags = s->oformat ? AV_OPT_FLAG_ENCODING_PARAM : AV_OPT_FLAG_DECODING_PARAM; char prefix = 0; const AVClass *cc = avcodec_get_class(); + if (!codec) + codec = s->oformat ? avcodec_find_encoder(codec_id) + : avcodec_find_decoder(codec_id); if (!codec) return NULL; @@ -1020,7 +1021,7 @@ AVDictionary **setup_find_stream_info_opts(AVFormatContext *s, } for (i = 0; i < s->nb_streams; i++) opts[i] = filter_codec_opts(codec_opts, s->streams[i]->codec->codec_id, - s, s->streams[i]); + s, s->streams[i], NULL); return opts; } -- cgit v1.2.3