Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: anders-mjoll via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: anders-mjoll <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] Fix incorrect extraction of Origin (PR #20656)
Date: Mon, 06 Oct 2025 14:31:23 -0000
Message-ID: <175976108368.65.754313117503418314@bf249f23a2c8> (raw)

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 <anders@onemimir.com>
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 -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

                 reply	other threads:[~2025-10-06 14:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=175976108368.65.754313117503418314@bf249f23a2c8 \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=code@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ http://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git