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

James Almer git at videolan.org
Thu Jun 20 23:17:22 EEST 2024


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Wed Jun 19 15:20:12 2024 -0300| [35df214a72685515a5e018a048fbed6f31b459d4] | committer: James Almer

avformat/mxfdec: don't use sizeof(AVMasteringDisplayMetadata)

It's not part of the libavutil ABI.

Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=35df214a72685515a5e018a048fbed6f31b459d4
---

 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;
                 }



More information about the ffmpeg-cvslog mailing list