PR #26146 opened by Baptiste Coudurier (bcoudurier) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26146 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26146.patch
The OP1a uni-track/multi-track qualifier (byte 14 of the OP UL) counts essence tracks only, ST 378 6.4.3. The timecode track does not count, so a file with a single stream gets 0x01 instead of 0x09, in the preface and in the partition packs. Only single-stream refs change: lavf/mxf_ffv1, fate/mxf-d10-user-comments, fate/time_base. 🤖 Generated with [Claude Code](https://claude.com/claude-code) From 61ef4f58c97bb65742758186141f71c7c19615b6 Mon Sep 17 00:00:00 2001 From: Baptiste Coudurier <[email protected]> Date: Fri, 13 Nov 2026 16:30:29 -0800 Subject: [PATCH] avformat/mxfenc: set the OP1a uni-track qualifier for a single track The timecode track is not an essence track, ST 378 6.4.3. Signed-off-by: Baptiste Coudurier <[email protected]> --- libavformat/mxfenc.c | 24 ++++++++++++++++-------- tests/ref/fate/mxf-d10-user-comments | 4 ++-- tests/ref/fate/time_base | 2 +- tests/ref/lavf/mxf_ffv1 | 2 +- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index 867a4abd4d2..ddaaa1158c8 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -746,6 +746,20 @@ static void mxf_write_essence_container_refs(AVFormatContext *s) avio_write(pb, multiple_desc_ul, 16); } +static void mxf_write_operational_pattern(AVFormatContext *s) +{ + AVIOContext *pb = s->pb; + + if (IS_OPATOM(s)) { + avio_write(pb, opatom_ul, 16); + } else { + avio_write(pb, op1a_ul, 14); + // qualifiers, ST 378 6.4: multi-track if more than one essence track + avio_w8(pb, s->nb_streams > 1 ? 0x09 : 0x01); + avio_w8(pb, op1a_ul[15]); + } +} + static void mxf_write_preface(AVFormatContext *s) { MXFContext *mxf = s->priv_data; @@ -783,10 +797,7 @@ static void mxf_write_preface(AVFormatContext *s) // operational pattern mxf_write_local_tag(s, 16, 0x3B09); - if (IS_OPATOM(s)) - avio_write(pb, opatom_ul, 16); - else - avio_write(pb, op1a_ul, 16); + mxf_write_operational_pattern(s); // write essence_container_refs mxf_write_local_tag(s, 8 + 16LL * DESCRIPTOR_COUNT(mxf->essence_container_count), 0x3B0A); @@ -2263,10 +2274,7 @@ static int mxf_write_partition(AVFormatContext *s, int bodysid, avio_wb32(pb, bodysid); // bodySID // operational pattern - if (IS_OPATOM(s)) - avio_write(pb, opatom_ul, 16); - else - avio_write(pb, op1a_ul, 16); + mxf_write_operational_pattern(s); // essence container mxf_write_essence_container_refs(s); diff --git a/tests/ref/fate/mxf-d10-user-comments b/tests/ref/fate/mxf-d10-user-comments index 9f3092f4af0..2fdf4e46938 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 +877a730a1e060e99b52509502862d37c *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 @@ -12,7 +12,7 @@ d0dae277c0cb07f517ae2b456658f123 *tests/data/fate/mxf-d10-user-comments.mxf_d10 0, 2, 3, 1, 150000, 0x36dbac43, F=0x0 0, 3, 4, 1, 150000, 0xe1c2955a, F=0x0 [FORMAT] -TAG:operational_pattern_ul=060e2b34.04010101.0d010201.01010900 +TAG:operational_pattern_ul=060e2b34.04010101.0d010201.01010100 TAG:uid=adab4424-2f25-4dc7-92ff-000c00000000 TAG:generation_uid=adab4424-2f25-4dc7-92ff-000c00000001 TAG:company_name=FATE-company diff --git a/tests/ref/fate/time_base b/tests/ref/fate/time_base index ae96232e60c..16a4bb9f4ec 100644 --- a/tests/ref/fate/time_base +++ b/tests/ref/fate/time_base @@ -1 +1 @@ -69ffc45e19ab070bc3e964d7b718fe53 +6e5f2c57c2d4a3bf4cdd3e64cae5e5bf diff --git a/tests/ref/lavf/mxf_ffv1 b/tests/ref/lavf/mxf_ffv1 index 4ae93b2e892..1857cd4c726 100644 --- a/tests/ref/lavf/mxf_ffv1 +++ b/tests/ref/lavf/mxf_ffv1 @@ -1,3 +1,3 @@ -67638015788bb7dfcc1c16183967b513 *tests/data/lavf/lavf.mxf_ffv1 +6ff842216d846e7918ecdda588390dc7 *tests/data/lavf/lavf.mxf_ffv1 5587001 tests/data/lavf/lavf.mxf_ffv1 tests/data/lavf/lavf.mxf_ffv1 CRC=0x02354cdc -- 2.54.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
