[FFmpeg-cvslog] r15366 - trunk/ffmpeg.c

Stefano Sabatini stefano.sabatini-lala
Sat Sep 20 12:07:38 CEST 2008


On date Friday 2008-09-19 01:30:38 +0200, Michael Niedermayer wrote:
> On Thu, Sep 18, 2008 at 03:00:37PM -0700, Mike Melanson wrote:
> > michael wrote:
> > > +        if(line[0] == '#' && !e)
> > > +            continue;
> > 
> > So the comment marker can only occur at the start of a line? Still not 
> > very good behavior. Expected behavior would be for everything between 
> > '#' and the next newline to be disregarded.
> 
> -        e|= sscanf(line, "%999[^=]=%999[^\n]\n", tmp, tmp2) - 2;
> +        e|= sscanf(line, "%999[^=]=%999[^#\n]", tmp, tmp2) - 2;

Please can you apply it?

> > Face it-- text parsers in C are ugly. Good luck trying to make this 
> > user-friendly feature pretty enough for the FFmpeg codebase.
> 
> Text parsers in C are only ugly when they are written by an idiot.
> One can always write whatever primitive building blocks are needed
> for a clean parser.

Nonetheless parsers written using some higher-level generator (bison,
or possibly another one which generates reentrant code) are easier to
write, read and debug, so they tend to be more robust. Not that I'm
saying that it would be needed for the preset file, but there are
other parts in ffmpeg where it could be useful (ffserver.conf parser
and the graphparser of libavfilter).

Regards.




More information about the ffmpeg-cvslog mailing list