diff options
author | Stefano Sabatini <stefasab@gmail.com> | 2013-10-17 21:04:16 +0400 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2013-10-27 12:18:45 +0400 |
commit | 4e268285aaff2fdd352eeac4765169a01e6eefe4 (patch) | |
tree | c581240e3f0a0b3521dc8ef0adc2d3cee460f949 | |
parent | d61617a52349f9e65903bffb801dba1388de01ac (diff) |
cmdutils: add -colors option
-rw-r--r-- | cmdutils.c | 12 | ||||
-rw-r--r-- | cmdutils.h | 6 | ||||
-rw-r--r-- | cmdutils_common_opts.h | 1 | ||||
-rw-r--r-- | doc/fftools-common-opts.texi | 3 |
4 files changed, 22 insertions, 0 deletions
diff --git a/cmdutils.c b/cmdutils.c index 90ad48f620..1fbd73cf84 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -1518,6 +1518,18 @@ int show_filters(void *optctx, const char *opt, const char *arg) return 0; } +void show_colors(void *optctx, const char *opt, const char *arg) +{ + const char *name; + const uint8_t *rgb; + int i; + + printf("%-32s #RRGGBB\n", "name"); + + for (i = 0; name = av_get_known_color_name(i, &rgb); i++) + printf("%-32s #%02x%02x%02x\n", name, rgb[0], rgb[1], rgb[2]); +} + int show_pix_fmts(void *optctx, const char *opt, const char *arg) { const AVPixFmtDescriptor *pix_desc = NULL; diff --git a/cmdutils.h b/cmdutils.h index 49bb765724..2538f05d98 100644 --- a/cmdutils.h +++ b/cmdutils.h @@ -489,6 +489,12 @@ int show_layouts(void *optctx, const char *opt, const char *arg); int show_sample_fmts(void *optctx, const char *opt, const char *arg); /** + * Print a listing containing all the color names and values recognized + * by the program. + */ +void show_colors(void *optctx, const char *opt, const char *arg); + +/** * Return a positive value if a line read from standard input * starts with [yY], otherwise return 0. */ diff --git a/cmdutils_common_opts.h b/cmdutils_common_opts.h index 9c265fc5f7..69663039e0 100644 --- a/cmdutils_common_opts.h +++ b/cmdutils_common_opts.h @@ -14,6 +14,7 @@ { "pix_fmts" , OPT_EXIT, {.func_arg = show_pix_fmts }, "show available pixel formats" }, { "layouts" , OPT_EXIT, {.func_arg = show_layouts }, "show standard channel layouts" }, { "sample_fmts", OPT_EXIT, {.func_arg = show_sample_fmts }, "show available audio sample formats" }, + { "colors" , OPT_EXIT, {.func_arg = show_colors }, "show available color names" }, { "loglevel" , HAS_ARG, {.func_arg = opt_loglevel}, "set logging level", "loglevel" }, { "v", HAS_ARG, {.func_arg = opt_loglevel}, "set logging level", "loglevel" }, { "report" , 0, {(void*)opt_report}, "generate a report" }, diff --git a/doc/fftools-common-opts.texi b/doc/fftools-common-opts.texi index 6d453ed693..617af2fa5e 100644 --- a/doc/fftools-common-opts.texi +++ b/doc/fftools-common-opts.texi @@ -128,6 +128,9 @@ Show available sample formats. @item -layouts Show channel names and standard channel layouts. +@item -colors +Show recognized color names. + @item -loglevel [repeat+]@var{loglevel} | -v [repeat+]@var{loglevel} Set the logging level used by the library. Adding "repeat+" indicates that repeated log output should not be compressed |