Commit 67a6dac7 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '7c501212'

* commit '7c501212':
  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: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents c5af0680 7c501212
...@@ -141,8 +141,8 @@ int64_t parse_time_or_die(const char *context, const char *timestr, ...@@ -141,8 +141,8 @@ int64_t parse_time_or_die(const char *context, const char *timestr,
return us; return us;
} }
void show_help_options(const OptionDef *options, const char *msg, int mask, void show_help_options(const OptionDef *options, const char *msg, int req_flags,
int value) int rej_flags)
{ {
const OptionDef *po; const OptionDef *po;
int first; int first;
...@@ -150,19 +150,23 @@ void show_help_options(const OptionDef *options, const char *msg, int mask, ...@@ -150,19 +150,23 @@ void show_help_options(const OptionDef *options, const char *msg, int mask,
first = 1; first = 1;
for (po = options; po->name != NULL; po++) { for (po = options; po->name != NULL; po++) {
char buf[64]; char buf[64];
if ((po->flags & mask) == value) {
if (first) { if (((po->flags & req_flags) != req_flags) ||
printf("%s", msg); (po->flags & rej_flags))
first = 0; continue;
}
av_strlcpy(buf, po->name, sizeof(buf)); if (first) {
if (po->flags & HAS_ARG) { printf("%s\n", msg);
av_strlcat(buf, " ", sizeof(buf)); first = 0;
av_strlcat(buf, po->argname, sizeof(buf)); }
} av_strlcpy(buf, po->name, sizeof(buf));
printf("-%-17s %s\n", buf, po->help); 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) void show_help_children(const AVClass *class, int flags)
......
...@@ -148,7 +148,6 @@ typedef struct { ...@@ -148,7 +148,6 @@ typedef struct {
#define OPT_STRING 0x0008 #define OPT_STRING 0x0008
#define OPT_VIDEO 0x0010 #define OPT_VIDEO 0x0010
#define OPT_AUDIO 0x0020 #define OPT_AUDIO 0x0020
#define OPT_GRAB 0x0040
#define OPT_INT 0x0080 #define OPT_INT 0x0080
#define OPT_FLOAT 0x0100 #define OPT_FLOAT 0x0100
#define OPT_SUBTITLE 0x0200 #define OPT_SUBTITLE 0x0200
...@@ -172,8 +171,16 @@ typedef struct { ...@@ -172,8 +171,16 @@ typedef struct {
const char *argname; const char *argname;
} OptionDef; } 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 * Show help for all options with given flags in class and all its
......
...@@ -639,13 +639,6 @@ lot. ...@@ -639,13 +639,6 @@ lot.
@end table @end table
@section Audio/Video grab options
@table @option
@item -isync (@emph{global})
Synchronize read on input.
@end table
@section Advanced options @section Advanced options
@table @option @table @option
......
...@@ -2144,29 +2144,20 @@ static int show_help(const char *opt, const char *arg) ...@@ -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; int flags = AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM;
av_log_set_callback(log_callback_help); av_log_set_callback(log_callback_help);
show_usage(); show_usage();
show_help_options(options, "Main options:\n", show_help_options(options, "Main options:",
OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE | OPT_GRAB, 0); 0, OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE);
show_help_options(options, "\nAdvanced options:\n", show_help_options(options, "Advanced options:",
OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE | OPT_GRAB, OPT_EXPERT, OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE);
OPT_EXPERT); show_help_options(options, "Video options:",
show_help_options(options, "\nVideo options:\n", OPT_VIDEO, OPT_EXPERT | OPT_AUDIO);
OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_GRAB, show_help_options(options, "Advanced Video options:",
OPT_VIDEO); OPT_EXPERT | OPT_VIDEO, OPT_AUDIO);
show_help_options(options, "\nAdvanced Video options:\n", show_help_options(options, "Audio options:",
OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_GRAB, OPT_AUDIO, OPT_EXPERT | OPT_VIDEO);
OPT_VIDEO | OPT_EXPERT); show_help_options(options, "Advanced Audio options:",
show_help_options(options, "\nAudio options:\n", OPT_EXPERT | OPT_AUDIO, OPT_VIDEO);
OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_GRAB, show_help_options(options, "Subtitle options:",
OPT_AUDIO); OPT_SUBTITLE, 0);
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);
printf("\n"); printf("\n");
show_help_children(avcodec_get_class(), flags); show_help_children(avcodec_get_class(), flags);
show_help_children(avformat_get_class(), flags); show_help_children(avformat_get_class(), flags);
...@@ -2426,12 +2417,11 @@ const OptionDef options[] = { ...@@ -2426,12 +2417,11 @@ const OptionDef options[] = {
"fix subtitles duration" }, "fix subtitles duration" },
/* grab options */ /* 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" }, "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" }, "deprecated, use -standard", "standard" },
{ "isync", OPT_BOOL | OPT_EXPERT | OPT_GRAB, { &input_sync }, { "isync", OPT_BOOL | OPT_EXPERT, { &input_sync }, "this option is deprecated and does nothing", "" },
"sync read on input", "" },
/* muxer options */ /* muxer options */
{ "muxdelay", OPT_FLOAT | HAS_ARG | OPT_EXPERT | OPT_OFFSET, { .off = OFFSET(mux_max_delay) }, { "muxdelay", OPT_FLOAT | HAS_ARG | OPT_EXPERT | OPT_OFFSET, { .off = OFFSET(mux_max_delay) },
......
...@@ -3027,10 +3027,8 @@ static int show_help(const char *opt, const char *arg) ...@@ -3027,10 +3027,8 @@ static int show_help(const char *opt, const char *arg)
{ {
av_log_set_callback(log_callback_help); av_log_set_callback(log_callback_help);
show_usage(); show_usage();
show_help_options(options, "Main options:\n", show_help_options(options, "Main options:", 0, OPT_EXPERT);
OPT_EXPERT, 0); show_help_options(options, "Advanced options:", OPT_EXPERT, 0);
show_help_options(options, "\nAdvanced options:\n",
OPT_EXPERT, OPT_EXPERT);
printf("\n"); printf("\n");
show_help_children(avcodec_get_class(), AV_OPT_FLAG_DECODING_PARAM); show_help_children(avcodec_get_class(), AV_OPT_FLAG_DECODING_PARAM);
show_help_children(avformat_get_class(), AV_OPT_FLAG_DECODING_PARAM); show_help_children(avformat_get_class(), AV_OPT_FLAG_DECODING_PARAM);
......
...@@ -2076,7 +2076,7 @@ static int show_help(const char *opt, const char *arg) ...@@ -2076,7 +2076,7 @@ static int show_help(const char *opt, const char *arg)
{ {
av_log_set_callback(log_callback_help); av_log_set_callback(log_callback_help);
show_usage(); show_usage();
show_help_options(options, "Main options:\n", 0, 0); show_help_options(options, "Main options:", 0, 0);
printf("\n"); printf("\n");
show_help_children(avformat_get_class(), AV_OPT_FLAG_DECODING_PARAM); show_help_children(avformat_get_class(), AV_OPT_FLAG_DECODING_PARAM);
......
...@@ -4650,7 +4650,7 @@ static int show_help(const char *opt, const char *arg) ...@@ -4650,7 +4650,7 @@ static int show_help(const char *opt, const char *arg)
printf("usage: ffserver [options]\n" printf("usage: ffserver [options]\n"
"Hyper fast multi format Audio/Video streaming server\n"); "Hyper fast multi format Audio/Video streaming server\n");
printf("\n"); printf("\n");
show_help_options(options, "Main options:\n", 0, 0); show_help_options(options, "Main options:", 0, 0);
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment