diff options
author | Stefano Sabatini <stefasab@gmail.com> | 2013-10-17 19:03:40 +0200 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2013-10-27 09:16:05 +0100 |
commit | d61617a52349f9e65903bffb801dba1388de01ac (patch) | |
tree | 8d5750fdc87510c44e59d0b16b16f251368a9b3c /libavutil/parseutils.c | |
parent | 1e5271a9fd6ddcceb083f2185a4bbd8d44c9a813 (diff) | |
download | ffmpeg-d61617a52349f9e65903bffb801dba1388de01ac.tar.gz |
lavu/parseutils: add av_get_known_color_name()
Diffstat (limited to 'libavutil/parseutils.c')
-rw-r--r-- | libavutil/parseutils.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c index 1e1b93e8e5..e793e2d4c6 100644 --- a/libavutil/parseutils.c +++ b/libavutil/parseutils.c @@ -420,6 +420,20 @@ int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, return 0; } +const char *av_get_known_color_name(int color_idx, const uint8_t **rgbp) +{ + const ColorEntry *color; + + if ((unsigned)color_idx >= FF_ARRAY_ELEMS(color_table)) + return NULL; + + color = &color_table[color_idx]; + if (rgbp) + *rgbp = color->rgb_color; + + return color->name; +} + /* get a positive number between n_min and n_max, for a maximum length of len_max. Return -1 if error. */ static int date_get_num(const char **pp, |