PR #20656 opened by anders-mjoll
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20656
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20656.patch
The code that attempted to extract origin (4B.02) was put in the wrong
metadata handler and was also read as the wrong integer type. According
ST 377-1 Origin is of type "Position" (Int64) in the Timeline Track, not
a 8 bit unsigned integer in the Sequence.
>From a958b6b8ef9e102b4846fd52882a9983600894ee Mon Sep 17 00:00:00 2001
From: Anders Rein
Date: Mon, 6 Oct 2025 16:23:45 +0200
Subject: [PATCH] Fix incorrect extraction of Origin
The code that attempted to extract origin (4B.02) was put in the wrong
metadata handler and was also read as the wrong integer type. According
ST 377-1 Origin is of type "Position" (Int64) in the Timeline Track, not
a 8 bit unsigned integer in the Sequence.
---
libavformat/mxfdec.c | 16
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index dc5dff651a..59b9b43a22 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -145,7 +145,6 @@ typedef struct MXFSequence {
UID *structural_components_refs;
int structural_components_count;
int64_t duration;
-uint8_t origin;
} MXFSequence;
typedef struct MXFTimecodeComponent {
@@ -189,6 +188,7 @@ typedef struct {
int body_sid;
MXFWrappingScheme wrapping;
int edit_units_per_packet; /* how many edit units to read at a time (PCM,
ClipWrapped) */
+int64_t origin;
} MXFTrack;
typedef struct MXFDescriptor {
@@ -1155,6 +1155,9 @@ static int mxf_read_track(void *arg, AVIOContext *pb, int
tag, int size, UID uid
track->edit_rate.num = avio_rb32(pb);
track->edit_rate.den = avio_rb32(pb);
break;
+case 0x4b02:
+track->origin = avio_rb64(pb);
+break;
case 0x4803:
avio_read(pb, track->sequence_ref, 16);
break;
@@ -1172,9 +1175,6 @@ static int mxf_read_sequence(void *arg, AVIOContext *pb,
int tag, int size, UID
case 0x0201:
avio_read(pb, sequence->data_definition_ul, 16);
break;
-case 0x4b02:
-sequence->origin = avio_r8(pb);
-break;
case 0x1001:
return mxf_read_strong_ref_array(pb,
&sequence->structural_components_refs,
&sequence->structural_components_count);
@@ -3025,11 +3025,11 @@ static int mxf_parse_structural_metadata(MXFContext
*mxf)
}
}
sti->need_parsing = AVSTREAM_PARSE_HEADERS;
-if (material_track->sequence->origin) {
-av_dict_set_int(&st->metadata, "material_track_origin",
material_track->sequence->origin, 0);
+if (material_track->origin) {
+av_dict_set_int(&st->metadata, "material_track_origin",
material_track->origin, 0);
}
-if (source_track->sequence->origin) {
-av_dict_set_int(&st->metadata, "source_track_origin",
source_track->sequence->origin, 0);
+if (source_track->origin) {
+av_dict_set_int(&st->metadata, "source_track_origin",
source_track->origin, 0);
}
if (descriptor->aspect_ratio.num && descriptor->aspect_ratio.den)
sti->display_aspect_ratio = descriptor->aspect_ratio;
--
2.49.1
___
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]