|
|
|
@ -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; |
|
|
|
|
} |
|
|
|
|