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
1791 1791
1792void show_help_default(const char *opt, const char *arg)1792void show_help_default(const char *opt, const char *arg)
1793{1793{
1794 /* per-file options have at least one of those set */
1795 const int per_file = OPT_SPEC | OPT_OFFSET | OPT_FUNC2;
1794 int show_advanced = 0, show_avoptions = 0;1796 int show_advanced = 0, show_avoptions = 0;
1795 1797
1796 if (opt) {1798 if (opt) {
@@ -1812,27 +1814,35 @@ void show_help_default(const char *opt, const char *arg) · 15 unmodified lines
1812 "\n", program_name);1814 "\n", program_name);
1813 1815
1814 show_help_options(options, "Print help / information / capabilities:",1816 show_help_options(options, "Print help / information / capabilities:",
1815 OPT_EXIT, 0);1817 OPT_EXIT, 0, 0);
1816 show_help_options(options, "Main options:",1818
1817 0, OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE |1819 show_help_options(options, "Global options (affect whole program "
1818 OPT_EXIT);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);
1819 if (show_advanced)1829 if (show_advanced)
1820 show_help_options(options, "Advanced options:",1830 show_help_options(options, "Advanced per-file options:",
1821 OPT_EXPERT, OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE);1831 OPT_EXPERT, OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE, per_file);
1822 1832
1823 show_help_options(options, "Video options:",1833 show_help_options(options, "Video options:",
1824 OPT_VIDEO, OPT_EXPERT | OPT_AUDIO);1834 OPT_VIDEO, OPT_EXPERT | OPT_AUDIO, 0);
1825 if (show_advanced)1835 if (show_advanced)
1826 show_help_options(options, "Advanced Video options:",1836 show_help_options(options, "Advanced Video options:",
1827 OPT_EXPERT | OPT_VIDEO, OPT_AUDIO);1837 OPT_EXPERT | OPT_VIDEO, OPT_AUDIO, 0);
1828 1838
1829 show_help_options(options, "Audio options:",1839 show_help_options(options, "Audio options:",
1830 OPT_AUDIO, OPT_EXPERT | OPT_VIDEO);1840 OPT_AUDIO, OPT_EXPERT | OPT_VIDEO, 0);
1831 if (show_advanced)1841 if (show_advanced)
1832 show_help_options(options, "Advanced Audio options:",1842 show_help_options(options, "Advanced Audio options:",
1833 OPT_EXPERT | OPT_AUDIO, OPT_VIDEO);1843 OPT_EXPERT | OPT_AUDIO, OPT_VIDEO, 0);
1834 show_help_options(options, "Subtitle options:",1844 show_help_options(options, "Subtitle options:",
1835 OPT_SUBTITLE, 0);1845 OPT_SUBTITLE, 0, 0);
1836 printf("\n");1846 printf("\n");
1837 1847
1838 if (show_avoptions) {1848 if (show_avoptions) {
avplay.c+2−2
@@ -2924,8 +2924,8 @@ void show_help_default(const char *opt, const char *arg) · 2923 unmodified lines
2924{2924{
2925 av_log_set_callback(log_callback_help);2925 av_log_set_callback(log_callback_help);
2926 show_usage();2926 show_usage();
2927 show_help_options(options, "Main options:", 0, OPT_EXPERT);2927 show_help_options(options, "Main options:", 0, OPT_EXPERT, 0);
2928 show_help_options(options, "Advanced options:", OPT_EXPERT, 0);2928 show_help_options(options, "Advanced options:", OPT_EXPERT, 0, 0);
2929 printf("\n");2929 printf("\n");
2930 show_help_children(avcodec_get_class(), AV_OPT_FLAG_DECODING_PARAM);2930 show_help_children(avcodec_get_class(), AV_OPT_FLAG_DECODING_PARAM);
2931 show_help_children(avformat_get_class(), AV_OPT_FLAG_DECODING_PARAM);2931 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
872{872{
873 av_log_set_callback(log_callback_help);873 av_log_set_callback(log_callback_help);
874 show_usage();874 show_usage();
875 show_help_options(options, "Main options:", 0, 0);875 show_help_options(options, "Main options:", 0, 0, 0);
876 printf("\n");876 printf("\n");
877 show_help_children(avformat_get_class(), AV_OPT_FLAG_DECODING_PARAM);877 show_help_children(avformat_get_class(), AV_OPT_FLAG_DECODING_PARAM);
878}878}
avserver.c+1−1
@@ -4634,7 +4634,7 @@ void show_help_default(const char *opt, const char *arg) · 4633 unmodified lines
4634 printf("usage: avserver [options]\n"4634 printf("usage: avserver [options]\n"
4635 "Hyper fast multi format Audio/Video streaming server\n");4635 "Hyper fast multi format Audio/Video streaming server\n");
4636 printf("\n");4636 printf("\n");
4637 show_help_options(options, "Main options:", 0, 0);4637 show_help_options(options, "Main options:", 0, 0, 0);
4638}4638}
4639 4639
4640static const OptionDef options[] = {4640static 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
114}114}
115 115
116void show_help_options(const OptionDef *options, const char *msg, int req_flags,116void show_help_options(const OptionDef *options, const char *msg, int req_flags,
117 int rej_flags)117 int rej_flags, int alt_flags)
118{118{
119 const OptionDef *po;119 const OptionDef *po;
120 int first;120 int first;
@@ -124,6 +124,7 @@ void show_help_options(const OptionDef *options, const char *msg, int req_flags, · 3 unmodified lines
124 char buf[64];124 char buf[64];
125 125
126 if (((po->flags & req_flags) != req_flags) ||126 if (((po->flags & req_flags) != req_flags) ||
127 (alt_flags && !(po->flags & alt_flags)) ||
127 (po->flags & rej_flags))128 (po->flags & rej_flags))
128 continue;129 continue;
129 130
cmdutils.h+2−1
@@ -160,9 +160,10 @@ typedef struct { · 159 unmodified lines
160 * @param msg title of this group. Only printed if at least one option matches.160 * @param msg title of this group. Only printed if at least one option matches.
161 * @param req_flags print only options which have all those flags set.161 * @param req_flags print only options which have all those flags set.
162 * @param rej_flags don't print options which have any of those flags set.162 * @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
163 */164 */
164void show_help_options(const OptionDef *options, const char *msg, int req_flags,165void show_help_options(const OptionDef *options, const char *msg, int req_flags,
165 int rej_flags);166 int rej_flags, int alt_flags);
166 167
167/**168/**
168 * Show help for all options with given flags in class and all its169 * 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