Signed-off-by: Michael Niedermayer <michaelni@gmx.at>tags/n0.9
| @@ -2963,7 +2963,7 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic) | |||||
| ist->st = st; | ist->st = st; | ||||
| ist->file_index = nb_input_files; | ist->file_index = nb_input_files; | ||||
| ist->discard = 1; | 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; | ist->ts_scale = 1.0; | ||||
| MATCH_PER_STREAM_OPT(ts_scale, dbl, ist->ts_scale, ic, st); | 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; | st->codec->codec_type = type; | ||||
| choose_encoder(o, oc, ost); | choose_encoder(o, oc, ost); | ||||
| if (ost->enc) { | 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); | avcodec_get_context_defaults3(st->codec, ost->enc); | ||||
| @@ -945,11 +945,10 @@ int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec) | |||||
| return AVERROR(EINVAL); | 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; | AVDictionary *ret = NULL; | ||||
| AVDictionaryEntry *t = 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; | int flags = s->oformat ? AV_OPT_FLAG_ENCODING_PARAM : AV_OPT_FLAG_DECODING_PARAM; | ||||
| char prefix = 0; | char prefix = 0; | ||||
| const AVClass *cc = avcodec_get_class(); | const AVClass *cc = avcodec_get_class(); | ||||
| @@ -999,7 +998,7 @@ AVDictionary **setup_find_stream_info_opts(AVFormatContext *s, AVDictionary *cod | |||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| for (i = 0; i < s->nb_streams; i++) | 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; | return opts; | ||||
| } | } | ||||
| @@ -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. | * @param st A stream from s for which the options should be filtered. | ||||
| * @return a pointer to the created dictionary | * @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(). | * Setup AVCodecContext options for avformat_find_stream_info(). | ||||
| @@ -3189,7 +3189,7 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic) | |||||
| ist->st = st; | ist->st = st; | ||||
| ist->file_index = nb_input_files; | ist->file_index = nb_input_files; | ||||
| ist->discard = 1; | 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; | ist->ts_scale = 1.0; | ||||
| MATCH_PER_STREAM_OPT(ts_scale, dbl, ist->ts_scale, ic, st); | 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; | st->codec->codec_type = type; | ||||
| choose_encoder(o, oc, ost); | choose_encoder(o, oc, ost); | ||||
| if (ost->enc) { | 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); | avcodec_get_context_defaults3(st->codec, ost->enc); | ||||
| @@ -2217,9 +2217,9 @@ static int stream_component_open(VideoState *is, int stream_index) | |||||
| return -1; | return -1; | ||||
| avctx = ic->streams[stream_index]->codec; | 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); | codec = avcodec_find_decoder(avctx->codec_id); | ||||
| opts = filter_codec_opts(codec_opts, codec, ic, ic->streams[stream_index]); | |||||
| switch(avctx->codec_type){ | 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_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; | case AVMEDIA_TYPE_SUBTITLE: if(subtitle_codec_name) codec= avcodec_find_decoder_by_name(subtitle_codec_name); break; | ||||