[FFmpeg-devel] [PATCH 1/8] fftools/cmdutils: hide some information listing options from basic help

Anton Khirnov anton at khirnov.net
Wed Jan 17 14:40:28 EET 2024


They are for advanced usage only and should not clutter basic output.
---
 fftools/ffmpeg_opt.c |  7 +++++--
 fftools/opt_common.h | 24 ++++++++++++------------
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 1978f438fe..6b16d92a87 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1197,7 +1197,10 @@ void show_help_default(const char *opt, const char *arg)
            "\n", program_name);
 
     show_help_options(options, "Print help / information / capabilities:",
-                      OPT_EXIT, 0, 0);
+                      OPT_EXIT, OPT_EXPERT, 0);
+    if (show_advanced)
+        show_help_options(options, "Advanced information / capabilities:",
+                          OPT_EXIT | OPT_EXPERT, 0, 0);
 
     show_help_options(options, "Global options (affect whole program "
                       "instead of just one file):",
@@ -1806,7 +1809,7 @@ const OptionDef options[] = {
     { "hwaccel_output_format",      OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_SPEC | OPT_INPUT,
         { .off = OFFSET(hwaccel_output_formats) },
         "select output format used with HW accelerated decoding", "format" },
-    { "hwaccels",                   OPT_TYPE_FUNC,   OPT_EXIT,
+    { "hwaccels",                   OPT_TYPE_FUNC,   OPT_EXIT | OPT_EXPERT,
         { .func_arg = show_hwaccels },
         "show available HW acceleration methods" },
     { "autorotate",                 OPT_TYPE_BOOL,   OPT_SPEC | OPT_EXPERT | OPT_INPUT,
diff --git a/fftools/opt_common.h b/fftools/opt_common.h
index 36c591cc94..9bb5268472 100644
--- a/fftools/opt_common.h
+++ b/fftools/opt_common.h
@@ -41,9 +41,9 @@ int show_sources(void *optctx, const char *opt, const char *arg);
 
 #if CONFIG_AVDEVICE
 #define CMDUTILS_COMMON_OPTIONS_AVDEVICE                                                                                \
-    { "sources"    , OPT_TYPE_FUNC, OPT_EXIT | OPT_FUNC_ARG, { .func_arg = show_sources },                              \
+    { "sources"    , OPT_TYPE_FUNC, OPT_EXIT | OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = show_sources },                 \
       "list sources of the input device", "device" },                                                                   \
-    { "sinks"      , OPT_TYPE_FUNC, OPT_EXIT | OPT_FUNC_ARG, { .func_arg = show_sinks },                                \
+    { "sinks"      , OPT_TYPE_FUNC, OPT_EXIT | OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = show_sinks },                   \
       "list sinks of the output device", "device" },                                                                    \
 
 #else
@@ -199,26 +199,26 @@ int opt_cpucount(void *optctx, const char *opt, const char *arg);
 #define CMDUTILS_COMMON_OPTIONS                                                                                         \
     { "L",            OPT_TYPE_FUNC, OPT_EXIT,              { .func_arg = show_license },     "show license" },                          \
     { "h",            OPT_TYPE_FUNC, OPT_EXIT,              { .func_arg = show_help },        "show help", "topic" },                    \
-    { "?",            OPT_TYPE_FUNC, OPT_EXIT,              { .func_arg = show_help },        "show help", "topic" },                    \
-    { "help",         OPT_TYPE_FUNC, OPT_EXIT,              { .func_arg = show_help },        "show help", "topic" },                    \
-    { "-help",        OPT_TYPE_FUNC, OPT_EXIT,              { .func_arg = show_help },        "show help", "topic" },                    \
+    { "?",            OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_help },        "show help", "topic" },                    \
+    { "help",         OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_help },        "show help", "topic" },                    \
+    { "-help",        OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_help },        "show help", "topic" },                    \
     { "version",      OPT_TYPE_FUNC, OPT_EXIT,              { .func_arg = show_version },     "show version" },                          \
-    { "buildconf",    OPT_TYPE_FUNC, OPT_EXIT,              { .func_arg = show_buildconf },   "show build configuration" },              \
-    { "formats",      OPT_TYPE_FUNC, OPT_EXIT,              { .func_arg = show_formats },     "show available formats" },                \
+    { "buildconf",    OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_buildconf },   "show build configuration" },              \
+    { "formats",      OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_formats },     "show available formats" },                \
     { "muxers",       OPT_TYPE_FUNC, OPT_EXIT,              { .func_arg = show_muxers },      "show available muxers" },                 \
     { "demuxers",     OPT_TYPE_FUNC, OPT_EXIT,              { .func_arg = show_demuxers },    "show available demuxers" },               \
     { "devices",      OPT_TYPE_FUNC, OPT_EXIT,              { .func_arg = show_devices },     "show available devices" },                \
-    { "codecs",       OPT_TYPE_FUNC, OPT_EXIT,              { .func_arg = show_codecs },      "show available codecs" },                 \
+    { "codecs",       OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_codecs },      "show available codecs" },                 \
     { "decoders",     OPT_TYPE_FUNC, OPT_EXIT,              { .func_arg = show_decoders },    "show available decoders" },               \
     { "encoders",     OPT_TYPE_FUNC, OPT_EXIT,              { .func_arg = show_encoders },    "show available encoders" },               \
-    { "bsfs",         OPT_TYPE_FUNC, OPT_EXIT,              { .func_arg = show_bsfs },        "show available bit stream filters" },     \
-    { "protocols",    OPT_TYPE_FUNC, OPT_EXIT,              { .func_arg = show_protocols },   "show available protocols" },              \
+    { "bsfs",         OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_bsfs },        "show available bit stream filters" },     \
+    { "protocols",    OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_protocols },   "show available protocols" },              \
     { "filters",      OPT_TYPE_FUNC, OPT_EXIT,              { .func_arg = show_filters },     "show available filters" },                \
     { "pix_fmts",     OPT_TYPE_FUNC, OPT_EXIT,              { .func_arg = show_pix_fmts },    "show available pixel formats" },          \
     { "layouts",      OPT_TYPE_FUNC, OPT_EXIT,              { .func_arg = show_layouts },     "show standard channel layouts" },         \
     { "sample_fmts",  OPT_TYPE_FUNC, OPT_EXIT,              { .func_arg = show_sample_fmts }, "show available audio sample formats" },   \
-    { "dispositions", OPT_TYPE_FUNC, OPT_EXIT,              { .func_arg = show_dispositions}, "show available stream dispositions" },    \
-    { "colors",       OPT_TYPE_FUNC, OPT_EXIT,              { .func_arg = show_colors },      "show available color names" },            \
+    { "dispositions", OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_dispositions}, "show available stream dispositions" },    \
+    { "colors",       OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_colors },      "show available color names" },            \
     { "loglevel",     OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = opt_loglevel },     "set logging level", "loglevel" },         \
     { "v",            OPT_TYPE_FUNC, OPT_FUNC_ARG,          { .func_arg = opt_loglevel },     "set logging level", "loglevel" },         \
     { "report",       OPT_TYPE_FUNC, OPT_EXPERT,            { .func_arg = opt_report },       "generate a report" },                     \
-- 
2.42.0



More information about the ffmpeg-devel mailing list