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 204C545B72 for ; Fri, 24 Mar 2023 11:44:01 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B296E68C75D; Fri, 24 Mar 2023 13:43:58 +0200 (EET) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8EAA068C471 for ; Fri, 24 Mar 2023 13:43:52 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 552582404EA for ; Fri, 24 Mar 2023 12:43:52 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id K-MVrL5zujbx for ; Fri, 24 Mar 2023 12:43:51 +0100 (CET) Received: from lain.khirnov.net (lain.khirnov.net [IPv6:2001:67c:1138:4306::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "lain.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id CFB47240178 for ; Fri, 24 Mar 2023 12:43:51 +0100 (CET) Received: by lain.khirnov.net (Postfix, from userid 1000) id B2B331601B2; Fri, 24 Mar 2023 12:43:51 +0100 (CET) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: <5ad3a06f-e5c7-13d0-3783-e0e03d655a15@gmail.com> References: <20230321170637.10907-1-jamrial@gmail.com> <20230321170637.10907-5-jamrial@gmail.com> <167965785107.27013.200047096152168442@lain.khirnov.net> <5ad3a06f-e5c7-13d0-3783-e0e03d655a15@gmail.com> Mail-Followup-To: FFmpeg development discussions and patches Date: Fri, 24 Mar 2023 12:43:51 +0100 Message-ID: <167965823170.27013.5875322007475665482@lain.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 5/7] avformat/matroskaenc: write a MaxBlockAdditionID element 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: Quoting James Almer (2023-03-24 12:41:27) > On 3/24/2023 8:37 AM, Anton Khirnov wrote: > > Quoting James Almer (2023-03-21 18:06:35) > >> A non zero value is mandatory for Matroska if the track has blocks with BlockAdditions. > >> > >> Signed-off-by: James Almer > >> --- > >> libavformat/matroskaenc.c | 36 ++++++++++++++++++++++++++++++++---- > >> 1 file changed, 32 insertions(+), 4 deletions(-) > >> > >> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c > >> index 46f4331a18..0687d9c32e 100644 > >> --- a/libavformat/matroskaenc.c > >> +++ b/libavformat/matroskaenc.c > >> @@ -188,6 +188,8 @@ typedef struct mkv_track { > >> int64_t last_timestamp; > >> int64_t duration; > >> int64_t duration_offset; > >> + uint64_t max_blockaddid; > >> + int64_t blockadditionmapping_offset; > >> int codecpriv_offset; > >> unsigned codecpriv_size; ///< size reserved for CodecPrivate excluding header+length field > >> int64_t ts_offset; > >> @@ -1597,12 +1599,21 @@ static int mkv_write_stereo_mode(AVFormatContext *s, EbmlWriter *writer, > >> return 0; > >> } > >> > >> -static void mkv_write_dovi(AVFormatContext *s, AVIOContext *pb, AVStream *st) > >> +static void mkv_write_blockadditionmapping(AVFormatContext *s, MatroskaMuxContext *mkv, > >> + AVIOContext *pb, mkv_track *track, AVStream *st) > >> { > >> #if CONFIG_MATROSKA_MUXER > >> AVDOVIDecoderConfigurationRecord *dovi = (AVDOVIDecoderConfigurationRecord *) > >> av_stream_get_side_data(st, AV_PKT_DATA_DOVI_CONF, NULL); > >> > >> + if (IS_SEEKABLE(s->pb, mkv)) { > >> + track->blockadditionmapping_offset = avio_tell(pb); > >> + // We can't know at this point if there will be a block with BlockAdditions, so > >> + // we either write the default value here, or a void element. Either of them will > >> + // be overwritten when finishing the track. > > > > IIRC matroska uints are variable-size, so the value you write later may > > have a longer representation than the dummy placeholder you're writing > > here. > > Or am I wrong? > > It might if we were to write any arbitrary value passed to the muxer in > AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL side data, but we will not. We're > only going to write 1 (opaque, codec specific, currently used for alpha > channel) at this point in the patchset, or 4 (itu-t t35) after patch > 6/7, for now. Ok, might still be safer against future changes to check that the updated value is not too large. -- Anton Khirnov _______________________________________________ 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".