From 992f8eaee7080ab2e67cacd8851ca334f69156b3 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sun, 29 Nov 2009 23:12:19 +0000 Subject: [PATCH] Factorize common commandline options definition. Originally committed as revision 20664 to svn://svn.ffmpeg.org/ffmpeg/trunk --- cmdutils_common_opts.h | 8 ++++++++ ffmpeg.c | 9 +-------- ffplay.c | 9 +-------- ffserver.c | 11 ++--------- 4 files changed, 12 insertions(+), 25 deletions(-) create mode 100644 cmdutils_common_opts.h diff --git a/cmdutils_common_opts.h b/cmdutils_common_opts.h new file mode 100644 index 0000000000..af324e0b9d --- /dev/null +++ b/cmdutils_common_opts.h @@ -0,0 +1,8 @@ + { "L", OPT_EXIT, {(void*)show_license}, "show license" }, + { "h", OPT_EXIT, {(void*)show_help}, "show help" }, + { "version", OPT_EXIT, {(void*)show_version}, "show version" }, + { "formats" , OPT_EXIT, {(void*)show_formats }, "show available formats" }, + { "codecs" , OPT_EXIT, {(void*)show_codecs }, "show available codecs" }, + { "bsfs" , OPT_EXIT, {(void*)show_bsfs }, "show available bit stream filters" }, + { "protocols", OPT_EXIT, {(void*)show_protocols}, "show available protocols" }, + { "loglevel", HAS_ARG | OPT_FUNC2, {(void*)opt_loglevel}, "set libav* logging level", "loglevel" }, diff --git a/ffmpeg.c b/ffmpeg.c index 86b8049f16..4a4b76da5a 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -3821,13 +3821,7 @@ static int opt_preset(const char *opt, const char *arg) static const OptionDef options[] = { /* main options */ - { "L", OPT_EXIT, {(void*)show_license}, "show license" }, - { "h", OPT_EXIT, {(void*)show_help}, "show help" }, - { "version", OPT_EXIT, {(void*)show_version}, "show version" }, - { "formats" , OPT_EXIT, {(void*)show_formats }, "show available formats" }, - { "codecs" , OPT_EXIT, {(void*)show_codecs }, "show available codecs" }, - { "bsfs" , OPT_EXIT, {(void*)show_bsfs }, "show available bit stream filters" }, - { "protocols", OPT_EXIT, {(void*)show_protocols}, "show available protocols" }, +#include "cmdutils_common_opts.h" { "f", HAS_ARG, {(void*)opt_format}, "force format", "fmt" }, { "i", HAS_ARG, {(void*)opt_input_file}, "input file name", "filename" }, { "y", OPT_BOOL, {(void*)&file_overwrite}, "overwrite output files" }, @@ -3851,7 +3845,6 @@ static const OptionDef options[] = { { "loop_input", OPT_BOOL | OPT_EXPERT, {(void*)&loop_input}, "loop (current only works with images)" }, { "loop_output", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&loop_output}, "number of times to loop output in formats that support looping (0 loops forever)", "" }, { "v", HAS_ARG | OPT_FUNC2, {(void*)opt_verbose}, "set ffmpeg verbosity level", "number" }, - { "loglevel", HAS_ARG | OPT_FUNC2, {(void*)opt_loglevel}, "set libav* logging level", "loglevel" }, { "target", HAS_ARG, {(void*)opt_target}, "specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\", \"dv50\", \"pal-vcd\", \"ntsc-svcd\", ...)", "type" }, { "threads", OPT_FUNC2 | HAS_ARG | OPT_EXPERT, {(void*)opt_thread_count}, "thread count", "count" }, { "vsync", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&video_sync_method}, "video sync method", "" }, diff --git a/ffplay.c b/ffplay.c index b8912e1134..5eb5a21165 100644 --- a/ffplay.c +++ b/ffplay.c @@ -2453,13 +2453,7 @@ static int opt_thread_count(const char *opt, const char *arg) } static const OptionDef options[] = { - { "h", OPT_EXIT, {(void*)show_help}, "show help" }, - { "version", OPT_EXIT, {(void*)show_version}, "show version" }, - { "L", OPT_EXIT, {(void*)show_license}, "show license" }, - { "formats" , OPT_EXIT, {(void*)show_formats }, "show available formats" }, - { "codecs" , OPT_EXIT, {(void*)show_codecs }, "show available codecs" }, - { "bsfs" , OPT_EXIT, {(void*)show_bsfs }, "show available bit stream filters" }, - { "protocols", OPT_EXIT, {(void*)show_protocols}, "show available protocols" }, +#include "cmdutils_common_opts.h" { "x", HAS_ARG | OPT_FUNC2, {(void*)opt_width}, "force displayed width", "width" }, { "y", HAS_ARG | OPT_FUNC2, {(void*)opt_height}, "force displayed height", "height" }, { "s", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_size}, "set frame size (WxH or abbreviation)", "size" }, @@ -2491,7 +2485,6 @@ static const OptionDef options[] = { { "sync", HAS_ARG | OPT_FUNC2 | OPT_EXPERT, {(void*)opt_sync}, "set audio-video sync. type (type=audio/video/ext)", "type" }, { "threads", HAS_ARG | OPT_FUNC2 | OPT_EXPERT, {(void*)opt_thread_count}, "thread count", "count" }, { "default", OPT_FUNC2 | HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" }, - { "loglevel", HAS_ARG | OPT_FUNC2, {(void*)opt_loglevel}, "set libav* logging level", "loglevel" }, { NULL, }, }; diff --git a/ffserver.c b/ffserver.c index 7abaed885b..fdb504f84a 100644 --- a/ffserver.c +++ b/ffserver.c @@ -4463,7 +4463,7 @@ static void opt_debug(void) logfilename[0] = '-'; } -static void opt_show_help(void) +static void show_help(void) { printf("usage: ffserver [options]\n" "Hyper fast multi format Audio/Video streaming server\n"); @@ -4472,14 +4472,7 @@ static void opt_show_help(void) } static const OptionDef options[] = { - { "h", OPT_EXIT, {(void*)opt_show_help}, "show help" }, - { "version", OPT_EXIT, {(void*)show_version}, "show version" }, - { "L", OPT_EXIT, {(void*)show_license}, "show license" }, - { "formats" , OPT_EXIT, {(void*)show_formats }, "show available formats" }, - { "codecs" , OPT_EXIT, {(void*)show_codecs }, "show available codecs" }, - { "bsfs" , OPT_EXIT, {(void*)show_bsfs }, "show available bit stream filters" }, - { "protocols", OPT_EXIT, {(void*)show_protocols}, "show available protocols" }, - { "loglevel", HAS_ARG | OPT_FUNC2, {(void*)opt_loglevel}, "set libav* logging level", "loglevel" }, +#include "cmdutils_common_opts.h" { "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" },