summaryrefslogtreecommitdiff
path: root/libavformat/mov.c
diff options
context:
space:
mode:
authorChen Meng <mengchen.mc@alibaba-inc.com>2016-11-11 11:42:26 +0800
committerMichael Niedermayer <michael@niedermayer.cc>2016-12-19 23:10:34 +0100
commit25e35b34365ea4fc737f406992b7947a0610edcb (patch)
treef3a87f33df26a9435891411d1be84c4207f39a33 /libavformat/mov.c
parent4240e5b047379b29c33dd3f4438bc4e610527b83 (diff)
avformat/mov.: Make the process of uuid-xmp atom faster.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r--libavformat/mov.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index fc0b25cf9d..d1b929174d 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4776,24 +4776,28 @@ static int mov_read_uuid(MOVContext *c, AVIOContext *pb, MOVAtom atom)
} 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 = 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;
+ }
buffer[len] = '\0';
av_dict_set(&c->fc->metadata, "xmp", buffer, 0);
+ 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;
}
- av_free(buffer);
} else if (!memcmp(uuid, uuid_spherical, sizeof(uuid))) {
size_t len = atom.size - sizeof(uuid);
ret = mov_parse_uuid_spherical(sc, pb, len);