History

lavu/parseutils: add av_get_known_color_name()

Stefano Sabatini committed 13 years ago

Commit d61617a1 parent 1e5271a4 files · +32 −3Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −1
  2. libavutil/parseutils.c +14 −0
  3. libavutil/parseutils.h +13 −0
  4. libavutil/version.h +2 −2
doc/APIchanges+3−1
@@ -15,7 +15,9 @@ libavutil: 2012-10-22 · 14 unmodified lines
15 15
16API changes, most recent first:16API changes, most recent first:
17 17
18libavutil 52.47.100182013-10-27 - xxxxxxx - lavu 52.48.100 - parseutils.h
19 Add av_get_known_color_name().
20
192013-10-17 - xxxxxxx - lavu 52.47.100 - opt.h212013-10-17 - xxxxxxx - lavu 52.47.100 - opt.h
20 Add AV_OPT_TYPE_CHANNEL_LAYOUT and channel layout option handlers22 Add AV_OPT_TYPE_CHANNEL_LAYOUT and channel layout option handlers
21 av_opt_get_channel_layout() and av_opt_set_channel_layout().23 av_opt_get_channel_layout() and av_opt_set_channel_layout().
libavutil/parseutils.c+14−0
@@ -420,6 +420,20 @@ int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, · 419 unmodified lines
420 return 0;420 return 0;
421}421}
422 422
423const char *av_get_known_color_name(int color_idx, const uint8_t **rgbp)
424{
425 const ColorEntry *color;
426
427 if ((unsigned)color_idx >= FF_ARRAY_ELEMS(color_table))
428 return NULL;
429
430 color = &color_table[color_idx];
431 if (rgbp)
432 *rgbp = color->rgb_color;
433
434 return color->name;
435}
436
423/* get a positive number between n_min and n_max, for a maximum length437/* get a positive number between n_min and n_max, for a maximum length
424 of len_max. Return -1 if error. */438 of len_max. Return -1 if error. */
425static int date_get_num(const char **pp,439static int date_get_num(const char **pp,
libavutil/parseutils.h+13−0
@@ -98,6 +98,19 @@ int av_parse_video_rate(AVRational *rate, const char *str); · 97 unmodified lines
98int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen,98int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen,
99 void *log_ctx);99 void *log_ctx);
100 100
101/**
102 * Get the name of a color from the internal table of hard-coded named
103 * colors.
104 *
105 * This function is meant to enumerate the color names recognized by
106 * av_parse_color().
107 *
108 * @param color_idx index of the requested color, starting from 0
109 * @param rgbp if not NULL, will point to a 3-elements array with the color value in RGB
110 * @return the color name string or NULL if color_idx is not in the array
111 */
112const char *av_get_known_color_name(int color_idx, const uint8_t **rgb);
113
101/**114/**
102 * Parse timestr and return in *time a corresponding number of115 * Parse timestr and return in *time a corresponding number of
103 * microseconds.116 * microseconds.
libavutil/version.h+2−2
@@ -75,8 +75,8 @@ · 74 unmodified lines
75 */75 */
76 76
77#define LIBAVUTIL_VERSION_MAJOR 5277#define LIBAVUTIL_VERSION_MAJOR 52
78#define LIBAVUTIL_VERSION_MINOR 4778#define LIBAVUTIL_VERSION_MINOR 48
79#define LIBAVUTIL_VERSION_MICRO 10179#define LIBAVUTIL_VERSION_MICRO 100
80 80
81#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \81#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
82 LIBAVUTIL_VERSION_MINOR, \82 LIBAVUTIL_VERSION_MINOR, \

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