History

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

Stefano Sabatini committed 17 years ago

Commit 3d3bd641 parent b69b6222 files · +3 −1Browse files

Unified · Split

2 files
  1. libavfilter/parseutils.c +2 −1
  2. libavfilter/parseutils.h +1 −0
libavfilter/parseutils.c+2−1
@@ -217,7 +217,7 @@ static int color_table_compare(const void *lhs, const void *rhs) · 216 unmodified lines
217217
218218 int av_parse_color(uint8_t *rgba_color, const char *color_string, void *log_ctx)
219219 {
220− if (!strcasecmp(color_string, "bikeshed")) {
220+ if (!strcasecmp(color_string, "random") || !strcasecmp(color_string, "bikeshed")) {
221221 int rgba = ff_random_get_seed();
222222 rgba_color[0] = rgba >> 24;
223223 rgba_color[1] = rgba >> 16;
@@ -304,6 +304,7 @@ int main(void) · 80 unmodified lines
304304 uint8_t rgba[4];
305305 const char *color_names[] = {
306306 "bikeshed",
307+ "RaNdOm",
307308 "foo",
308309 "red",
309310 "Red ",
libavfilter/parseutils.h+1−0
@@ -45,6 +45,7 @@ char *av_get_token(const char **buf, const char *term); · 44 unmodified lines
4545 *
4646 * @param color_string a string specifying a color. It can be the name of
4747 * a color (case insensitive match) or a 0xRRGGBB[AA] sequence.
48+ * The string "random" will result in a random color.
4849 * @return >= 0 in case of success, a negative value in case of
4950 * failure (for example if color_string cannot be parsed).
5051 */

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