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 1D3BE40A21 for ; Sat, 25 Dec 2021 10:36:25 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 07BC468B0AD; Sat, 25 Dec 2021 12:36:23 +0200 (EET) Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BFFF568AEAE for ; Sat, 25 Dec 2021 12:36:15 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id A26A4E6645 for ; Sat, 25 Dec 2021 11:36:14 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X5v3Y2us9G_I for ; Sat, 25 Dec 2021 11:36:09 +0100 (CET) Received: from iq (iq [217.27.212.140]) by iq.passwd.hu (Postfix) with ESMTPS id 7167BE6548 for ; Sat, 25 Dec 2021 11:36:09 +0100 (CET) Date: Sat, 25 Dec 2021 11:36:09 +0100 (CET) From: Marton Balint To: FFmpeg development discussions and patches In-Reply-To: Message-ID: <5c5d4436-bf6d-02-e693-c2c7338ff0d0@passwd.hu> References: MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH v3 2/2] avformat/mov: add use_hoov option 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Sat, 25 Dec 2021, Zhao Zhili wrote: > Fix #8883. > --- > doc/demuxers.texi | 6 ++++++ > libavformat/isom.h | 1 + > libavformat/mov.c | 9 +++++++-- > 3 files changed, 14 insertions(+), 2 deletions(-) > > diff --git a/doc/demuxers.texi b/doc/demuxers.texi > index cab8a7072c..276b536ac5 100644 > --- a/doc/demuxers.texi > +++ b/doc/demuxers.texi > @@ -713,6 +713,12 @@ specify. > > @item decryption_key > 16-byte key, in hex, to decrypt files encrypted using ISO Common Encryption (CENC/AES-128 CTR; ISO/IEC 23001-7). > + > +@item use_hoov > +Whether to use hoov atom as moov atom to support some broken files. Set it to 0 for disable, 1 for enable, > +-1 for automatic, which means take hoov as moov in the second pass if moov doesn't been found in the first > +pass. > + > @end table > > @subsection Audible AAX > diff --git a/libavformat/isom.h b/libavformat/isom.h > index ef8f19b18c..7c837811a6 100644 > --- a/libavformat/isom.h > +++ b/libavformat/isom.h > @@ -305,6 +305,7 @@ typedef struct MOVContext { > int32_t movie_display_matrix[3][3]; ///< display matrix from mvhd > int have_read_mfra_size; > uint32_t mfra_size; > + int use_hoov; > } MOVContext; > > int ff_mp4_read_descr_len(AVIOContext *pb); > diff --git a/libavformat/mov.c b/libavformat/mov.c > index ea2f010aa0..82237f930b 100644 > --- a/libavformat/mov.c > +++ b/libavformat/mov.c > @@ -7325,7 +7325,7 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) > a.size = avio_rb32(pb); > a.type = avio_rl32(pb); > if (((a.type == MKTAG('f','r','e','e') && c->moov_retry) || > - a.type == MKTAG('h','o','o','v')) && > + a.type == MKTAG('h','o','o','v') && c->use_hoov == 1) && > a.size >= 8 && > c->fc->strict_std_compliance < FF_COMPLIANCE_STRICT) { > uint32_t type; > @@ -7951,8 +7951,12 @@ static int mov_read_header(AVFormatContext *s) > > /* check MOV header */ > do { > - if (mov->moov_retry) > + if (mov->moov_retry) { > avio_seek(pb, 0, SEEK_SET); > + /* reset use_hoov from auto mode to force mode in second pass */ > + if (mov->use_hoov == -1) > + mov->use_hoov = 1; > + } > if ((err = mov_read_default(mov, pb, atom)) < 0) { > av_log(s, AV_LOG_ERROR, "error reading header\n"); > return err; > @@ -8593,6 +8597,7 @@ static const AVOption mov_options[] = { > { "decryption_key", "The media decryption key (hex)", OFFSET(decryption_key), AV_OPT_TYPE_BINARY, .flags = AV_OPT_FLAG_DECODING_PARAM }, > { "enable_drefs", "Enable external track support.", OFFSET(enable_drefs), AV_OPT_TYPE_BOOL, > {.i64 = 0}, 0, 1, FLAGS }, > + { "use_hoov", "Take hoov as moov atom, 0 for disable, -1 for auto, 1 means force", OFFSET(use_hoov), AV_OPT_TYPE_INT, {.i64 = 1}, -1, 1, FLAGS }, Kind of unusual that the default is 1 and not -1 (automatic). Is it intentional? Does it make sense to find hoov atom first and discard moov? Can't that cause problems for valid files? If it can, then maybe -1 should be the default, no? Thanks, Marton _______________________________________________ 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".