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
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 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 }
1795 1804
1796 show_usage();1805 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
1797 show_help_options(options, "Print help / information / capabilities:",1814 show_help_options(options, "Print help / information / capabilities:",
1798 OPT_EXIT, 0);1815 OPT_EXIT, 0);
1799 show_help_options(options, "Main options:",1816 show_help_options(options, "Main options:",
1800 0, OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE |1817 0, OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE |
1801 OPT_EXIT);1818 OPT_EXIT);
1802 show_help_options(options, "Advanced options:",1819 if (show_advanced)
1803 OPT_EXPERT, OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE);1820 show_help_options(options, "Advanced options:",
1821 OPT_EXPERT, OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE);
1822
1804 show_help_options(options, "Video options:",1823 show_help_options(options, "Video options:",
1805 OPT_VIDEO, OPT_EXPERT | OPT_AUDIO);1824 OPT_VIDEO, OPT_EXPERT | OPT_AUDIO);
1806 show_help_options(options, "Advanced Video options:",1825 if (show_advanced)
1807 OPT_EXPERT | OPT_VIDEO, OPT_AUDIO);1826 show_help_options(options, "Advanced Video options:",
1827 OPT_EXPERT | OPT_VIDEO, OPT_AUDIO);
1828
1808 show_help_options(options, "Audio options:",1829 show_help_options(options, "Audio options:",
1809 OPT_AUDIO, OPT_EXPERT | OPT_VIDEO);1830 OPT_AUDIO, OPT_EXPERT | OPT_VIDEO);
1810 show_help_options(options, "Advanced Audio options:",1831 if (show_advanced)
1811 OPT_EXPERT | OPT_AUDIO, OPT_VIDEO);1832 show_help_options(options, "Advanced Audio options:",
1833 OPT_EXPERT | OPT_AUDIO, OPT_VIDEO);
1812 show_help_options(options, "Subtitle options:",1834 show_help_options(options, "Subtitle options:",
1813 OPT_SUBTITLE, 0);1835 OPT_SUBTITLE, 0);
1814 printf("\n");1836 printf("\n");
1815 show_help_children(avcodec_get_class(), flags);1837
1816 show_help_children(avformat_get_class(), flags);1838 if (show_avoptions) {
1817 show_help_children(sws_get_class(), flags);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 }
1818}1844}
1819 1845
1820void show_usage(void)1846void 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