diff --git a/libavutil/mastering_display_metadata.c b/libavutil/mastering_display_metadata.c index ea41f13f9d..dd37ed7d0e 100644 --- a/libavutil/mastering_display_metadata.c +++ b/libavutil/mastering_display_metadata.c @@ -25,9 +25,20 @@ #include "mastering_display_metadata.h" #include "mem.h" +static void get_defaults(AVMasteringDisplayMetadata *mastering) +{ + for (int i = 0; i < 3; i++) + for (int j = 0; j < 2; j++) + mastering->display_primaries[i][j] = (AVRational) { 0, 1 }; + mastering->white_point[0] = + mastering->white_point[1] = + mastering->min_luminance = + mastering->max_luminance = (AVRational) { 0, 1 }; +} + AVMasteringDisplayMetadata *av_mastering_display_metadata_alloc(void) { - return av_mallocz(sizeof(AVMasteringDisplayMetadata)); + return av_mastering_display_metadata_alloc_size(NULL); } AVMasteringDisplayMetadata *av_mastering_display_metadata_alloc_size(size_t *size) @@ -36,6 +47,8 @@ AVMasteringDisplayMetadata *av_mastering_display_metadata_alloc_size(size_t *siz if (!mastering) return NULL; + get_defaults(mastering); + if (size) *size = sizeof(*mastering); @@ -51,6 +64,7 @@ AVMasteringDisplayMetadata *av_mastering_display_metadata_create_side_data(AVFra return NULL; memset(side_data->data, 0, sizeof(AVMasteringDisplayMetadata)); + get_defaults((AVMasteringDisplayMetadata *)side_data->data); return (AVMasteringDisplayMetadata *)side_data->data; } diff --git a/libavutil/version.h b/libavutil/version.h index 4f51d441fa..9c24b64032 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -80,7 +80,7 @@ #define LIBAVUTIL_VERSION_MAJOR 59 #define LIBAVUTIL_VERSION_MINOR 24 -#define LIBAVUTIL_VERSION_MICRO 101 +#define LIBAVUTIL_VERSION_MICRO 102 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \