PR #22874 opened by Marvin Scholz (ePirat)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22874
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22874.patch

Add IAMF frame side data types and copy the packet side data to frames, so that 
the data can be used by renderers, which operate on AVFrames and not packets.

Also implement printing of IAMF frame side data in ffprobe.


>From 6a85c6d81356151bbadfeaf2b333a49bb507365b Mon Sep 17 00:00:00 2001
From: Marvin Scholz <[email protected]>
Date: Tue, 21 Apr 2026 19:24:53 +0200
Subject: [PATCH 1/3] avutil: add IAMF frame side data types

These contain the same data as the packet side data equivalents.
---
 doc/APIchanges        |  6 ++++++
 libavutil/frame.h     | 24 ++++++++++++++++++++++++
 libavutil/side_data.c |  3 +++
 libavutil/version.h   |  2 +-
 4 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index f1cbbb41b8..69f79b34be 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,12 @@ The last version increases of all libraries were on 2025-03-28
 
 API changes, most recent first:
 
+2026-04-21 - xxxxxxxxxx - lavu 60.31.100 - frame.h
+  Add IAMF frame side data types to enum AVFrameSideDataType:
+    - AV_FRAME_DATA_IAMF_MIX_GAIN_PARAM
+    - AV_FRAME_DATA_IAMF_DEMIXING_INFO_PARAM
+    - AV_FRAME_DATA_IAMF_RECON_GAIN_INFO_PARAM
+
 2026-04-14 - 7faa6ee2aa - lavc 62.30.100 - packet.h
   Add AV_PKT_DATA_DYNAMIC_HDR_SMPTE_2094_APP5 side data type.
 
diff --git a/libavutil/frame.h b/libavutil/frame.h
index 02a54303bc..99bef9066a 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -267,6 +267,30 @@ enum AVFrameSideDataType {
       * volume transform as specified in the SMPTE 2094-50 standard.
       */
      AV_FRAME_DATA_DYNAMIC_HDR_SMPTE_2094_APP5,
+
+     /**
+      * IAMF Mix Gain Parameter Data associated with the audio frame. This 
metadata
+      * is in the form of the AVIAMFParamDefinition struct and contains 
information
+      * defined in sections 3.6.1 and 3.8.1 of the Immersive Audio Model and
+      * Formats standard.
+      */
+     AV_FRAME_DATA_IAMF_MIX_GAIN_PARAM,
+
+     /**
+      * IAMF Demixing Info Parameter Data associated with the audio frame. This
+      * metadata is in the form of the AVIAMFParamDefinition struct and 
contains
+      * information defined in sections 3.6.1 and 3.8.2 of the Immersive Audio 
Model
+      * and Formats standard.
+      */
+     AV_FRAME_DATA_IAMF_DEMIXING_INFO_PARAM,
+
+     /**
+      * IAMF Recon Gain Info Parameter Data associated with the audio frame. 
This
+      * metadata is in the form of the AVIAMFParamDefinition struct and 
contains
+      * information defined in sections 3.6.1 and 3.8.3 of the Immersive Audio 
Model
+      * and Formats standard.
+      */
+     AV_FRAME_DATA_IAMF_RECON_GAIN_INFO_PARAM,
 };
 
 enum AVActiveFormatDescription {
diff --git a/libavutil/side_data.c b/libavutil/side_data.c
index 7bf5f7e96e..64c4220ed9 100644
--- a/libavutil/side_data.c
+++ b/libavutil/side_data.c
@@ -58,6 +58,9 @@ static const AVSideDataDescriptor sd_props[] = {
     [AV_FRAME_DATA_SEI_UNREGISTERED]            = { "H.26[45] User Data 
Unregistered SEI message",  AV_SIDE_DATA_PROP_MULTI },
     [AV_FRAME_DATA_VIDEO_HINT]                  = { "Encoding video hint",     
                     AV_SIDE_DATA_PROP_SIZE_DEPENDENT },
     [AV_FRAME_DATA_3D_REFERENCE_DISPLAYS]       = { "3D Reference Displays 
Information",            AV_SIDE_DATA_PROP_GLOBAL },
+    [AV_FRAME_DATA_IAMF_MIX_GAIN_PARAM]         = { "IAMF Mix Gain Parameter 
Data" },
+    [AV_FRAME_DATA_IAMF_DEMIXING_INFO_PARAM]    = { "IAMF Demixing Info 
Parameter Data",            AV_SIDE_DATA_PROP_CHANNEL_DEPENDENT },
+    [AV_FRAME_DATA_IAMF_RECON_GAIN_INFO_PARAM]  = { "IAMF Recon Gain Info 
Parameter Data" },
 };
 
 const AVSideDataDescriptor *av_frame_side_data_desc(enum AVFrameSideDataType 
type)
diff --git a/libavutil/version.h b/libavutil/version.h
index 40a7d8e300..07c47da803 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  60
-#define LIBAVUTIL_VERSION_MINOR  30
+#define LIBAVUTIL_VERSION_MINOR  31
 #define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
-- 
2.52.0


>From f99058d9d1d23dc1563d9768e0e33e72652d17d5 Mon Sep 17 00:00:00 2001
From: Marvin Scholz <[email protected]>
Date: Tue, 21 Apr 2026 19:25:13 +0200
Subject: [PATCH 2/3] avcodec: map IAMF packet side data to frame side data

---
 libavcodec/decode.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index d64f089b82..c82e357845 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1549,6 +1549,9 @@ int ff_decode_frame_props_from_pkt(const AVCodecContext 
*avctx,
         { AV_PKT_DATA_S12M_TIMECODE,               AV_FRAME_DATA_S12M_TIMECODE 
},
         { AV_PKT_DATA_SKIP_SAMPLES,                AV_FRAME_DATA_SKIP_SAMPLES 
},
         { AV_PKT_DATA_LCEVC,                       AV_FRAME_DATA_LCEVC },
+        { AV_PKT_DATA_IAMF_MIX_GAIN_PARAM,         
AV_FRAME_DATA_IAMF_MIX_GAIN_PARAM },
+        { AV_PKT_DATA_IAMF_DEMIXING_INFO_PARAM,    
AV_FRAME_DATA_IAMF_DEMIXING_INFO_PARAM },
+        { AV_PKT_DATA_IAMF_RECON_GAIN_INFO_PARAM,  
AV_FRAME_DATA_IAMF_RECON_GAIN_INFO_PARAM },
         { AV_PKT_DATA_NB }
     };
 
-- 
2.52.0


>From 892722d1baf8321375fb283967f4542076fbb6b7 Mon Sep 17 00:00:00 2001
From: Marvin Scholz <[email protected]>
Date: Tue, 21 Apr 2026 20:43:32 +0200
Subject: [PATCH 3/3] ffprobe: implement printing IAMF frame side data

---
 fftools/ffprobe.c | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index aec358aa2d..94d0085671 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -1402,6 +1402,9 @@ static void show_subtitle(AVTextFormatContext *tfc, 
AVSubtitle *sub, AVStream *s
     fflush(stdout);
 }
 
+static void print_iamf_param_definition(AVTextFormatContext *tfc, const char 
*name,
+                                        const AVIAMFParamDefinition *param, 
SectionID section_id);
+
 static void print_frame_side_data(AVTextFormatContext *tfc,
                                   const AVFrame *frame,
                                   const AVStream *stream)
@@ -1464,6 +1467,11 @@ static void print_frame_side_data(AVTextFormatContext 
*tfc,
             print_int("view_id", *(int*)sd->data);
         } else if (sd->type == AV_FRAME_DATA_EXIF) {
             print_int("size", sd->size);
+        } else if (sd->type == AV_FRAME_DATA_IAMF_MIX_GAIN_PARAM ||
+            sd->type == AV_FRAME_DATA_IAMF_DEMIXING_INFO_PARAM ||
+            sd->type == AV_FRAME_DATA_IAMF_RECON_GAIN_INFO_PARAM) {
+            const AVIAMFParamDefinition *param = (AVIAMFParamDefinition 
*)sd->data;
+            print_iamf_param_definition(tfc, NULL, param, 
SECTION_ID_FRAME_SIDE_DATA);
         }
         avtext_print_section_footer(tfc);
     }
@@ -2155,12 +2163,20 @@ static void 
print_iamf_param_definition(AVTextFormatContext *tfc, const char *na
                                         const AVIAMFParamDefinition *param, 
SectionID section_id)
 {
     SectionID subsection_id, parameter_section_id;
-    subsection_id = sections[section_id].children_ids[0];
+    if (section_id == SECTION_ID_FRAME_SIDE_DATA)
+        subsection_id = SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST;
+    else
+        subsection_id = sections[section_id].children_ids[0];
     av_assert0(subsection_id != -1);
     parameter_section_id = sections[subsection_id].children_ids[0];
     av_assert0(parameter_section_id != -1);
-    avtext_print_section_header(tfc, "IAMF Param Definition", section_id);
-    print_str("name",           name);
+
+    // When printing as part of side-data, skip opening a section
+    if (section_id != SECTION_ID_FRAME_SIDE_DATA)
+        avtext_print_section_header(tfc, "IAMF Param Definition", section_id);
+
+    if (name)
+        print_str("name",           name);
     print_int("nb_subblocks",   param->nb_subblocks);
     print_int("type",           param->type);
     print_int("parameter_id",   param->parameter_id);
@@ -2203,7 +2219,9 @@ static void 
print_iamf_param_definition(AVTextFormatContext *tfc, const char *na
     }
     if (param->nb_subblocks > 0)
         avtext_print_section_footer(tfc); // subsection_id
-    avtext_print_section_footer(tfc); // section_id
+
+    if (section_id != SECTION_ID_FRAME_SIDE_DATA)
+        avtext_print_section_footer(tfc); // section_id
 }
 
 static void print_iamf_audio_element_params(AVTextFormatContext *tfc, const 
AVStreamGroup *stg,
-- 
2.52.0

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

Reply via email to