diff options
author | Clément Bœsch <cboesch@gopro.com> | 2017-05-05 13:53:11 +0200 |
---|---|---|
committer | Clément Bœsch <cboesch@gopro.com> | 2017-05-05 14:04:30 +0200 |
commit | b010843594fee88a791185b83684e0e725007b7b (patch) | |
tree | d8153bc6faa8472878362c8b35910be5fe42893d | |
parent | cea5e7355c58004605321295b7a506052292dbbc (diff) | |
parent | 122de16dd8108a59a55d30543c9f28b5f61b02d1 (diff) | |
download | ffmpeg-b010843594fee88a791185b83684e0e725007b7b.tar.gz |
Merge commit '122de16dd8108a59a55d30543c9f28b5f61b02d1'
* commit '122de16dd8108a59a55d30543c9f28b5f61b02d1':
Replace cmdutils_common_opts.h by a macro
Merged-by: Clément Bœsch <cboesch@gopro.com>
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | cmdutils.h | 53 | ||||
-rw-r--r-- | cmdutils_common_opts.h | 37 | ||||
-rw-r--r-- | ffmpeg_opt.c | 2 | ||||
-rw-r--r-- | ffplay.c | 2 | ||||
-rw-r--r-- | ffprobe.c | 2 | ||||
-rw-r--r-- | ffserver.c | 2 | ||||
-rw-r--r-- | tests/ref/fate/source | 2 |
8 files changed, 58 insertions, 45 deletions
@@ -59,8 +59,7 @@ FFLIBS := avutil DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.ffpreset) $(SRC_PATH)/doc/ffprobe.xsd EXAMPLES_FILES := $(wildcard $(SRC_PATH)/doc/examples/*.c) $(SRC_PATH)/doc/examples/Makefile $(SRC_PATH)/doc/examples/README -SKIPHEADERS = cmdutils_common_opts.h \ - compat/w32pthreads.h +SKIPHEADERS = compat/w32pthreads.h # first so "all" becomes default target all: all-yes diff --git a/cmdutils.h b/cmdutils.h index e75d8d3161..e1d64d8986 100644 --- a/cmdutils.h +++ b/cmdutils.h @@ -206,6 +206,59 @@ typedef struct OptionDef { void show_help_options(const OptionDef *options, const char *msg, int req_flags, int rej_flags, int alt_flags); +#if CONFIG_OPENCL +#define CMDUTILS_COMMON_OPTIONS_OPENCL \ + { "opencl_bench", OPT_EXIT, {.func_arg = opt_opencl_bench}, \ + "run benchmark on all OpenCL devices and show results" }, \ + { "opencl_options", HAS_ARG, {.func_arg = opt_opencl}, \ + "set OpenCL environment options" }, \ + +#else +#define CMDUTILS_COMMON_OPTIONS_OPENCL +#endif + +#if CONFIG_AVDEVICE +#define CMDUTILS_COMMON_OPTIONS_AVDEVICE \ + { "sources" , OPT_EXIT | HAS_ARG, { .func_arg = show_sources }, \ + "list sources of the input device", "device" }, \ + { "sinks" , OPT_EXIT | HAS_ARG, { .func_arg = show_sinks }, \ + "list sinks of the output device", "device" }, \ + +#else +#define CMDUTILS_COMMON_OPTIONS_AVDEVICE +#endif + +#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" }, \ + { "buildconf", OPT_EXIT, { .func_arg = show_buildconf }, "show build configuration" }, \ + { "formats", OPT_EXIT, { .func_arg = show_formats }, "show available formats" }, \ + { "muxers", OPT_EXIT, { .func_arg = show_muxers }, "show available muxers" }, \ + { "demuxers", OPT_EXIT, { .func_arg = show_demuxers }, "show available demuxers" }, \ + { "devices", OPT_EXIT, { .func_arg = show_devices }, "show available devices" }, \ + { "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" }, \ + { "layouts", OPT_EXIT, { .func_arg = show_layouts }, "show standard channel layouts" }, \ + { "sample_fmts", OPT_EXIT, { .func_arg = show_sample_fmts }, "show available audio sample formats" }, \ + { "colors", OPT_EXIT, { .func_arg = show_colors }, "show available color names" }, \ + { "loglevel", HAS_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \ + { "v", HAS_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \ + { "report", 0, { (void*)opt_report }, "generate a report" }, \ + { "max_alloc", HAS_ARG, { .func_arg = opt_max_alloc }, "set maximum size of a single allocated block", "bytes" }, \ + { "cpuflags", HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags }, "force specific cpu flags", "flags" }, \ + { "hide_banner", OPT_BOOL | OPT_EXPERT, {&hide_banner}, "do not show program banner", "hide_banner" }, \ + CMDUTILS_COMMON_OPTIONS_OPENCL \ + CMDUTILS_COMMON_OPTIONS_AVDEVICE \ + /** * 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 f7c1ca4d47..0000000000 --- a/cmdutils_common_opts.h +++ /dev/null @@ -1,37 +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" }, - { "buildconf" , OPT_EXIT, {.func_arg = show_buildconf}, "show build configuration" }, - { "formats" , OPT_EXIT, {.func_arg = show_formats }, "show available formats" }, - { "muxers" , OPT_EXIT, {.func_arg = show_muxers }, "show available muxers" }, - { "demuxers" , OPT_EXIT, {.func_arg = show_demuxers }, "show available demuxers" }, - { "devices" , OPT_EXIT, {.func_arg = show_devices }, "show available devices" }, - { "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" }, - { "layouts" , OPT_EXIT, {.func_arg = show_layouts }, "show standard channel layouts" }, - { "sample_fmts", OPT_EXIT, {.func_arg = show_sample_fmts }, "show available audio sample formats" }, - { "colors" , OPT_EXIT, {.func_arg = show_colors }, "show available color names" }, - { "loglevel" , HAS_ARG, {.func_arg = opt_loglevel}, "set logging level", "loglevel" }, - { "v", HAS_ARG, {.func_arg = opt_loglevel}, "set logging level", "loglevel" }, - { "report" , 0, {(void*)opt_report}, "generate a report" }, - { "max_alloc" , HAS_ARG, {.func_arg = opt_max_alloc}, "set maximum size of a single allocated block", "bytes" }, - { "cpuflags" , HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags }, "force specific cpu flags", "flags" }, - { "hide_banner", OPT_BOOL | OPT_EXPERT, {&hide_banner}, "do not show program banner", "hide_banner" }, -#if CONFIG_OPENCL - { "opencl_bench", OPT_EXIT, {.func_arg = opt_opencl_bench}, "run benchmark on all OpenCL devices and show results" }, - { "opencl_options", HAS_ARG, {.func_arg = opt_opencl}, "set OpenCL environment options" }, -#endif -#if CONFIG_AVDEVICE - { "sources" , OPT_EXIT | HAS_ARG, { .func_arg = show_sources }, - "list sources of the input device", "device" }, - { "sinks" , OPT_EXIT | HAS_ARG, { .func_arg = show_sinks }, - "list sinks of the output device", "device" }, -#endif diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c index e73a61059f..ce85f324cf 100644 --- a/ffmpeg_opt.c +++ b/ffmpeg_opt.c @@ -3291,7 +3291,7 @@ static int opt_progress(void *optctx, const char *opt, const char *arg) #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" }, @@ -3512,7 +3512,7 @@ static int opt_codec(void *optctx, const char *opt, const char *arg) static int dummy; 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" }, @@ -3379,7 +3379,7 @@ DEFINE_OPT_SHOW_SECTION(streams, STREAMS) DEFINE_OPT_SHOW_SECTION(programs, PROGRAMS) static const OptionDef real_options[] = { -#include "cmdutils_common_opts.h" + CMDUTILS_COMMON_OPTIONS { "f", HAS_ARG, {.func_arg = opt_format}, "force format", "format" }, { "unit", OPT_BOOL, {&show_value_unit}, "show unit of the displayed values" }, { "prefix", OPT_BOOL, {&use_value_prefix}, "use SI prefixes for the displayed values" }, diff --git a/ffserver.c b/ffserver.c index 8b819b6934..f9f987acac 100644 --- a/ffserver.c +++ b/ffserver.c @@ -3950,7 +3950,7 @@ void show_help_default(const char *opt, const char *arg) } static const OptionDef options[] = { -#include "cmdutils_common_opts.h" + CMDUTILS_COMMON_OPTIONS { "n", OPT_BOOL, {(void *)&no_launch }, "enable no-launch mode" }, { "d", 0, {(void*)opt_debug}, "enable debug mode" }, { "f", HAS_ARG | OPT_STRING, {(void*)&config.filename }, "use configfile instead of /etc/ffserver.conf", "configfile" }, diff --git a/tests/ref/fate/source b/tests/ref/fate/source index bfda0260bd..bb34e5189e 100644 --- a/tests/ref/fate/source +++ b/tests/ref/fate/source @@ -1,5 +1,4 @@ Files without standard license headers: -cmdutils_common_opts.h compat/avisynth/windowsPorts/basicDataTypeConversions.h compat/avisynth/windowsPorts/windows2linux.h libavcodec/file_open.c @@ -16,7 +15,6 @@ libswscale/log2_tab.c tools/uncoded_frame.c tools/yuvcmp.c Headers without standard inclusion guards: -cmdutils_common_opts.h compat/avisynth/avisynth_c.h compat/avisynth/avs/capi.h compat/avisynth/avs/config.h |