Browse code

Merge commit '122de16dd8108a59a55d30543c9f28b5f61b02d1'

* commit '122de16dd8108a59a55d30543c9f28b5f61b02d1':
Replace cmdutils_common_opts.h by a macro

Merged-by: Clément Bœsch <cboesch@gopro.com>

Clément Bœsch authored on 2017/05/05 20:53:11
Showing 8 changed files
... ...
@@ -59,8 +59,7 @@ FFLIBS := avutil
59 59
 DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.ffpreset) $(SRC_PATH)/doc/ffprobe.xsd
60 60
 EXAMPLES_FILES := $(wildcard $(SRC_PATH)/doc/examples/*.c) $(SRC_PATH)/doc/examples/Makefile $(SRC_PATH)/doc/examples/README
61 61
 
62
-SKIPHEADERS = cmdutils_common_opts.h                                    \
63
-              compat/w32pthreads.h
62
+SKIPHEADERS = compat/w32pthreads.h
64 63
 
65 64
 # first so "all" becomes default target
66 65
 all: all-yes
... ...
@@ -206,6 +206,59 @@ typedef struct OptionDef {
206 206
 void show_help_options(const OptionDef *options, const char *msg, int req_flags,
207 207
                        int rej_flags, int alt_flags);
208 208
 
209
+#if CONFIG_OPENCL
210
+#define CMDUTILS_COMMON_OPTIONS_OPENCL                                                                                  \
211
+    { "opencl_bench", OPT_EXIT, {.func_arg = opt_opencl_bench},                                                         \
212
+       "run benchmark on all OpenCL devices and show results" },                                                        \
213
+    { "opencl_options", HAS_ARG, {.func_arg = opt_opencl},                                                              \
214
+       "set OpenCL environment options" },                                                                              \
215
+
216
+#else
217
+#define CMDUTILS_COMMON_OPTIONS_OPENCL
218
+#endif
219
+
220
+#if CONFIG_AVDEVICE
221
+#define CMDUTILS_COMMON_OPTIONS_AVDEVICE                                                                                \
222
+    { "sources"    , OPT_EXIT | HAS_ARG, { .func_arg = show_sources },                                                  \
223
+      "list sources of the input device", "device" },                                                                   \
224
+    { "sinks"      , OPT_EXIT | HAS_ARG, { .func_arg = show_sinks },                                                    \
225
+      "list sinks of the output device", "device" },                                                                    \
226
+
227
+#else
228
+#define CMDUTILS_COMMON_OPTIONS_AVDEVICE
229
+#endif
230
+
231
+#define CMDUTILS_COMMON_OPTIONS                                                                                         \
232
+    { "L",           OPT_EXIT,             { .func_arg = show_license },     "show license" },                          \
233
+    { "h",           OPT_EXIT,             { .func_arg = show_help },        "show help", "topic" },                    \
234
+    { "?",           OPT_EXIT,             { .func_arg = show_help },        "show help", "topic" },                    \
235
+    { "help",        OPT_EXIT,             { .func_arg = show_help },        "show help", "topic" },                    \
236
+    { "-help",       OPT_EXIT,             { .func_arg = show_help },        "show help", "topic" },                    \
237
+    { "version",     OPT_EXIT,             { .func_arg = show_version },     "show version" },                          \
238
+    { "buildconf",   OPT_EXIT,             { .func_arg = show_buildconf },   "show build configuration" },              \
239
+    { "formats",     OPT_EXIT,             { .func_arg = show_formats },     "show available formats" },                \
240
+    { "muxers",      OPT_EXIT,             { .func_arg = show_muxers },      "show available muxers" },                 \
241
+    { "demuxers",    OPT_EXIT,             { .func_arg = show_demuxers },    "show available demuxers" },               \
242
+    { "devices",     OPT_EXIT,             { .func_arg = show_devices },     "show available devices" },                \
243
+    { "codecs",      OPT_EXIT,             { .func_arg = show_codecs },      "show available codecs" },                 \
244
+    { "decoders",    OPT_EXIT,             { .func_arg = show_decoders },    "show available decoders" },               \
245
+    { "encoders",    OPT_EXIT,             { .func_arg = show_encoders },    "show available encoders" },               \
246
+    { "bsfs",        OPT_EXIT,             { .func_arg = show_bsfs },        "show available bit stream filters" },     \
247
+    { "protocols",   OPT_EXIT,             { .func_arg = show_protocols },   "show available protocols" },              \
248
+    { "filters",     OPT_EXIT,             { .func_arg = show_filters },     "show available filters" },                \
249
+    { "pix_fmts",    OPT_EXIT,             { .func_arg = show_pix_fmts },    "show available pixel formats" },          \
250
+    { "layouts",     OPT_EXIT,             { .func_arg = show_layouts },     "show standard channel layouts" },         \
251
+    { "sample_fmts", OPT_EXIT,             { .func_arg = show_sample_fmts }, "show available audio sample formats" },   \
252
+    { "colors",      OPT_EXIT,             { .func_arg = show_colors },      "show available color names" },            \
253
+    { "loglevel",    HAS_ARG,              { .func_arg = opt_loglevel },     "set logging level", "loglevel" },         \
254
+    { "v",           HAS_ARG,              { .func_arg = opt_loglevel },     "set logging level", "loglevel" },         \
255
+    { "report",      0,                    { (void*)opt_report },            "generate a report" },                     \
256
+    { "max_alloc",   HAS_ARG,              { .func_arg = opt_max_alloc },    "set maximum size of a single allocated block", "bytes" }, \
257
+    { "cpuflags",    HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags },     "force specific cpu flags", "flags" },     \
258
+    { "hide_banner", OPT_BOOL | OPT_EXPERT, {&hide_banner},     "do not show program banner", "hide_banner" },          \
259
+    CMDUTILS_COMMON_OPTIONS_OPENCL                                                                                      \
260
+    CMDUTILS_COMMON_OPTIONS_AVDEVICE                                                                                    \
261
+
209 262
 /**
210 263
  * Show help for all options with given flags in class and all its
211 264
  * children.
212 265
deleted file mode 100644
... ...
@@ -1,37 +0,0 @@
1
-    { "L"          , OPT_EXIT, {.func_arg = show_license},      "show license" },
2
-    { "h"          , OPT_EXIT, {.func_arg = show_help},         "show help", "topic" },
3
-    { "?"          , OPT_EXIT, {.func_arg = show_help},         "show help", "topic" },
4
-    { "help"       , OPT_EXIT, {.func_arg = show_help},         "show help", "topic" },
5
-    { "-help"      , OPT_EXIT, {.func_arg = show_help},         "show help", "topic" },
6
-    { "version"    , OPT_EXIT, {.func_arg = show_version},      "show version" },
7
-    { "buildconf"  , OPT_EXIT, {.func_arg = show_buildconf},    "show build configuration" },
8
-    { "formats"    , OPT_EXIT, {.func_arg = show_formats  },    "show available formats" },
9
-    { "muxers"     , OPT_EXIT, {.func_arg = show_muxers   },    "show available muxers" },
10
-    { "demuxers"   , OPT_EXIT, {.func_arg = show_demuxers },    "show available demuxers" },
11
-    { "devices"    , OPT_EXIT, {.func_arg = show_devices  },    "show available devices" },
12
-    { "codecs"     , OPT_EXIT, {.func_arg = show_codecs   },    "show available codecs" },
13
-    { "decoders"   , OPT_EXIT, {.func_arg = show_decoders },    "show available decoders" },
14
-    { "encoders"   , OPT_EXIT, {.func_arg = show_encoders },    "show available encoders" },
15
-    { "bsfs"       , OPT_EXIT, {.func_arg = show_bsfs     },    "show available bit stream filters" },
16
-    { "protocols"  , OPT_EXIT, {.func_arg = show_protocols},    "show available protocols" },
17
-    { "filters"    , OPT_EXIT, {.func_arg = show_filters  },    "show available filters" },
18
-    { "pix_fmts"   , OPT_EXIT, {.func_arg = show_pix_fmts },    "show available pixel formats" },
19
-    { "layouts"    , OPT_EXIT, {.func_arg = show_layouts  },    "show standard channel layouts" },
20
-    { "sample_fmts", OPT_EXIT, {.func_arg = show_sample_fmts }, "show available audio sample formats" },
21
-    { "colors"     , OPT_EXIT, {.func_arg = show_colors },      "show available color names" },
22
-    { "loglevel"   , HAS_ARG,  {.func_arg = opt_loglevel},      "set logging level", "loglevel" },
23
-    { "v",           HAS_ARG,  {.func_arg = opt_loglevel},      "set logging level", "loglevel" },
24
-    { "report"     , 0,        {(void*)opt_report}, "generate a report" },
25
-    { "max_alloc"  , HAS_ARG,  {.func_arg = opt_max_alloc},     "set maximum size of a single allocated block", "bytes" },
26
-    { "cpuflags"   , HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags }, "force specific cpu flags", "flags" },
27
-    { "hide_banner", OPT_BOOL | OPT_EXPERT, {&hide_banner},     "do not show program banner", "hide_banner" },
28
-#if CONFIG_OPENCL
29
-    { "opencl_bench", OPT_EXIT, {.func_arg = opt_opencl_bench}, "run benchmark on all OpenCL devices and show results" },
30
-    { "opencl_options", HAS_ARG, {.func_arg = opt_opencl},      "set OpenCL environment options" },
31
-#endif
32
-#if CONFIG_AVDEVICE
33
-    { "sources"    , OPT_EXIT | HAS_ARG, { .func_arg = show_sources },
34
-      "list sources of the input device", "device" },
35
-    { "sinks"      , OPT_EXIT | HAS_ARG, { .func_arg = show_sinks },
36
-      "list sinks of the output device", "device" },
37
-#endif
... ...
@@ -3291,7 +3291,7 @@ static int opt_progress(void *optctx, const char *opt, const char *arg)
3291 3291
 #define OFFSET(x) offsetof(OptionsContext, x)
3292 3292
 const OptionDef options[] = {
3293 3293
     /* main options */
3294
-#include "cmdutils_common_opts.h"
3294
+    CMDUTILS_COMMON_OPTIONS
3295 3295
     { "f",              HAS_ARG | OPT_STRING | OPT_OFFSET |
3296 3296
                         OPT_INPUT | OPT_OUTPUT,                      { .off       = OFFSET(format) },
3297 3297
         "force format", "fmt" },
... ...
@@ -3512,7 +3512,7 @@ static int opt_codec(void *optctx, const char *opt, const char *arg)
3512 3512
 static int dummy;
3513 3513
 
3514 3514
 static const OptionDef options[] = {
3515
-#include "cmdutils_common_opts.h"
3515
+    CMDUTILS_COMMON_OPTIONS
3516 3516
     { "x", HAS_ARG, { .func_arg = opt_width }, "force displayed width", "width" },
3517 3517
     { "y", HAS_ARG, { .func_arg = opt_height }, "force displayed height", "height" },
3518 3518
     { "s", HAS_ARG | OPT_VIDEO, { .func_arg = opt_frame_size }, "set frame size (WxH or abbreviation)", "size" },
... ...
@@ -3379,7 +3379,7 @@ DEFINE_OPT_SHOW_SECTION(streams,          STREAMS)
3379 3379
 DEFINE_OPT_SHOW_SECTION(programs,         PROGRAMS)
3380 3380
 
3381 3381
 static const OptionDef real_options[] = {
3382
-#include "cmdutils_common_opts.h"
3382
+    CMDUTILS_COMMON_OPTIONS
3383 3383
     { "f", HAS_ARG, {.func_arg = opt_format}, "force format", "format" },
3384 3384
     { "unit", OPT_BOOL, {&show_value_unit}, "show unit of the displayed values" },
3385 3385
     { "prefix", OPT_BOOL, {&use_value_prefix}, "use SI prefixes for the displayed values" },
... ...
@@ -3950,7 +3950,7 @@ void show_help_default(const char *opt, const char *arg)
3950 3950
 }
3951 3951
 
3952 3952
 static const OptionDef options[] = {
3953
-#include "cmdutils_common_opts.h"
3953
+    CMDUTILS_COMMON_OPTIONS
3954 3954
     { "n", OPT_BOOL, {(void *)&no_launch }, "enable no-launch mode" },
3955 3955
     { "d", 0, {(void*)opt_debug}, "enable debug mode" },
3956 3956
     { "f", HAS_ARG | OPT_STRING, {(void*)&config.filename }, "use configfile instead of /etc/ffserver.conf", "configfile" },
... ...
@@ -1,5 +1,4 @@
1 1
 Files without standard license headers:
2
-cmdutils_common_opts.h
3 2
 compat/avisynth/windowsPorts/basicDataTypeConversions.h
4 3
 compat/avisynth/windowsPorts/windows2linux.h
5 4
 libavcodec/file_open.c
... ...
@@ -16,7 +15,6 @@ libswscale/log2_tab.c
16 16
 tools/uncoded_frame.c
17 17
 tools/yuvcmp.c
18 18
 Headers without standard inclusion guards:
19
-cmdutils_common_opts.h
20 19
 compat/avisynth/avisynth_c.h
21 20
 compat/avisynth/avs/capi.h
22 21
 compat/avisynth/avs/config.h