avio_skip(AVIOContext *s, int64_t offset) equals avio_seek(s, offset, 
SEEK_CUR), of course, I have to say which has a better name.
------------------------------------------------------------------From:Steven 
Liu <lingjiujia...@gmail.com>Time:2016 Nov 9 (Wed) 21:00To:FFmpeg development 
discussions and patches <ffmpeg-devel@ffmpeg.org>Cc:Oliver 
<mengchen...@alibaba-inc.com>Subject:Re: [FFmpeg-devel] [PATCH] Make the 
process for uuid-xmp data faster


2016-11-09 17:30 GMT+08:00 Chen Meng <mengchen...@alibaba-inc.com>:
---
 libavformat/mov.c | 34 ++++++++++++++++++++--------------
 1 file changed, 20 insertions(+), 14 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index ca978c2..c358d17 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4530,24 +4530,30 @@ 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;
-        }
+no need newline.          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_seek(pb, len, SEEK_CUR);
 maybe avio_skip? +            if (ret < 0)
+                return ret;
         }
-        av_free(buffer);
     }
     return 0;
 }
--
2.10.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
refrence: http://ffmpeg.org/developer.html#Submitting-patches-1
Use the patcheck tool of FFmpeg to check your patch. The tool is located in the 
tools directory




localhost:ffmpeg liuqi$ ./tools/patcheck 
~/multimedia/FFmpeg-devel-Make-the-process-for-uuid-xmp-data-faster.patchpatCHeck
 1e10.0This tool is intended to help a human check/review patches. It is very 
far frombeing free of false positives and negatives, and its output are just 
hints of whatmay or may not be bad. When you use it and it misses something or 
detectssomething wrong, fix it and send a patch to the ffmpeg-devel mailing 
list.License: GPL, Author: Michael Niedermayer
trailing 
whitespace/Users/liuqi/multimedia/FFmpeg-devel-Make-the-process-for-uuid-xmp-data-faster.patch:22:+egrep:
 empty (sub)expressionegrep: empty (sub)expressionegrep: empty 
(sub)expressionegrep: empty (sub)expressionegrep: empty (sub)expressionegrep: 
empty (sub)expressionegrep: empty (sub)expressionegrep: empty 
(sub)expressionegrep: empty (sub)expressionegrep: empty (sub)expressionegrep: 
empty (sub)expressionxargs: illegal option -- dusage: xargs [-0opt] [-E eofstr] 
[-I replstr [-R replacements]] [-J replstr]             [-L number] [-n number 
[-x]] [-P maxprocs] [-s size]             [utility [argument ...]]
Missing changelog entry (ignore if minor change)egrep: empty 
(sub)expressionlocalhost:ffmpeg liuqi$
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to