Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Anton Khirnov <anton@khirnov.net>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH 5/7] avformat/matroskaenc: write a MaxBlockAdditionID element
Date: Fri, 24 Mar 2023 12:37:31 +0100
Message-ID: <167965785107.27013.200047096152168442@lain.khirnov.net> (raw)
In-Reply-To: <20230321170637.10907-5-jamrial@gmail.com>

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 <jamrial@gmail.com>
> ---
>  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".

  parent reply	other threads:[~2023-03-24 11:37 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-21 17:06 [FFmpeg-devel] [PATCH 1/7] avformat/matroskadec: support parsing more than one BlockMore element James Almer
2023-03-21 17:06 ` [FFmpeg-devel] [PATCH 2/7] avformat/matroskadec: set the default value for BlockAddIDType James Almer
2023-03-21 17:06 ` [FFmpeg-devel] [PATCH 3/7] avformat/matroskadec: export Dynamic HDR10+ packet side data James Almer
2023-03-24 11:18   ` Anton Khirnov
2023-03-24 11:28     ` James Almer
2023-03-24 11:40       ` Anton Khirnov
2023-03-24 12:34         ` James Almer
2023-03-21 17:06 ` [FFmpeg-devel] [PATCH 4/7] avformat/matroska: add a few more Block Addition ID Type enum values James Almer
2023-03-21 17:06 ` [FFmpeg-devel] [PATCH 5/7] avformat/matroskaenc: write a MaxBlockAdditionID element James Almer
2023-03-21 17:59   ` [FFmpeg-devel] [PATCH v2 " James Almer
2023-03-24 11:37   ` Anton Khirnov [this message]
2023-03-24 11:41     ` [FFmpeg-devel] [PATCH " James Almer
2023-03-24 11:43       ` Anton Khirnov
2023-03-21 17:06 ` [FFmpeg-devel] [PATCH 6/7] avformat/matroskaenc: support writing Dynamic HDR10+ packet side data James Almer
2023-03-21 18:00   ` [FFmpeg-devel] [PATCH v2 " James Almer
2023-03-24 11:45     ` Anton Khirnov
2023-03-24 11:50       ` James Almer
2023-03-24 11:58         ` Anton Khirnov
2023-03-24 12:59           ` James Almer
2023-03-24 15:11             ` Jerome Martinez
2023-03-24 15:39               ` James Almer
2023-03-21 17:06 ` [FFmpeg-devel] [PATCH 7/7] fate/matroska: add HDR10+ muxing tests James Almer
2023-03-21 18:00   ` [FFmpeg-devel] [PATCH v2 " James Almer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=167965785107.27013.200047096152168442@lain.khirnov.net \
    --to=anton@khirnov.net \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git