From patchwork Tue Nov 8 06:15:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?GBK?B?w8+zvSjj1bfqKQ==?= X-Patchwork-Id: 1335 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.90.1 with SMTP id o1csp1523495vsb; Mon, 7 Nov 2016 22:15:35 -0800 (PST) X-Received: by 10.28.149.79 with SMTP id x76mr11509246wmd.27.1478585735050; Mon, 07 Nov 2016 22:15:35 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id v1si33764228wjj.96.2016.11.07.22.15.34; Mon, 07 Nov 2016 22:15:35 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@alibaba-inc.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE dis=NONE) header.from=alibaba-inc.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 736096891DA; Tue, 8 Nov 2016 08:15:28 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out0-141.mail.aliyun.com (out0-141.mail.aliyun.com [140.205.0.141]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E52AB680CF8 for ; Tue, 8 Nov 2016 08:15:11 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alibaba-inc.com; s=default; t=1478585710; h=From:To:Subject:Date:Message-Id; bh=j8GbcJBrn+xvEk8TmTpwcbnSyg0mFr/Fz9Yxy/OcTmM=; b=Y+fxOjPoHTlztEDBbUYuMYi9e4b50PH3mTe1PI44FhHR4mNh0LWwoob/JLZphZaanPfxUtyhmRx6fPOaCKUKtXMXeXVjHq/7x2xWuyBZWKjx8nXOEDy2P/MoR/J1OAkuTMi5gg+OVrWWQWy3G/P17Ce7Qja9X8hIGr8QFohZNdk= X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R571e4; FP=0|-1|-1|-1|0|-1|-1|-1; HT=e02c03297; MF=mengchen.mc@alibaba-inc.com; NM=1; PH=DS; RN=1; SR=0; TI=SMTPD_---.793xxHP_1478585704; Received: from localhost(mailfrom:mengchen.mc@alibaba-inc.com ip:121.0.29.67) by smtp.aliyun-inc.com(127.0.0.1); Tue, 08 Nov 2016 14:15:04 +0800 From: "=?GBK?B?w8+zvSjj1bfqKQ==?=" To: ffmpeg-devel@ffmpeg.org Date: Tue, 08 Nov 2016 14:15:04 +0800 Message-Id: <20161108061504.48675-1-mengchen.mc@alibaba-inc.com> X-Mailer: git-send-email 2.10.2 Subject: [FFmpeg-devel] [PATCH] Making xmp data process faster X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavformat/mov.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index f06de06..341d22d 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 atoms, 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';