Re: [FFmpeg-devel] [PATCH] lavf/mov: Extend extracting XMP in mov files using UUID Box
On Fri, Feb 05, 2016 at 03:39:25PM -0800, 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 | 25 + > 1 file changed, 25 insertions(+) applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The misfortune of the wise is better than the prosperity of the fool. -- Epicurus signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavf/mov: Extend extracting XMP in mov files using UUID Box
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 | 25 + 1 file changed, 25 insertions(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index e2f107f..1c939ba 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3895,6 +3895,10 @@ static int mov_read_uuid(MOVContext *c, AVIOContext *pb, MOVAtom atom) 0xa5, 0xd4, 0x0b, 0x30, 0xe8, 0x14, 0x11, 0xdd, 0xba, 0x2f, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66 }; +static const uint8_t uuid_xmp[] = { +0xbe, 0x7a, 0xcf, 0xcb, 0x97, 0xa9, 0x42, 0xe8, +0x9c, 0x71, 0x99, 0x94, 0x91, 0xe3, 0xaf, 0xac +}; if (atom.size < sizeof(uuid) || atom.size == INT64_MAX) return AVERROR_INVALIDDATA; @@ -3949,6 +3953,27 @@ static int mov_read_uuid(MOVContext *c, AVIOContext *pb, MOVAtom atom) } av_free(buffer); +} else if (!memcmp(uuid, uuid_xmp, sizeof(uuid))) { +uint8_t *buffer; +size_t len = atom.size - sizeof(uuid); + +buffer = av_mallocz(len + 1); +if (!buffer) { +return AVERROR(ENOMEM); +} +ret = avio_read(pb, buffer, len); +if (ret < 0) { +av_free(buffer); +return ret; +} else if (ret != len) { +av_free(buffer); +return AVERROR_INVALIDDATA; +} +if (c->export_xmp) { +buffer[len] = '\0'; +av_dict_set(>fc->metadata, "xmp", buffer, 0); +} +av_free(buffer); } return 0; } -- 2.7.0.rc3.207.g0ac5344 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavf/mov: Extend extracting XMP in mov files using UUID Box
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(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index e2f107f..9e7003e 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3895,6 +3895,10 @@ static int mov_read_uuid(MOVContext *c, AVIOContext *pb, MOVAtom atom) 0xa5, 0xd4, 0x0b, 0x30, 0xe8, 0x14, 0x11, 0xdd, 0xba, 0x2f, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66 }; +static const uint8_t uuid_xmp[] = { +0xbe, 0x7a, 0xcf, 0xcb, 0x97, 0xa9, 0x42, 0xe8, +0x9c, 0x71, 0x99, 0x94, 0x91, 0xe3, 0xaf, 0xac +}; 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))) { +uint8_t *buffer; +size_t len = atom.size - sizeof(uuid_xmp); + +if (len < 4) { +return AVERROR_INVALIDDATA; +} + +buffer = av_mallocz(len + 1); +if (!buffer) { +return AVERROR(ENOMEM); +} +ret = avio_read(pb, buffer, len); +if (ret < 0) { +av_free(buffer); +return ret; +} else if (ret != len) { +av_free(buffer); +return AVERROR_INVALIDDATA; +} +if (c->export_xmp) { +av_dict_set(>fc->metadata, "xmp", buffer, 0); +} +av_free(buffer); } return 0; } -- 2.7.0.rc3.207.g0ac5344 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel