From 35df214a72685515a5e018a048fbed6f31b459d4 Mon Sep 17 00:00:00 2001 From: James Almer Date: Wed, 19 Jun 2024 15:20:12 -0300 Subject: [PATCH] avformat/mxfdec: don't use sizeof(AVMasteringDisplayMetadata) It's not part of the libavutil ABI. Signed-off-by: James Almer --- 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; }