[FFmpeg-devel] [PATCH] Make av_parse_color() support a "Random" color

Stefano Sabatini stefano.sabatini-lala
Mon May 11 23:48:01 CEST 2009


On date Monday 2009-05-11 09:20:54 +0200, Reimar D?ffinger encoded:
> On Mon, May 11, 2009 at 01:57:28AM +0200, Michael Niedermayer wrote:
> > On Mon, May 11, 2009 at 12:34:40AM +0200, Stefano Sabatini wrote:
> > > On date Sunday 2009-05-10 23:06:42 +0100, M?ns Rullg?rd encoded:
> > > > Stefano Sabatini <stefano.sabatini-lala at poste.it> writes:
> > > > 
> > > > > On date Sunday 2009-05-10 23:25:37 +0200, Diego Biurrun encoded:
> > > > >> On Sun, May 10, 2009 at 09:37:21PM +0200, Stefano Sabatini wrote:
> > > > >> > On date Sunday 2009-05-10 11:32:24 -0700, Baptiste Coudurier encoded:
> > > > >> > > 
> > > > >> > > Stefano Sabatini wrote:
> > > > >> > > > as recently suggested on ffmpeg-cvs.
> > > > >> > > > 
> > > > >> > > > --- ffmpeg.orig/libavfilter/parseutils.c	2009-05-10 11:18:12.000000000 +0200
> > > > >> > > > +++ ffmpeg/libavfilter/parseutils.c	2009-05-10 11:18:46.000000000 +0200
> > > > >> > > > @@ -217,7 +217,7 @@
> > > > >> > > >  
> > > > >> > > >  int av_parse_color(uint8_t *rgba_color, const char *color_string, void *log_ctx)
> > > > >> > > >  {
> > > > >> > > > -    if (!strcmp(color_string, "bikeshed")) {
> > > > >> > > > +    if (!strcmp(color_string, "Random") || !strcmp(color_string, "bikeshed")) {
> > > > >> > > >          int rgba = ff_random_get_seed();
> > > > >> > > >          rgba_color[0] = rgba >> 24;
> > > > >> > > >          rgba_color[1] = rgba >> 16;
> > > > >> > > 
> > > > >> > > Why uppercase 'R' ?
> > > > >> > 
> > > > >> > Not a strong opinion on this, but all the other colors are uppercased
> > > > >> > (so maybe also it should be "Bikeshed"), talking about bikesheds...
> > > > >> 
> > > > >> They should IMHO be lowercase..
> > > > >
> > > > > MediumAquaMarine is IMO more readable than mediumaquamarine,
> > > > > especially for non-native readers.
> > > > 
> > > > How about making it case insensitive?
> > > 
> > > Check attached.
> > 
> > is there a reason why you dont use strcasecmp() ?
> 
> IMHO both strcasecmp() and lowercase() should be avoided, it creates
> problems (unexpected behaviour) if the application sets the locale.

Could you elaborate on this? 

Also are you saying that there is no safe way to lowercase a string in
C99?

Regards.
-- 
FFmpeg = Faithless and Forgiving Mean Peaceless Extreme Genius



More information about the ffmpeg-devel mailing list