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
1515
1616 API changes, most recent first:
1717
18−libavutil 52.47.100
18+2013-10-27 - xxxxxxx - lavu 52.48.100 - parseutils.h
19+ Add av_get_known_color_name().
20+
1921 2013-10-17 - xxxxxxx - lavu 52.47.100 - opt.h
2022 Add AV_OPT_TYPE_CHANNEL_LAYOUT and channel layout option handlers
2123 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
420420 return 0;
421421 }
422422
423+const 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+
423437 /* get a positive number between n_min and n_max, for a maximum length
424438 of len_max. Return -1 if error. */
425439 static 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
9898 int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen,
9999 void *log_ctx);
100100
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+ */
112+const char *av_get_known_color_name(int color_idx, const uint8_t **rgb);
113+
101114 /**
102115 * Parse timestr and return in *time a corresponding number of
103116 * microseconds.
libavutil/version.h+2−2
@@ -75,8 +75,8 @@ · 74 unmodified lines
7575 */
7676
7777 #define LIBAVUTIL_VERSION_MAJOR 52
78−#define LIBAVUTIL_VERSION_MINOR 47
79−#define LIBAVUTIL_VERSION_MICRO 101
78+#define LIBAVUTIL_VERSION_MINOR 48
79+#define LIBAVUTIL_VERSION_MICRO 100
8080
8181 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
8282 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