History

cmdutils: add -colors option

Stefano Sabatini committed 13 years ago

Commit 4e268281 parent d61617a4 files · +22 −0Browse files

Unified · Split

4 files
  1. cmdutils.c +12 −0
  2. cmdutils.h +6 −0
  3. cmdutils_common_opts.h +1 −0
  4. doc/fftools-common-opts.texi +3 −0
cmdutils.c+12−0
@@ -1518,6 +1518,18 @@ int show_filters(void *optctx, const char *opt, const char *arg) · 1517 unmodified lines
1518 return 0;1518 return 0;
1519}1519}
1520 1520
1521void show_colors(void *optctx, const char *opt, const char *arg)
1522{
1523 const char *name;
1524 const uint8_t *rgb;
1525 int i;
1526
1527 printf("%-32s #RRGGBB\n", "name");
1528
1529 for (i = 0; name = av_get_known_color_name(i, &rgb); i++)
1530 printf("%-32s #%02x%02x%02x\n", name, rgb[0], rgb[1], rgb[2]);
1531}
1532
1521int show_pix_fmts(void *optctx, const char *opt, const char *arg)1533int show_pix_fmts(void *optctx, const char *opt, const char *arg)
1522{1534{
1523 const AVPixFmtDescriptor *pix_desc = NULL;1535 const AVPixFmtDescriptor *pix_desc = NULL;
cmdutils.h+6−0
@@ -488,6 +488,12 @@ int show_layouts(void *optctx, const char *opt, const char *arg); · 487 unmodified lines
488 */488 */
489int show_sample_fmts(void *optctx, const char *opt, const char *arg);489int show_sample_fmts(void *optctx, const char *opt, const char *arg);
490 490
491/**
492 * Print a listing containing all the color names and values recognized
493 * by the program.
494 */
495void show_colors(void *optctx, const char *opt, const char *arg);
496
491/**497/**
492 * Return a positive value if a line read from standard input498 * Return a positive value if a line read from standard input
493 * starts with [yY], otherwise return 0.499 * starts with [yY], otherwise return 0.
cmdutils_common_opts.h+1−0
@@ -14,6 +14,7 @@ · 13 unmodified lines
14 { "pix_fmts" , OPT_EXIT, {.func_arg = show_pix_fmts }, "show available pixel formats" },14 { "pix_fmts" , OPT_EXIT, {.func_arg = show_pix_fmts }, "show available pixel formats" },
15 { "layouts" , OPT_EXIT, {.func_arg = show_layouts }, "show standard channel layouts" },15 { "layouts" , OPT_EXIT, {.func_arg = show_layouts }, "show standard channel layouts" },
16 { "sample_fmts", OPT_EXIT, {.func_arg = show_sample_fmts }, "show available audio sample formats" },16 { "sample_fmts", OPT_EXIT, {.func_arg = show_sample_fmts }, "show available audio sample formats" },
17 { "colors" , OPT_EXIT, {.func_arg = show_colors }, "show available color names" },
17 { "loglevel" , HAS_ARG, {.func_arg = opt_loglevel}, "set logging level", "loglevel" },18 { "loglevel" , HAS_ARG, {.func_arg = opt_loglevel}, "set logging level", "loglevel" },
18 { "v", HAS_ARG, {.func_arg = opt_loglevel}, "set logging level", "loglevel" },19 { "v", HAS_ARG, {.func_arg = opt_loglevel}, "set logging level", "loglevel" },
19 { "report" , 0, {(void*)opt_report}, "generate a report" },20 { "report" , 0, {(void*)opt_report}, "generate a report" },
doc/fftools-common-opts.texi+3−0
@@ -128,6 +128,9 @@ Show available sample formats. · 127 unmodified lines
128@item -layouts128@item -layouts
129Show channel names and standard channel layouts.129Show channel names and standard channel layouts.
130 130
131@item -colors
132Show recognized color names.
133
131@item -loglevel [repeat+]@var{loglevel} | -v [repeat+]@var{loglevel}134@item -loglevel [repeat+]@var{loglevel} | -v [repeat+]@var{loglevel}
132Set the logging level used by the library.135Set the logging level used by the library.
133Adding "repeat+" indicates that repeated log output should not be compressed136Adding "repeat+" indicates that repeated log output should not be compressed

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