History

avconv: refactor help printing.

By default don't dump every single option on the user, but print only the basic options. Add -h long/full to print more options.

Anton Khirnov committed 14 years ago

Commit 6e3857f1 parent f8b1e661 file · +36 −10Browse files

Unified · Split

avconv_opt.c+36−10
@@ -1791,30 +1791,56 @@ 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− int flags = AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM;
1794+ int show_advanced = 0, show_avoptions = 0;
1795+
1796+ if (opt) {
1797+ if (!strcmp(opt, "long"))
1798+ show_advanced = 1;
1799+ else if (!strcmp(opt, "full"))
1800+ show_advanced = show_avoptions = 1;
1801+ else
1802+ av_log(NULL, AV_LOG_ERROR, "Unknown help option '%s'.\n", opt);
1803+ }
17951804
17961805 show_usage();
1806+
1807+ printf("Getting help:\n"
1808+ " -h -- print basic options\n"
1809+ " -h long -- print more options\n"
1810+ " -h full -- print all options (including all format and codec specific options, very long)\n"
1811+ " See man %s for detailed description of the options.\n"
1812+ "\n", program_name);
1813+
17971814 show_help_options(options, "Print help / information / capabilities:",
17981815 OPT_EXIT, 0);
17991816 show_help_options(options, "Main options:",
18001817 0, OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE |
18011818 OPT_EXIT);
1802− show_help_options(options, "Advanced options:",
1803− OPT_EXPERT, OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE);
1819+ if (show_advanced)
1820+ show_help_options(options, "Advanced options:",
1821+ OPT_EXPERT, OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE);
1822+
18041823 show_help_options(options, "Video options:",
18051824 OPT_VIDEO, OPT_EXPERT | OPT_AUDIO);
1806− show_help_options(options, "Advanced Video options:",
1807− OPT_EXPERT | OPT_VIDEO, OPT_AUDIO);
1825+ if (show_advanced)
1826+ show_help_options(options, "Advanced Video options:",
1827+ OPT_EXPERT | OPT_VIDEO, OPT_AUDIO);
1828+
18081829 show_help_options(options, "Audio options:",
18091830 OPT_AUDIO, OPT_EXPERT | OPT_VIDEO);
1810− show_help_options(options, "Advanced Audio options:",
1811− OPT_EXPERT | OPT_AUDIO, OPT_VIDEO);
1831+ if (show_advanced)
1832+ show_help_options(options, "Advanced Audio options:",
1833+ OPT_EXPERT | OPT_AUDIO, OPT_VIDEO);
18121834 show_help_options(options, "Subtitle options:",
18131835 OPT_SUBTITLE, 0);
18141836 printf("\n");
1815− show_help_children(avcodec_get_class(), flags);
1816− show_help_children(avformat_get_class(), flags);
1817− show_help_children(sws_get_class(), flags);
1837+
1838+ if (show_avoptions) {
1839+ int flags = AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM;
1840+ show_help_children(avcodec_get_class(), flags);
1841+ show_help_children(avformat_get_class(), flags);
1842+ show_help_children(sws_get_class(), flags);
1843+ }
18181844 }
18191845
18201846 void show_usage(void)

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