[FFmpeg-cvslog] lavu/parseutils: add av_get_known_color_name()

Stefano Sabatini git at videolan.org
Sun Oct 27 09:22:08 CET 2013


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Thu Oct 17 19:03:40 2013 +0200| [d61617a52349f9e65903bffb801dba1388de01ac] | committer: Stefano Sabatini

lavu/parseutils: add av_get_known_color_name()

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d61617a52349f9e65903bffb801dba1388de01ac
---

 doc/APIchanges         |    4 +++-
 libavutil/parseutils.c |   14 ++++++++++++++
 libavutil/parseutils.h |   13 +++++++++++++
 libavutil/version.h    |    4 ++--
 4 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index c1f103a..35940db 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,7 +15,9 @@ libavutil:     2012-10-22
 
 API changes, most recent first:
 
-libavutil 52.47.100
+2013-10-27 - xxxxxxx - lavu 52.48.100 - parseutils.h
+  Add av_get_known_color_name().
+
 2013-10-17 - xxxxxxx - lavu 52.47.100 - opt.h
   Add AV_OPT_TYPE_CHANNEL_LAYOUT and channel layout option handlers
   av_opt_get_channel_layout() and av_opt_set_channel_layout().
diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c
index 1e1b93e..e793e2d 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,
diff --git a/libavutil/parseutils.h b/libavutil/parseutils.h
index dcfb705..c80f0de 100644
--- a/libavutil/parseutils.h
+++ b/libavutil/parseutils.h
@@ -99,6 +99,19 @@ int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen,
                    void *log_ctx);
 
 /**
+ * Get the name of a color from the internal table of hard-coded named
+ * colors.
+ *
+ * This function is meant to enumerate the color names recognized by
+ * av_parse_color().
+ *
+ * @param color_idx index of the requested color, starting from 0
+ * @param rgbp      if not NULL, will point to a 3-elements array with the color value in RGB
+ * @return the color name string or NULL if color_idx is not in the array
+ */
+const char *av_get_known_color_name(int color_idx, const uint8_t **rgb);
+
+/**
  * Parse timestr and return in *time a corresponding number of
  * microseconds.
  *
diff --git a/libavutil/version.h b/libavutil/version.h
index 9d089d8..67a2acd 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -75,8 +75,8 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  52
-#define LIBAVUTIL_VERSION_MINOR  47
-#define LIBAVUTIL_VERSION_MICRO 101
+#define LIBAVUTIL_VERSION_MINOR  48
+#define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
                                                LIBAVUTIL_VERSION_MINOR, \



More information about the ffmpeg-cvslog mailing list