aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2023-03-19 10:52:47 -0300
committerJames Almer <jamrial@gmail.com>2023-04-05 09:47:12 -0300
commit1c2a1e07500017c873a318fe2f49011f35c1f534 (patch)
tree946e2471a49df37153ab2a1954aedaa32d8d61b6
parent00fde8063a0aa8c663ba628cb054a204bfca4aa4 (diff)
downloadffmpeg-1c2a1e07500017c873a318fe2f49011f35c1f534.tar.gz
avformat/matroskaenc: write a MaxBlockAdditionID element
A non zero value is mandatory for Matroska if the track has blocks with BlockAdditions. Signed-off-by: James Almer <jamrial@gmail.com>
-rw-r--r--libavformat/matroskaenc.c35
-rw-r--r--tests/ref/fate/aac-autobsf-adtstoasc4
-rw-r--r--tests/ref/fate/matroska-avoid-negative-ts4
-rw-r--r--tests/ref/fate/matroska-dovi-write-config74
-rw-r--r--tests/ref/fate/matroska-dovi-write-config84
-rw-r--r--tests/ref/fate/matroska-dvbsub-remux4
-rw-r--r--tests/ref/fate/matroska-encoding-delay14
-rw-r--r--tests/ref/fate/matroska-flac-extradata-update4
-rw-r--r--tests/ref/fate/matroska-h264-remux4
-rw-r--r--tests/ref/fate/matroska-mastering-display-metadata4
-rw-r--r--tests/ref/fate/matroska-move-cues-to-front4
-rw-r--r--tests/ref/fate/matroska-mpegts-remux4
-rw-r--r--tests/ref/fate/matroska-ms-mode4
-rw-r--r--tests/ref/fate/matroska-ogg-opus-remux10
-rw-r--r--tests/ref/fate/matroska-opus-remux10
-rw-r--r--tests/ref/fate/matroska-pgs-remux4
-rw-r--r--tests/ref/fate/matroska-pgs-remux-durations4
-rw-r--r--tests/ref/fate/matroska-qt-mode4
-rw-r--r--tests/ref/fate/matroska-spherical-mono-remux4
-rw-r--r--tests/ref/fate/matroska-vp8-alpha-remux4
-rw-r--r--tests/ref/fate/matroska-zero-length-block4
-rw-r--r--tests/ref/fate/rgb24-mkv4
-rw-r--r--tests/ref/fate/shortest-sub4
-rw-r--r--tests/ref/lavf-fate/av1.mkv4
-rw-r--r--tests/ref/lavf/mka4
-rw-r--r--tests/ref/lavf/mkv4
-rw-r--r--tests/ref/lavf/mkv_attachment4
-rw-r--r--tests/ref/seek/lavf-mkv44
28 files changed, 116 insertions, 89 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 6b24d26d59..3b0998ecc8 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.
+ put_ebml_uint(mkv->track.bc, MATROSKA_ID_TRACKMAXBLKADDID, 0);
+ }
+
if (dovi && dovi->dv_profile <= 10) {
ebml_master mapping;
uint8_t buf[ISOM_DVCC_DVVC_SIZE];
@@ -1846,9 +1857,6 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
if (ret < 0)
return ret;
- if (!IS_WEBM(mkv))
- mkv_write_dovi(s, pb, st);
-
break;
case AVMEDIA_TYPE_AUDIO:
@@ -1924,6 +1932,9 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
return AVERROR(EINVAL);
}
+ if (!IS_WEBM(mkv))
+ mkv_write_blockadditionmapping(s, mkv, pb, track, st);
+
if (!IS_WEBM(mkv) || par->codec_id != AV_CODEC_ID_WEBVTT) {
uint8_t *codecpriv;
int codecpriv_size, max_payload_size;
@@ -2667,6 +2678,7 @@ static int mkv_write_block(void *logctx, MatroskaMuxContext *mkv,
side_data + 8, side_data_size - 8);
ebml_writer_close_master(&writer);
ebml_writer_close_master(&writer);
+ track->max_blockaddid = additional_id;
}
if (!force_blockgroup && writer.nb_elements == 2) {
@@ -3070,6 +3082,21 @@ after_cues:
if (mkv->track.bc) {
// write Tracks master
+ if (!IS_WEBM(mkv))
+ for (unsigned i = 0; i < s->nb_streams; i++) {
+ const mkv_track *track = &mkv->tracks[i];
+
+ if (!track->max_blockaddid)
+ continue;
+
+ // We reserved a single byte to write this value.
+ av_assert0(track->max_blockaddid <= 0xFF);
+
+ avio_seek(mkv->track.bc, track->blockadditionmapping_offset, SEEK_SET);
+
+ put_ebml_uint(mkv->track.bc, MATROSKA_ID_TRACKMAXBLKADDID, track->max_blockaddid);
+ }
+
avio_seek(pb, mkv->track.pos, SEEK_SET);
ret = end_ebml_master_crc32(pb, &mkv->track.bc, mkv,
MATROSKA_ID_TRACKS, 0, 0, 0);
diff --git a/tests/ref/fate/aac-autobsf-adtstoasc b/tests/ref/fate/aac-autobsf-adtstoasc
index 57bfcae18b..76125083b6 100644
--- a/tests/ref/fate/aac-autobsf-adtstoasc
+++ b/tests/ref/fate/aac-autobsf-adtstoasc
@@ -1,5 +1,5 @@
-4342e4f3f93b16514bda511b3b7fd93a *tests/data/fate/aac-autobsf-adtstoasc.matroska
-6642 tests/data/fate/aac-autobsf-adtstoasc.matroska
+3d4465a7ea2cfba31af737e288c892fe *tests/data/fate/aac-autobsf-adtstoasc.matroska
+6646 tests/data/fate/aac-autobsf-adtstoasc.matroska
#extradata 0: 2, 0x0030001c
#tb 0: 1/1000
#media_type 0: audio
diff --git a/tests/ref/fate/matroska-avoid-negative-ts b/tests/ref/fate/matroska-avoid-negative-ts
index 129ea1be66..73616cbc5a 100644
--- a/tests/ref/fate/matroska-avoid-negative-ts
+++ b/tests/ref/fate/matroska-avoid-negative-ts
@@ -1,5 +1,5 @@
-fbe66be73d379073e0705891f290a6b2 *tests/data/fate/matroska-avoid-negative-ts.matroska
-973055 tests/data/fate/matroska-avoid-negative-ts.matroska
+ff83530bf89f9ab1df0d181bb848c475 *tests/data/fate/matroska-avoid-negative-ts.matroska
+973063 tests/data/fate/matroska-avoid-negative-ts.matroska
#extradata 0: 22, 0x2885037c
#tb 0: 1/1000
#media_type 0: video
diff --git a/tests/ref/fate/matroska-dovi-write-config7 b/tests/ref/fate/matroska-dovi-write-config7
index 9207b14b5c..8b40848f4a 100644
--- a/tests/ref/fate/matroska-dovi-write-config7
+++ b/tests/ref/fate/matroska-dovi-write-config7
@@ -1,5 +1,5 @@
-d23b8b0d0613a82ba36fdc27acf3ef5d *tests/data/fate/matroska-dovi-write-config7.matroska
-72672 tests/data/fate/matroska-dovi-write-config7.matroska
+b4db571fe6304f159a0383a38c9c0cee *tests/data/fate/matroska-dovi-write-config7.matroska
+72680 tests/data/fate/matroska-dovi-write-config7.matroska
#extradata 0: 116, 0x2b8d1669
#extradata 1: 116, 0x2b8d1669
#tb 0: 1/1000
diff --git a/tests/ref/fate/matroska-dovi-write-config8 b/tests/ref/fate/matroska-dovi-write-config8
index 5feb7b8065..c36d3a8a07 100644
--- a/tests/ref/fate/matroska-dovi-write-config8
+++ b/tests/ref/fate/matroska-dovi-write-config8
@@ -1,5 +1,5 @@
-0047ca43aa8ab2948752e367f184dc1f *tests/data/fate/matroska-dovi-write-config8.matroska
-3600576 tests/data/fate/matroska-dovi-write-config8.matroska
+8c77c1d18ee58a8923c411d3ba006a46 *tests/data/fate/matroska-dovi-write-config8.matroska
+3600584 tests/data/fate/matroska-dovi-write-config8.matroska
#extradata 0: 551, 0xa18acf66
#extradata 1: 2, 0x00340022
#tb 0: 1/1000
diff --git a/tests/ref/fate/matroska-dvbsub-remux b/tests/ref/fate/matroska-dvbsub-remux
index b7346b8f55..03341d9668 100644
--- a/tests/ref/fate/matroska-dvbsub-remux
+++ b/tests/ref/fate/matroska-dvbsub-remux
@@ -1,5 +1,5 @@
-77d210dc36d7a01988d159b3c902524c *tests/data/fate/matroska-dvbsub-remux.matroska
-39010 tests/data/fate/matroska-dvbsub-remux.matroska
+5d1591e9abd7e1373d43bc776572aaf7 *tests/data/fate/matroska-dvbsub-remux.matroska
+39018 tests/data/fate/matroska-dvbsub-remux.matroska
#extradata 0: 5, 0x00bb0064
#extradata 1: 5, 0x00bb0064
#tb 0: 1/1000
diff --git a/tests/ref/fate/matroska-encoding-delay b/tests/ref/fate/matroska-encoding-delay
index e6cf4790f5..401de4facf 100644
--- a/tests/ref/fate/matroska-encoding-delay
+++ b/tests/ref/fate/matroska-encoding-delay
@@ -1,5 +1,5 @@
-b933b7b94de55ae029369312d48d8649 *tests/data/fate/matroska-encoding-delay.matroska
-961221 tests/data/fate/matroska-encoding-delay.matroska
+1f6f9c0fbaba0f128acbea296cec1887 *tests/data/fate/matroska-encoding-delay.matroska
+961229 tests/data/fate/matroska-encoding-delay.matroska
#extradata 0: 22, 0x32ea0490
#tb 0: 1/1000
#media_type 0: video
@@ -32,7 +32,7 @@ dts_time=-0.010000
duration=24
duration_time=0.024000
size=1152
-pos=1238
+pos=1246
flags=K__
[/PACKET]
[PACKET]
@@ -45,7 +45,7 @@ dts_time=0.000000
duration=40
duration_time=0.040000
size=237628
-pos=2398
+pos=2406
flags=K__
[/PACKET]
[PACKET]
@@ -58,7 +58,7 @@ dts_time=0.014000
duration=24
duration_time=0.024000
size=1152
-pos=240033
+pos=240041
flags=K__
[/PACKET]
[PACKET]
@@ -71,7 +71,7 @@ dts_time=0.038000
duration=24
duration_time=0.024000
size=1152
-pos=241208
+pos=241216
flags=K__
[/PACKET]
[PACKET]
@@ -84,7 +84,7 @@ dts_time=0.040000
duration=40
duration_time=0.040000
size=238066
-pos=242368
+pos=242376
flags=K__
[/PACKET]
[STREAM]
diff --git a/tests/ref/fate/matroska-flac-extradata-update b/tests/ref/fate/matroska-flac-extradata-update
index d5814925f5..d6713aaafa 100644
--- a/tests/ref/fate/matroska-flac-extradata-update
+++ b/tests/ref/fate/matroska-flac-extradata-update
@@ -1,5 +1,5 @@
-28bc0ded5dc520d955caf29db80d35da *tests/data/fate/matroska-flac-extradata-update.matroska
-1795 tests/data/fate/matroska-flac-extradata-update.matroska
+fdbfdc51b519fd5e8f425aca1e7b8704 *tests/data/fate/matroska-flac-extradata-update.matroska
+1807 tests/data/fate/matroska-flac-extradata-update.matroska
#extradata 0: 34, 0x93650c81
#extradata 1: 34, 0x93650c81
#extradata 2: 34, 0x93650c81
diff --git a/tests/ref/fate/matroska-h264-remux b/tests/ref/fate/matroska-h264-remux
index 6edd88fba8..9a9a98217c 100644
--- a/tests/ref/fate/matroska-h264-remux
+++ b/tests/ref/fate/matroska-h264-remux
@@ -1,5 +1,5 @@
-3c00191234d5c4d77151d38a86403101 *tests/data/fate/matroska-h264-remux.matroska
-2036033 tests/data/fate/matroska-h264-remux.matroska
+fa3352ef6d3abd7d93f8627981a53f6f *tests/data/fate/matroska-h264-remux.matroska
+2036049 tests/data/fate/matroska-h264-remux.matroska
#tb 0: 1/25
#media_type 0: video
#codec_id 0: rawvideo
diff --git a/tests/ref/fate/matroska-mastering-display-metadata b/tests/ref/fate/matroska-mastering-display-metadata
index 5b23e9506c..95df3594c7 100644
--- a/tests/ref/fate/matroska-mastering-display-metadata
+++ b/tests/ref/fate/matroska-mastering-display-metadata
@@ -1,5 +1,5 @@
-69a904789151abaee46033391a4fce46 *tests/data/fate/matroska-mastering-display-metadata.matroska
-1669555 tests/data/fate/matroska-mastering-display-metadata.matroska
+e9a5f7314d6ae2ef16713335df2b5903 *tests/data/fate/matroska-mastering-display-metadata.matroska
+1669571 tests/data/fate/matroska-mastering-display-metadata.matroska
#extradata 0: 4, 0x040901a3
#extradata 3: 200, 0x506463a8
#tb 0: 1/1000
diff --git a/tests/ref/fate/matroska-move-cues-to-front b/tests/ref/fate/matroska-move-cues-to-front
index 78697b2eae..79ccc2fd93 100644
--- a/tests/ref/fate/matroska-move-cues-to-front
+++ b/tests/ref/fate/matroska-move-cues-to-front
@@ -1,5 +1,5 @@
-8ebfcf15768bbe66611e349383fbf26a *tests/data/fate/matroska-move-cues-to-front.matroska
-23210287 tests/data/fate/matroska-move-cues-to-front.matroska
+74a5ed3f0b14112322c8bf3e94d6e98b *tests/data/fate/matroska-move-cues-to-front.matroska
+23210297 tests/data/fate/matroska-move-cues-to-front.matroska
#tb 0: 1/1000
#media_type 0: audio
#codec_id 0: pcm_s24be
diff --git a/tests/ref/fate/matroska-mpegts-remux b/tests/ref/fate/matroska-mpegts-remux
index 2faab0892f..af41b57af1 100644
--- a/tests/ref/fate/matroska-mpegts-remux
+++ b/tests/ref/fate/matroska-mpegts-remux
@@ -1,5 +1,5 @@
-acaf3ebe07afe9815e0a984921d3ab87 *tests/data/fate/matroska-mpegts-remux.matroska
-6494 tests/data/fate/matroska-mpegts-remux.matroska
+ca1b91e49b6e238b641007c186d8f424 *tests/data/fate/matroska-mpegts-remux.matroska
+6502 tests/data/fate/matroska-mpegts-remux.matroska
#tb 0: 1/1000
#media_type 0: audio
#codec_id 0: ac3
diff --git a/tests/ref/fate/matroska-ms-mode b/tests/ref/fate/matroska-ms-mode
index f90a7e431f..0a42ab0748 100644
--- a/tests/ref/fate/matroska-ms-mode
+++ b/tests/ref/fate/matroska-ms-mode
@@ -1,5 +1,5 @@
-afb4fc9b2ca6cafc03d8029fdf4da876 *tests/data/fate/matroska-ms-mode.matroska
-413086 tests/data/fate/matroska-ms-mode.matroska
+7f0b825626a028765098222816ba56b8 *tests/data/fate/matroska-ms-mode.matroska
+413094 tests/data/fate/matroska-ms-mode.matroska
#extradata 0: 40, 0x54290c93
#extradata 1: 114, 0xb6c80771
#tb 0: 1/1000
diff --git a/tests/ref/fate/matroska-ogg-opus-remux b/tests/ref/fate/matroska-ogg-opus-remux
index 473b9ff00c..cd3eade361 100644
--- a/tests/ref/fate/matroska-ogg-opus-remux
+++ b/tests/ref/fate/matroska-ogg-opus-remux
@@ -1,5 +1,5 @@
-a3f98769fe55bc5234cf75fb1949749a *tests/data/fate/matroska-ogg-opus-remux.matroska
-10200 tests/data/fate/matroska-ogg-opus-remux.matroska
+b602a1a4aaa4fbca4b8aaf39b66d7235 *tests/data/fate/matroska-ogg-opus-remux.matroska
+10204 tests/data/fate/matroska-ogg-opus-remux.matroska
#extradata 0: 19, 0x399c0471
#tb 0: 1/1000
#media_type 0: audio
@@ -57,7 +57,7 @@ dts_time=-0.007000
duration=20
duration_time=0.020000
size=402
-pos=540
+pos=544
flags=K__
[/PACKET]
[PACKET]
@@ -70,7 +70,7 @@ dts_time=0.013000
duration=20
duration_time=0.020000
size=216
-pos=949
+pos=953
flags=K__
[/PACKET]
[PACKET]
@@ -83,7 +83,7 @@ dts_time=0.033000
duration=20
duration_time=0.020000
size=215
-pos=1172
+pos=1176
flags=K__
[/PACKET]
[STREAM]
diff --git a/tests/ref/fate/matroska-opus-remux b/tests/ref/fate/matroska-opus-remux
index 8ebc80ee36..975510e167 100644
--- a/tests/ref/fate/matroska-opus-remux
+++ b/tests/ref/fate/matroska-opus-remux
@@ -1,5 +1,5 @@
-551e45142f0989b281e837a3a86f0218 *tests/data/fate/matroska-opus-remux.matroska
-9355 tests/data/fate/matroska-opus-remux.matroska
+fe0258eb0d4b525203ea240c87a154d3 *tests/data/fate/matroska-opus-remux.matroska
+9359 tests/data/fate/matroska-opus-remux.matroska
#extradata 0: 19, 0x3a04048f
#tb 0: 1/1000
#media_type 0: audio
@@ -68,7 +68,7 @@ dts_time=-0.007000
duration=20
duration_time=0.020000
size=320
-pos=496
+pos=500
flags=K__
[/PACKET]
[PACKET]
@@ -81,7 +81,7 @@ dts_time=0.014000
duration=20
duration_time=0.020000
size=159
-pos=823
+pos=827
flags=K__
[/PACKET]
[PACKET]
@@ -94,7 +94,7 @@ dts_time=0.034000
duration=20
duration_time=0.020000
size=148
-pos=989
+pos=993
flags=K__
[/PACKET]
[STREAM]
diff --git a/tests/ref/fate/matroska-pgs-remux b/tests/ref/fate/matroska-pgs-remux
index ed5beb7463..a086111495 100644
--- a/tests/ref/fate/matroska-pgs-remux
+++ b/tests/ref/fate/matroska-pgs-remux
@@ -1,5 +1,5 @@
-6703d4e9a905bc5a1fc529776e8ffb51 *tests/data/fate/matroska-pgs-remux.matroska
-49744 tests/data/fate/matroska-pgs-remux.matroska
+d39daa393d66ae0b0c153be045897585 *tests/data/fate/matroska-pgs-remux.matroska
+49748 tests/data/fate/matroska-pgs-remux.matroska
#tb 0: 1/1000
#media_type 0: subtitle
#codec_id 0: hdmv_pgs_subtitle
diff --git a/tests/ref/fate/matroska-pgs-remux-durations b/tests/ref/fate/matroska-pgs-remux-durations
index a255640fa6..37494cd98f 100644
--- a/tests/ref/fate/matroska-pgs-remux-durations
+++ b/tests/ref/fate/matroska-pgs-remux-durations
@@ -1,5 +1,5 @@
-a547f8b6463a60e5ef2e9a2b117c4dfa *tests/data/fate/matroska-pgs-remux-durations.matroska
-49756 tests/data/fate/matroska-pgs-remux-durations.matroska
+27af80eecea4f15f415f22841bc699d5 *tests/data/fate/matroska-pgs-remux-durations.matroska
+49760 tests/data/fate/matroska-pgs-remux-durations.matroska
#tb 0: 1/1000
#media_type 0: subtitle
#codec_id 0: hdmv_pgs_subtitle
diff --git a/tests/ref/fate/matroska-qt-mode b/tests/ref/fate/matroska-qt-mode
index 17a8e6619e..d54f5d167c 100644
--- a/tests/ref/fate/matroska-qt-mode
+++ b/tests/ref/fate/matroska-qt-mode
@@ -1,5 +1,5 @@
-39a3d6faff69892c8a20301560b80b14 *tests/data/fate/matroska-qt-mode.matroska
-1884224 tests/data/fate/matroska-qt-mode.matroska
+c3483a76cd0bfbaf80a32dad041b6f52 *tests/data/fate/matroska-qt-mode.matroska
+1884232 tests/data/fate/matroska-qt-mode.matroska
#extradata 0: 90, 0x817d0185
#tb 0: 1/1000
#media_type 0: video
diff --git a/tests/ref/fate/matroska-spherical-mono-remux b/tests/ref/fate/matroska-spherical-mono-remux
index 6b975c1586..c65d206e91 100644
--- a/tests/ref/fate/matroska-spherical-mono-remux
+++ b/tests/ref/fate/matroska-spherical-mono-remux
@@ -1,5 +1,5 @@
-31cdace875cb696973d5a493ce776eea *tests/data/fate/matroska-spherical-mono-remux.matroska
-161554 tests/data/fate/matroska-spherical-mono-remux.matroska
+dfc2e196ca14cce155b1a081a0628fd3 *tests/data/fate/matroska-spherical-mono-remux.matroska
+161562 tests/data/fate/matroska-spherical-mono-remux.matroska
#extradata 0: 43, 0x2b0e0d7b
#extradata 1: 43, 0x2b0e0d7b
#tb 0: 1/1000
diff --git a/tests/ref/fate/matroska-vp8-alpha-remux b/tests/ref/fate/matroska-vp8-alpha-remux
index 17c15ec9df..1fad574edd 100644
--- a/tests/ref/fate/matroska-vp8-alpha-remux
+++ b/tests/ref/fate/matroska-vp8-alpha-remux
@@ -1,5 +1,5 @@
-fd4f24bf776a2f84e01b0aa7fdfece38 *tests/data/fate/matroska-vp8-alpha-remux.matroska
-235011 tests/data/fate/matroska-vp8-alpha-remux.matroska
+3339f3fa157bdd63f22f5a579f308c89 *tests/data/fate/matroska-vp8-alpha-remux.matroska
+235015 tests/data/fate/matroska-vp8-alpha-remux.matroska
#tb 0: 1/1000
#media_type 0: video
#codec_id 0: vp8
diff --git a/tests/ref/fate/matroska-zero-length-block b/tests/ref/fate/matroska-zero-length-block
index bef887d58b..3987cc14c4 100644
--- a/tests/ref/fate/matroska-zero-length-block
+++ b/tests/ref/fate/matroska-zero-length-block
@@ -1,5 +1,5 @@
-d9c8efb9d64addce3cac97e6c417d985 *tests/data/fate/matroska-zero-length-block.matroska
-630 tests/data/fate/matroska-zero-length-block.matroska
+f577fad2fff41d6e055f605281582b8d *tests/data/fate/matroska-zero-length-block.matroska
+634 tests/data/fate/matroska-zero-length-block.matroska
#tb 0: 1/1000
#media_type 0: subtitle
#codec_id 0: subrip
diff --git a/tests/ref/fate/rgb24-mkv b/tests/ref/fate/rgb24-mkv
index f2cff5ff96..d037c01b32 100644
--- a/tests/ref/fate/rgb24-mkv
+++ b/tests/ref/fate/rgb24-mkv
@@ -1,5 +1,5 @@
-a46cb669137f18ac0a42012485e5e863 *tests/data/fate/rgb24-mkv.matroska
-58211 tests/data/fate/rgb24-mkv.matroska
+69dc9d35fdfadccb28c7baf401776ec3 *tests/data/fate/rgb24-mkv.matroska
+58215 tests/data/fate/rgb24-mkv.matroska
#tb 0: 1/10
#media_type 0: video
#codec_id 0: rawvideo
diff --git a/tests/ref/fate/shortest-sub b/tests/ref/fate/shortest-sub
index 53f89925b9..b6571b4f32 100644
--- a/tests/ref/fate/shortest-sub
+++ b/tests/ref/fate/shortest-sub
@@ -1,5 +1,5 @@
-145b9b48d56f9c966bf41657f7569954 *tests/data/fate/shortest-sub.matroska
-139232 tests/data/fate/shortest-sub.matroska
+d334a0eee71351ddad0a63011107909f *tests/data/fate/shortest-sub.matroska
+139240 tests/data/fate/shortest-sub.matroska
#extradata 1: 167, 0xf7272d5f
#tb 0: 1/1000
#media_type 0: video
diff --git a/tests/ref/lavf-fate/av1.mkv b/tests/ref/lavf-fate/av1.mkv
index 2008e1a932..382e3aeee3 100644
--- a/tests/ref/lavf-fate/av1.mkv
+++ b/tests/ref/lavf-fate/av1.mkv
@@ -1,3 +1,3 @@
-72a4713f9165c73574d40e8b81c5d70f *tests/data/lavf-fate/lavf.av1.mkv
-55642 tests/data/lavf-fate/lavf.av1.mkv
+7d2c39dd98d5776425a4015e1eead6c6 *tests/data/lavf-fate/lavf.av1.mkv
+55646 tests/data/lavf-fate/lavf.av1.mkv
tests/data/lavf-fate/lavf.av1.mkv CRC=0x7c27cc15
diff --git a/tests/ref/lavf/mka b/tests/ref/lavf/mka
index 7af63e0779..93a0b8f71a 100644
--- a/tests/ref/lavf/mka
+++ b/tests/ref/lavf/mka
@@ -1,3 +1,3 @@
-e2d55cd3844fd7237a92181dbbcb08d9 *tests/data/lavf/lavf.mka
-43569 tests/data/lavf/lavf.mka
+77db16a9fe1c42a230c85124bfb40cad *tests/data/lavf/lavf.mka
+43573 tests/data/lavf/lavf.mka
tests/data/lavf/lavf.mka CRC=0x3a1da17e
diff --git a/tests/ref/lavf/mkv b/tests/ref/lavf/mkv
index d54c44a647..fbd40fc1cb 100644
--- a/tests/ref/lavf/mkv
+++ b/tests/ref/lavf/mkv
@@ -1,3 +1,3 @@
-0934e35639b6735c1e26595e8f47ba70 *tests/data/lavf/lavf.mkv
-320409 tests/data/lavf/lavf.mkv
+32b87b6adbe76df1008bc074f82fabb0 *tests/data/lavf/lavf.mkv
+320417 tests/data/lavf/lavf.mkv
tests/data/lavf/lavf.mkv CRC=0xec6c3c68
diff --git a/tests/ref/lavf/mkv_attachment b/tests/ref/lavf/mkv_attachment
index ad96424098..2966a827cc 100644
--- a/tests/ref/lavf/mkv_attachment
+++ b/tests/ref/lavf/mkv_attachment
@@ -1,3 +1,3 @@
-d2708709bdd6817d9cb2b475fdfa903f *tests/data/lavf/lavf.mkv_attachment
-472559 tests/data/lavf/lavf.mkv_attachment
+41739c51209d94b4763f9dbe4d1e1dc9 *tests/data/lavf/lavf.mkv_attachment
+472567 tests/data/lavf/lavf.mkv_attachment
tests/data/lavf/lavf.mkv_attachment CRC=0xec6c3c68
diff --git a/tests/ref/seek/lavf-mkv b/tests/ref/seek/lavf-mkv
index 8ac0354164..06ba6e0380 100644
--- a/tests/ref/seek/lavf-mkv
+++ b/tests/ref/seek/lavf-mkv
@@ -1,48 +1,48 @@
-ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 657 size: 208
+ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 665 size: 208
ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 873 size: 27837
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 881 size: 27837
ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292289 size: 27834
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292297 size: 27834
ret: 0 st: 0 flags:0 ts: 0.788000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292289 size: 27834
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292297 size: 27834
ret: 0 st: 0 flags:1 ts:-0.317000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 873 size: 27837
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 881 size: 27837
ret:-1 st: 1 flags:0 ts: 2.577000
ret: 0 st: 1 flags:1 ts: 1.471000
-ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320130 size: 209
+ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320138 size: 209
ret: 0 st:-1 flags:0 ts: 0.365002
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146841 size: 27925
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146849 size: 27925
ret: 0 st:-1 flags:1 ts:-0.740831
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 873 size: 27837
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 881 size: 27837
ret:-1 st: 0 flags:0 ts: 2.153000
ret: 0 st: 0 flags:1 ts: 1.048000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292289 size: 27834
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292297 size: 27834
ret: 0 st: 1 flags:0 ts:-0.058000
-ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 657 size: 208
+ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 665 size: 208
ret: 0 st: 1 flags:1 ts: 2.836000
-ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320130 size: 209
+ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320138 size: 209
ret:-1 st:-1 flags:0 ts: 1.730004
ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146841 size: 27925
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146849 size: 27925
ret: 0 st: 0 flags:0 ts:-0.482000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 873 size: 27837
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 881 size: 27837
ret: 0 st: 0 flags:1 ts: 2.413000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292289 size: 27834
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292297 size: 27834
ret:-1 st: 1 flags:0 ts: 1.307000
ret: 0 st: 1 flags:1 ts: 0.201000
-ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 657 size: 208
+ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 665 size: 208
ret: 0 st:-1 flags:0 ts:-0.904994
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 873 size: 27837
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 881 size: 27837
ret: 0 st:-1 flags:1 ts: 1.989173
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292289 size: 27834
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292297 size: 27834
ret: 0 st: 0 flags:0 ts: 0.883000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292289 size: 27834
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292297 size: 27834
ret: 0 st: 0 flags:1 ts:-0.222000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 873 size: 27837
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 881 size: 27837
ret:-1 st: 1 flags:0 ts: 2.672000
ret: 0 st: 1 flags:1 ts: 1.566000
-ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320130 size: 209
+ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320138 size: 209
ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146841 size: 27925
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146849 size: 27925
ret: 0 st:-1 flags:1 ts:-0.645825
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 873 size: 27837
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 881 size: 27837