Skip to content

Commit

Permalink
CVideoLayerBridgeDRMPRIME add colourspace connector property
Browse files Browse the repository at this point in the history
  • Loading branch information
lrusak authored and johnrvt committed Dec 29, 2020
1 parent 7d43dbe commit 7ebc733
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
12 changes: 12 additions & 0 deletions xbmc/cores/VideoPlayer/Buffers/VideoBufferDRMPRIME.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ extern "C"
namespace DRMPRIME
{

std::string GetColorimetry(const VideoPicture& picture)
{
switch (picture.color_space)
{
case AVCOL_SPC_BT2020_CL:
case AVCOL_SPC_BT2020_NCL:
return "BT2020_RGB";
}

return "Default";
}

std::string GetColorEncoding(const VideoPicture& picture)
{
switch (picture.color_space)
Expand Down
1 change: 1 addition & 0 deletions xbmc/cores/VideoPlayer/Buffers/VideoBufferDRMPRIME.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ enum hdmi_eotf
HDMI_EOTF_BT_2100_HLG,
};

std::string GetColorimetry(const VideoPicture& picture);
std::string GetColorEncoding(const VideoPicture& picture);
std::string GetColorRange(const VideoPicture& picture);
uint8_t GetEOTF(const VideoPicture& picture);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,18 @@ void CVideoLayerBridgeDRMPRIME::Disable()
m_DRM->AddProperty(plane, "FB_ID", 0);
m_DRM->AddProperty(plane, "CRTC_ID", 0);

// disable HDR metadata
auto connector = m_DRM->GetConnector();

bool result;
uint64_t value;
std::tie(result, value) = connector->GetPropertyValue("Colorspace", "Default");
if (result)
{
CLog::Log(LOGDEBUG, "CVideoLayerBridgeDRMPRIME::{} - setting connector colorspace to Default", __FUNCTION__);
m_DRM->AddProperty(connector, "Colorspace", value);
}

// disable HDR metadata
if (connector->SupportsProperty("HDR_OUTPUT_METADATA"))
{
m_DRM->AddProperty(connector, "HDR_OUTPUT_METADATA", 0);
Expand Down Expand Up @@ -173,6 +183,16 @@ void CVideoLayerBridgeDRMPRIME::Configure(CVideoBufferDRMPRIME* buffer)
m_DRM->AddProperty(plane, "COLOR_RANGE", value);

auto connector = m_DRM->GetConnector();

std::tie(result, value) = connector->GetPropertyValue("Colorspace", GetColorimetry(picture));
if (result)
{
CLog::Log(LOGDEBUG, "CVideoLayerBridgeDRMPRIME::{} - setting connector colorspace to {}", __FUNCTION__,
GetColorimetry(picture));
m_DRM->AddProperty(connector, "Colorspace", value);
m_DRM->SetActive(true);
}

if (connector->SupportsProperty("HDR_OUTPUT_METADATA"))
{
m_hdr_metadata.metadata_type = HDMI_STATIC_METADATA_TYPE1;
Expand Down

0 comments on commit 7ebc733

Please sign in to comment.