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,
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)
......
......@@ -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
......
......@@ -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
......
......@@ -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) },
......
......@@ -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);
......
......@@ -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);
......
......@@ -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;
}
......
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