From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id B396D408F5 for ; Fri, 24 Dec 2021 03:43:56 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8116868B26F; Fri, 24 Dec 2021 05:43:54 +0200 (EET) Received: from out162-62-57-210.mail.qq.com (out162-62-57-210.mail.qq.com [162.62.57.210]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0F2C76804B5 for ; Fri, 24 Dec 2021 05:43:46 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1640317423; bh=MrqzBtWV2ifryDf3MD5mhfHPKt/LjbdOlfsl5Q6XiKk=; h=From:Subject:Date:References:To:In-Reply-To; b=cN5p5SdCpukZX3iha9QWqshy5RaQhSpAtL8V8gutxK3BW1ShcoviqjD0+wnMMs/gs v6YsvHyYACcT5ywOkcXLaDqd+OhvSpWMe6DoG/KF9DSeJx+L2amW6HgsmkKvNOnXO/ qjYFev2tAamSFR2N9ZQPWfjXumIPhImv2AP8rIaI= Received: from [192.168.255.10] ([113.108.77.59]) by newxmesmtplogicsvrszc7.qq.com (NewEsmtp) with SMTP id AEA07C2D; Fri, 24 Dec 2021 11:43:42 +0800 X-QQ-mid: xmsmtpt1640317422t3zram3c4 Message-ID: X-QQ-XMAILINFO: M1xqn9pGP6LNdJwYf1BjjxczZyrhO9N9TAWPD5CSTuf3xt8BUDf0kQYQ8GYV8H 48rR1hpIiFczRlGVON7LCH8fFHI7advp4abMmeG3yC8GFnq/3fU6BA9he1dWcK5naEuhKw5yo3lS 89MP0Lc6gVpShZ53HifuNvl1PAogW1Yu/TJEtOls70lJ06CrvWv2abie1lSQIERLrvGv/oWGE8g+ bJDrPiMk5OI0IyclHVZNuMrGwcXQoGhgAdjKGYoSChztUnWZkGR5DNjSEN2+54C+oHoE7hUvNxPq oNOXAHm1fGa/VredeuJfNzv40OI7LlJRFz28a3Rpt8EtN9+kRv70jZIufVu9Vv5yNBlPe5pEjdKL RE13Oxx0F4HkEWcsgsK99XS5vIRoiomaN6x6S8i/E/pZDqULKr9/u2+cZh0j0+F6YqdWeH7sVkKv pTM2TKScEeS7anHUPz2V4h0V3dZULn958jiA3XzYPgzVYxv7siST0xHmHmxWkcZAGSFLtaetg/r6 t5+SMtwuL5sikpTKOkhU8AalqQKUGb04OtSZ0KWIC5hUQm8nke1mBUikCj/pzXy+d9WXj/F3y+dP 6eLDifrJVthlH9Mma5lGCe+SbR7M0e3Pb0xAbEhZGYuUHGG+tGCfkoqfMLhwOgIHF0wqj5UDxDR5 WSnlTRg7TVTYrxNXJ9GI50S6bJTcjOR1grs5LbxbbFXvFiu1EYS9oGjdMxPTpHT62MeAOx3DxVVU 67o8wt1inm3IOsRAYXe38rrRTAIMlUNIuqoNoyvMKC1XSU6FgED/oA2zIC6/g94bIsHF6iVFpxj0 2jclb8JQTlRTnNr4VhMa3eVkM6C1mV85NGIsvoYSCMai3n45zLbGoU From: =?utf-8?B?InpoaWxpemhhbyjotbXlv5fnq4spIg==?= Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Date: Fri, 24 Dec 2021 11:43:39 +0800 References: <20211223071012.52638-1-lq@chinaffmpeg.org> To: FFmpeg development discussions and patches In-Reply-To: <20211223071012.52638-1-lq@chinaffmpeg.org> X-OQ-MSGID: <49AE5577-FEBF-4AA1-BDB6-69832C7F0A37@foxmail.com> X-Mailer: Apple Mail (2.3654.60.0.2.21) Subject: Re: [FFmpeg-devel] [PATCH] avformat/mov: add ignore_hoov option to ignore hoov atom X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: > On Dec 23, 2021, at 3:10 PM, Steven Liu wrote: > > Try to get context from the moov atom when the hoov before moov atom, > because the streams info get a possible incorrect when there have both > hoov and moov atom. So add and ignore_hoov option for try to get > moov context by user. > > Signed-off-by: Steven Liu > --- > doc/demuxers.texi | 6 ++++++ > libavformat/isom.h | 2 ++ > libavformat/mov.c | 14 ++++++++++++-- > 3 files changed, 20 insertions(+), 2 deletions(-) > > diff --git a/doc/demuxers.texi b/doc/demuxers.texi > index cab8a7072c..d23c118210 100644 > --- a/doc/demuxers.texi > +++ b/doc/demuxers.texi > @@ -660,6 +660,11 @@ to demuxing linearly from the beginning. Default is true. > Ignore any edit list atoms. The demuxer, by default, modifies the stream index to reflect the > timeline described by the edit list. Default is false. > > +@item ignore_hoov > +Ignore hoov atom. The demuxer, by default, use hoov atom when there have hoov before moov atom. > +You can try ignore hoov atom try the moov atom. > +Default is false. > + > @item advanced_editlist > Modify the stream index to reflect the timeline described by the edit list. @code{ignore_editlist} > must be set to false for this option to be effective. > diff --git a/libavformat/isom.h b/libavformat/isom.h > index ef8f19b18c..6aa2b40c94 100644 > --- a/libavformat/isom.h > +++ b/libavformat/isom.h > @@ -255,6 +255,7 @@ typedef struct MOVContext { > AVFormatContext *fc; > int time_scale; > int64_t duration; ///< duration of the longest track > + int found_hoov; ///< 'hoov' atom has been found > int found_moov; ///< 'moov' atom has been found > int found_mdat; ///< 'mdat' atom has been found > int found_hdlr_mdta; ///< 'hdlr' atom with type 'mdta' has been found > @@ -273,6 +274,7 @@ typedef struct MOVContext { > unsigned int nb_chapter_tracks; > int use_absolute_path; > int ignore_editlist; > + int ignore_hoov; > int advanced_editlist; > int ignore_chapters; > int seek_individually; > diff --git a/libavformat/mov.c b/libavformat/mov.c > index 2aed6e80ef..cd775b219f 100644 > --- a/libavformat/mov.c > +++ b/libavformat/mov.c > @@ -1159,8 +1159,11 @@ static int mov_read_moov(MOVContext *c, AVIOContext *pb, MOVAtom atom) > > if (c->found_moov) { > av_log(c->fc, AV_LOG_WARNING, "Found duplicated MOOV Atom. Skipped it\n"); > - avio_skip(pb, atom.size); > - return 0; > + if (!c->found_hoov) { > + avio_skip(pb, atom.size); > + return 0; > + } > + c->found_hoov = 0; > } > > if ((ret = mov_read_default(c, pb, atom)) < 0) > @@ -4239,6 +4242,9 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom) > MOVStreamContext *sc; > int ret; > > + if (c->found_hoov) > + return 0; > + Does it break files with only hoov boxes? > st = avformat_new_stream(c->fc, NULL); > if (!st) return AVERROR(ENOMEM); > st->id = -1; > @@ -7329,6 +7335,8 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) > a.size >= 8 && > c->fc->strict_std_compliance < FF_COMPLIANCE_STRICT) { > uint32_t type; > + if (c->ignore_hoov) > + c->found_hoov = 1; > avio_skip(pb, 4); > type = avio_rl32(pb); > if (avio_feof(pb)) > @@ -8541,6 +8549,8 @@ static const AVOption mov_options[] = { > 0, 1, FLAGS}, > {"ignore_editlist", "Ignore the edit list atom.", OFFSET(ignore_editlist), AV_OPT_TYPE_BOOL, {.i64 = 0}, > 0, 1, FLAGS}, > + {"ignore_hoov", "Ignore the hoov atom.", OFFSET(ignore_hoov), AV_OPT_TYPE_BOOL, {.i64 = 0}, > + 0, 1, FLAGS}, TBH, add an option is too much effort to workaround such broken files. I prefer a.type == MKTAG('h','o','o','v') && c->fc->strict_std_compliance < FF_COMPLIANCE_UNOFFICIAL But it will break those samples if user doesn't lower strict_std_compliance. > {"advanced_editlist", > "Modify the AVIndex according to the editlists. Use this option to decode in the order specified by the edits.", > OFFSET(advanced_editlist), AV_OPT_TYPE_BOOL, {.i64 = 1}, > -- > 2.25.0 > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".