Browse code

Accept "bikeshed" as a random color.

Originally committed as revision 18758 to svn://svn.ffmpeg.org/ffmpeg/trunk

Ramiro Polla authored on 2009/05/07 00:25:30
Showing 1 changed files
... ...
@@ -24,6 +24,7 @@
24 24
 
25 25
 #include <string.h>
26 26
 #include "libavutil/avutil.h"
27
+#include "libavutil/random_seed.h"
27 28
 #include "parseutils.h"
28 29
 
29 30
 #define WHITESPACES " \n\t"
... ...
@@ -216,6 +217,13 @@ static int color_table_compare(const void *lhs, const void *rhs)
216 216
 
217 217
 int av_parse_color(uint8_t *rgba_color, const char *color_string, void *log_ctx)
218 218
 {
219
+    if (!strcmp(color_string, "bikeshed")) {
220
+        int rgba = ff_random_get_seed();
221
+        rgba_color[0] = rgba >> 24;
222
+        rgba_color[1] = rgba >> 16;
223
+        rgba_color[2] = rgba >> 8;
224
+        rgba_color[3] = rgba;
225
+    } else
219 226
     if (!strncmp(color_string, "0x", 2)) {
220 227
         char *tail;
221 228
         int len = strlen(color_string);
... ...
@@ -295,6 +303,7 @@ int main(void)
295 295
     {
296 296
         uint8_t rgba[4];
297 297
         const char *color_names[] = {
298
+            "bikeshed",
298 299
             "foo",
299 300
             "red",
300 301
             "Red ",