Skip to content

Commit

Permalink
Improves 'F11' key behaviour (manual HDR toggle)
Browse files Browse the repository at this point in the history
* In auto HDR mode (default), F11 key is disabled while a video is playing (can still be used from kodi GUI).
* In manual HDR mode is now possible toggle HDR on the fly while HDR video is playing (toggles between HDR passthrough or HDR tonemapped).
  • Loading branch information
thexai committed Sep 13, 2020
1 parent 1cd618c commit 7a9bf1c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions xbmc/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1667,6 +1667,12 @@ bool CApplication::OnAction(const CAction &action)
// Display HDR : toggle HDR on/off
if (action.GetID() == ACTION_HDR_TOGGLE)
{
// Only enables manual HDR toggle if no video is playing or auto HDR switch is disabled
if (m_appPlayer.IsPlayingVideo() &&
CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(
CServiceBroker::GetWinSystem()->SETTING_WINSYSTEM_IS_HDR_DISPLAY))
return true;

HDR_STATUS hdrStatus = CServiceBroker::GetWinSystem()->ToggleHDR();

if (hdrStatus == HDR_STATUS::HDR_OFF)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,13 @@ void CRendererBase::ProcessHDR(CRenderBuffer* rb)
}

if (!DX::Windowing()->IsHDROutput())
{
if (m_lastHdr10.RedPrimary[0] != 0)
m_lastHdr10 = {};
if (m_HdrType != HDR_TYPE::HDR_NONE_SDR)
m_HdrType = HDR_TYPE::HDR_NONE_SDR;
return;
}

// HDR10
if (rb->color_transfer == AVCOL_TRC_SMPTE2084 && rb->primaries == AVCOL_PRI_BT2020)
Expand Down Expand Up @@ -579,6 +585,7 @@ void CRendererBase::ProcessHDR(CRenderBuffer* rb)
DX::Windowing()->SetHdrColorSpace(DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709);
m_HdrType = HDR_TYPE::HDR_NONE_SDR;
m_iCntMetaData = 0;
m_lastHdr10 = {};
if (m_AutoSwitchHDR)
DX::Windowing()->ToggleHDR(); // Toggle display HDR OFF
}
Expand Down

0 comments on commit 7a9bf1c

Please sign in to comment.