Browse Source

fftools/cmdutils: hide some information listing options from basic help

They are for advanced usage only and should not clutter basic output.
Anton Khirnov 1 year ago
parent
commit
d8173cfcaf
2 changed files with 17 additions and 14 deletions
  1. 5 2
      fftools/ffmpeg_opt.c
  2. 12 12
      fftools/opt_common.h

+ 5 - 2
fftools/ffmpeg_opt.c

@@ -1198,7 +1198,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):",
@@ -1807,7 +1810,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,

+ 12 - 12
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" },                     \