[FFmpeg-devel] [PATCH 3/3] avformat/mxfdec: don't use sizeof(AVMasteringDisplayMetadata)

James Almer jamrial at gmail.com
Wed Jun 19 21:24:13 EEST 2024


It's not part of the libavutil ABI.

Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavformat/mxfdec.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 852fb7e056..a5863445ab 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -227,6 +227,7 @@ typedef struct MXFDescriptor {
     UID color_trc_ul;
     UID color_space_ul;
     AVMasteringDisplayMetadata *mastering;
+    size_t mastering_size;
     AVContentLightMetadata *coll;
     size_t coll_size;
 } MXFDescriptor;
@@ -1424,7 +1425,7 @@ static int mxf_read_generic_descriptor(void *arg, AVIOContext *pb, int tag, int
         }
         if (IS_KLV_KEY(uid, mxf_mastering_display_prefix)) {
             if (!descriptor->mastering) {
-                descriptor->mastering = av_mastering_display_metadata_alloc();
+                descriptor->mastering = av_mastering_display_metadata_alloc_size(&descriptor->mastering_size);
                 if (!descriptor->mastering)
                     return AVERROR(ENOMEM);
             }
@@ -2955,7 +2956,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
             if (descriptor->mastering) {
                 if (!av_packet_side_data_add(&st->codecpar->coded_side_data, &st->codecpar->nb_coded_side_data,
                                              AV_PKT_DATA_MASTERING_DISPLAY_METADATA,
-                                             (uint8_t *)descriptor->mastering, sizeof(*descriptor->mastering), 0)) {
+                                             (uint8_t *)descriptor->mastering, descriptor->mastering_size, 0)) {
                     ret = AVERROR(ENOMEM);
                     goto fail_and_free;
                 }
-- 
2.45.2



More information about the ffmpeg-devel mailing list