From a91f34aad84a1643e8aaadbf8a6204828712731d Mon Sep 17 00:00:00 2001 From: James Almer Date: Wed, 19 Jun 2024 15:19:56 -0300 Subject: [PATCH] avformat/mov: don't use sizeof(AVMasteringDisplayMetadata) It's not part of the libavutil ABI. Signed-off-by: James Almer --- libavformat/isom.h | 1 + libavformat/mov.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libavformat/isom.h b/libavformat/isom.h index c0a5788e08..35b767a52c 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -250,6 +250,7 @@ typedef struct MOVStreamContext { AVSphericalMapping *spherical; size_t spherical_size; AVMasteringDisplayMetadata *mastering; + size_t mastering_size; AVContentLightMetadata *coll; size_t coll_size; AVAmbientViewingEnvironment *ambient; diff --git a/libavformat/mov.c b/libavformat/mov.c index 367af8478b..2d5b24b9a9 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -6138,7 +6138,7 @@ static int mov_read_smdm(MOVContext *c, AVIOContext *pb, MOVAtom atom) avio_skip(pb, 3); /* flags */ - sc->mastering = av_mastering_display_metadata_alloc(); + sc->mastering = av_mastering_display_metadata_alloc_size(&sc->mastering_size); if (!sc->mastering) return AVERROR(ENOMEM); @@ -6181,7 +6181,7 @@ static int mov_read_mdcv(MOVContext *c, AVIOContext *pb, MOVAtom atom) return 0; } - sc->mastering = av_mastering_display_metadata_alloc(); + sc->mastering = av_mastering_display_metadata_alloc_size(&sc->mastering_size); if (!sc->mastering) return AVERROR(ENOMEM); @@ -10043,7 +10043,7 @@ static int mov_read_header(AVFormatContext *s) if (sc->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 *)sc->mastering, sizeof(*sc->mastering), 0)) + (uint8_t *)sc->mastering, sc->mastering_size, 0)) return AVERROR(ENOMEM); sc->mastering = NULL;