[FFmpeg-devel] [PATCH] ffprobe: prefer lower cased section names over upper cased names

Stefano Sabatini stefasab at gmail.com
Sun Oct 9 16:34:11 CEST 2011


On date Sunday 2011-10-09 10:00:55 +0200, Clément Bœsch encoded:
> On Sun, Oct 09, 2011 at 12:46:17AM +0200, Stefano Sabatini wrote:
> > This is consistent with the chapter names. The default writer section
> > names are converted to upper case for keeping backward compatibility.
> > ---
> >  ffprobe.c |   25 +++++++++++++++++--------
> >  1 files changed, 17 insertions(+), 8 deletions(-)
> > 
> > diff --git a/ffprobe.c b/ffprobe.c
> > index 82a8f54..1568d2b 100644
> > --- a/ffprobe.c
> > +++ b/ffprobe.c
> > @@ -336,16 +336,25 @@ static void default_print_chapter_header(WriterContext *wctx, const char *chapte
> >          printf("\n");
> >  }
> >  
> > +/* lame uppercasing routine, assumes the string is lower case ASCII */
> > +static void print_upcased(const char *s)
> > +{
> > +    while (*s) {
> > +        printf("%c", *s - 32);
> > +        s++;
> > +    }
> > +}
> > +
> 
> If we assume this function will only be called for section in the old
> format, we can have sth like:
>         int i;
>         char buf[16];
>         for (i = 0; s[i]; i++)
>             buf[i] = s[i] - 32;
>         printf("[%s%s]\n", end ? "/" : "", buf);
> 
> and thus avoid multiple printf calls; for each [PACKET]...[/PACKET], you
> get 16 calls to printf, and here just one.

Damn, you right, updated.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ffprobe-prefer-lower-cased-section-names-over-upper-.patch
Type: text/x-diff
Size: 4005 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20111009/e81e94da/attachment.bin>


More information about the ffmpeg-devel mailing list