Skip to content

Commit

Permalink
Автоматическое включение/выключение "Windows HDR" теперь работает и д…
Browse files Browse the repository at this point in the history
…ля Dolby Vision, так же как для обычного HDR контекста. Единственное отличие - это происходит не в момент инициализации а после получения первого сэмпла с Dovi метаданными.
  • Loading branch information
Aleksoid1978 committed Feb 15, 2024
1 parent 9bff85c commit 192e205
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Source/DX11VideoProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1422,7 +1422,7 @@ bool CDX11VideoProcessor::HandleHDRToggle()
{
m_bHdrDisplaySwitching = true;
bool bRet = false;
if (m_bHdrPassthrough && SourceIsPQorHLG()) {
if (m_bHdrPassthrough && SourceIsHDR()) {
MONITORINFOEXW mi = { sizeof(mi) };
GetMonitorInfoW(m_lastFullscreenHMonitor ? m_lastFullscreenHMonitor : MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTOPRIMARY), (MONITORINFO*)&mi);
DisplayConfig_t displayConfig = {};
Expand Down Expand Up @@ -2086,7 +2086,7 @@ HRESULT CDX11VideoProcessor::CopySample(IMediaSample* pSample)
}

memcpy(&m_Dovi.msd, pDOVIMetadata, sizeof(MediaSideDataDOVIMetadata));
const bool updateStats = !m_Dovi.bValid;
const bool doviStateChanged = !m_Dovi.bValid;
m_Dovi.bValid = true;

if (bMasteringLuminanceChanged) {
Expand Down Expand Up @@ -2114,7 +2114,7 @@ HRESULT CDX11VideoProcessor::CopySample(IMediaSample* pSample)
if (m_D3D11VP.IsReady()) {
InitMediaType(&m_pFilter->m_inputMT);
}
else if (updateStats) {
else if (doviStateChanged) {
UpdateStatsStatic();
}

Expand All @@ -2135,9 +2135,12 @@ HRESULT CDX11VideoProcessor::CopySample(IMediaSample* pSample)
}
}

if (m_bHdrPassthrough && m_bHdrPassthroughSupport && !SourceIsPQorHLG() && !m_pDXGISwapChain4) {
if (doviStateChanged && !SourceIsPQorHLG()) {
ReleaseSwapChain();
Init(m_hWnd);

m_srcVideoTransferFunction = 0;
InitMediaType(&m_pFilter->m_inputMT);
}
}
}
Expand Down

0 comments on commit 192e205

Please sign in to comment.