From 3a95585f1517a10b7a078d19cb44afd26c6421d5 Mon Sep 17 00:00:00 2001 From: clsid2 Date: Sat, 20 Jun 2020 15:10:56 +0200 Subject: [PATCH 01/10] [MPC-HC] Use our own ffmpeg clone repository. WARNING: This should be the first custom commit in our fork and its title should not be modified. --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 3296ec1a8..e474117da 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "ffmpeg"] path = ffmpeg - url = git://git.1f0.de/ffmpeg.git + url = https://github.com/clsid2/FFmpeg.git [submodule "libbluray"] path = libbluray url = git://git.1f0.de/libbluray.git From 63ed72866a7a9673334ad553c534528e1fcfcd46 Mon Sep 17 00:00:00 2001 From: Underground78 Date: Sat, 28 Sep 2013 17:30:14 +0200 Subject: [PATCH 02/10] Tray icon: Add an optional custom callback for "show property page" events. Signed-off-by: clsid2 --- common/DSUtilLite/BaseTrayIcon.cpp | 23 ++++++++++++++++++----- common/DSUtilLite/BaseTrayIcon.h | 2 ++ common/includes/LAVSplitterSettings.h | 10 ++++++++++ decoder/LAVAudio/LAVAudio.cpp | 12 ++++++++++++ decoder/LAVAudio/LAVAudio.h | 5 +++++ decoder/LAVAudio/LAVAudioSettings.h | 11 +++++++++++ decoder/LAVVideo/LAVVideo.cpp | 13 +++++++++++++ decoder/LAVVideo/LAVVideo.h | 5 +++++ decoder/LAVVideo/LAVVideoSettings.h | 11 +++++++++++ demuxer/LAVSplitter/LAVSplitter.cpp | 12 ++++++++++++ demuxer/LAVSplitter/LAVSplitter.h | 5 +++++ 11 files changed, 104 insertions(+), 5 deletions(-) diff --git a/common/DSUtilLite/BaseTrayIcon.cpp b/common/DSUtilLite/BaseTrayIcon.cpp index c70283ff5..17e8cf7d3 100644 --- a/common/DSUtilLite/BaseTrayIcon.cpp +++ b/common/DSUtilLite/BaseTrayIcon.cpp @@ -187,13 +187,26 @@ HRESULT CBaseTrayIcon::CreateTrayIconData() HRESULT CBaseTrayIcon::OpenPropPage() { CheckPointer(m_pFilter, E_UNEXPECTED); + HRESULT hr = E_UNEXPECTED; + m_bPropPageOpen = TRUE; - RECT desktopRect; - GetWindowRect(GetDesktopWindow(), &desktopRect); - SetWindowPos(m_hWnd, 0, (desktopRect.right / 2) - PROP_WIDTH_OFFSET, (desktopRect.bottom / 2) - PROP_HEIGHT_OFFSET, - 0, 0, SWP_NOZORDER | SWP_NOSIZE); - CBaseDSPropPage::ShowPropPageDialog(m_pFilter, m_hWnd); + if (!m_fpCustomOpenPropPage) { + RECT desktopRect; + GetWindowRect(GetDesktopWindow(), &desktopRect); + SetWindowPos(m_hWnd, 0, (desktopRect.right / 2) - PROP_WIDTH_OFFSET, (desktopRect.bottom / 2) - PROP_HEIGHT_OFFSET, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + CBaseDSPropPage::ShowPropPageDialog(m_pFilter, m_hWnd); + hr = S_OK; + } else { + hr = m_fpCustomOpenPropPage(m_pFilter); + } m_bPropPageOpen = FALSE; + + return hr; +} + +HRESULT CBaseTrayIcon::SetCustomOpenPropPage(HRESULT (*fpCustomOpenPropPage)(IBaseFilter* pFilter)) +{ + m_fpCustomOpenPropPage = fpCustomOpenPropPage; return S_OK; } diff --git a/common/DSUtilLite/BaseTrayIcon.h b/common/DSUtilLite/BaseTrayIcon.h index aeea8346d..423280c66 100644 --- a/common/DSUtilLite/BaseTrayIcon.h +++ b/common/DSUtilLite/BaseTrayIcon.h @@ -28,6 +28,7 @@ class CBaseTrayIcon virtual ~CBaseTrayIcon(void); static BOOL ProcessBlackList(); + HRESULT SetCustomOpenPropPage(HRESULT (*fpCustomOpenPropPage)(IBaseFilter* pFilter)); protected: virtual HRESULT CreateTrayIconData(); @@ -56,6 +57,7 @@ class CBaseTrayIcon HANDLE m_hThread = 0; HWND m_hWnd = 0; BOOL m_bPropPageOpen = FALSE; + HRESULT (*m_fpCustomOpenPropPage)(IBaseFilter* pFilter) = nullptr; WCHAR m_wszClassName[64]; const WCHAR *m_wszName = nullptr; diff --git a/common/includes/LAVSplitterSettings.h b/common/includes/LAVSplitterSettings.h index 3b2c352f2..e72f3db9b 100644 --- a/common/includes/LAVSplitterSettings.h +++ b/common/includes/LAVSplitterSettings.h @@ -24,6 +24,9 @@ // {774A919D-EA95-4A87-8A1E-F48ABE8499C7} DEFINE_GUID(IID_ILAVFSettings, 0x774a919d, 0xea95, 0x4a87, 0x8a, 0x1e, 0xf4, 0x8a, 0xbe, 0x84, 0x99, 0xc7); +// {77C1027F-BF53-458F-82CE-9DD88A2C300B} +DEFINE_GUID(IID_ILAVFSettingsMPCHCCustom, 0x77c1027f, 0xbf53, 0x458f, 0x82, 0xce, 0x9d, 0xd8, 0x8a, 0x2c, 0x30, 0xb); + typedef enum LAVSubtitleMode { LAVSubtitleMode_NoSubs, @@ -193,3 +196,10 @@ interface __declspec(uuid("774A919D-EA95-4A87-8A1E-F48ABE8499C7")) ILAVFSettings // Get the maximum queue size, in number of packets STDMETHOD_(DWORD, GetMaxQueueSize)() = 0; }; + +[uuid("77C1027F-BF53-458F-82CE-9DD88A2C300B")] +interface ILAVFSettingsMPCHCCustom : public IUnknown +{ + // Set a custom callback function to handle the property page + STDMETHOD(SetPropertyPageCallback)(HRESULT (*fpPropPageCallback)(IBaseFilter* pFilter)) = 0; +}; diff --git a/decoder/LAVAudio/LAVAudio.cpp b/decoder/LAVAudio/LAVAudio.cpp index 8694cd79c..d2c0ac696 100644 --- a/decoder/LAVAudio/LAVAudio.cpp +++ b/decoder/LAVAudio/LAVAudio.cpp @@ -124,6 +124,7 @@ STDMETHODIMP CLAVAudio::CreateTrayIcon() if (CBaseTrayIcon::ProcessBlackList()) return S_FALSE; m_pTrayIcon = new CBaseTrayIcon(this, TEXT(LAV_AUDIO), IDI_ICON1); + m_pTrayIcon->SetCustomOpenPropPage(m_fpPropPageCallback); return S_OK; } @@ -453,7 +454,9 @@ STDMETHODIMP CLAVAudio::NonDelegatingQueryInterface(REFIID riid, void **ppv) *ppv = nullptr; return QI(ISpecifyPropertyPages) QI(ISpecifyPropertyPages2) QI2(ILAVAudioSettings) + QI2(ILAVAudioSettingsMPCHCCustom) QI2(ILAVAudioStatus) __super::NonDelegatingQueryInterface(riid, ppv); + } // ISpecifyPropertyPages2 @@ -829,6 +832,15 @@ STDMETHODIMP_(BOOL) CLAVAudio::GetSampleConvertDithering() return m_settings.SampleConvertDither; } +// ILAVAudioSettingsMPCHCCustom +STDMETHODIMP CLAVAudio::SetPropertyPageCallback(HRESULT (*fpPropPageCallback)(IBaseFilter* pFilter)) +{ + m_fpPropPageCallback = fpPropPageCallback; + if (m_pTrayIcon) + m_pTrayIcon->SetCustomOpenPropPage(fpPropPageCallback); + return S_OK; +} + STDMETHODIMP CLAVAudio::SetSuppressFormatChanges(BOOL bEnabled) { m_settings.SuppressFormatChanges = bEnabled; diff --git a/decoder/LAVAudio/LAVAudio.h b/decoder/LAVAudio/LAVAudio.h index dca5a8cc1..9f1c5d558 100644 --- a/decoder/LAVAudio/LAVAudio.h +++ b/decoder/LAVAudio/LAVAudio.h @@ -80,6 +80,7 @@ class __declspec(uuid("E8E73B6B-4CB3-44A4-BE99-4F7BCB96E491")) CLAVAudio , public ISpecifyPropertyPages2 , public ILAVAudioSettings , public ILAVAudioStatus + , public ILAVAudioSettingsMPCHCCustom { public: CLAVAudio(LPUNKNOWN pUnk, HRESULT *phr); @@ -138,6 +139,9 @@ class __declspec(uuid("E8E73B6B-4CB3-44A4-BE99-4F7BCB96E491")) CLAVAudio STDMETHODIMP SetOutput51LegacyLayout(BOOL b51Legacy); STDMETHODIMP_(BOOL) GetOutput51LegacyLayout(); + // ILAVAudioSettingsMPCHCCustom + STDMETHODIMP SetPropertyPageCallback(HRESULT (*fpPropPageCallback)(IBaseFilter* pFilter)); + // ILAVAudioStatus STDMETHODIMP_(BOOL) IsSampleFormatSupported(LAVAudioSampleFormat sfCheck); STDMETHODIMP GetDecodeDetails(const char **pCodec, const char **pDecodeFormat, int *pnChannels, int *pSampleRate, @@ -396,4 +400,5 @@ class __declspec(uuid("E8E73B6B-4CB3-44A4-BE99-4F7BCB96E491")) CLAVAudio } m_raData; CBaseTrayIcon *m_pTrayIcon = nullptr; + HRESULT (*m_fpPropPageCallback)(IBaseFilter* pFilter) = nullptr; }; diff --git a/decoder/LAVAudio/LAVAudioSettings.h b/decoder/LAVAudio/LAVAudioSettings.h index 79855ee76..5c511828b 100644 --- a/decoder/LAVAudio/LAVAudioSettings.h +++ b/decoder/LAVAudio/LAVAudioSettings.h @@ -22,6 +22,10 @@ // {4158A22B-6553-45D0-8069-24716F8FF171} DEFINE_GUID(IID_ILAVAudioSettings, 0x4158a22b, 0x6553, 0x45d0, 0x80, 0x69, 0x24, 0x71, 0x6f, 0x8f, 0xf1, 0x71); +// {40A1D048-D41B-4D53-B737-FF9F99A245A0} +DEFINE_GUID(IID_ILAVAudioSettingsMPCHCCustom, + 0x40a1d048, 0xd41b, 0x4d53, 0xb7, 0x37, 0xff, 0x9f, 0x99, 0xa2, 0x45, 0xa0); + // {A668B8F2-BA87-4F63-9D41-768F7DE9C50E} DEFINE_GUID(IID_ILAVAudioStatus, 0xa668b8f2, 0xba87, 0x4f63, 0x9d, 0x41, 0x76, 0x8f, 0x7d, 0xe9, 0xc5, 0xe); @@ -201,6 +205,13 @@ interface __declspec(uuid("4158A22B-6553-45D0-8069-24716F8FF171")) ILAVAudioSett STDMETHOD(SetBitstreamingFallback)(BOOL bBitstreamingFallback) = 0; }; +[uuid("40A1D048-D41B-4D53-B737-FF9F99A245A0")] +interface ILAVAudioSettingsMPCHCCustom : public IUnknown +{ + // Set a custom callback function to handle the property page + STDMETHOD(SetPropertyPageCallback)(HRESULT (*fpPropPageCallback)(IBaseFilter* pFilter)) = 0; +}; + // LAV Audio Status Interface // Get the current playback stats interface __declspec(uuid("A668B8F2-BA87-4F63-9D41-768F7DE9C50E")) ILAVAudioStatus : public IUnknown diff --git a/decoder/LAVVideo/LAVVideo.cpp b/decoder/LAVVideo/LAVVideo.cpp index b540874b1..6110d3483 100644 --- a/decoder/LAVVideo/LAVVideo.cpp +++ b/decoder/LAVVideo/LAVVideo.cpp @@ -47,6 +47,7 @@ CLAVVideo::CLAVVideo(LPUNKNOWN pUnk, HRESULT *phr) : CTransformFilter(NAME("LAV Video Decoder"), 0, __uuidof(CLAVVideo)) , m_Decoder(this) + , m_fpPropPageCallback(NULL) { *phr = S_OK; m_pInput = new CVideoInputPin(TEXT("CVideoInputPin"), this, phr, L"Input"); @@ -98,6 +99,7 @@ HRESULT CLAVVideo::CreateTrayIcon() if (CBaseTrayIcon::ProcessBlackList()) return S_FALSE; m_pTrayIcon = new CBaseTrayIcon(this, TEXT(LAV_VIDEO), IDI_ICON1); + m_pTrayIcon->SetCustomOpenPropPage(m_fpPropPageCallback); return S_OK; } @@ -439,7 +441,9 @@ STDMETHODIMP CLAVVideo::NonDelegatingQueryInterface(REFIID riid, void **ppv) *ppv = nullptr; return QI(ISpecifyPropertyPages) QI(ISpecifyPropertyPages2) QI(IPropertyBag) QI2(ILAVVideoSettings) + QI2(ILAVVideoSettingsMPCHCCustom) QI2(ILAVVideoStatus) __super::NonDelegatingQueryInterface(riid, ppv); + } // ISpecifyPropertyPages2 @@ -2807,6 +2811,15 @@ STDMETHODIMP CLAVVideo::SetGPUDeviceIndex(DWORD dwDevice) return S_OK; } +// ILAVVideoSettingsMPCHCCustom +STDMETHODIMP CLAVVideo::SetPropertyPageCallback(HRESULT (*fpPropPageCallback)(IBaseFilter* pFilter)) +{ + m_fpPropPageCallback = fpPropPageCallback; + if (m_pTrayIcon) + m_pTrayIcon->SetCustomOpenPropPage(fpPropPageCallback); + return S_OK; +} + STDMETHODIMP_(DWORD) CLAVVideo::GetHWAccelNumDevices(LAVHWAccel hwAccel) { HRESULT hr = S_OK; diff --git a/decoder/LAVVideo/LAVVideo.h b/decoder/LAVVideo/LAVVideo.h index 595d60104..861e08259 100644 --- a/decoder/LAVVideo/LAVVideo.h +++ b/decoder/LAVVideo/LAVVideo.h @@ -66,6 +66,7 @@ class __declspec(uuid("EE30215D-164F-4A92-A4EB-9D4C13390F9F")) CLAVVideo , public ILAVVideoStatus , public ILAVVideoCallback , public IPropertyBag + , public ILAVVideoSettingsMPCHCCustom { public: CLAVVideo(LPUNKNOWN pUnk, HRESULT *phr); @@ -138,6 +139,9 @@ class __declspec(uuid("EE30215D-164F-4A92-A4EB-9D4C13390F9F")) CLAVVideo STDMETHODIMP SetGPUDeviceIndex(DWORD dwDevice); + // ILAVVideoSettingsMPCHCCustom + STDMETHODIMP SetPropertyPageCallback(HRESULT (*fpPropPageCallback)(IBaseFilter* pFilter)); + STDMETHODIMP_(DWORD) GetHWAccelNumDevices(LAVHWAccel hwAccel); STDMETHODIMP GetHWAccelDeviceInfo(LAVHWAccel hwAccel, DWORD dwIndex, BSTR *pstrDeviceName, DWORD *pdwDeviceIdentifier); @@ -366,6 +370,7 @@ class __declspec(uuid("EE30215D-164F-4A92-A4EB-9D4C13390F9F")) CLAVVideo DWORD m_dwGPUDeviceIndex = DWORD_MAX; CBaseTrayIcon *m_pTrayIcon = nullptr; + HRESULT (*m_fpPropPageCallback)(IBaseFilter* pFilter) = nullptr; #ifdef DEBUG FloatingAverage m_pixFmtTimingAvg; diff --git a/decoder/LAVVideo/LAVVideoSettings.h b/decoder/LAVVideo/LAVVideoSettings.h index bc0a8496b..409ed1c0f 100644 --- a/decoder/LAVVideo/LAVVideoSettings.h +++ b/decoder/LAVVideo/LAVVideoSettings.h @@ -22,6 +22,10 @@ // {FA40D6E9-4D38-4761-ADD2-71A9EC5FD32F} DEFINE_GUID(IID_ILAVVideoSettings, 0xfa40d6e9, 0x4d38, 0x4761, 0xad, 0xd2, 0x71, 0xa9, 0xec, 0x5f, 0xd3, 0x2f); +// {F3BB90A3-B1CE-48C1-954C-3A506A33DE25} +DEFINE_GUID(IID_ILAVVideoSettingsMPCHCCustom, +0xf3bb90a3, 0xb1ce, 0x48c1, 0x95, 0x4c, 0x3a, 0x50, 0x6a, 0x33, 0xde, 0x25); + // {1CC2385F-36FA-41B1-9942-5024CE0235DC} DEFINE_GUID(IID_ILAVVideoStatus, 0x1cc2385f, 0x36fa, 0x41b1, 0x99, 0x42, 0x50, 0x24, 0xce, 0x2, 0x35, 0xdc); @@ -402,6 +406,13 @@ interface __declspec(uuid("FA40D6E9-4D38-4761-ADD2-71A9EC5FD32F")) ILAVVideoSett STDMETHOD(SetEnableCCOutputPin)(BOOL bEnabled) = 0; }; +[uuid("F3BB90A3-B1CE-48C1-954C-3A506A33DE25")] +interface ILAVVideoSettingsMPCHCCustom : public IUnknown +{ + // Set a custom callback function to handle the property page + STDMETHOD(SetPropertyPageCallback)(HRESULT (*fpPropPageCallback)(IBaseFilter* pFilter)) = 0; +}; + // LAV Video status interface interface __declspec(uuid("1CC2385F-36FA-41B1-9942-5024CE0235DC")) ILAVVideoStatus : public IUnknown { diff --git a/demuxer/LAVSplitter/LAVSplitter.cpp b/demuxer/LAVSplitter/LAVSplitter.cpp index f7b750452..05154f8db 100644 --- a/demuxer/LAVSplitter/LAVSplitter.cpp +++ b/demuxer/LAVSplitter/LAVSplitter.cpp @@ -102,6 +102,7 @@ STDMETHODIMP CLAVSplitter::CreateTrayIcon() if (CBaseTrayIcon::ProcessBlackList()) return S_FALSE; m_pTrayIcon = new CLAVSplitterTrayIcon(this, TEXT(LAV_SPLITTER), IDI_ICON1); + m_pTrayIcon->SetCustomOpenPropPage(m_fpPropPageCallback); return S_OK; } @@ -326,7 +327,9 @@ STDMETHODIMP CLAVSplitter::NonDelegatingQueryInterface(REFIID riid, void **ppv) } return QI(IMediaSeeking) QI(IAMStreamSelect) QI(ISpecifyPropertyPages) QI(ISpecifyPropertyPages2) QI2(ILAVFSettings) + QI2(ILAVFSettingsMPCHCCustom) QI2(ILAVFSettingsInternal) QI(IObjectWithSite) QI(IBufferInfo) __super::NonDelegatingQueryInterface(riid, ppv); + } // ISpecifyPropertyPages2 @@ -2121,6 +2124,15 @@ STDMETHODIMP_(std::set &) CLAVSplitter::GetInputFormats() return m_InputFormats; } +// ILAVFSettingsMPCHCCustom +STDMETHODIMP CLAVSplitter::SetPropertyPageCallback(HRESULT (*fpPropPageCallback)(IBaseFilter* pFilter)) +{ + m_fpPropPageCallback = fpPropPageCallback; + if (m_pTrayIcon) + m_pTrayIcon->SetCustomOpenPropPage(fpPropPageCallback); + return S_OK; +} + CLAVSplitterSource::CLAVSplitterSource(LPUNKNOWN pUnk, HRESULT *phr) : CLAVSplitter(pUnk, phr) { diff --git a/demuxer/LAVSplitter/LAVSplitter.h b/demuxer/LAVSplitter/LAVSplitter.h index e3a337f5d..7da7e0fd0 100644 --- a/demuxer/LAVSplitter/LAVSplitter.h +++ b/demuxer/LAVSplitter/LAVSplitter.h @@ -61,6 +61,7 @@ class __declspec(uuid("171252A0-8820-4AFE-9DF8-5C92B2D66B04")) CLAVSplitter , public IAMStreamSelect , public IAMOpenProgress , public ILAVFSettingsInternal + , public ILAVFSettingsMPCHCCustom , public ISpecifyPropertyPages2 , public IObjectWithSite , public IBufferInfo @@ -175,6 +176,9 @@ class __declspec(uuid("171252A0-8820-4AFE-9DF8-5C92B2D66B04")) CLAVSplitter STDMETHODIMP SetMaxQueueSize(DWORD dwMaxSize); STDMETHODIMP_(DWORD) GetMaxQueueSize(); + // ILAVFSettingsMPCHCCustom + STDMETHODIMP SetPropertyPageCallback(HRESULT (*fpPropPageCallback)(IBaseFilter* pFilter)); + // ILAVSplitterSettingsInternal STDMETHODIMP_(LPCSTR) GetInputFormat() { @@ -339,6 +343,7 @@ class __declspec(uuid("171252A0-8820-4AFE-9DF8-5C92B2D66B04")) CLAVSplitter IUnknown *m_pSite = nullptr; CBaseTrayIcon *m_pTrayIcon = nullptr; + HRESULT (*m_fpPropPageCallback)(IBaseFilter* pFilter) = nullptr; }; class __declspec(uuid("B98D13E7-55DB-4385-A33D-09FD1BA26338")) CLAVSplitterSource : public CLAVSplitter From 93f8b438405474a27ff66422b104f5c889232ebd Mon Sep 17 00:00:00 2001 From: Underground78 Date: Sat, 20 Jun 2020 12:00:00 +0000 Subject: [PATCH 03/10] Fix the include directories for FFmpeg's out-of-source-tree build. Signed-off-by: clsid2 --- common/common.props | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/common.props b/common/common.props index 256cbd66d..7d3cebddb 100644 --- a/common/common.props +++ b/common/common.props @@ -24,6 +24,7 @@ + $(SolutionDir)bin_$(PlatformName)d\thirdparty\ffmpeg;%(AdditionalIncludeDirectories) Disabled MultiThreadedDebugDLL @@ -39,6 +40,7 @@ + $(SolutionDir)bin_$(PlatformName)\thirdparty\ffmpeg;%(AdditionalIncludeDirectories) /Gw /Zo %(AdditionalOptions) MaxSpeed Speed From a41a0a39a3d45c13d47fd234df5c7cf29e54745e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Sun, 13 Aug 2017 22:09:05 +0200 Subject: [PATCH 04/10] Respect MPCHC_WINSDK_VER value. Signed-off-by: clsid2 --- common/platform.props | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/platform.props b/common/platform.props index 585502f34..8f85f6ff2 100644 --- a/common/platform.props +++ b/common/platform.props @@ -3,12 +3,14 @@ v141 false - 8.1 + 8.1 + $(MPCHC_WINSDK_VER) v142 false - 10.0 + 10.0 + $(MPCHC_WINSDK_VER) true From 4af6b72480dfc4624d9a7b9e51ad9f9a03b72f07 Mon Sep 17 00:00:00 2001 From: clsid2 Date: Sat, 20 Jun 2020 12:00:00 +0000 Subject: [PATCH 05/10] Use the git version of vanilla LAV Filters, minus our custom patches. Signed-off-by: clsid2 --- common/genversion.bat | 64 ++++++++++++++--------------------------- common/version.sh | 67 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+), 42 deletions(-) create mode 100644 common/version.sh diff --git a/common/genversion.bat b/common/genversion.bat index f46b30a08..218667039 100644 --- a/common/genversion.bat +++ b/common/genversion.bat @@ -3,49 +3,29 @@ SETLOCAL PUSHD "%~dp0" -SET nbMAJOR_PART=0 -SET nbCOMMIT_PART=0 -SET nbHASH_PART=00000 -SET OLDVER= - -:: check for git presence -CALL git describe >NUL 2>&1 -IF ERRORLEVEL 1 ( - GOTO NOGIT -) - -:: Get git-describe output -FOR /F "tokens=*" %%A IN ('"git describe --long --abbrev=5 HEAD"') DO ( - SET strFILE_VERSION=%%A -) - -:: Split into tag, nb commits, hash -FOR /F "tokens=1,2,3 delims=-" %%A IN ("%strFILE_VERSION%") DO ( - SET nbMAJOR_PART=%%A - SET nbCOMMIT_PART=%%B - SET nbHASH_PART=%%C -) - -:: strip the "g" off the hash -SET nbHASH_PART=%nbHASH_PART:~1% - -:WRITE_VER - -:: check if info changed, and write if needed -IF EXIST includes\version_rev.h ( - SET /P OLDVER= includes\version_rev.h ECHO %NEWVER% -) -GOTO :END - -:NOGIT -echo Git not found -goto WRITE_VER +IF EXIST "..\..\..\..\..\build.user.bat" CALL "..\..\..\..\..\build.user.bat" + +IF NOT DEFINED MPCHC_GIT IF DEFINED GIT (SET MPCHC_GIT=%GIT%) +IF NOT DEFINED MPCHC_MSYS IF DEFINED MSYS (SET MPCHC_MSYS=%MSYS%) ELSE (GOTO MissingVar) + +IF NOT EXIST "%MPCHC_MSYS%" GOTO MissingVar + +SET PATH=%MPCHC_MSYS%\usr\bin;%MPCHC_GIT%\cmd;%PATH% +FOR %%G IN (bash.exe) DO (SET FOUND=%%~$PATH:G) +IF NOT DEFINED FOUND GOTO MissingVar + +bash.exe ./version.sh + :END POPD ENDLOCAL +EXIT /B + + +:MissingVar +ECHO Not all build dependencies were found. +ECHO. +ECHO See "..\..\..\..\..\docs\Compilation.md" for more information. +ENDLOCAL +EXIT /B 1 diff --git a/common/version.sh b/common/version.sh new file mode 100644 index 000000000..3652a522d --- /dev/null +++ b/common/version.sh @@ -0,0 +1,67 @@ +#!/bin/bash +# (C) 2013 see Authors.txt +# +# This file is part of MPC-HC. +# +# MPC-HC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# MPC-HC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +versionfile_fixed="./includes/version.h" +versionfile="./includes/version_rev.h" + +# Read major, minor and patch version numbers from static version.h file +while read -r _ var value; do + if [[ $var == LAV_VERSION_MAJOR ]]; then + ver_fixed_major=$value + elif [[ $var == LAV_VERSION_MINOR ]]; then + ver_fixed_minor=$value + elif [[ $var == LAV_VERSION_REVISION ]]; then + ver_fixed_patch=$value + fi +done < "$versionfile_fixed" +ver_fixed="${ver_fixed_major}.${ver_fixed_minor}.${ver_fixed_patch}" +echo "Version: $ver_fixed" + +# If we are not inside a git repo use hardcoded values +if ! git rev-parse --git-dir > /dev/null 2>&1; then + hash=0000000 + ver=0 + ver_additional= + echo "Warning: Git not available or not a git repo. Using dummy values for hash and version number." +else + # Get information about the current version + describe=$(git describe --long `git log --grep="\[MPC-HC\] Use our own ffmpeg clone repository\." --pretty=%H`~1) + echo "Describe: $describe" + + # Get the abbreviated hash of the current changeset + hash=${describe##*-g} + + # Get the number changesets since the last tag + ver=${describe#*-} + ver=${ver%-*} + + echo "Hash: $hash" + if ! git diff-index --quiet HEAD; then + echo "Revision: $ver (Local modifications found)" + else + echo "Revision: $ver" + fi +fi + +version_info="#define LAV_VERSION_BUILD $ver" + +# Update version_rev.h if it does not exist, or if version information was changed. +if [[ ! -f "$versionfile" ]] || [[ "$version_info" != "$(<"$versionfile")" ]]; then + # Write the version information to version_rev.h + echo "$version_info" > "$versionfile" +fi From 0a64ed4ba874bc95d57cac40c50cb174a1c0b170 Mon Sep 17 00:00:00 2001 From: clsid2 Date: Sat, 20 Jun 2020 12:00:00 +0000 Subject: [PATCH 06/10] blacklist: check both HKLM and HKCU Signed-off-by: clsid2 --- common/DSUtilLite/DShowUtil.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/DSUtilLite/DShowUtil.cpp b/common/DSUtilLite/DShowUtil.cpp index 3625079ad..57fa8360a 100644 --- a/common/DSUtilLite/DShowUtil.cpp +++ b/common/DSUtilLite/DShowUtil.cpp @@ -879,7 +879,8 @@ BOOL CheckApplicationBlackList(LPCTSTR subkey) if (SUCCEEDED(hr)) { dwVal = regLM.ReadDWORD(processName, hr); - return SUCCEEDED(hr) && dwVal; + if (SUCCEEDED(hr)) + return dwVal; } // Check current user path From 8468e641c07afb989a0fa6448560dfc25581556f Mon Sep 17 00:00:00 2001 From: clsid2 Date: Sat, 20 Jun 2020 12:00:00 +0000 Subject: [PATCH 07/10] Don't connect to AC3Filter or ffdshow when bitstreaming Signed-off-by: clsid2 --- common/includes/moreuuids.h | 8 ++++++++ decoder/LAVAudio/LAVAudio.cpp | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/common/includes/moreuuids.h b/common/includes/moreuuids.h index 634c90456..9a7f1706e 100644 --- a/common/includes/moreuuids.h +++ b/common/includes/moreuuids.h @@ -1374,6 +1374,14 @@ DEFINE_GUID(CLSID_MPBDReader, 0x79a37017, 0x3178, 0x4859, 0x80, 0x79, 0xec, 0xb9 // 008BAC12-FBAF-497b-9670-BC6F6FBAE2C4 DEFINE_GUID(CLSID_MPCVideoDec, 0x008BAC12, 0xFBAF, 0x497B, 0x96, 0x70, 0xBC, 0x6F, 0x6F, 0xBA, 0xE2, 0xC4); +// ffdshow Audio Decoder +// 0F40E1E5-4F79-4988-B1A9-CC98794E6B55 +DEFINE_GUID(CLSID_ffdshow_audio, 0x0F40E1E5, 0x4F79, 0x4988, 0xB1, 0xA9, 0xCC, 0x98, 0x79, 0x4E, 0x6B, 0x55); + +// ffdshow audio processor +// B86F6BEE-E7C0-4D03-8D52-5B4430CF6C88 +DEFINE_GUID(CLSID_ffdshow_audio_raw, 0xB86F6BEE, 0xE7C0, 0x4D03, 0x8D, 0x52, 0x5B, 0x44, 0x30, 0xCF, 0x6C, 0x88); + // ffdshow DXVA Video Decoder // 0B0EFF97-C750-462C-9488-B10E7D87F1A6 DEFINE_GUID(CLSID_ffdshowDXVA, 0x0B0EFF97, 0xC750, 0x462C, 0x94, 0x88, 0xB1, 0x0E, 0x7D, 0x87, 0xF1, 0xA6); diff --git a/decoder/LAVAudio/LAVAudio.cpp b/decoder/LAVAudio/LAVAudio.cpp index d2c0ac696..739a2c055 100644 --- a/decoder/LAVAudio/LAVAudio.cpp +++ b/decoder/LAVAudio/LAVAudio.cpp @@ -1687,6 +1687,24 @@ HRESULT CLAVAudio::CheckConnect(PIN_DIRECTION dir, IPin *pPin) // TODO: Check if the upstream source filter is LAVFSplitter, and store that somewhere // Validate that this is called before any media type negotiation } + else if (dir == PINDIR_OUTPUT) { + // Check if we want to bitstream + if (m_avBSContext) { + // Get the filter we're connecting to + IBaseFilter *pFilter = GetFilterFromPin(pPin); + CLSID guidFilter = GUID_NULL; + if (pFilter != nullptr) { + if (FAILED(pFilter->GetClassID(&guidFilter))) { + guidFilter = GUID_NULL; + } + SafeRelease(&pFilter); + } + // Don't allow connection to AC3Filter and ffdshow + if (guidFilter == CLSID_AC3Filter || guidFilter == CLSID_ffdshow_audio || guidFilter == CLSID_ffdshow_audio_raw) { + return VFW_E_TYPE_NOT_ACCEPTED; + } + } + } return __super::CheckConnect(dir, pPin); } From 7d58cb9e5b5cbeb9ac57421c1dbd0a732a8ba326 Mon Sep 17 00:00:00 2001 From: clsid2 Date: Sat, 20 Jun 2020 12:00:00 +0000 Subject: [PATCH 08/10] Increase default value of NetworkAnalysisDuration Signed-off-by: clsid2 --- demuxer/LAVSplitter/LAVSplitter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demuxer/LAVSplitter/LAVSplitter.cpp b/demuxer/LAVSplitter/LAVSplitter.cpp index 05154f8db..a1afdb73c 100644 --- a/demuxer/LAVSplitter/LAVSplitter.cpp +++ b/demuxer/LAVSplitter/LAVSplitter.cpp @@ -149,7 +149,7 @@ STDMETHODIMP CLAVSplitter::LoadDefaults() m_settings.PreferHighQualityAudio = TRUE; m_settings.QueueMaxPackets = 350; m_settings.QueueMaxMemSize = 256; - m_settings.NetworkAnalysisDuration = 1000; + m_settings.NetworkAnalysisDuration = 2100; for (const FormatInfo &fmt : m_InputFormats) { From edc0471aad658c278c211871daeb4bbc072ce712 Mon Sep 17 00:00:00 2001 From: clsid2 Date: Sat, 20 Jun 2020 12:00:00 +0000 Subject: [PATCH 09/10] Disallow P016 mediatype when connecting to EVR/VMR in case of software decoding. It is doesn't work properly with some drivers. Signed-off-by: clsid2 --- decoder/LAVVideo/LAVVideo.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/decoder/LAVVideo/LAVVideo.cpp b/decoder/LAVVideo/LAVVideo.cpp index 6110d3483..78bae22ab 100644 --- a/decoder/LAVVideo/LAVVideo.cpp +++ b/decoder/LAVVideo/LAVVideo.cpp @@ -1070,8 +1070,8 @@ HRESULT CLAVVideo::CompleteConnect(PIN_DIRECTION dir, IPin *pReceivePin) BOOL bFailNonDXVA = false; // Fail P010 software connections before Windows 10 Creators Update (presumably it was fixed before Creators // already, but this is definitely a safe known condition) - if (!IsWindows10BuildOrNewer(15063) && (m_pOutput->CurrentMediaType().subtype == MEDIASUBTYPE_P010 || - m_pOutput->CurrentMediaType().subtype == MEDIASUBTYPE_P016)) + if (!IsWindows10BuildOrNewer(15063) && m_pOutput->CurrentMediaType().subtype == MEDIASUBTYPE_P010 || + m_pOutput->CurrentMediaType().subtype == MEDIASUBTYPE_P016) { // Check if we're connecting to EVR IBaseFilter *pFilter = GetFilterFromPin(pReceivePin); From 4926b3d015aa30bf9ccc16142176cc1f212bfb88 Mon Sep 17 00:00:00 2001 From: adipose <3324395+adipose@users.noreply.github.com> Date: Wed, 23 Sep 2020 20:05:33 -0700 Subject: [PATCH 10/10] Update LAVFUtils.cpp support langType tag (requires ffmpeg patch) --- demuxer/Demuxers/LAVFUtils.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/demuxer/Demuxers/LAVFUtils.cpp b/demuxer/Demuxers/LAVFUtils.cpp index 6dbf849d0..70e7e4f11 100644 --- a/demuxer/Demuxers/LAVFUtils.cpp +++ b/demuxer/Demuxers/LAVFUtils.cpp @@ -268,7 +268,15 @@ std::string lavf_get_stream_description(const AVStream *pStream) if (lang) { - sLanguage = ProbeLangForLanguage(lang); + AVDictionaryEntry* dictEntry = av_dict_get(pStream->metadata, "langType", nullptr, 0); + if (dictEntry && strcmp(dictEntry->value, "BCP 47") == 0) + { + sLanguage = lang; //ProbeLangForLanguage will not always yield good results for a BCP-47 tag. possibly do something better? + } + else + { + sLanguage = ProbeLangForLanguage(lang); + } if (sLanguage.empty()) { sLanguage = lang;