[PR] avformat/matroskadec: Export max_block_additional_id in the stream metadata (PR #23876)

vigneshvg via ffmpeg-devel <[email protected]> Wed, 22 Jul 2026 23:56:10 -0000
Newsgroups gmane.comp.video.ffmpeg.devel
Message-ID <178476457113.59.8419644194579624192@29965ddac10e>
PR #23876 opened by vigneshvg
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23876
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23876.patch

This is useful for apps to detect when parsing the headers if
BlockAdditional payloads are to be expected in the file.

Note that the updates in fate references are because this causes
the muxer to write it out as Tags (which is already the case for
alpha_mode, stereo_mode, duration, etc.).

Signed-off-by: Vignesh Venkat <[email protected]>


>From 12827344c3f473ddbb860465c832c0a8bbecfba8 Mon Sep 17 00:00:00 2001
From: Vignesh Venkat <[email protected]>
Date: Wed, 22 Jul 2026 16:38:53 -0700
Subject: [PATCH] avformat/matroskadec: Export max_block_additional_id in the
 stream metadata

This is useful for apps to detect when parsing the headers if
BlockAdditional payloads are to be expected in the file.

Note that the updates in fate references are because this causes
the muxer to write it out as Tags (which is already the case for
alpha_mode, stereo_mode, duration, etc.).

Signed-off-by: Vignesh Venkat <[email protected]>
---
 libavformat/matroskadec.c                    | 8 ++++++++
 tests/ref/fate/matroska-dovi-hvce-mkv-to-mkv | 4 ++--
 tests/ref/fate/matroska-vp8-alpha-remux      | 4 ++--
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 18849af689..b0313c5a02 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -3281,6 +3281,14 @@ static int matroska_parse_tracks(AVFormatContext *s)
             av_dict_set(&st->metadata, "language", track->language, 0);
         av_dict_set(&st->metadata, "title", track->name, 0);
 
+        if (track->max_block_additional_id) {
+            char* buf = av_asprintf("%zu", track->max_block_additional_id);
+            if (!buf)
+                return AVERROR(ENOMEM);
+            av_dict_set(&st->metadata, "max_block_additional_id", buf,
+                        AV_DICT_DONT_STRDUP_KEY);
+        }
+
         if (track->time_scale < 0.01) {
             av_log(matroska->ctx, AV_LOG_WARNING,
                    "Track TimestampScale too small %f, assuming 1.0.\n",
diff --git a/tests/ref/fate/matroska-dovi-hvce-mkv-to-mkv b/tests/ref/fate/matroska-dovi-hvce-mkv-to-mkv
index e1b832d947..88741548cb 100644
--- a/tests/ref/fate/matroska-dovi-hvce-mkv-to-mkv
+++ b/tests/ref/fate/matroska-dovi-hvce-mkv-to-mkv
@@ -1,5 +1,5 @@
-d9c448202481e87d921bb81f268082e6 *tests/data/fate/matroska-dovi-hvce-mkv-to-mkv.matroska
-668201 tests/data/fate/matroska-dovi-hvce-mkv-to-mkv.matroska
+d117671c22a8a2cdebb461e51f6c03a2 *tests/data/fate/matroska-dovi-hvce-mkv-to-mkv.matroska
+668234 tests/data/fate/matroska-dovi-hvce-mkv-to-mkv.matroska
 #extradata 0:      187, 0x34a930cb
 #tb 0: 1/1000
 #media_type 0: video
diff --git a/tests/ref/fate/matroska-vp8-alpha-remux b/tests/ref/fate/matroska-vp8-alpha-remux
index 28c6343f2d..727e98477f 100644
--- a/tests/ref/fate/matroska-vp8-alpha-remux
+++ b/tests/ref/fate/matroska-vp8-alpha-remux
@@ -1,5 +1,5 @@
-129f76bb3cee967ebd067efa30c4e4f7 *tests/data/fate/matroska-vp8-alpha-remux.matroska
-235025 tests/data/fate/matroska-vp8-alpha-remux.matroska
+77511f89cb660c186fd0242e1a8cec18 *tests/data/fate/matroska-vp8-alpha-remux.matroska
+235058 tests/data/fate/matroska-vp8-alpha-remux.matroska
 #tb 0: 1/1000
 #media_type 0: video
 #codec_id 0: vp8
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]