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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7742>
This commit is contained in:
Matthew Waters 2024-10-22 13:20:30 +11:00 committed by GStreamer Marge Bot
parent a509a1fd40
commit 06c344d43a

View file

@ -333,7 +333,8 @@ public:
BMDFrameFlags flags = m_dframe ? m_dframe->GetFlags () : bmdFrameFlagDefault; BMDFrameFlags flags = m_dframe ? m_dframe->GetFlags () : bmdFrameFlagDefault;
if (have_mastering_info || have_light_level || 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; flags |= bmdFrameContainsHDRMetadata;
} }
@ -461,75 +462,87 @@ public:
case bmdDeckLinkFrameMetadataHDRDisplayPrimariesRedX: case bmdDeckLinkFrameMetadataHDRDisplayPrimariesRedX:
if (have_mastering_info) { if (have_mastering_info) {
*value = (double) mastering_info.display_primaries[0].x / 50000.0; *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: case bmdDeckLinkFrameMetadataHDRDisplayPrimariesRedY:
if (have_mastering_info) { if (have_mastering_info) {
*value = (double) mastering_info.display_primaries[0].y / 50000.0; *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: case bmdDeckLinkFrameMetadataHDRDisplayPrimariesGreenX:
if (have_mastering_info) { if (have_mastering_info) {
*value = (double) mastering_info.display_primaries[1].x / 50000.0; *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: case bmdDeckLinkFrameMetadataHDRDisplayPrimariesGreenY:
if (have_mastering_info) { if (have_mastering_info) {
*value = (double) mastering_info.display_primaries[1].y / 50000.0; *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: case bmdDeckLinkFrameMetadataHDRDisplayPrimariesBlueX:
if (have_mastering_info) { if (have_mastering_info) {
*value = (double) mastering_info.display_primaries[2].x / 50000.0; *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: case bmdDeckLinkFrameMetadataHDRDisplayPrimariesBlueY:
if (have_mastering_info) { if (have_mastering_info) {
*value = (double) mastering_info.display_primaries[2].y / 50000.0; *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: case bmdDeckLinkFrameMetadataHDRWhitePointX:
if (have_mastering_info) { if (have_mastering_info) {
*value = (double) mastering_info.white_point.x / 50000.0; *value = (double) mastering_info.white_point.x / 50000.0;
return S_OK; } else {
*value = 0.0;
} }
return E_INVALIDARG; return S_OK;
case bmdDeckLinkFrameMetadataHDRWhitePointY: case bmdDeckLinkFrameMetadataHDRWhitePointY:
if (have_mastering_info) { if (have_mastering_info) {
*value = (double) mastering_info.white_point.y / 50000.0; *value = (double) mastering_info.white_point.y / 50000.0;
return S_OK; } else {
*value = 0.0;
} }
return E_INVALIDARG; return S_OK;
case bmdDeckLinkFrameMetadataHDRMaxDisplayMasteringLuminance: case bmdDeckLinkFrameMetadataHDRMaxDisplayMasteringLuminance:
if (have_mastering_info) { if (have_mastering_info) {
*value = (double) mastering_info.max_display_mastering_luminance * 65535.0 / 10000.0; *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: case bmdDeckLinkFrameMetadataHDRMinDisplayMasteringLuminance:
if (have_mastering_info) { if (have_mastering_info) {
*value = (double) mastering_info.min_display_mastering_luminance * 6.55350 / 10000.0; *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: case bmdDeckLinkFrameMetadataHDRMaximumContentLightLevel:
if (have_light_level) { if (have_light_level) {
*value = (double) light_level.max_content_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: case bmdDeckLinkFrameMetadataHDRMaximumFrameAverageLightLevel:
if (have_light_level) { if (have_light_level) {
*value = (double) light_level.max_frame_average_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: default:
return E_INVALIDARG; return E_INVALIDARG;
} }