[FFmpeg-cvslog] avformat/matroskadec: don't use sizeof(AVMasteringDisplayMetadata)
James Almer
git at videolan.org
Thu Jun 20 23:17:18 EEST 2024
ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Wed Jun 19 15:19:49 2024 -0300| [8a85d3fd39a0ab12c92c130c6e1764336854632f] | committer: James Almer
avformat/matroskadec: 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=8a85d3fd39a0ab12c92c130c6e1764336854632f
---
libavformat/matroskadec.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 328109b354..6bc5fa621e 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -2324,15 +2324,15 @@ static int mkv_parse_video_color(AVStream *st, const MatroskaTrack *track) {
}
if (has_mastering_primaries || has_mastering_luminance) {
- AVMasteringDisplayMetadata *metadata;
- AVPacketSideData *sd = av_packet_side_data_new(&st->codecpar->coded_side_data,
- &st->codecpar->nb_coded_side_data,
- AV_PKT_DATA_MASTERING_DISPLAY_METADATA,
- sizeof(AVMasteringDisplayMetadata), 0);
- if (!sd)
+ size_t size = 0;
+ AVMasteringDisplayMetadata *metadata = av_mastering_display_metadata_alloc_size(&size);
+ if (!metadata)
+ return AVERROR(ENOMEM);
+ if (!av_packet_side_data_add(&st->codecpar->coded_side_data, &st->codecpar->nb_coded_side_data,
+ AV_PKT_DATA_MASTERING_DISPLAY_METADATA, metadata, size, 0)) {
+ av_freep(&metadata);
return AVERROR(ENOMEM);
- metadata = (AVMasteringDisplayMetadata*)sd->data;
- memset(metadata, 0, sizeof(AVMasteringDisplayMetadata));
+ }
if (has_mastering_primaries) {
metadata->display_primaries[0][0] = av_d2q(mastering_meta->r_x, INT_MAX);
metadata->display_primaries[0][1] = av_d2q(mastering_meta->r_y, INT_MAX);
More information about the ffmpeg-cvslog
mailing list