Skip to content

Commit

Permalink
Do not show video renderer error message when capturing
Browse files Browse the repository at this point in the history
  • Loading branch information
clsid2 committed Dec 18, 2023
1 parent 44c5e5e commit 066cd44
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
35 changes: 20 additions & 15 deletions src/mpc-hc/FGManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ CFGManager::CFGManager(LPCTSTR pName, LPUNKNOWN pUnk, HWND hWnd, bool IsPreview)
, m_bIsPreview(IsPreview)
, m_bPreviewSupportsRotation(false)
, m_ignoreVideo(false)
, m_bIsCapture(false)
, m_source()
, m_transform()
, m_override()
Expand Down Expand Up @@ -819,21 +820,23 @@ HRESULT CFGManager::Connect(IPin* pPinOut, IPin* pPinIn, bool bContinueRender)
CInterfaceList<IUnknown, &IID_IUnknown> pUnks;
if (FAILED(pFGF->Create(&pBF, pUnks))) {
TRACE(_T("FGM: Filter creation failed\n"));
// Check if selected video renderer fails to load
CLSID filter = pFGF->GetCLSID();
if (filter == CLSID_MPCVRAllocatorPresenter || filter == CLSID_madVRAllocatorPresenter || filter == CLSID_DXRAllocatorPresenter) {
if (IDYES == AfxMessageBox(_T("The selected video renderer has failed to load.\n\nThe player will now fallback to using a basic video renderer, which has reduced performance and quality. Subtitles may also fail to load.\n\nDo you want to change settings to use the default video renderer (EVR-CP/VMR9)? (player restart required)"), MB_ICONEXCLAMATION | MB_YESNO, 0)) {
CAppSettings& s = AfxGetAppSettings();
s.iDSVideoRendererType = IsCLSIDRegistered(CLSID_EnhancedVideoRenderer) ? VIDRNDT_DS_EVR_CUSTOM : VIDRNDT_DS_VMR9RENDERLESS;
}
} else if (filter == CLSID_EVRAllocatorPresenter || filter == CLSID_VMR9AllocatorPresenter) {
if (IDYES == AfxMessageBox(_T("The selected video renderer has failed to load.\n\nThis problem is often caused by a bug in the graphics driver. Or you may be using a generic driver which has limited capabilities. It is recommended to update the graphics driver to solve this problem. A proper driver is required for optimal video playback performance and quality.\n\nThe player will now fallback to using a basic video renderer, which has reduced performance and quality. Subtitles may also fail to load.\n\nYou can select a different renderer here:\nOptions > playback > Output\n\nDo you want to use the basic video renderer by default?"), MB_ICONEXCLAMATION | MB_YESNO, 0)) {
CAppSettings& s = AfxGetAppSettings();
s.iDSVideoRendererType = IsCLSIDRegistered(CLSID_EnhancedVideoRenderer) ? VIDRNDT_DS_EVR : VIDRNDT_DS_VMR9WINDOWED;
s.SetSubtitleRenderer(CAppSettings::SubtitleRenderer::VS_FILTER);
// Disable DXVA in internal video decoder
CMPlayerCApp* pApp = AfxGetMyApp();
pApp->WriteProfileInt(IDS_R_INTERNAL_LAVVIDEO_HWACCEL, _T("HWAccel"), 0);
if (!m_bIsCapture) {
// Check if selected video renderer fails to load
CLSID filter = pFGF->GetCLSID();
if (filter == CLSID_MPCVRAllocatorPresenter || filter == CLSID_madVRAllocatorPresenter || filter == CLSID_DXRAllocatorPresenter) {
if (IDYES == AfxMessageBox(_T("The selected video renderer has failed to load.\n\nThe player will now fallback to using a basic video renderer, which has reduced performance and quality. Subtitles may also fail to load.\n\nDo you want to change settings to use the default video renderer (EVR-CP/VMR9)? (player restart required)"), MB_ICONEXCLAMATION | MB_YESNO, 0)) {
CAppSettings& s = AfxGetAppSettings();
s.iDSVideoRendererType = IsCLSIDRegistered(CLSID_EnhancedVideoRenderer) ? VIDRNDT_DS_EVR_CUSTOM : VIDRNDT_DS_VMR9RENDERLESS;
}
} else if (filter == CLSID_EVRAllocatorPresenter || filter == CLSID_VMR9AllocatorPresenter) {
if (IDYES == AfxMessageBox(_T("The selected video renderer has failed to load.\n\nThis problem is often caused by a bug in the graphics driver. Or you may be using a generic driver which has limited capabilities. It is recommended to update the graphics driver to solve this problem. A proper driver is required for optimal video playback performance and quality.\n\nThe player will now fallback to using a basic video renderer, which has reduced performance and quality. Subtitles may also fail to load.\n\nYou can select a different renderer here:\nOptions > playback > Output\n\nDo you want to use the basic video renderer by default?"), MB_ICONEXCLAMATION | MB_YESNO, 0)) {
CAppSettings& s = AfxGetAppSettings();
s.iDSVideoRendererType = IsCLSIDRegistered(CLSID_EnhancedVideoRenderer) ? VIDRNDT_DS_EVR : VIDRNDT_DS_VMR9WINDOWED;
s.SetSubtitleRenderer(CAppSettings::SubtitleRenderer::VS_FILTER);
// Disable DXVA in internal video decoder
CMPlayerCApp* pApp = AfxGetMyApp();
pApp->WriteProfileInt(IDS_R_INTERNAL_LAVVIDEO_HWACCEL, _T("HWAccel"), 0);
}
}
}
continue;
Expand Down Expand Up @@ -2977,6 +2980,8 @@ CFGManagerCapture::CFGManagerCapture(LPCTSTR pName, LPUNKNOWN pUnk, HWND hWnd)
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_NULL);
m_transform.AddTail(pFGF);
}

m_bIsCapture = True;
}

//
Expand Down
2 changes: 2 additions & 0 deletions src/mpc-hc/FGManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ class CFGManager
HWND m_hWnd;
bool m_bIsPreview,m_bPreviewSupportsRotation;
CStringW m_entryRFS;
bool m_bIsCapture;

public:
CFGManager(LPCTSTR pName, LPUNKNOWN pUnk, HWND hWnd = 0, bool IsPreview = false);
virtual ~CFGManager();
Expand Down

0 comments on commit 066cd44

Please sign in to comment.