From patchwork Thu Oct 13 18:17:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liangsi X-Patchwork-Id: 992 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.66 with SMTP id o63csp306971vsd; Thu, 13 Oct 2016 11:23:11 -0700 (PDT) X-Received: by 10.194.246.169 with SMTP id xx9mr7877608wjc.76.1476382991879; Thu, 13 Oct 2016 11:23:11 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id fa4si19180482wjd.246.2016.10.13.11.23.11; Thu, 13 Oct 2016 11:23:11 -0700 (PDT) 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=@google.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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0B1246898D1; Thu, 13 Oct 2016 21:23:09 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pa0-f48.google.com (mail-pa0-f48.google.com [209.85.220.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 53B0A68060B for ; Thu, 13 Oct 2016 21:23:02 +0300 (EEST) Received: by mail-pa0-f48.google.com with SMTP id rz1so40687506pab.1 for ; Thu, 13 Oct 2016 11:23:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=dYPyI92n6DthOaBxBNlo3Pnekep92tRanpst4iJ0oPc=; b=LuhBtXkBsnQxl2Dsj8+sd0mTVw/2D21Ct2Z+e19RQ+v0DsVJiYCPxZBHBdr2MiaPbu rUwvTSaZDNco9OIwIcGeHXxSmNWNOeWFFme0D1yBNe9BixJVZGWu5zm22RmiPsimGXDl CUBkkScjVH8uMiMcOf/pIMnqcbq9+aZu9+G/SLjToRCmlRPY/y2TzPeNCIXsu6lKy8aF 9DOabpCP5OmtbZtENOOPhrIm+S0A+phQa8eGwk+rFNlHNvqD+44/uWZJhQZqep1QIoKe fRM6qfeHVxSMzV627HLNuwfBCMofkhM+jY4tJ/ZlOtGo6PzjW2IyaktzzJj2k4mRxUge wnvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=dYPyI92n6DthOaBxBNlo3Pnekep92tRanpst4iJ0oPc=; b=Jo3eXNg6ddjEgC33YPvTxNIdFZFsmK6mRUR9Ri2zZ57XMsL4DrJR4FeK+OeuaQVQP1 g8ERHljxrAzv3rICHH3Zhrh0oVYOeyr70kIywBmwNCwnO2HAFkzkTFnrADFCrytBbGmQ HJMgB2jLufHazZc2+i1Fgnct/+0oyaY+aaW0Ci9mhnTk3UJtYQRUzLGStQ743lSLboqA 1yL4dklWx7D3nD061HgHm03DWL5ak9CufL/7PVHR199ySSEK19gfkkjKKu9RsAZJpJsE OGKV+5LQC77o+zkVzlq5af8J79smwJhfwQFXzHO92A2ysC3u6Ot15EejuaPhr60+v1qB Pe5w== X-Gm-Message-State: AA6/9RmrBaxUOisH3DBkjlwFuHpSwJO+XtPSSu1PXiKsXVBM8YOqWA1hsVZ+NRYBgGT++rY4 X-Received: by 10.66.132.108 with SMTP id ot12mr9973379pab.157.1476382633762; Thu, 13 Oct 2016 11:17:13 -0700 (PDT) Received: from zhenni.mtv.corp.google.com ([100.98.2.83]) by smtp.gmail.com with ESMTPSA id qd12sm21349299pab.22.2016.10.13.11.17.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 13 Oct 2016 11:17:13 -0700 (PDT) From: liangsi To: ffmpeg-devel@ffmpeg.org Date: Thu, 13 Oct 2016 11:17:06 -0700 Message-Id: <1476382626-52168-1-git-send-email-zhennihuang@google.com> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 Subject: [FFmpeg-devel] [PATCH] mov: add option to ignore moov atoms which are detected in free atoms. 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: liangsi MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavformat/isom.h | 1 + libavformat/mov.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libavformat/isom.h b/libavformat/isom.h index 2246fed..6824f7e 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -214,6 +214,7 @@ typedef struct MOVContext { int use_absolute_path; int ignore_editlist; int ignore_chapters; + int ignore_moov_atom_in_free; int seek_individually; int64_t next_root_atom; ///< offset of the next root atom int export_all; diff --git a/libavformat/mov.c b/libavformat/mov.c index a15c8d1..1d80c09 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -4848,7 +4848,8 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (atom.size >= 8) { a.size = avio_rb32(pb); a.type = avio_rl32(pb); - if (a.type == MKTAG('f','r','e','e') && + if (!c->ignore_moov_atom_in_free && + a.type == MKTAG('f','r','e','e') && a.size >= 8 && c->moov_retry) { uint8_t buf[8]; @@ -5926,6 +5927,8 @@ static const AVOption mov_options[] = { 0, 1, FLAGS}, {"ignore_chapters", "", OFFSET(ignore_chapters), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS}, + {"ignore_moov_atom_in_free", "", OFFSET(ignore_moov_atom_in_free), AV_OPT_TYPE_BOOL, + {.i64 = 0}, 0, 1, FLAGS}, {"use_mfra_for", "use mfra for fragment timestamps", OFFSET(use_mfra_for), AV_OPT_TYPE_INT, {.i64 = FF_MOV_FLAG_MFRA_AUTO},