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 378A8457E0 for ; Fri, 24 Mar 2023 11:37:41 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C43C968C741; Fri, 24 Mar 2023 13:37:38 +0200 (EET) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1837968C732 for ; Fri, 24 Mar 2023 13:37:32 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id C0D062404EA for ; Fri, 24 Mar 2023 12:37:31 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id JInj8YOa6Hn3 for ; Fri, 24 Mar 2023 12:37:31 +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 39037240178 for ; Fri, 24 Mar 2023 12:37:31 +0100 (CET) Received: by lain.khirnov.net (Postfix, from userid 1000) id 19DB41601B2; Fri, 24 Mar 2023 12:37:31 +0100 (CET) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: <20230321170637.10907-5-jamrial@gmail.com> References: <20230321170637.10907-1-jamrial@gmail.com> <20230321170637.10907-5-jamrial@gmail.com> Mail-Followup-To: FFmpeg development discussions and patches Date: Fri, 24 Mar 2023 12:37:31 +0100 Message-ID: <167965785107.27013.200047096152168442@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-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? -- 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".