Commit 25e35b34 authored by Chen Meng's avatar Chen Meng Committed by Michael Niedermayer

avformat/mov.: Make the process of uuid-xmp atom faster.

Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 4240e5b0
...@@ -4776,7 +4776,7 @@ static int mov_read_uuid(MOVContext *c, AVIOContext *pb, MOVAtom atom) ...@@ -4776,7 +4776,7 @@ static int mov_read_uuid(MOVContext *c, AVIOContext *pb, MOVAtom atom)
} else if (!memcmp(uuid, uuid_xmp, sizeof(uuid))) { } else if (!memcmp(uuid, uuid_xmp, sizeof(uuid))) {
uint8_t *buffer; uint8_t *buffer;
size_t len = atom.size - sizeof(uuid); size_t len = atom.size - sizeof(uuid);
if (c->export_xmp) {
buffer = av_mallocz(len + 1); buffer = av_mallocz(len + 1);
if (!buffer) { if (!buffer) {
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
...@@ -4789,11 +4789,15 @@ static int mov_read_uuid(MOVContext *c, AVIOContext *pb, MOVAtom atom) ...@@ -4789,11 +4789,15 @@ static int mov_read_uuid(MOVContext *c, AVIOContext *pb, MOVAtom atom)
av_free(buffer); av_free(buffer);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
if (c->export_xmp) {
buffer[len] = '\0'; buffer[len] = '\0';
av_dict_set(&c->fc->metadata, "xmp", buffer, 0); av_dict_set(&c->fc->metadata, "xmp", buffer, 0);
}
av_free(buffer); av_free(buffer);
} else {
// skip all uuid atom, which makes it fast for long uuid-xmp file
ret = avio_skip(pb, len);
if (ret < 0)
return ret;
}
} else if (!memcmp(uuid, uuid_spherical, sizeof(uuid))) { } else if (!memcmp(uuid, uuid_spherical, sizeof(uuid))) {
size_t len = atom.size - sizeof(uuid); size_t len = atom.size - sizeof(uuid);
ret = mov_parse_uuid_spherical(sc, pb, len); ret = mov_parse_uuid_spherical(sc, pb, len);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment