Skip to content

Commit

Permalink
Tweak handling of video renderer failure.
Browse files Browse the repository at this point in the history
  • Loading branch information
clsid2 committed Jun 8, 2021
1 parent edd12ed commit 728958c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
6 changes: 0 additions & 6 deletions src/mpc-hc/FGFilterLAV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@

#define LAV_FILTERS_VERSION(major, minor, rev, commit) ((QWORD)(major) << 48 | (QWORD)(minor) << 32 | (QWORD)(rev) << 16 | (QWORD)(commit))

#define IDS_R_INTERNAL_LAVSPLITTER IDS_R_INTERNAL_FILTERS _T("\\LAVSplitter")
#define IDS_R_INTERNAL_LAVVIDEO IDS_R_INTERNAL_FILTERS _T("\\LAVVideo")
#define IDS_R_INTERNAL_LAVVIDEO_OUTPUTFORMAT IDS_R_INTERNAL_LAVVIDEO _T("\\OutputFormat")
#define IDS_R_INTERNAL_LAVVIDEO_HWACCEL IDS_R_INTERNAL_LAVVIDEO _T("\\HWAccel")
#define IDS_R_INTERNAL_LAVAUDIO IDS_R_INTERNAL_FILTERS _T("\\LAVAudio")

#ifndef _WIN64
#define LAVFILTERS_DIR _T("LAVFilters\\")
#else
Expand Down
6 changes: 6 additions & 0 deletions src/mpc-hc/FGFilterLAV.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ DEFINE_GUID(GUID_LAVAudio, 0xE8E73B6B, 0x4CB3, 0x44A4, 0xBE, 0x99, 0x4F, 0x7B, 0
#include "LAVFilters/src/decoder/LAVVideo/LAVVideoSettings.h"
#include "LAVFilters/src/decoder/LAVAudio/LAVAudioSettings.h"

#define IDS_R_INTERNAL_LAVSPLITTER IDS_R_INTERNAL_FILTERS _T("\\LAVSplitter")
#define IDS_R_INTERNAL_LAVVIDEO IDS_R_INTERNAL_FILTERS _T("\\LAVVideo")
#define IDS_R_INTERNAL_LAVVIDEO_OUTPUTFORMAT IDS_R_INTERNAL_LAVVIDEO _T("\\OutputFormat")
#define IDS_R_INTERNAL_LAVVIDEO_HWACCEL IDS_R_INTERNAL_LAVVIDEO _T("\\HWAccel")
#define IDS_R_INTERNAL_LAVAUDIO IDS_R_INTERNAL_FILTERS _T("\\LAVAudio")

class CFGFilterLAV : public CFGFilterFile
{
protected:
Expand Down
12 changes: 10 additions & 2 deletions src/mpc-hc/FGManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -766,11 +766,19 @@ HRESULT CFGManager::Connect(IPin* pPinOut, IPin* pPinIn, bool bContinueRender)
TRACE(_T(" --> Filter creation failed\n"));
// Check if selected video renderer fails to load
CLSID filter = pFGF->GetCLSID();
if (filter == CLSID_EVRAllocatorPresenter || filter == CLSID_VMR9AllocatorPresenter || filter == CLSID_MPCVRAllocatorPresenter || filter == CLSID_madVRAllocatorPresenter || filter == CLSID_DXRAllocatorPresenter) {
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 for current video.\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)) {
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

0 comments on commit 728958c

Please sign in to comment.