[SCM] libav/experimental: 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.

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:45:49 UTC 2013


The following commit has been merged in the experimental branch:
commit 3d3bd64db8a319cf40aea3587f346f0ac0805b9b
Author: Stefano Sabatini <stefano.sabatini-lala at poste.it>
Date:   Thu May 14 18:58:06 2009 +0000

    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.
    
    Originally committed as revision 18828 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavfilter/parseutils.c b/libavfilter/parseutils.c
index 13fa581..85effb0 100644
--- a/libavfilter/parseutils.c
+++ b/libavfilter/parseutils.c
@@ -217,7 +217,7 @@ static int color_table_compare(const void *lhs, const void *rhs)
 
 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 ",
diff --git a/libavfilter/parseutils.h b/libavfilter/parseutils.h
index 52df821..46c66ed 100644
--- a/libavfilter/parseutils.h
+++ b/libavfilter/parseutils.h
@@ -45,6 +45,7 @@ char *av_get_token(const char **buf, const char *term);
  *
  * @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).
  */

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list