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

Clément Bœsch ubitux at gmail.com
Sun Oct 9 10:00:55 CEST 2011


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.

[...]

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20111009/f4b377cd/attachment.asc>


More information about the ffmpeg-devel mailing list