aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-08-20 16:52:42 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-08-20 16:55:08 +0200
commit67a6dac7c18caecb418f7590a484dcbfcad869ab (patch)
treedfc518e76432ade673085eb8003c25edefb5fc53
parentc5af0680848a62c482c0fd142f8d6646cec46212 (diff)
parent7c5012127fb7e18f0616011257bb4248f6a8b608 (diff)
downloadffmpeg-67a6dac7c18caecb418f7590a484dcbfcad869ab.tar.gz
Merge commit '7c5012127fb7e18f0616011257bb4248f6a8b608'
* commit '7c5012127fb7e18f0616011257bb4248f6a8b608': cmdutils: change semantics of show_help_options() and document it. avtools: move some newlines to show_help_options(). avconv: deprecate -isync. Conflicts: ffmpeg_opt.c ffserver.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--cmdutils.c30
-rw-r--r--cmdutils.h13
-rw-r--r--doc/ffmpeg.texi7
-rw-r--r--ffmpeg_opt.c44
-rw-r--r--ffplay.c6
-rw-r--r--ffprobe.c2
-rw-r--r--ffserver.c2
7 files changed, 48 insertions, 56 deletions
diff --git a/cmdutils.c b/cmdutils.c
index eeb5e39099..443873b779 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -141,8 +141,8 @@ int64_t parse_time_or_die(const char *context, const char *timestr,
return us;
}
-void show_help_options(const OptionDef *options, const char *msg, int mask,
- int value)
+void show_help_options(const OptionDef *options, const char *msg, int req_flags,
+ int rej_flags)
{
const OptionDef *po;
int first;
@@ -150,19 +150,23 @@ void show_help_options(const OptionDef *options, const char *msg, int mask,
first = 1;
for (po = options; po->name != NULL; po++) {
char buf[64];
- if ((po->flags & mask) == value) {
- if (first) {
- printf("%s", msg);
- first = 0;
- }
- av_strlcpy(buf, po->name, sizeof(buf));
- if (po->flags & HAS_ARG) {
- av_strlcat(buf, " ", sizeof(buf));
- av_strlcat(buf, po->argname, sizeof(buf));
- }
- printf("-%-17s %s\n", buf, po->help);
+
+ if (((po->flags & req_flags) != req_flags) ||
+ (po->flags & rej_flags))
+ continue;
+
+ if (first) {
+ printf("%s\n", msg);
+ first = 0;
+ }
+ av_strlcpy(buf, po->name, sizeof(buf));
+ if (po->flags & HAS_ARG) {
+ av_strlcat(buf, " ", sizeof(buf));
+ av_strlcat(buf, po->argname, sizeof(buf));
}
+ printf("-%-17s %s\n", buf, po->help);
}
+ printf("\n");
}
void show_help_children(const AVClass *class, int flags)
diff --git a/cmdutils.h b/cmdutils.h
index f50eb173c0..fb2229fc50 100644
--- a/cmdutils.h
+++ b/cmdutils.h
@@ -148,7 +148,6 @@ typedef struct {
#define OPT_STRING 0x0008
#define OPT_VIDEO 0x0010
#define OPT_AUDIO 0x0020
-#define OPT_GRAB 0x0040
#define OPT_INT 0x0080
#define OPT_FLOAT 0x0100
#define OPT_SUBTITLE 0x0200
@@ -172,8 +171,16 @@ typedef struct {
const char *argname;
} OptionDef;
-void show_help_options(const OptionDef *options, const char *msg, int mask,
- int value);
+/**
+ * Print help for all options matching specified flags.
+ *
+ * @param options a list of options
+ * @param msg title of this group. Only printed if at least one option matches.
+ * @param req_flags print only options which have all those flags set.
+ * @param rej_flags don't print options which have any of those flags set.
+ */
+void show_help_options(const OptionDef *options, const char *msg, int req_flags,
+ int rej_flags);
/**
* Show help for all options with given flags in class and all its
diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 89c1eb84c7..ec8bed3c9d 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -639,13 +639,6 @@ lot.
@end table
-@section Audio/Video grab options
-
-@table @option
-@item -isync (@emph{global})
-Synchronize read on input.
-@end table
-
@section Advanced options
@table @option
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 0d5fecd16b..aba9a1b6ff 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -2144,29 +2144,20 @@ static int show_help(const char *opt, const char *arg)
int flags = AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM;
av_log_set_callback(log_callback_help);
show_usage();
- show_help_options(options, "Main options:\n",
- OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE | OPT_GRAB, 0);
- show_help_options(options, "\nAdvanced options:\n",
- OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE | OPT_GRAB,
- OPT_EXPERT);
- show_help_options(options, "\nVideo options:\n",
- OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_GRAB,
- OPT_VIDEO);
- show_help_options(options, "\nAdvanced Video options:\n",
- OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_GRAB,
- OPT_VIDEO | OPT_EXPERT);
- show_help_options(options, "\nAudio options:\n",
- OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_GRAB,
- OPT_AUDIO);
- show_help_options(options, "\nAdvanced Audio options:\n",
- OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_GRAB,
- OPT_AUDIO | OPT_EXPERT);
- show_help_options(options, "\nSubtitle options:\n",
- OPT_SUBTITLE | OPT_GRAB,
- OPT_SUBTITLE);
- show_help_options(options, "\nAudio/Video grab options:\n",
- OPT_GRAB,
- OPT_GRAB);
+ show_help_options(options, "Main options:",
+ 0, OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE);
+ show_help_options(options, "Advanced options:",
+ OPT_EXPERT, OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE);
+ show_help_options(options, "Video options:",
+ OPT_VIDEO, OPT_EXPERT | OPT_AUDIO);
+ show_help_options(options, "Advanced Video options:",
+ OPT_EXPERT | OPT_VIDEO, OPT_AUDIO);
+ show_help_options(options, "Audio options:",
+ OPT_AUDIO, OPT_EXPERT | OPT_VIDEO);
+ show_help_options(options, "Advanced Audio options:",
+ OPT_EXPERT | OPT_AUDIO, OPT_VIDEO);
+ show_help_options(options, "Subtitle options:",
+ OPT_SUBTITLE, 0);
printf("\n");
show_help_children(avcodec_get_class(), flags);
show_help_children(avformat_get_class(), flags);
@@ -2426,12 +2417,11 @@ const OptionDef options[] = {
"fix subtitles duration" },
/* grab options */
- { "vc", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_GRAB, { .func_arg = opt_video_channel },
+ { "vc", HAS_ARG | OPT_EXPERT | OPT_VIDEO, { .func_arg = opt_video_channel },
"deprecated, use -channel", "channel" },
- { "tvstd", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_GRAB, { .func_arg = opt_video_standard },
+ { "tvstd", HAS_ARG | OPT_EXPERT | OPT_VIDEO, { .func_arg = opt_video_standard },
"deprecated, use -standard", "standard" },
- { "isync", OPT_BOOL | OPT_EXPERT | OPT_GRAB, { &input_sync },
- "sync read on input", "" },
+ { "isync", OPT_BOOL | OPT_EXPERT, { &input_sync }, "this option is deprecated and does nothing", "" },
/* muxer options */
{ "muxdelay", OPT_FLOAT | HAS_ARG | OPT_EXPERT | OPT_OFFSET, { .off = OFFSET(mux_max_delay) },
diff --git a/ffplay.c b/ffplay.c
index 5c7ab3670a..c28883c498 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -3027,10 +3027,8 @@ static int show_help(const char *opt, const char *arg)
{
av_log_set_callback(log_callback_help);
show_usage();
- show_help_options(options, "Main options:\n",
- OPT_EXPERT, 0);
- show_help_options(options, "\nAdvanced options:\n",
- OPT_EXPERT, OPT_EXPERT);
+ show_help_options(options, "Main options:", 0, OPT_EXPERT);
+ show_help_options(options, "Advanced options:", OPT_EXPERT, 0);
printf("\n");
show_help_children(avcodec_get_class(), AV_OPT_FLAG_DECODING_PARAM);
show_help_children(avformat_get_class(), AV_OPT_FLAG_DECODING_PARAM);
diff --git a/ffprobe.c b/ffprobe.c
index 0038956479..2046ec0f34 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -2076,7 +2076,7 @@ static int show_help(const char *opt, const char *arg)
{
av_log_set_callback(log_callback_help);
show_usage();
- show_help_options(options, "Main options:\n", 0, 0);
+ show_help_options(options, "Main options:", 0, 0);
printf("\n");
show_help_children(avformat_get_class(), AV_OPT_FLAG_DECODING_PARAM);
diff --git a/ffserver.c b/ffserver.c
index 51eb07a63e..c03278c0b1 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -4650,7 +4650,7 @@ static int show_help(const char *opt, const char *arg)
printf("usage: ffserver [options]\n"
"Hyper fast multi format Audio/Video streaming server\n");
printf("\n");
- show_help_options(options, "Main options:\n", 0, 0);
+ show_help_options(options, "Main options:", 0, 0);
return 0;
}