[FFmpeg-devel] [PATCH] lavf/mov: Extend extracting XMP in mov files using UUID Box

Derek Buitenhuis derek.buitenhuis at gmail.com
Fri Feb 5 15:05:10 CET 2016


On 2/4/2016 11:28 PM, Thierry Foucu wrote:
> The UUID is based on http://www.adobe.com/devnet/xmp.html
> 
> The patch is made according to XMP SPECIFICATION PART 3 - STORAGE IN
> FILES See Table 8
> ---
>  libavformat/mov.c | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)

[...]

>      if (atom.size < sizeof(uuid) || atom.size == INT64_MAX)
>          return AVERROR_INVALIDDATA;
> @@ -3949,6 +3953,30 @@ static int mov_read_uuid(MOVContext *c, AVIOContext *pb, MOVAtom atom)
>          }
>  
>          av_free(buffer);
> +    } else if (!memcmp(uuid, uuid_xmp, sizeof(uuid_xmp))) {

NIT: Just for consistency, this could be sizeof(uuid).

> +        uint8_t *buffer;
> +        size_t len = atom.size - sizeof(uuid_xmp);

Ditto.

> +
> +        if (len < 4) {
> +            return AVERROR_INVALIDDATA;
> +        }

I'm not sure what this check is for. For uuid boxes with ISML
metadata, there are 4 bytes of zeroes here, but there's no such
thing for XMP, as far as I know (it's XML).

> +        buffer = av_mallocz(len + 1);

I assume the +1 is for a NULL terminator for the XML string,
but I do not see it set before exporting as metadata. I'm not
sure if XMP packets are required to contain a NULL terminator
or not (if so, it should be checked).

- Derek


More information about the ffmpeg-devel mailing list