10 #include "libavutil/mastering_display_metadata.h"
14 {
return static_cast<uint16_t>(std::round(x)); }
28 const AVContentLightMetadata* Light)
30 bool luminance = Display && Display->has_luminance;
31 bool primaries = Display && Display->has_primaries;
36 for (
size_t i = 0; i < 3; i++)
54 const auto * display = av_frame_get_side_data(AvFrame, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA);
55 const auto * ddata = display ?
reinterpret_cast<AVMasteringDisplayMetadata*
>(display->data) :
nullptr;
56 const auto *
content = av_frame_get_side_data(AvFrame, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL);
57 const auto * cdata =
content ?
reinterpret_cast<AVContentLightMetadata*
>(
content->data) :
nullptr;
60 if (!
Frame->m_hdrMetadata.get())
61 Frame->m_hdrMetadata = std::make_shared<MythHDRVideoMetadata>();
62 Frame->m_hdrMetadata->Update(ddata, cdata);
66 Frame->m_hdrMetadata =
nullptr;