This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit a5822fca94f9370ca57682bfc5b592b63d517f6d
Author:     James Almer <[email protected]>
AuthorDate: Tue Mar 17 10:57:32 2026 -0300
Commit:     James Almer <[email protected]>
CommitDate: Sun May 17 11:16:51 2026 -0300

    avformat/avformat: add a Track Reference Stream Group
    
    Signed-off-by: James Almer <[email protected]>
---
 doc/APIchanges            |  4 ++++
 fftools/ffmpeg_mux_init.c |  3 +++
 libavformat/avformat.c    |  5 +++++
 libavformat/avformat.h    | 18 ++++++++++++++++++
 libavformat/dump.c        | 10 ++++++++++
 libavformat/options.c     | 26 ++++++++++++++++++++++++++
 libavformat/version.h     |  2 +-
 7 files changed, 67 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 28e7b7b31c..2d1be16756 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,10 @@ The last version increases of all libraries were on 2025-03-28
 
 API changes, most recent first:
 
+2026-05-17 - xxxxxxxxxxx - lavf 62.17.100 - avformat.h
+  Add AV_STREAM_GROUP_PARAMS_TREF.
+  Add AVStreamGroupTREF.
+
 2026-05-16 - xxxxxxxxxxx - lavf 62.16.100 - avformat.h
   Add AVFMT_FIXED_FRAMESIZE.
 
diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index ca84c7d84d..a41939d0e5 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -2556,6 +2556,7 @@ static int of_map_group(Muxer *mux, AVDictionary **dict, 
AVBPrint *bp, const cha
         break;
     }
     case AV_STREAM_GROUP_PARAMS_LCEVC:
+    case AV_STREAM_GROUP_PARAMS_TREF:
         break;
     default:
         av_log(mux, AV_LOG_ERROR, "Unsupported mapped group type %d.\n", 
stg->type);
@@ -2581,6 +2582,8 @@ static int of_parse_group_token(Muxer *mux, const char 
*token, char *ptr)
                 { .i64 = AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION }, .unit 
= "type" },
             { "lcevc", NULL, 0, AV_OPT_TYPE_CONST,
                 { .i64 = AV_STREAM_GROUP_PARAMS_LCEVC }, .unit = "type" },
+            { "tref", NULL, 0, AV_OPT_TYPE_CONST,
+                { .i64 = AV_STREAM_GROUP_PARAMS_TREF }, .unit = "type" },
         { NULL },
     };
     const AVClass class = {
diff --git a/libavformat/avformat.c b/libavformat/avformat.c
index 3bc79a3592..6cb067a3f7 100644
--- a/libavformat/avformat.c
+++ b/libavformat/avformat.c
@@ -106,6 +106,10 @@ void ff_free_stream_group(AVStreamGroup **pstg)
         av_opt_free(stg->params.lcevc);
         av_freep(&stg->params.lcevc);
         break;
+    case AV_STREAM_GROUP_PARAMS_TREF:
+        av_opt_free(stg->params.tref);
+        av_freep(&stg->params.tref);
+        break;
     default:
         break;
     }
@@ -264,6 +268,7 @@ const char *avformat_stream_group_name(enum 
AVStreamGroupParamsType type)
     case AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION:     return "IAMF Mix 
Presentation";
     case AV_STREAM_GROUP_PARAMS_TILE_GRID:                 return "Tile Grid";
     case AV_STREAM_GROUP_PARAMS_LCEVC:                     return "LCEVC 
(Split video and enhancement)";
+    case AV_STREAM_GROUP_PARAMS_TREF:                      return "Track 
Reference";
     }
     return NULL;
 }
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index d6740fcf5d..ba9cebdb9e 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1087,12 +1087,29 @@ typedef struct AVStreamGroupLCEVC {
     int height;
 } AVStreamGroupLCEVC;
 
+/**
+ * AVStreamGroupTREF is meant to define the relation between video, audio,
+ * or subtitle streams, and a data stream containing metadata.
+ *
+ * No more than one stream of @ref AVCodecParameters.codec_type "codec_type"
+ * AVMEDIA_TYPE_DATA shall be present.
+ */
+typedef struct AVStreamGroupTREF {
+    const AVClass *av_class;
+
+    /**
+     * Index of the metadata stream in the AVStreamGroup.
+     */
+    unsigned int metadata_index;
+} AVStreamGroupTREF;
+
 enum AVStreamGroupParamsType {
     AV_STREAM_GROUP_PARAMS_NONE,
     AV_STREAM_GROUP_PARAMS_IAMF_AUDIO_ELEMENT,
     AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION,
     AV_STREAM_GROUP_PARAMS_TILE_GRID,
     AV_STREAM_GROUP_PARAMS_LCEVC,
+    AV_STREAM_GROUP_PARAMS_TREF,
 };
 
 struct AVIAMFAudioElement;
@@ -1135,6 +1152,7 @@ typedef struct AVStreamGroup {
         struct AVIAMFMixPresentation *iamf_mix_presentation;
         struct AVStreamGroupTileGrid *tile_grid;
         struct AVStreamGroupLCEVC *lcevc;
+        struct AVStreamGroupTREF *tref;
     } params;
 
     /**
diff --git a/libavformat/dump.c b/libavformat/dump.c
index 66abc2af7e..f2c7cf9845 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -837,6 +837,16 @@ static void dump_stream_group(const AVFormatContext *ic, 
uint8_t *printed,
         }
         break;
     }
+    case AV_STREAM_GROUP_PARAMS_TREF: {
+        const AVStreamGroupTREF *tref = stg->params.tref;
+        av_log(NULL, AV_LOG_INFO, " Track Reference:\n");
+        for (int i = 0; i < stg->nb_streams; i++) {
+            const AVStream *st = stg->streams[i];
+            dump_stream_format(ic, st->index, i, index, is_output, 
AV_LOG_INFO);
+            printed[st->index] = 1;
+        }
+        break;
+    }
     default:
         break;
     }
diff --git a/libavformat/options.c b/libavformat/options.c
index 9365a16e1d..2f05ec9c11 100644
--- a/libavformat/options.c
+++ b/libavformat/options.c
@@ -366,6 +366,20 @@ static const AVClass lcevc_class = {
     .option     = lcevc_options,
 };
 
+#define OFFSET(x) offsetof(AVStreamGroupTREF, x)
+static const AVOption tref_options[] = {
+    { "metadata_index", "Index of the data stream within the group", 
OFFSET(metadata_index),
+        AV_OPT_TYPE_UINT, { .i64 = 0 }, 0, UINT_MAX, FLAGS },
+    { NULL },
+};
+#undef OFFSET
+
+static const AVClass tref_class = {
+    .class_name = "AVStreamGroupTREF",
+    .version    = LIBAVUTIL_VERSION_INT,
+    .option     = tref_options,
+};
+
 static void *stream_group_child_next(void *obj, void *prev)
 {
     AVStreamGroup *stg = obj;
@@ -379,6 +393,8 @@ static void *stream_group_child_next(void *obj, void *prev)
             return stg->params.tile_grid;
         case AV_STREAM_GROUP_PARAMS_LCEVC:
             return stg->params.lcevc;
+        case AV_STREAM_GROUP_PARAMS_TREF:
+            return stg->params.tref;
         default:
             break;
         }
@@ -409,6 +425,9 @@ static const AVClass *stream_group_child_iterate(void 
**opaque)
     case AV_STREAM_GROUP_PARAMS_LCEVC:
         ret = &lcevc_class;
         break;
+    case AV_STREAM_GROUP_PARAMS_TREF:
+        ret = &tref_class;
+        break;
     default:
         break;
     }
@@ -485,6 +504,13 @@ AVStreamGroup 
*avformat_stream_group_create(AVFormatContext *s,
         stg->params.lcevc->av_class = &lcevc_class;
         av_opt_set_defaults(stg->params.lcevc);
         break;
+    case AV_STREAM_GROUP_PARAMS_TREF:
+        stg->params.tref = av_mallocz(sizeof(*stg->params.tref));
+        if (!stg->params.tref)
+            goto fail;
+        stg->params.tref->av_class = &tref_class;
+        av_opt_set_defaults(stg->params.tref);
+        break;
     default:
         goto fail;
     }
diff --git a/libavformat/version.h b/libavformat/version.h
index 9e1f484db4..2a28a3bf40 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,7 +31,7 @@
 
 #include "version_major.h"
 
-#define LIBAVFORMAT_VERSION_MINOR  16
+#define LIBAVFORMAT_VERSION_MINOR  17
 #define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \

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

Reply via email to