aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-11-27 21:17:56 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-11-27 21:17:56 +0100
commit6d13499be04a610b6ce4c445eac768244ee04d64 (patch)
tree369940f19a4f83b5a7eec7d5cf2f044de6f84339
parente99c4bbdf3ddaf8d68c8eb882eda2c2c36219235 (diff)
downloadffmpeg-6d13499be04a610b6ce4c445eac768244ee04d64.tar.gz
cmdutils: pass AVCodec to filter_codec_opts()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--avconv.c4
-rw-r--r--cmdutils.c5
-rw-r--r--cmdutils.h2
-rw-r--r--ffmpeg.c4
-rw-r--r--ffplay.c4
5 files changed, 9 insertions, 10 deletions
diff --git a/avconv.c b/avconv.c
index 4620b2baa8..9140a2ad51 100644
--- a/avconv.c
+++ b/avconv.c
@@ -2963,7 +2963,7 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
ist->st = st;
ist->file_index = nb_input_files;
ist->discard = 1;
- ist->opts = filter_codec_opts(codec_opts, ist->st->codec->codec_id, ic, st);
+ ist->opts = filter_codec_opts(codec_opts, choose_decoder(o, ic, st), ic, st);
ist->ts_scale = 1.0;
MATCH_PER_STREAM_OPT(ts_scale, dbl, ist->ts_scale, ic, st);
@@ -3302,7 +3302,7 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
st->codec->codec_type = type;
choose_encoder(o, oc, ost);
if (ost->enc) {
- ost->opts = filter_codec_opts(codec_opts, ost->enc->id, oc, st);
+ ost->opts = filter_codec_opts(codec_opts, ost->enc, oc, st);
}
avcodec_get_context_defaults3(st->codec, ost->enc);
diff --git a/cmdutils.c b/cmdutils.c
index daca802181..62c87cb6b6 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -945,11 +945,10 @@ int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
return AVERROR(EINVAL);
}
-AVDictionary *filter_codec_opts(AVDictionary *opts, enum CodecID codec_id, AVFormatContext *s, AVStream *st)
+AVDictionary *filter_codec_opts(AVDictionary *opts, AVCodec *codec, AVFormatContext *s, AVStream *st)
{
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();
@@ -999,7 +998,7 @@ AVDictionary **setup_find_stream_info_opts(AVFormatContext *s, AVDictionary *cod
return NULL;
}
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]);
+ opts[i] = filter_codec_opts(codec_opts, avcodec_find_decoder(s->streams[i]->codec->codec_id), s, s->streams[i]);
return opts;
}
diff --git a/cmdutils.h b/cmdutils.h
index 3544cdb9f0..8c140f2157 100644
--- a/cmdutils.h
+++ b/cmdutils.h
@@ -212,7 +212,7 @@ int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec);
* @param st A stream from s for which the options should be filtered.
* @return a pointer to the created dictionary
*/
-AVDictionary *filter_codec_opts(AVDictionary *opts, enum CodecID codec_id, AVFormatContext *s, AVStream *st);
+AVDictionary *filter_codec_opts(AVDictionary *opts, AVCodec *codec, AVFormatContext *s, AVStream *st);
/**
* Setup AVCodecContext options for avformat_find_stream_info().
diff --git a/ffmpeg.c b/ffmpeg.c
index 8db18dcf72..40f5ea8ce8 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3189,7 +3189,7 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
ist->st = st;
ist->file_index = nb_input_files;
ist->discard = 1;
- ist->opts = filter_codec_opts(codec_opts, ist->st->codec->codec_id, ic, st);
+ ist->opts = filter_codec_opts(codec_opts, choose_decoder(o, ic, st), ic, st);
ist->ts_scale = 1.0;
MATCH_PER_STREAM_OPT(ts_scale, dbl, ist->ts_scale, ic, st);
@@ -3546,7 +3546,7 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
st->codec->codec_type = type;
choose_encoder(o, oc, ost);
if (ost->enc) {
- ost->opts = filter_codec_opts(codec_opts, ost->enc->id, oc, st);
+ ost->opts = filter_codec_opts(codec_opts, ost->enc, oc, st);
}
avcodec_get_context_defaults3(st->codec, ost->enc);
diff --git a/ffplay.c b/ffplay.c
index 673f31db15..75e0bb55bf 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -2217,9 +2217,9 @@ static int stream_component_open(VideoState *is, int stream_index)
return -1;
avctx = ic->streams[stream_index]->codec;
- opts = filter_codec_opts(codec_opts, avctx->codec_id, ic, ic->streams[stream_index]);
-
codec = avcodec_find_decoder(avctx->codec_id);
+ opts = filter_codec_opts(codec_opts, codec, ic, ic->streams[stream_index]);
+
switch(avctx->codec_type){
case AVMEDIA_TYPE_AUDIO : if(audio_codec_name ) codec= avcodec_find_decoder_by_name( audio_codec_name); break;
case AVMEDIA_TYPE_SUBTITLE: if(subtitle_codec_name) codec= avcodec_find_decoder_by_name(subtitle_codec_name); break;