From patchwork Wed Oct 12 18:58:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liangsi X-Patchwork-Id: 987 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.66 with SMTP id o63csp285804vsd; Thu, 13 Oct 2016 10:03:30 -0700 (PDT) X-Received: by 10.28.153.76 with SMTP id b73mr2858777wme.60.1476378210784; Thu, 13 Oct 2016 10:03:30 -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 f3si18823217wjt.126.2016.10.13.10.03.30; Thu, 13 Oct 2016 10:03:30 -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=@gmail.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=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 886B8689C09; Thu, 13 Oct 2016 20:03:27 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf0-f196.google.com (mail-pf0-f196.google.com [209.85.192.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 29D536898B7 for ; Wed, 12 Oct 2016 21:58:52 +0300 (EEST) Received: by mail-pf0-f196.google.com with SMTP id s8so3269660pfj.2 for ; Wed, 12 Oct 2016 11:58:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=dYPyI92n6DthOaBxBNlo3Pnekep92tRanpst4iJ0oPc=; b=EJJ9abIlq1/qu1UNl0uZXHjdK1bcBGqbHqYp+tVDaEYIEqcIhxlqCzp9iXeWM6U0ak DjaM6NuLQGka7wdJkoiPiC/66daT9+ejXn+zql3evtRUr9KrZEq4FIfprVRX2dlPoiMo TEvil1/mP6OLPOFXP2jNrxr++DjqLYuvHdokV3CF0Ns8p6/1NBP+qMwsB9F6MoTwMkpI oHechbpPq0+sEUPT6d9HOPcLS7b9nctIvCT7WixWVRRin92ym4EsDzf+M9nV1n6WmQ7W jjHdQ5nyazdK7JhNENi4cGlJC/iguKGaypvAyT0JCDV9QOqHUt99pMFV+9wLWmEU9JQ/ X6OQ== 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=ePVRGO12JHbiUJSctJRBf9hM1YpEVFA2dZvabBweJdTPIGFFxlMVPExkJS036Ng1sW 68k9OSiGSm2TDJRLeZsp+g3+1bDeiyqlucmLuOnofyDRTvW8eCNLXbTxHkXJ53H6oIzL gNcZwLOqvv7qAKGHUNSpmBR9Y8rUpJ8o9leYGc5uDT4yV16A+V0PT8WrLNjGJtka1qhs QKqpSGitkNJlfxL0Rx6O15KOq0HiFR8tJoKp/NCtle9rm2G+iZMNWrvvx04t4WFIUH4b a5Eztm702P/bTggYkTN0SO8gBtmOItqnHW4BuLPDe5OdkIY0rbd3n6Yib2WIbepDqW/m ba2Q== X-Gm-Message-State: AA6/9Rnvtu87rWmi5qfYi6KS0W5WdYoXA0eZt+Ss6a5l508bqUwaWuUQDawc9coe9+2TUw== X-Received: by 10.98.131.71 with SMTP id h68mr3981615pfe.166.1476298730833; Wed, 12 Oct 2016 11:58:50 -0700 (PDT) Received: from zhenni.mtv.corp.google.com ([100.98.2.83]) by smtp.gmail.com with ESMTPSA id oo10sm10152698pac.12.2016.10.12.11.58.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 12 Oct 2016 11:58:49 -0700 (PDT) From: liangsi X-Google-Original-From: liangsi To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Oct 2016 11:58:30 -0700 Message-Id: <1476298710-74434-1-git-send-email-zhennihuang@google.com> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 X-Mailman-Approved-At: Thu, 13 Oct 2016 20:03:26 +0300 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},