[FFmpeg-cvslog] r18828 - in trunk/libavfilter: parseutils.c parseutils.h

stefano subversion
Thu May 14 20:58:07 CEST 2009


Author: stefano
Date: Thu May 14 20:58:06 2009
New Revision: 18828

Log:
Add support in av_parse_color() to a "random" color name, which will
result in a randomly choosen random color, as it is with the
"bikeshed" color.

Modified:
   trunk/libavfilter/parseutils.c
   trunk/libavfilter/parseutils.h

Modified: trunk/libavfilter/parseutils.c
==============================================================================
--- trunk/libavfilter/parseutils.c	Thu May 14 20:54:25 2009	(r18827)
+++ trunk/libavfilter/parseutils.c	Thu May 14 20:58:06 2009	(r18828)
@@ -217,7 +217,7 @@ static int color_table_compare(const voi
 
 int av_parse_color(uint8_t *rgba_color, const char *color_string, void *log_ctx)
 {
-    if (!strcasecmp(color_string, "bikeshed")) {
+    if (!strcasecmp(color_string, "random") || !strcasecmp(color_string, "bikeshed")) {
         int rgba = ff_random_get_seed();
         rgba_color[0] = rgba >> 24;
         rgba_color[1] = rgba >> 16;
@@ -304,6 +304,7 @@ int main(void)
         uint8_t rgba[4];
         const char *color_names[] = {
             "bikeshed",
+            "RaNdOm",
             "foo",
             "red",
             "Red ",

Modified: trunk/libavfilter/parseutils.h
==============================================================================
--- trunk/libavfilter/parseutils.h	Thu May 14 20:54:25 2009	(r18827)
+++ trunk/libavfilter/parseutils.h	Thu May 14 20:58:06 2009	(r18828)
@@ -45,6 +45,7 @@ char *av_get_token(const char **buf, con
  *
  * @param color_string a string specifying a color. It can be the name of
  * a color (case insensitive match) or a 0xRRGGBB[AA] sequence.
+ * The string "random" will result in a random color.
  * @return >= 0 in case of success, a negative value in case of
  * failure (for example if color_string cannot be parsed).
  */



More information about the ffmpeg-cvslog mailing list