From patchwork Tue Nov 8 08:34:13 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: 1337 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.90.1 with SMTP id o1csp1569602vsb; Tue, 8 Nov 2016 00:34:34 -0800 (PST) X-Received: by 10.28.145.134 with SMTP id t128mr12944700wmd.50.1478594074589; Tue, 08 Nov 2016 00:34:34 -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 v130si15317380wmf.126.2016.11.08.00.34.34; Tue, 08 Nov 2016 00:34:34 -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 32E8F689A9F; Tue, 8 Nov 2016 10:34: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 5D71A689758 for ; Tue, 8 Nov 2016 10:34:19 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alibaba-inc.com; s=default; t=1478594061; h=From:To:Subject:Date:Message-Id; bh=yz3/c7XkHPGiBiVghTMt/xmg7dKDF6lSx719y3qsvLk=; b=Ok5xIh/uKC1UgmhYdmZ3AkASUSGVI/Hx9tPp6DGyuk2UkeHa0hJ3aCrv4TG+Q1L21vDo9+ZSNKC2w2U4aiWPUHcJEx+njzhm4zrJPw06H/tcPJis4gLjOkMIVvo3E3JdUYIrUzA07vaV+VGsFdLZJAilDqJz8QJsWa0vRyt7P8U= X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R151e4; FP=0|-1|-1|-1|0|-1|-1|-1; HT=e02c03282; MF=mengchen.mc@alibaba-inc.com; NM=1; PH=DS; RN=2; SR=0; TI=SMTPD_---.793y4vA_1478594059; 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 16:34:20 +0800 From: "Chen Meng" To: ffmpeg-devel@ffmpeg.org Date: Tue, 08 Nov 2016 16:34:13 +0800 Message-Id: <20161108083413.57277-1-mengchen.mc@alibaba-inc.com> X-Mailer: git-send-email 2.10.2 Subject: [FFmpeg-devel] [PATCH] Making process of uuid-xmp 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 Cc: Chen Meng 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..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';