aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2024-06-19 15:19:49 -0300
committerJames Almer <jamrial@gmail.com>2024-06-20 17:04:03 -0300
commit8a85d3fd39a0ab12c92c130c6e1764336854632f (patch)
tree78fc69c4f6328168990e458e543c958a8e09629b
parentc3606cad9cffded4620af07287606d4d97f29bf1 (diff)
downloadffmpeg-8a85d3fd39a0ab12c92c130c6e1764336854632f.tar.gz
avformat/matroskadec: don't use sizeof(AVMasteringDisplayMetadata)
It's not part of the libavutil ABI. Signed-off-by: James Almer <jamrial@gmail.com>
-rw-r--r--libavformat/matroskadec.c16
1 files 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);