On 04/25/2011 10:46 AM, Justin Ruggles wrote: > On 04/25/2011 10:14 AM, Ronald S. Bultje wrote: > >> Hi, >> >> On Sun, Apr 24, 2011 at 10:06 PM, Justin Ruggles >> <[email protected]> wrote: >> [..] >>> diff --git a/ffplay.c b/ffplay.c >> [..] >>> @@ -2416,6 +2416,23 @@ static int decode_thread(void *arg) >>> + /* Set AVCodecContext options so they will be seen by >>> av_find_stream_info() */ >>> + for (i = 0; i < ic->nb_streams; i++) { >>> + AVCodecContext *dec = ic->streams[i]->codec; >>> + switch (dec->codec_type) { >>> + case AVMEDIA_TYPE_AUDIO: >>> + set_context_opts(dec, avcodec_opts[AVMEDIA_TYPE_AUDIO], >>> + AV_OPT_FLAG_AUDIO_PARAM | >>> AV_OPT_FLAG_DECODING_PARAM, >>> + NULL); >>> + break; >>> + case AVMEDIA_TYPE_VIDEO: >>> + set_context_opts(dec, avcodec_opts[AVMEDIA_TYPE_VIDEO], >>> + AV_OPT_FLAG_VIDEO_PARAM | >>> AV_OPT_FLAG_DECODING_PARAM, >>> + NULL); >>> + break; >>> + } >>> + } >> >> Can possibly be generalized in cmdutils.c... > > > possibly... it doesn't do much though. if not for the flags it would > basically be a loop around set_context_opts(). > > i can shorten it if you want. :) > > for (i = 0; i < ic->nb_streams; i++) { > AVCodecContext *dec = ic->streams[i]->codec; > int oflag = 0; > switch (dec->codec_type) { > case AVMEDIA_TYPE_AUDIO: oflag = AVMEDIA_TYPE_AUDIO; break; > case AVMEDIA_TYPE_VIDEO: oflag = AVMEDIA_TYPE_VIDEO; break; > } > if (oflag) > set_context_opts(dec, avcodec_opts[dec->codec_type], > oflag | AV_OPT_FLAG_DECODING_PARAM, NULL); > }
oops, that code isn't quite right. flag names should be AV_OPT_FLAG_AUDIO_PARAM and AV_OPT_FLAG_VIDEO_PARAM. but the concept still works. -Justin _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
