From a3ad68d36c0bff87c525035b3f745bb274b00d41 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 13 Aug 2012 20:06:25 +0200 Subject: cmdutils: extend -h to allow printing codec details. --- doc/avtools-common-opts.texi | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'doc') diff --git a/doc/avtools-common-opts.texi b/doc/avtools-common-opts.texi index 375e4b041c..eefb37bfcf 100644 --- a/doc/avtools-common-opts.texi +++ b/doc/avtools-common-opts.texi @@ -51,8 +51,20 @@ These options are shared amongst the av* tools. @item -L Show license. -@item -h, -?, -help, --help -Show help. +@item -h, -?, -help, --help [@var{arg}] +Show help. An optional parameter may be specified to print help about a specific +item. + +Possible values of @var{arg} are: +@table @option +@item decoder=@var{decoder_name} +Print detailed information about the decoder named @var{decoder_name}. Use the +@option{-decoders} option to get a list of all decoders. + +@item encoder=@var{encoder_name} +Print detailed information about the encoder named @var{encoder_name}. Use the +@option{-encoders} option to get a list of all encoders. +@end table @item -version Show version. -- cgit v1.2.3 From 1136bd362a873156d9eb99f38a3edd09ae553eee Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 14 Aug 2012 07:57:56 +0200 Subject: avtools: add -h demuxer/muxer --- cmdutils.c | 55 ++++++++++++++++++++++++++++++++++++++++++++ doc/avtools-common-opts.texi | 9 ++++++++ 2 files changed, 64 insertions(+) (limited to 'doc') diff --git a/cmdutils.c b/cmdutils.c index 55cf3f082a..50076c231d 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -936,6 +936,57 @@ static void show_help_codec(const char *name, int encoder) } } +static void show_help_demuxer(const char *name) +{ + const AVInputFormat *fmt = av_find_input_format(name); + + if (!fmt) { + av_log(NULL, AV_LOG_ERROR, "Unknown format '%s'.\n", name); + return; + } + + printf("Demuxer %s [%s]:\n", fmt->name, fmt->long_name); + + if (fmt->extensions) + printf(" Common extensions: %s.\n", fmt->extensions); + + if (fmt->priv_class) + show_help_children(fmt->priv_class, AV_OPT_FLAG_DECODING_PARAM); +} + +static void show_help_muxer(const char *name) +{ + const AVCodecDescriptor *desc; + const AVOutputFormat *fmt = av_guess_format(name, NULL, NULL); + + if (!fmt) { + av_log(NULL, AV_LOG_ERROR, "Unknown format '%s'.\n", name); + return; + } + + printf("Muxer %s [%s]:\n", fmt->name, fmt->long_name); + + if (fmt->extensions) + printf(" Common extensions: %s.\n", fmt->extensions); + if (fmt->mime_type) + printf(" Mime type: %s.\n", fmt->mime_type); + if (fmt->video_codec != AV_CODEC_ID_NONE && + (desc = avcodec_descriptor_get(fmt->video_codec))) { + printf(" Default video codec: %s.\n", desc->name); + } + if (fmt->audio_codec != AV_CODEC_ID_NONE && + (desc = avcodec_descriptor_get(fmt->audio_codec))) { + printf(" Default audio codec: %s.\n", desc->name); + } + if (fmt->subtitle_codec != AV_CODEC_ID_NONE && + (desc = avcodec_descriptor_get(fmt->subtitle_codec))) { + printf(" Default subtitle codec: %s.\n", desc->name); + } + + if (fmt->priv_class) + show_help_children(fmt->priv_class, AV_OPT_FLAG_ENCODING_PARAM); +} + int show_help(const char *opt, const char *arg) { char *topic, *par; @@ -952,6 +1003,10 @@ int show_help(const char *opt, const char *arg) show_help_codec(par, 0); } else if (!strcmp(topic, "encoder")) { show_help_codec(par, 1); + } else if (!strcmp(topic, "demuxer")) { + show_help_demuxer(par); + } else if (!strcmp(topic, "muxer")) { + show_help_muxer(par); } else { show_help_default(topic, par); } diff --git a/doc/avtools-common-opts.texi b/doc/avtools-common-opts.texi index eefb37bfcf..d07505d2e4 100644 --- a/doc/avtools-common-opts.texi +++ b/doc/avtools-common-opts.texi @@ -64,6 +64,15 @@ Print detailed information about the decoder named @var{decoder_name}. Use the @item encoder=@var{encoder_name} Print detailed information about the encoder named @var{encoder_name}. Use the @option{-encoders} option to get a list of all encoders. + +@item demuxer=@var{demuxer_name} +Print detailed information about the demuxer named @var{demuxer_name}. Use the +@option{-formats} option to get a list of all demuxers and muxers. + +@item muxer=@var{muxer_name} +Print detailed information about the muxer named @var{muxer_name}. Use the +@option{-formats} option to get a list of all muxers and demuxers. + @end table @item -version -- cgit v1.2.3