[FFmpeg-devel] Make FLV decoder expose meta-data
Aurelien Jacobs
aurel
Sun Jul 5 16:21:12 CEST 2009
On Wed, Jul 01, 2009 at 03:17:28PM -0700, Art Clarke wrote:
> Support for boolean, number and string FLV meta data (demuxing, not
> muxing). This re-enables the onMetaData parser since we now get useful
> stuff out of it for others to use.
>
> [...]
>
> Index: libavformat/flvdec.c
> ===================================================================
> --- libavformat/flvdec.c (revision 19316)
> +++ libavformat/flvdec.c (working copy)
> @@ -218,8 +218,14 @@
> vcodec = vstream ? vstream->codec : NULL;
>
> if(amf_type == AMF_DATA_TYPE_BOOL) {
> + strncpy(str_val, num_val > 0 ? "true" : "false", sizeof(str_val)-1);
> + str_val[sizeof(str_val)-1] = 0;
str_val is a 256 bytes buffer so copying "true" or "false" into it won't
overflow. You could simply use strcpy(). But if you want to keep bound
checking, please use av_strlcpy() instead of strncpy().
> [...]
> } else if(amf_type == AMF_DATA_TYPE_NUMBER) {
> + snprintf(str_val, sizeof(str_val)-1, "%0.lf", num_val);
> + str_val[sizeof(str_val)-1] = 0;
snprintf() guaranty that the generated string will be null terminated.
So no need for the -1 and no need to explicitely add null byte.
Also your format string is a bit strange. First, the l modifier seems
useless and not even defined in my printf man page.
And the 0 seems useless to.
> @@ -375,7 +382,7 @@
> if ((flags & 0xf0) == 0x50) /* video info / command frame */
> goto skip;
> } else {
> - if (type == FLV_TAG_TYPE_META && size > 13+1+4 && 0)
> + if (type == FLV_TAG_TYPE_META && size > 13+1+4)
> flv_read_metabody(s, next);
This code was disabled in r18460 as a way to fix issue977 [1].
So this would re-open this issue. The audiosamplerate interpreting
code should probably be disabled/removed... (this belong in a
separate patch)
Aurel
[1] https://roundup.ffmpeg.org/roundup/ffmpeg/issue977
More information about the ffmpeg-devel
mailing list