[FFmpeg-devel] [PATCH] Making process of uuid-xmp faster.

Chen Meng mengchen.mc at alibaba-inc.com
Tue Nov 8 10:34:13 EET 2016


---
 libavformat/mov.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index f06de06..388cd1f 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4533,13 +4533,20 @@ static int mov_read_uuid(MOVContext *c, AVIOContext *pb, MOVAtom atom)
         if (!buffer) {
             return AVERROR(ENOMEM);
         }
-        ret = avio_read(pb, buffer, len);
+
+        if (c->export_xmp) {
+            ret = avio_read(pb, buffer, len);
+            if (ret != len) {
+                av_free(buffer);
+                return AVERROR_INVALIDDATA;
+            }
+        } else {
+            // skip all uuid atom, which makes it fast for long uuid-xmp file 
+            ret = avio_seek(pb, len, SEEK_CUR);
+        }
         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';
-- 
2.10.2



More information about the ffmpeg-devel mailing list