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
15181518 return 0;
15191519 }
15201520
1521+void 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+
15211533 int show_pix_fmts(void *optctx, const char *opt, const char *arg)
15221534 {
15231535 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
488488 */
489489 int show_sample_fmts(void *optctx, const char *opt, const char *arg);
490490
491+/**
492+ * Print a listing containing all the color names and values recognized
493+ * by the program.
494+ */
495+void show_colors(void *optctx, const char *opt, const char *arg);
496+
491497 /**
492498 * Return a positive value if a line read from standard input
493499 * starts with [yY], otherwise return 0.
cmdutils_common_opts.h+1−0
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414 { "pix_fmts" , OPT_EXIT, {.func_arg = show_pix_fmts }, "show available pixel formats" },
1515 { "layouts" , OPT_EXIT, {.func_arg = show_layouts }, "show standard channel layouts" },
1616 { "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" },
1718 { "loglevel" , HAS_ARG, {.func_arg = opt_loglevel}, "set logging level", "loglevel" },
1819 { "v", HAS_ARG, {.func_arg = opt_loglevel}, "set logging level", "loglevel" },
1920 { "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
128128 @item -layouts
129129 Show channel names and standard channel layouts.
130130
131+@item -colors
132+Show recognized color names.
133+
131134 @item -loglevel [repeat+]@var{loglevel} | -v [repeat+]@var{loglevel}
132135 Set the logging level used by the library.
133136 Adding "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