On 19/09/13 10:27, Martin Storsjö wrote: > On Wed, 18 Sep 2013, Luca Barbato wrote: > >> From: Justin Ruggles <justin.rugg...@gmail.com> >> >> Signed-off-by: Luca Barbato <lu_z...@gentoo.org> >> --- >> >> Updated a little, is being really useful to debug QSV. >> >> avplay.c | 35 ++++++++++++++++++++++++++++++----- >> doc/avplay.texi | 4 ++++ >> 2 files changed, 34 insertions(+), 5 deletions(-) > > In general, this is really nice and appreciated. > >> diff --git a/avplay.c b/avplay.c >> index 00becbe..18c6364 100644 >> --- a/avplay.c >> +++ b/avplay.c >> @@ -231,6 +231,8 @@ static int screen_width = 0; >> static int screen_height = 0; >> static int audio_disable; >> static int video_disable; >> +static const char *acodec_name; >> +static const char *vcodec_name; >> static int wanted_stream[AVMEDIA_TYPE_NB] = { >> [AVMEDIA_TYPE_AUDIO] = -1, >> [AVMEDIA_TYPE_VIDEO] = -1, >> @@ -2024,10 +2026,11 @@ static int stream_component_open(VideoState >> *is, int stream_index) >> { >> AVFormatContext *ic = is->ic; >> AVCodecContext *avctx; >> - AVCodec *codec; >> + AVCodec *codec = NULL; >> SDL_AudioSpec wanted_spec, spec; >> AVDictionary *opts; >> AVDictionaryEntry *t = NULL; >> + enum AVMediaType codec_type; >> >> if (stream_index < 0 || stream_index >= ic->nb_streams) >> return -1; >> @@ -2035,7 +2038,26 @@ static int stream_component_open(VideoState >> *is, int stream_index) >> >> opts = filter_codec_opts(codec_opts, avctx->codec_id, ic, >> ic->streams[stream_index], NULL); >> >> - codec = avcodec_find_decoder(avctx->codec_id); >> + codec_type = avcodec_get_type(avctx->codec_id); >> + if (acodec_name && codec_type == AVMEDIA_TYPE_AUDIO || >> + vcodec_name && codec_type == AVMEDIA_TYPE_VIDEO) { >> + const char *name; >> + if (codec_type == AVMEDIA_TYPE_AUDIO) >> + name = acodec_name; >> + else >> + name = vcodec_name; >> + >> + codec = avcodec_find_decoder_by_name(name); >> + if (!codec) { >> + av_log(NULL, AV_LOG_FATAL, "Unknown decoder '%s'\n", name); >> + } else if (codec->type != codec_type) { >> + av_log(NULL, AV_LOG_FATAL, "Invalid decoder type '%s'\n", >> name); >> + codec = NULL; >> + } >> + } else { >> + codec = avcodec_find_decoder(avctx->codec_id); >> + } >> + >> avctx->debug_mv = debug_mv; >> avctx->workaround_bugs = workaround_bugs; >> avctx->idct_algo = idct; >> @@ -2315,9 +2337,6 @@ static int decode_thread(void *arg) >> st_index[AVMEDIA_TYPE_AUDIO] : >> st_index[AVMEDIA_TYPE_VIDEO]), >> NULL, 0); >> - if (show_status) { >> - av_dump_format(ic, 0, is->filename, 0); >> - } >> >> /* open the streams */ >> if (st_index[AVMEDIA_TYPE_AUDIO] >= 0) { >> @@ -2344,6 +2363,10 @@ static int decode_thread(void *arg) >> goto fail; >> } >> >> + if (show_status) { >> + av_dump_format(ic, 0, is->filename, 0); >> + } >> + > > Why is this block moved? > >> for (;;) { >> if (is->abort_request) >> break; >> @@ -2860,6 +2883,8 @@ static const OptionDef options[] = { >> { "rdftspeed", OPT_INT | HAS_ARG| OPT_AUDIO | OPT_EXPERT, { >> &rdftspeed }, "rdft speed", "msecs" }, >> { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, { >> opt_default }, "generic catch all option", "" }, >> { "i", 0, { NULL }, "avconv compatibility dummy option", ""}, >> + { "ac", HAS_ARG | OPT_STRING, { &acodec_name }, "audio codec >> name", "" }, >> + { "vc", HAS_ARG | OPT_STRING, { &vcodec_name }, "video codec >> name", "" }, >> { NULL, }, > > Would it make more sense to name them acodec and vcodec as the (old) > avconv options, instead of inventing yet another naming?
It is in line with the other avplay short options, acodec and vcodec are deprecated, I do not have time to add -c:{number,a,v,s} properly. lu _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel