diff mbox

[FFmpeg-devel,2/2] cmdutils: add show_help_protocol for get protocol options

Message ID 20191126112701.31395-1-lq@chinaffmpeg.org
State Superseded
Headers show

Commit Message

Liu Steven Nov. 26, 2019, 11:27 a.m. UTC
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
---
 fftools/cmdutils.c   | 18 ++++++++++++++++++
 fftools/ffmpeg_opt.c |  2 +-
 2 files changed, 19 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 84f98b7c04..e0516296d5 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -1870,6 +1870,22 @@  static void show_help_demuxer(const char *name)
         show_help_children(fmt->priv_class, AV_OPT_FLAG_DECODING_PARAM);
 }
 
+static void show_help_protocol(const char *name)
+{
+    const AVClass *proto_class = av_urlcontext_get_class_by_name(name);
+
+    printf("Protocol [%s]:\n"
+           " D. = Input supported\n"
+           " .E = Output supported\n"
+           " --\n", name);
+    if (!proto_class) {
+        av_log(NULL, AV_LOG_ERROR, "Unknown protocol '%s'.\n", name);
+        return;
+    }
+
+    show_help_children(proto_class, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM);
+}
+
 static void show_help_muxer(const char *name)
 {
     const AVCodecDescriptor *desc;
@@ -2000,6 +2016,8 @@  int show_help(void *optctx, const char *opt, const char *arg)
         show_help_demuxer(par);
     } else if (!strcmp(topic, "muxer")) {
         show_help_muxer(par);
+    } else if (!strcmp(topic, "protocol")) {
+        show_help_protocol(par);
 #if CONFIG_AVFILTER
     } else if (!strcmp(topic, "filter")) {
         show_help_filter(par);
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 71063cc443..8d73fa8a78 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -3194,7 +3194,7 @@  void show_help_default(const char *opt, const char *arg)
            "    -h      -- print basic options\n"
            "    -h long -- print more options\n"
            "    -h full -- print all options (including all format and codec specific options, very long)\n"
-           "    -h type=name -- print all options for the named decoder/encoder/demuxer/muxer/filter/bsf\n"
+           "    -h type=name -- print all options for the named decoder/encoder/demuxer/muxer/filter/bsf/protocol\n"
            "    See man %s for detailed description of the options.\n"
            "\n", program_name);