Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -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
Expand Down
23 changes: 18 additions & 5 deletions common/DSUtilLite/BaseTrayIcon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 2 additions & 0 deletions common/DSUtilLite/BaseTrayIcon.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class CBaseTrayIcon
virtual ~CBaseTrayIcon(void);

static BOOL ProcessBlackList();
HRESULT SetCustomOpenPropPage(HRESULT (*fpCustomOpenPropPage)(IBaseFilter* pFilter));

protected:
virtual HRESULT CreateTrayIconData();
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion common/DSUtilLite/DShowUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions common/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug' Or '$(Configuration)'=='DebugRelease'">
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir)bin_$(PlatformName)d\thirdparty\ffmpeg;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
</ClCompile>
Expand All @@ -39,6 +40,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir)bin_$(PlatformName)\thirdparty\ffmpeg;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/Gw /Zo %(AdditionalOptions)</AdditionalOptions>
<Optimization>MaxSpeed</Optimization>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
Expand Down
64 changes: 22 additions & 42 deletions common/genversion.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
SET NEWVER=#define LAV_VERSION_BUILD %nbCOMMIT_PART%
IF NOT "%NEWVER%" == "%OLDVER%" (
:: swapped order to avoid trailing newlines
> 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
10 changes: 10 additions & 0 deletions common/includes/LAVSplitterSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
};
8 changes: 8 additions & 0 deletions common/includes/moreuuids.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 4 additions & 2 deletions common/platform.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
<PropertyGroup Label="Configuration" Condition="'$(VisualStudioVersion)' == '15.0'">
<PlatformToolset>v141</PlatformToolset>
<SpectreMitigation>false</SpectreMitigation>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion Condition="'$(MPCHC_WINSDK_VER)' == ''">8.1</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion Condition="'$(MPCHC_WINSDK_VER)' != ''">$(MPCHC_WINSDK_VER)</WindowsTargetPlatformVersion>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(VisualStudioVersion)' == '16.0'">
<PlatformToolset>v142</PlatformToolset>
<SpectreMitigation>false</SpectreMitigation>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion Condition="'$(MPCHC_WINSDK_VER)' == ''">10.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion Condition="'$(MPCHC_WINSDK_VER)' != ''">$(MPCHC_WINSDK_VER)</WindowsTargetPlatformVersion>
</PropertyGroup>
<PropertyGroup>
<UseNativeEnvironment>true</UseNativeEnvironment>
Expand Down
67 changes: 67 additions & 0 deletions common/version.sh
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.

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
30 changes: 30 additions & 0 deletions decoder/LAVAudio/LAVAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -1675,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);
}

Expand Down
5 changes: 5 additions & 0 deletions decoder/LAVAudio/LAVAudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
};
11 changes: 11 additions & 0 deletions decoder/LAVAudio/LAVAudioSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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
Expand Down
Loading