PR #26144 opened by Baptiste Coudurier (bcoudurier)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26144
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26144.patch

The Preface DMSchemes batch was written as 8 zero bytes, i.e. an item size of 0.
ST 377-1 4.3 gives batches of ULs an item size of 16, even when empty.

Only the md5s of the muxed MXF files change; file sizes and seek offsets are 
unchanged.

🤖 Generated with [Claude Code](https://claude.com/claude-code)



From 2b7ebef1680f12142e12206608e5bacb1fc04959 Mon Sep 17 00:00:00 2001
From: Baptiste Coudurier <[email protected]>
Date: Fri, 13 Nov 2026 16:38:12 -0800
Subject: [PATCH] avformat/mxfenc: write the DM schemes batch item size

An empty batch still has a 16 byte item size, ST 377-1 4.3.

Signed-off-by: Baptiste Coudurier <[email protected]>
---
 libavformat/mxfenc.c                    | 4 ++--
 tests/ref/fate/copy-trac4914            | 2 +-
 tests/ref/fate/mxf-d10-user-comments    | 2 +-
 tests/ref/fate/mxf-opatom-user-comments | 2 +-
 tests/ref/fate/mxf-reel_name            | 2 +-
 tests/ref/fate/mxf-remux-applehdr10     | 2 +-
 tests/ref/fate/mxf-user-comments        | 2 +-
 tests/ref/fate/time_base                | 2 +-
 tests/ref/lavf/mxf                      | 6 +++---
 tests/ref/lavf/mxf_d10                  | 2 +-
 tests/ref/lavf/mxf_dv25                 | 2 +-
 tests/ref/lavf/mxf_dvcpro100            | 2 +-
 tests/ref/lavf/mxf_dvcpro50             | 2 +-
 tests/ref/lavf/mxf_ffv1                 | 2 +-
 tests/ref/lavf/mxf_opatom               | 2 +-
 tests/ref/lavf/mxf_opatom_audio         | 2 +-
 16 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 867a4abd4d2..fb927876eea 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -792,9 +792,9 @@ static void mxf_write_preface(AVFormatContext *s)
     mxf_write_local_tag(s, 8 + 16LL * 
DESCRIPTOR_COUNT(mxf->essence_container_count), 0x3B0A);
     mxf_write_essence_container_refs(s);
 
-    // write dm_scheme_refs
+    // write dm_scheme_refs, empty batch of ULs
     mxf_write_local_tag(s, 8, 0x3B0B);
-    avio_wb64(pb, 0);
+    mxf_write_refs_count(pb, 0);
 }
 
 /*
diff --git a/tests/ref/fate/copy-trac4914 b/tests/ref/fate/copy-trac4914
index 1fd16e9a4cf..aa90883e6b9 100644
--- a/tests/ref/fate/copy-trac4914
+++ b/tests/ref/fate/copy-trac4914
@@ -1,4 +1,4 @@
-a0f68fa1d9ed5d3030d8244ea0b0299a *tests/data/fate/copy-trac4914.mxf
+aff25c8d72e67567154b312790568d19 *tests/data/fate/copy-trac4914.mxf
 561721 tests/data/fate/copy-trac4914.mxf
 #tb 0: 1001/30000
 #media_type 0: video
diff --git a/tests/ref/fate/mxf-d10-user-comments 
b/tests/ref/fate/mxf-d10-user-comments
index 9f3092f4af0..a41eae703d6 100644
--- a/tests/ref/fate/mxf-d10-user-comments
+++ b/tests/ref/fate/mxf-d10-user-comments
@@ -1,4 +1,4 @@
-d0dae277c0cb07f517ae2b456658f123 *tests/data/fate/mxf-d10-user-comments.mxf_d10
+e0e867f6c9bab73fdc057e5952991cf5 *tests/data/fate/mxf-d10-user-comments.mxf_d10
 3782189 tests/data/fate/mxf-d10-user-comments.mxf_d10
 #extradata 0:       34, 0x716b05c4
 #tb 0: 1/25
diff --git a/tests/ref/fate/mxf-opatom-user-comments 
b/tests/ref/fate/mxf-opatom-user-comments
index 14a1cee1f26..98fa698a868 100644
--- a/tests/ref/fate/mxf-opatom-user-comments
+++ b/tests/ref/fate/mxf-opatom-user-comments
@@ -1 +1 @@
-d40b64e492133c74faa07e605eb65b2f
+e1de3ef7984c753c3829ca6b717bfcd3
diff --git a/tests/ref/fate/mxf-reel_name b/tests/ref/fate/mxf-reel_name
index f3bafcc118d..8568d3e1646 100644
--- a/tests/ref/fate/mxf-reel_name
+++ b/tests/ref/fate/mxf-reel_name
@@ -1 +1 @@
-75e0ac14d5632d709bd805f1cacb1fbb
+5368d6641911ec00d13ba521b8314287
diff --git a/tests/ref/fate/mxf-remux-applehdr10 
b/tests/ref/fate/mxf-remux-applehdr10
index 9fbf8b60c74..4313afa2bd3 100644
--- a/tests/ref/fate/mxf-remux-applehdr10
+++ b/tests/ref/fate/mxf-remux-applehdr10
@@ -1,4 +1,4 @@
-5e03bad42adeb396b6614890f30aefba *tests/data/fate/mxf-remux-applehdr10.mxf
+8f0a38a4e6f32124cac7df0ea89ab287 *tests/data/fate/mxf-remux-applehdr10.mxf
 323641 tests/data/fate/mxf-remux-applehdr10.mxf
 #tb 0: 1001/60000
 #media_type 0: video
diff --git a/tests/ref/fate/mxf-user-comments b/tests/ref/fate/mxf-user-comments
index b4c78744b01..b8943bd43fa 100644
--- a/tests/ref/fate/mxf-user-comments
+++ b/tests/ref/fate/mxf-user-comments
@@ -1 +1 @@
-620ae205fefbb6dba74418f357a62c36
+4ee8fdb92fe77d2301b191fcfbee8596
diff --git a/tests/ref/fate/time_base b/tests/ref/fate/time_base
index ae96232e60c..d1a3a49be2e 100644
--- a/tests/ref/fate/time_base
+++ b/tests/ref/fate/time_base
@@ -1 +1 @@
-69ffc45e19ab070bc3e964d7b718fe53
+8ca5f348a9fc84fb0d837467da228974
diff --git a/tests/ref/lavf/mxf b/tests/ref/lavf/mxf
index 7e90a07f214..2d797532225 100644
--- a/tests/ref/lavf/mxf
+++ b/tests/ref/lavf/mxf
@@ -1,9 +1,9 @@
-b3e24d85944c027e86d5d410ab7e4670 *tests/data/lavf/lavf.mxf
+89ec2061697ae58b21f20dd456793c0e *tests/data/lavf/lavf.mxf
 526393 tests/data/lavf/lavf.mxf
 tests/data/lavf/lavf.mxf CRC=0x8dddfaab
-c714c4f9bea014001c51d25a3d4bee8f *tests/data/lavf/lavf.mxf
+ccd55e4fbbdcec01f9772583dbff4e01 *tests/data/lavf/lavf.mxf
 551481 tests/data/lavf/lavf.mxf
 tests/data/lavf/lavf.mxf CRC=0xf091e687
-779a390835c475041fc711db9004bee5 *tests/data/lavf/lavf.mxf
+c661334394b1d2dd5ba307acc53c8a0e *tests/data/lavf/lavf.mxf
 526393 tests/data/lavf/lavf.mxf
 tests/data/lavf/lavf.mxf CRC=0x8dddfaab
diff --git a/tests/ref/lavf/mxf_d10 b/tests/ref/lavf/mxf_d10
index 1dfaf476a3b..b4a937a9f93 100644
--- a/tests/ref/lavf/mxf_d10
+++ b/tests/ref/lavf/mxf_d10
@@ -1,3 +1,3 @@
-0f1187f21b47d645ea6ea4c3cea3d73d *tests/data/lavf/lavf.mxf_d10
+9409101162a0779ce053082a959554ee *tests/data/lavf/lavf.mxf_d10
 5332013 tests/data/lavf/lavf.mxf_d10
 tests/data/lavf/lavf.mxf_d10 CRC=0xc58d9422
diff --git a/tests/ref/lavf/mxf_dv25 b/tests/ref/lavf/mxf_dv25
index 33a05113984..33b02319d6e 100644
--- a/tests/ref/lavf/mxf_dv25
+++ b/tests/ref/lavf/mxf_dv25
@@ -1,3 +1,3 @@
-e9a10efc1a6d127448ac6b60b0b3af51 *tests/data/lavf/lavf.mxf_dv25
+c1c0b76332ab29bb953df28a3af88681 *tests/data/lavf/lavf.mxf_dv25
 3834413 tests/data/lavf/lavf.mxf_dv25
 tests/data/lavf/lavf.mxf_dv25 CRC=0x3efa60d5
diff --git a/tests/ref/lavf/mxf_dvcpro100 b/tests/ref/lavf/mxf_dvcpro100
index 21e1d21e536..a1da8b49352 100644
--- a/tests/ref/lavf/mxf_dvcpro100
+++ b/tests/ref/lavf/mxf_dvcpro100
@@ -1,3 +1,3 @@
-a2d6031d60aee54d24919d7628a1f7b5 *tests/data/lavf/lavf.mxf_dvcpro100
+e295922f8f5813c5ccad37947645c99a *tests/data/lavf/lavf.mxf_dvcpro100
 14637613 tests/data/lavf/lavf.mxf_dvcpro100
 tests/data/lavf/lavf.mxf_dvcpro100 CRC=0x25feb3fd
diff --git a/tests/ref/lavf/mxf_dvcpro50 b/tests/ref/lavf/mxf_dvcpro50
index 7cf0cc8f0c1..09fb7dda4f5 100644
--- a/tests/ref/lavf/mxf_dvcpro50
+++ b/tests/ref/lavf/mxf_dvcpro50
@@ -1,3 +1,3 @@
-25160bc35e28e0fe89b5ce1ea89e0eff *tests/data/lavf/lavf.mxf_dvcpro50
+7a0dfccb8515e53ab5218ff235b0e0fb *tests/data/lavf/lavf.mxf_dvcpro50
 7431213 tests/data/lavf/lavf.mxf_dvcpro50
 tests/data/lavf/lavf.mxf_dvcpro50 CRC=0xfd34a6d9
diff --git a/tests/ref/lavf/mxf_ffv1 b/tests/ref/lavf/mxf_ffv1
index 4ae93b2e892..2b467627543 100644
--- a/tests/ref/lavf/mxf_ffv1
+++ b/tests/ref/lavf/mxf_ffv1
@@ -1,3 +1,3 @@
-67638015788bb7dfcc1c16183967b513 *tests/data/lavf/lavf.mxf_ffv1
+0aa286f95c7222366ebcdece18c57583 *tests/data/lavf/lavf.mxf_ffv1
 5587001 tests/data/lavf/lavf.mxf_ffv1
 tests/data/lavf/lavf.mxf_ffv1 CRC=0x02354cdc
diff --git a/tests/ref/lavf/mxf_opatom b/tests/ref/lavf/mxf_opatom
index fa722418139..cde56adc18f 100644
--- a/tests/ref/lavf/mxf_opatom
+++ b/tests/ref/lavf/mxf_opatom
@@ -1,3 +1,3 @@
-6418766ca9b8b23fae74a80d66f26f3e *tests/data/lavf/lavf.mxf_opatom
+f65b5312d2233a5963c0c59a8bb2c59f *tests/data/lavf/lavf.mxf_opatom
 4717625 tests/data/lavf/lavf.mxf_opatom
 tests/data/lavf/lavf.mxf_opatom CRC=0xb13ba2f8
diff --git a/tests/ref/lavf/mxf_opatom_audio b/tests/ref/lavf/mxf_opatom_audio
index 0e034991c00..72721597994 100644
--- a/tests/ref/lavf/mxf_opatom_audio
+++ b/tests/ref/lavf/mxf_opatom_audio
@@ -1,3 +1,3 @@
-633b6d373009416f214edcf456208580 *tests/data/lavf/lavf.mxf_opatom_audio
+2c042a4c213356439b30c21254482496 *tests/data/lavf/lavf.mxf_opatom_audio
 102969 tests/data/lavf/lavf.mxf_opatom_audio
 tests/data/lavf/lavf.mxf_opatom_audio CRC=0xd155c6ff
-- 
2.54.0

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

Reply via email to