PR #23810 opened by vigneshvg
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23810
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23810.patch

This is similar to `cdsc` but intended for rendering metadata.
>From a demuxer's point of view both of them are essentially the
same.

Added in the draft spec here: https://www.mpeg.org/standards/MPEG-4/12/

Link to the newly added fate sample: 
https://drive.google.com/file/d/1qfRALYT6ZCcijKEAkrWWjIDq_E2dm3Ix/view?usp=drive_link
 (also attached in the PR).

Signed-off-by: Vignesh Venkat <[email protected]>


>From 3a77f39417e27be68bb5154d9bee388ec3a48c2d Mon Sep 17 00:00:00 2001
From: Vignesh Venkat <[email protected]>
Date: Tue, 14 Jul 2026 14:23:00 -0700
Subject: [PATCH] avformat/mov: Support rndr track reference type

This is similar to `cdsc` but intended for rendering metadata.
>From a demuxer's point of view both of them are essentially the
same.

Added in the draft spec here: https://www.mpeg.org/standards/MPEG-4/12/

Link to the newly added fate sample: 
https://drive.google.com/file/d/1qfRALYT6ZCcijKEAkrWWjIDq_E2dm3Ix/view?usp=drive_link

Signed-off-by: Vignesh Venkat <[email protected]>
---
 libavformat/mov.c                 | 18 +++++++++++-------
 tests/fate/mov.mak                |  3 +++
 tests/ref/fate/mov-t35-rndr-track | 22 ++++++++++++++++++++++
 3 files changed, 36 insertions(+), 7 deletions(-)
 create mode 100644 tests/ref/fate/mov-t35-rndr-track

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 02a3dc97a7..cdf309e9c1 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2623,7 +2623,7 @@ static MovTref *mov_add_tref_tag(MOVStreamContext *sc, 
uint32_t name)
     return tag;
 }
 
-static int mov_read_cdsc(MOVContext* c, AVIOContext* pb, MOVAtom atom)
+static int mov_read_cdsc_rndr(MOVContext* c, AVIOContext* pb, MOVAtom atom)
 {
     AVStream* st;
     MOVStreamContext* sc;
@@ -2632,7 +2632,7 @@ static int mov_read_cdsc(MOVContext* c, AVIOContext* pb, 
MOVAtom atom)
         return 0;
 
     if (atom.size > 4) {
-        av_log(c->fc, AV_LOG_ERROR, "Only a single tref of type cdsc is 
supported\n");
+        av_log(c->fc, AV_LOG_ERROR, "Only a single tref of type cdsc/rndr is 
supported\n");
         return AVERROR_PATCHWELCOME;
     }
     if (atom.size < 4)
@@ -9807,7 +9807,8 @@ static const MOVParseTableEntry mov_default_parse_table[] 
= {
 { MKTAG('a','v','c','C'), mov_read_glbl },
 { MKTAG('p','a','s','p'), mov_read_pasp },
 { MKTAG('c','l','a','p'), mov_read_clap },
-{ MKTAG('c','d','s','c'), mov_read_cdsc },
+{ MKTAG('c','d','s','c'), mov_read_cdsc_rndr },
+{ MKTAG('r','n','d','r'), mov_read_cdsc_rndr },
 { MKTAG('s','b','a','s'), mov_read_sbas },
 { MKTAG('v','d','e','p'), mov_read_vdep },
 { MKTAG('s','i','d','x'), mov_read_sidx },
@@ -11133,7 +11134,7 @@ static AVStream 
*mov_find_reference_track(AVFormatContext *s, AVStream *st,
     return NULL;
 }
 
-static int mov_parse_cdsc_streams(AVFormatContext *s)
+static int mov_parse_cdsc_and_rndr_streams(AVFormatContext *s)
 {
     int err;
 
@@ -11148,8 +11149,11 @@ static int mov_parse_cdsc_streams(AVFormatContext *s)
         MOVStreamContext *sc = st->priv_data;
         MovTref *tag = mov_find_tref_tag(sc, MKTAG('c','d','s','c'));
 
-        if (!tag)
-            continue;
+        if (!tag) {
+            tag = mov_find_tref_tag(sc, MKTAG('r','n','d','r'));
+            if (!tag)
+                continue;
+        }
 
         st_ref = mov_find_reference_track(s, st, tag->id, tag->nb_id, 0);
         if (!st_ref) {
@@ -11401,7 +11405,7 @@ static int mov_read_header(AVFormatContext *s)
     }
 
     /* Create metadata stream groups. */
-    err = mov_parse_cdsc_streams(s);
+    err = mov_parse_cdsc_and_rndr_streams(s);
     if (err < 0)
         return err;
 
diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
index 1629796f77..9815d72529 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -39,6 +39,7 @@ FATE_MOV_FFPROBE-$(call FRAMEMD5, MOV, H264, H264_PARSER) += 
fate-mov-neg-firstp
                    fate-mov-mp4-with-mov-in24-ver \
                    fate-mov-mime-codecstring \
                    fate-mov-t35-cdsc-track \
+                   fate-mov-t35-rndr-track \
 
 FATE_MOV_FFPROBE-$(call FRAMEMD5, MOV, MPEG4, H264_PARSER) += 
fate-mov-mp4-extended-atom \
 
@@ -168,6 +169,8 @@ fate-mov-mime-codecstring: CMD = run 
ffprobe$(PROGSSUF)$(EXESUF) -show_entries s
 
 fate-mov-t35-cdsc-track: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entries 
stream_group=index,id,nb_streams,type:stream_group_stream=index,id,codec_name,codec_type,codec_tag_string,extradata_size
 $(TARGET_SAMPLES)/mov/mov-t35-cdsc-track.mp4
 
+fate-mov-t35-rndr-track: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entries 
stream_group=index,id,nb_streams,type:stream_group_stream=index,id,codec_name,codec_type,codec_tag_string,extradata_size
 $(TARGET_SAMPLES)/mov/mov-t35-rndr-track.mp4
+
 FATE_MOV_FFMPEG_FFPROBE_SAMPLES-$(call REMUX, MP4 MOV, OGG_DEMUXER 
VORBIS_DECODER) \
                           += fate-mov-mp4-chapters
 fate-mov-mp4-chapters: CMD = transcode ogg 
$(TARGET_SAMPLES)/vorbis/vorbis_chapter_extension_demo.ogg mp4 "-c copy" "-c 
copy -t 0.1" "-show_chapters"
diff --git a/tests/ref/fate/mov-t35-rndr-track 
b/tests/ref/fate/mov-t35-rndr-track
new file mode 100644
index 0000000000..29fbab1c13
--- /dev/null
+++ b/tests/ref/fate/mov-t35-rndr-track
@@ -0,0 +1,22 @@
+[STREAM_GROUP]
+index=0
+id=0x2
+nb_streams=2
+type=Track Reference
+[STREAM]
+index=0
+codec_name=av1
+codec_type=video
+codec_tag_string=av01
+id=0x1
+extradata_size=17
+[/STREAM]
+[STREAM]
+index=1
+codec_name=itut_t35
+codec_type=data
+codec_tag_string=it35
+id=0x2
+extradata_size=5
+[/STREAM]
+[/STREAM_GROUP]
-- 
2.52.0

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

Reply via email to