From 06c344d43a2e92f04b9c1490d70b0fce4e4f3fb2 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Tue, 22 Oct 2024 13:20:30 +1100 Subject: [PATCH] decklinkvideosink: provide default values when HDR metadata is not available Some file format standards don't require mastering-display-info and content-light-level values to be provided. Decklink however requires the static HDR metdata for the PQ transfer function which we may not have. CTA-861-G mentions that in this case, 0 may provided as an 'unknown' value which is what we use here. Part-of: --- .../sys/decklink/gstdecklinkvideosink.cpp | 63 +++++++++++-------- 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/subprojects/gst-plugins-bad/sys/decklink/gstdecklinkvideosink.cpp b/subprojects/gst-plugins-bad/sys/decklink/gstdecklinkvideosink.cpp index b6618f5767..9eda700727 100644 --- a/subprojects/gst-plugins-bad/sys/decklink/gstdecklinkvideosink.cpp +++ b/subprojects/gst-plugins-bad/sys/decklink/gstdecklinkvideosink.cpp @@ -333,7 +333,8 @@ public: BMDFrameFlags flags = m_dframe ? m_dframe->GetFlags () : bmdFrameFlagDefault; if (have_mastering_info || have_light_level || - colorimetry.transfer == GST_VIDEO_TRANSFER_ARIB_STD_B67) { + colorimetry.transfer == GST_VIDEO_TRANSFER_ARIB_STD_B67 || + colorimetry.transfer == GST_VIDEO_TRANSFER_SMPTE2084) { flags |= bmdFrameContainsHDRMetadata; } @@ -461,75 +462,87 @@ public: case bmdDeckLinkFrameMetadataHDRDisplayPrimariesRedX: if (have_mastering_info) { *value = (double) mastering_info.display_primaries[0].x / 50000.0; - return S_OK; + } else { + *value = 0.0; } - return E_INVALIDARG; + return S_OK; case bmdDeckLinkFrameMetadataHDRDisplayPrimariesRedY: if (have_mastering_info) { *value = (double) mastering_info.display_primaries[0].y / 50000.0; - return S_OK; + } else { + *value = 0.0; } - return E_INVALIDARG; + return S_OK; case bmdDeckLinkFrameMetadataHDRDisplayPrimariesGreenX: if (have_mastering_info) { *value = (double) mastering_info.display_primaries[1].x / 50000.0; - return S_OK; + } else { + *value = 0.0; } - return E_INVALIDARG; + return S_OK; case bmdDeckLinkFrameMetadataHDRDisplayPrimariesGreenY: if (have_mastering_info) { *value = (double) mastering_info.display_primaries[1].y / 50000.0; - return S_OK; + } else { + *value = 0.0; } - return E_INVALIDARG; + return S_OK; case bmdDeckLinkFrameMetadataHDRDisplayPrimariesBlueX: if (have_mastering_info) { *value = (double) mastering_info.display_primaries[2].x / 50000.0; - return S_OK; + } else { + *value = 0.0; } - return E_INVALIDARG; + return S_OK; case bmdDeckLinkFrameMetadataHDRDisplayPrimariesBlueY: if (have_mastering_info) { *value = (double) mastering_info.display_primaries[2].y / 50000.0; - return S_OK; + } else { + *value = 0.0; } - return E_INVALIDARG; + return S_OK; case bmdDeckLinkFrameMetadataHDRWhitePointX: if (have_mastering_info) { *value = (double) mastering_info.white_point.x / 50000.0; - return S_OK; + } else { + *value = 0.0; } - return E_INVALIDARG; + return S_OK; case bmdDeckLinkFrameMetadataHDRWhitePointY: if (have_mastering_info) { *value = (double) mastering_info.white_point.y / 50000.0; - return S_OK; + } else { + *value = 0.0; } - return E_INVALIDARG; + return S_OK; case bmdDeckLinkFrameMetadataHDRMaxDisplayMasteringLuminance: if (have_mastering_info) { *value = (double) mastering_info.max_display_mastering_luminance * 65535.0 / 10000.0; - return S_OK; + } else { + *value = 0.0; } - return E_INVALIDARG; + return S_OK; case bmdDeckLinkFrameMetadataHDRMinDisplayMasteringLuminance: if (have_mastering_info) { *value = (double) mastering_info.min_display_mastering_luminance * 6.55350 / 10000.0; - return S_OK; + } else { + *value = 0.0; } - return E_INVALIDARG; + return S_OK; case bmdDeckLinkFrameMetadataHDRMaximumContentLightLevel: if (have_light_level) { *value = (double) light_level.max_content_light_level; - return S_OK; + } else { + *value = 0.0; } - return E_INVALIDARG; + return S_OK; case bmdDeckLinkFrameMetadataHDRMaximumFrameAverageLightLevel: if (have_light_level) { *value = (double) light_level.max_frame_average_light_level; - return S_OK; + } else { + *value = 0.0; } - return E_INVALIDARG; + return S_OK; default: return E_INVALIDARG; }