[FFmpeg-devel] [PATCH] Adds support parsing the QuickTime Metadata Keys.

wm4 nfxjfg at googlemail.com
Fri Oct 23 01:19:00 CEST 2015


On Fri, 23 Oct 2015 00:10:20 +0100
Derek Buitenhuis <derek.buitenhuis at gmail.com> wrote:

> On 10/22/2015 11:04 PM, Tinglin Liu wrote:
> > +        } else if (data_type == 23 && str_size >= 4) {  // BE float32
> > +            union av_intfloat32 val;
> > +            val.i = avio_rb32(pb);  
> 
> I found we have a function to to this: av_int2float().
> 
> > +            if (snprintf(str, str_size_alloc, "%f", val.f) >= str_size_alloc) {  
> 
> snprintf can never return a value greater than the length passed to it, so just == is fine.

Wrong, snprintf() always returns the number of characters the string
would have been, even if the buffer size is smaller.

Also, str_size_alloc is unsigned, so in theory this catches cases when
snprintf fails (negative return value) too. But probably doesn't matter
here.

Also, shouldn't this use some av_ wrapper? What about locale issues?
Some locales won't print a "." but a ",".


More information about the ffmpeg-devel mailing list