[FFmpeg-devel] [PATCH v4 1/3] avcodec: add ambient viewing environment packet side data.

Cosmin Stejerean cosmin at cosmin.at
Sun Feb 4 17:14:10 EET 2024


From: Damiano Galassi <damiog at gmail.com>

---
 doc/APIchanges        | 3 +++
 fftools/ffprobe.c     | 3 +++
 libavcodec/avpacket.c | 1 +
 libavcodec/decode.c   | 1 +
 libavcodec/packet.h   | 9 ++++++++-
 libavcodec/version.h  | 2 +-
 6 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index e477ed78e0..1f5724324a 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09
 
 API changes, most recent first:
 
+2024-02-04 - xxxxxxxxxx - lavc 60.39.100 - packet.h
+  Add AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT.
+
 2023-11-xx - xxxxxxxxxx - lavfi 9.16.100 - buffersink.h buffersrc.h
   Add av_buffersink_get_colorspace and av_buffersink_get_color_range.
   Add AVBufferSrcParameters.color_space and AVBufferSrcParameters.color_range.
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index f33e2471cb..aa1153e709 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2392,6 +2392,9 @@ static void print_pkt_side_data(WriterContext *w,
             AVContentLightMetadata *metadata = (AVContentLightMetadata *)sd->data;
             print_int("max_content", metadata->MaxCLL);
             print_int("max_average", metadata->MaxFALL);
+        } else if (sd->type == AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT) {
+            print_ambient_viewing_environment(
+                w, (const AVAmbientViewingEnvironment *)sd->data);
         } else if (sd->type == AV_PKT_DATA_DYNAMIC_HDR10_PLUS) {
             AVDynamicHDRPlus *metadata = (AVDynamicHDRPlus *)sd->data;
             print_dynamic_hdr10_plus(w, metadata);
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index 0f8c9b77ae..e118bbaad1 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -301,6 +301,7 @@ const char *av_packet_side_data_name(enum AVPacketSideDataType type)
     case AV_PKT_DATA_DOVI_CONF:                  return "DOVI configuration record";
     case AV_PKT_DATA_S12M_TIMECODE:              return "SMPTE ST 12-1:2014 timecode";
     case AV_PKT_DATA_DYNAMIC_HDR10_PLUS:         return "HDR10+ Dynamic Metadata (SMPTE 2094-40)";
+    case AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT:return "Ambient viewing environment";
     case AV_PKT_DATA_IAMF_MIX_GAIN_PARAM:        return "IAMF Mix Gain Parameter Data";
     case AV_PKT_DATA_IAMF_DEMIXING_INFO_PARAM:   return "IAMF Demixing Info Parameter Data";
     case AV_PKT_DATA_IAMF_RECON_GAIN_INFO_PARAM: return "IAMF Recon Gain Info Parameter Data";
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 2cfb3fcf97..da6446d879 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1434,6 +1434,7 @@ static const struct {
     { AV_PKT_DATA_CONTENT_LIGHT_LEVEL,        AV_FRAME_DATA_CONTENT_LIGHT_LEVEL },
     { AV_PKT_DATA_ICC_PROFILE,                AV_FRAME_DATA_ICC_PROFILE },
     { AV_PKT_DATA_DYNAMIC_HDR10_PLUS,         AV_FRAME_DATA_DYNAMIC_HDR_PLUS },
+    { AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT,AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT },
 };
 
 int ff_decode_frame_props_from_pkt(const AVCodecContext *avctx,
diff --git a/libavcodec/packet.h b/libavcodec/packet.h
index 2c57d262c6..bb28e7d62a 100644
--- a/libavcodec/packet.h
+++ b/libavcodec/packet.h
@@ -331,7 +331,14 @@ enum AVPacketSideDataType {
      * If its value becomes huge, some code using it
      * needs to be updated as it assumes it to be smaller than other limits.
      */
-    AV_PKT_DATA_NB
+    AV_PKT_DATA_NB,
+
+    /**
+     * Ambient viewing environment metadata, as defined by H.274.. This metadata
+     * should be associated with a video stream and contains data in the form
+     * of the AVAmbientViewingEnvironment struct.
+    */
+    AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT
 };
 
 #define AV_PKT_DATA_QUALITY_FACTOR AV_PKT_DATA_QUALITY_STATS //DEPRECATED
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 0fae3d06d3..f2f14eaed1 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #include "version_major.h"
 
-#define LIBAVCODEC_VERSION_MINOR  38
+#define LIBAVCODEC_VERSION_MINOR  39
 #define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
-- 
2.42.1




More information about the ffmpeg-devel mailing list