From patchwork Mon Oct 24 21:11:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liangsi X-Patchwork-Id: 1163 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.133 with SMTP id o127csp2354845vsd; Mon, 24 Oct 2016 14:12:11 -0700 (PDT) X-Received: by 10.194.41.201 with SMTP id h9mr13439540wjl.10.1477343531242; Mon, 24 Oct 2016 14:12: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 cp15si18327390wjb.287.2016.10.24.14.12.10; Mon, 24 Oct 2016 14:12: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 B4B68689CD4; Tue, 25 Oct 2016 00:12:05 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf0-f178.google.com (mail-pf0-f178.google.com [209.85.192.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EEC92689C6F for ; Tue, 25 Oct 2016 00:11:57 +0300 (EEST) Received: by mail-pf0-f178.google.com with SMTP id s8so105104851pfj.2 for ; Mon, 24 Oct 2016 14:12:01 -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:in-reply-to:references; bh=IER8cJOfxeKV41mcmtOzlxft6K4MxGJBi976qpS40Zo=; b=YykN8nN59aagM2goKtyEddhOzQYxbo0IMz9/RVnYLWUmapkwQnSRVewVPPeKm3CRlP 4PqHQqYvCPXNtpxlcu6aGla0Zsypj6e/a0gr4xxXFayuy6d5miVbSXbSEe/+g1U4fBws Qe9jGsKk+wdAQ8XZ9y8REwhQlyd29O6iF5ByQEPmylH6SfFBQ14mYsI17LbiOEN13jPG UbsGpuwwC+8/5ZcQRTrTA18VtfSBReTH7ysSGp/j9FwbQXiCr01+WXMewrzlfNwsQUqJ 2tWlWMCKneTOBFvQzKOSEFTs9cnpS/O0rnjhu6uNByXjiWnbyacxlh3Ve81fXuMS5fQU NWJQ== 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:in-reply-to :references; bh=IER8cJOfxeKV41mcmtOzlxft6K4MxGJBi976qpS40Zo=; b=AoTazlaAiUgwEC7lOpzbd6UJNeL8BomISmQoTqu/UDOrqAdLLNDS1OjZF6VnlLYmgq oczZzsXjFsTYS4mQaIw8TLxIakEQyODN09iuibqA7Dfws5F2nL6HS6rjpl21Yagp6lQo 4lLbliD5tfkt0JGfKzznX40Ec0wRFcSc2s7cYeKwelDl94M25se1l5ICIZ/yJBevomGC /SLjfu+J78UWNOnLmk7nM2H2xa+o4uPpaw65GJdCDSn61KxG6McfPM07eeR+xcELO4DX x5L/scx4MIHF++KeMHbPNUgITVW+qqSBeRWUc7oFk4PpR8i2koTH0DbNAXVXJPEUeQFZ o3kg== X-Gm-Message-State: ABUngve7lPNRyqJlFaDI0xXb5LqJene9MVBx3L40iJis9ATEnq5KHp49MaIehyFDQbQ40H97 X-Received: by 10.99.129.200 with SMTP id t191mr26994158pgd.180.1477343519430; Mon, 24 Oct 2016 14:11:59 -0700 (PDT) Received: from zhenni.mtv.corp.google.com ([100.98.2.83]) by smtp.gmail.com with ESMTPSA id 3sm27520668pfo.31.2016.10.24.14.11.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Oct 2016 14:11:58 -0700 (PDT) From: Zhenni Huang To: ffmpeg-devel@ffmpeg.org Date: Mon, 24 Oct 2016 14:11:52 -0700 Message-Id: <1477343512-60568-1-git-send-email-zhennihuang@google.com> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 In-Reply-To: <1476298710-74434-1-git-send-email-zhennihuang@google.com> References: <1476298710-74434-1-git-send-email-zhennihuang@google.com> Subject: [FFmpeg-devel] [PATCH] mov: add option to ignore moov atoms which are detected in free atoms, so apps can have flexibility to use moov atom not in free atoms as default. 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" From: liangsi --- 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},