History

avconv: split printing "main options" into global and per-file.

Anton Khirnov committed 14 years ago

Commit f9fada21 parent 6e3857f6 files · +29 −17Browse files

Unified · Split

6 files
  1. avconv_opt.c +21 −11
  2. avplay.c +2 −2
  3. avprobe.c +1 −1
  4. avserver.c +1 −1
  5. cmdutils.c +2 −1
  6. cmdutils.h +2 −1
avconv_opt.c+21−11
@@ -1791,6 +1791,8 @@ static int opt_filter_complex(const char *opt, const char *arg) · 1790 unmodified lines
17911791
17921792 void show_help_default(const char *opt, const char *arg)
17931793 {
1794+ /* per-file options have at least one of those set */
1795+ const int per_file = OPT_SPEC | OPT_OFFSET | OPT_FUNC2;
17941796 int show_advanced = 0, show_avoptions = 0;
17951797
17961798 if (opt) {
@@ -1812,27 +1814,35 @@ void show_help_default(const char *opt, const char *arg) · 15 unmodified lines
18121814 "\n", program_name);
18131815
18141816 show_help_options(options, "Print help / information / capabilities:",
1815− OPT_EXIT, 0);
1816− show_help_options(options, "Main options:",
1817− 0, OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE |
1818− OPT_EXIT);
1817+ OPT_EXIT, 0, 0);
1818+
1819+ show_help_options(options, "Global options (affect whole program "
1820+ "instead of just one file:",
1821+ 0, per_file | OPT_EXIT | OPT_EXPERT, 0);
1822+ if (show_advanced)
1823+ show_help_options(options, "Advanced global options:", OPT_EXPERT,
1824+ per_file | OPT_EXIT, 0);
1825+
1826+ show_help_options(options, "Per-file main options:", 0,
1827+ OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE |
1828+ OPT_EXIT, per_file);
18191829 if (show_advanced)
1820− show_help_options(options, "Advanced options:",
1821− OPT_EXPERT, OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE);
1830+ show_help_options(options, "Advanced per-file options:",
1831+ OPT_EXPERT, OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE, per_file);
18221832
18231833 show_help_options(options, "Video options:",
1824− OPT_VIDEO, OPT_EXPERT | OPT_AUDIO);
1834+ OPT_VIDEO, OPT_EXPERT | OPT_AUDIO, 0);
18251835 if (show_advanced)
18261836 show_help_options(options, "Advanced Video options:",
1827− OPT_EXPERT | OPT_VIDEO, OPT_AUDIO);
1837+ OPT_EXPERT | OPT_VIDEO, OPT_AUDIO, 0);
18281838
18291839 show_help_options(options, "Audio options:",
1830− OPT_AUDIO, OPT_EXPERT | OPT_VIDEO);
1840+ OPT_AUDIO, OPT_EXPERT | OPT_VIDEO, 0);
18311841 if (show_advanced)
18321842 show_help_options(options, "Advanced Audio options:",
1833− OPT_EXPERT | OPT_AUDIO, OPT_VIDEO);
1843+ OPT_EXPERT | OPT_AUDIO, OPT_VIDEO, 0);
18341844 show_help_options(options, "Subtitle options:",
1835− OPT_SUBTITLE, 0);
1845+ OPT_SUBTITLE, 0, 0);
18361846 printf("\n");
18371847
18381848 if (show_avoptions) {
avplay.c+2−2
@@ -2924,8 +2924,8 @@ void show_help_default(const char *opt, const char *arg) · 2923 unmodified lines
29242924 {
29252925 av_log_set_callback(log_callback_help);
29262926 show_usage();
2927− show_help_options(options, "Main options:", 0, OPT_EXPERT);
2928− show_help_options(options, "Advanced options:", OPT_EXPERT, 0);
2927+ show_help_options(options, "Main options:", 0, OPT_EXPERT, 0);
2928+ show_help_options(options, "Advanced options:", OPT_EXPERT, 0, 0);
29292929 printf("\n");
29302930 show_help_children(avcodec_get_class(), AV_OPT_FLAG_DECODING_PARAM);
29312931 show_help_children(avformat_get_class(), AV_OPT_FLAG_DECODING_PARAM);
avprobe.c+1−1
@@ -872,7 +872,7 @@ void show_help_default(const char *opt, const char *arg) · 871 unmodified lines
872872 {
873873 av_log_set_callback(log_callback_help);
874874 show_usage();
875− show_help_options(options, "Main options:", 0, 0);
875+ show_help_options(options, "Main options:", 0, 0, 0);
876876 printf("\n");
877877 show_help_children(avformat_get_class(), AV_OPT_FLAG_DECODING_PARAM);
878878 }
avserver.c+1−1
@@ -4634,7 +4634,7 @@ void show_help_default(const char *opt, const char *arg) · 4633 unmodified lines
46344634 printf("usage: avserver [options]\n"
46354635 "Hyper fast multi format Audio/Video streaming server\n");
46364636 printf("\n");
4637− show_help_options(options, "Main options:", 0, 0);
4637+ show_help_options(options, "Main options:", 0, 0, 0);
46384638 }
46394639
46404640 static const OptionDef options[] = {
cmdutils.c+2−1
@@ -114,7 +114,7 @@ int64_t parse_time_or_die(const char *context, const char *timestr, · 113 unmodified lines
114114 }
115115
116116 void show_help_options(const OptionDef *options, const char *msg, int req_flags,
117− int rej_flags)
117+ int rej_flags, int alt_flags)
118118 {
119119 const OptionDef *po;
120120 int first;
@@ -124,6 +124,7 @@ void show_help_options(const OptionDef *options, const char *msg, int req_flags, · 3 unmodified lines
124124 char buf[64];
125125
126126 if (((po->flags & req_flags) != req_flags) ||
127+ (alt_flags && !(po->flags & alt_flags)) ||
127128 (po->flags & rej_flags))
128129 continue;
129130
cmdutils.h+2−1
@@ -160,9 +160,10 @@ typedef struct { · 159 unmodified lines
160160 * @param msg title of this group. Only printed if at least one option matches.
161161 * @param req_flags print only options which have all those flags set.
162162 * @param rej_flags don't print options which have any of those flags set.
163+ * @param alt_flags print only options that have at least one of those flags set
163164 */
164165 void show_help_options(const OptionDef *options, const char *msg, int req_flags,
165− int rej_flags);
166+ int rej_flags, int alt_flags);
166167
167168 /**
168169 * Show help for all options with given flags in class and all its

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t