[FFmpeg-cvslog] Replace cmdutils_common_opts.h by a macro

Diego Biurrun git at videolan.org
Fri May 5 15:04:45 EEST 2017


ffmpeg | branch: master | Diego Biurrun <diego at biurrun.de> | Tue May 17 17:06:57 2011 +0200| [122de16dd8108a59a55d30543c9f28b5f61b02d1] | committer: Diego Biurrun

Replace cmdutils_common_opts.h by a macro

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=122de16dd8108a59a55d30543c9f28b5f61b02d1
---

 Makefile               |  3 +--
 avconv_opt.c           |  2 +-
 avplay.c               |  2 +-
 avprobe.c              |  2 +-
 cmdutils.h             | 20 ++++++++++++++++++++
 cmdutils_common_opts.h | 18 ------------------
 6 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/Makefile b/Makefile
index d480ea5c37..98eb3ab1d9 100644
--- a/Makefile
+++ b/Makefile
@@ -103,8 +103,7 @@ FFLIBS := avutil
 
 DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.avpreset)
 
-SKIPHEADERS = cmdutils_common_opts.h                                    \
-              compat/w32pthreads.h
+SKIPHEADERS = compat/w32pthreads.h
 
 # first so "all" becomes default target
 all: all-yes
diff --git a/avconv_opt.c b/avconv_opt.c
index 4d7140dc46..8b43f0f4e2 100644
--- a/avconv_opt.c
+++ b/avconv_opt.c
@@ -2474,7 +2474,7 @@ fail:
 #define OFFSET(x) offsetof(OptionsContext, x)
 const OptionDef options[] = {
     /* main options */
-#include "cmdutils_common_opts.h"
+    CMDUTILS_COMMON_OPTIONS
     { "f",              HAS_ARG | OPT_STRING | OPT_OFFSET |
                         OPT_INPUT | OPT_OUTPUT,                      { .off       = OFFSET(format) },
         "force format", "fmt" },
diff --git a/avplay.c b/avplay.c
index e5ee9dbbef..18879e16bc 100644
--- a/avplay.c
+++ b/avplay.c
@@ -2904,7 +2904,7 @@ static int opt_duration(void *optctx, const char *opt, const char *arg)
 
 #define OFF(x) offsetof(PlayerState, x)
 static const OptionDef options[] = {
-#include "cmdutils_common_opts.h"
+    CMDUTILS_COMMON_OPTIONS
     { "x", HAS_ARG, { .func_arg = opt_width }, "force displayed width", "width" },
     { "y", HAS_ARG, { .func_arg = opt_height }, "force displayed height", "height" },
     { "s", HAS_ARG | OPT_VIDEO, { .func_arg = opt_frame_size }, "set frame size (WxH or abbreviation)", "size" },
diff --git a/avprobe.c b/avprobe.c
index f0c942ad63..a24e6440eb 100644
--- a/avprobe.c
+++ b/avprobe.c
@@ -1094,7 +1094,7 @@ static int opt_pretty(void *optctx, const char *opt, const char *arg)
 }
 
 static const OptionDef real_options[] = {
-#include "cmdutils_common_opts.h"
+    CMDUTILS_COMMON_OPTIONS
     { "f", HAS_ARG, {.func_arg = opt_format}, "force format", "format" },
     { "of", HAS_ARG, {.func_arg = opt_output_format}, "output the document either as ini or json", "output_format" },
     { "unit", OPT_BOOL, {&show_value_unit},
diff --git a/cmdutils.h b/cmdutils.h
index 45d98586fa..cc78ac5911 100644
--- a/cmdutils.h
+++ b/cmdutils.h
@@ -182,6 +182,26 @@ typedef struct OptionDef {
 void show_help_options(const OptionDef *options, const char *msg, int req_flags,
                        int rej_flags, int alt_flags);
 
+#define CMDUTILS_COMMON_OPTIONS                                                                                         \
+    { "L",           OPT_EXIT,             { .func_arg = show_license },     "show license" },                          \
+    { "h",           OPT_EXIT,             { .func_arg = show_help },        "show help", "topic" },                    \
+    { "?",           OPT_EXIT,             { .func_arg = show_help },        "show help", "topic" },                    \
+    { "help",        OPT_EXIT,             { .func_arg = show_help },        "show help", "topic" },                    \
+    { "-help",       OPT_EXIT,             { .func_arg = show_help },        "show help", "topic" },                    \
+    { "version",     OPT_EXIT,             { .func_arg = show_version },     "show version" },                          \
+    { "formats",     OPT_EXIT,             { .func_arg = show_formats },     "show available formats" },                \
+    { "codecs",      OPT_EXIT,             { .func_arg = show_codecs },      "show available codecs" },                 \
+    { "decoders",    OPT_EXIT,             { .func_arg = show_decoders },    "show available decoders" },               \
+    { "encoders",    OPT_EXIT,             { .func_arg = show_encoders },    "show available encoders" },               \
+    { "bsfs",        OPT_EXIT,             { .func_arg = show_bsfs },        "show available bit stream filters" },     \
+    { "protocols",   OPT_EXIT,             { .func_arg = show_protocols },   "show available protocols" },              \
+    { "filters",     OPT_EXIT,             { .func_arg = show_filters },     "show available filters" },                \
+    { "pix_fmts",    OPT_EXIT,             { .func_arg = show_pix_fmts },    "show available pixel formats" },          \
+    { "sample_fmts", OPT_EXIT,             { .func_arg = show_sample_fmts }, "show available audio sample formats" },   \
+    { "loglevel",    HAS_ARG,              { .func_arg = opt_loglevel },     "set libav* logging level", "loglevel" },  \
+    { "v",           HAS_ARG,              { .func_arg = opt_loglevel },     "set libav* logging level", "loglevel" },  \
+    { "cpuflags",    HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags },     "set CPU flags mask", "mask" },            \
+
 /**
  * Show help for all options with given flags in class and all its
  * children.
diff --git a/cmdutils_common_opts.h b/cmdutils_common_opts.h
deleted file mode 100644
index 8693f59c56..0000000000
--- a/cmdutils_common_opts.h
+++ /dev/null
@@ -1,18 +0,0 @@
-    { "L"          , OPT_EXIT, {.func_arg = show_license},      "show license" },
-    { "h"          , OPT_EXIT, {.func_arg = show_help},         "show help", "topic" },
-    { "?"          , OPT_EXIT, {.func_arg = show_help},         "show help", "topic" },
-    { "help"       , OPT_EXIT, {.func_arg = show_help},         "show help", "topic" },
-    { "-help"      , OPT_EXIT, {.func_arg = show_help},         "show help", "topic" },
-    { "version"    , OPT_EXIT, {.func_arg = show_version},      "show version" },
-    { "formats"    , OPT_EXIT, {.func_arg = show_formats  },    "show available formats" },
-    { "codecs"     , OPT_EXIT, {.func_arg = show_codecs   },    "show available codecs" },
-    { "decoders"   , OPT_EXIT, {.func_arg = show_decoders },    "show available decoders" },
-    { "encoders"   , OPT_EXIT, {.func_arg = show_encoders },    "show available encoders" },
-    { "bsfs"       , OPT_EXIT, {.func_arg = show_bsfs     },    "show available bit stream filters" },
-    { "protocols"  , OPT_EXIT, {.func_arg = show_protocols},    "show available protocols" },
-    { "filters"    , OPT_EXIT, {.func_arg = show_filters  },    "show available filters" },
-    { "pix_fmts"   , OPT_EXIT, {.func_arg = show_pix_fmts },    "show available pixel formats" },
-    { "sample_fmts", OPT_EXIT, {.func_arg = show_sample_fmts }, "show available audio sample formats" },
-    { "loglevel"   , HAS_ARG,  {.func_arg = opt_loglevel},      "set libav* logging level", "loglevel" },
-    { "v",           HAS_ARG,  {.func_arg = opt_loglevel},      "set libav* logging level", "loglevel" },
-    { "cpuflags",    HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags },  "set CPU flags mask", "mask" },



More information about the ffmpeg-cvslog mailing list