diff options
author | Underground78 <underground78@users.sourceforge.net> | 2013-09-28 19:30:14 +0400 |
---|---|---|
committer | Underground78 <underground78@users.sourceforge.net> | 2014-02-19 00:48:51 +0400 |
commit | 5f577fe5bb075bc0c6f3915d71c3f8a23c9ea499 (patch) | |
tree | 0009ae8eaa37f679d057b896083608dd9dca932c | |
parent | 8859c3563d5828ff920c933f70d8fb08f074d9f2 (diff) |
[MPC-HC] Tray icon: Add an optional custom callback for "show property page" events.
-rw-r--r-- | common/DSUtilLite/BaseTrayIcon.cpp | 22 | ||||
-rw-r--r-- | common/DSUtilLite/BaseTrayIcon.h | 2 | ||||
-rw-r--r-- | common/includes/LAVSplitterSettings.h | 11 | ||||
-rw-r--r-- | decoder/LAVAudio/LAVAudio.cpp | 11 | ||||
-rw-r--r-- | decoder/LAVAudio/LAVAudio.h | 7 | ||||
-rw-r--r-- | decoder/LAVAudio/LAVAudioSettings.h | 11 | ||||
-rw-r--r-- | decoder/LAVVideo/LAVVideo.cpp | 12 | ||||
-rw-r--r-- | decoder/LAVVideo/LAVVideo.h | 7 | ||||
-rw-r--r-- | decoder/LAVVideo/LAVVideoSettings.h | 11 | ||||
-rw-r--r-- | demuxer/LAVSplitter/LAVSplitter.cpp | 11 | ||||
-rw-r--r-- | demuxer/LAVSplitter/LAVSplitter.h | 5 |
11 files changed, 104 insertions, 6 deletions
diff --git a/common/DSUtilLite/BaseTrayIcon.cpp b/common/DSUtilLite/BaseTrayIcon.cpp index 73d3d41c..46b4e0be 100644 --- a/common/DSUtilLite/BaseTrayIcon.cpp +++ b/common/DSUtilLite/BaseTrayIcon.cpp @@ -184,12 +184,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 e04e469f..d298ed43 100644 --- a/common/DSUtilLite/BaseTrayIcon.h +++ b/common/DSUtilLite/BaseTrayIcon.h @@ -28,6 +28,7 @@ public: virtual ~CBaseTrayIcon(void); static BOOL ProcessBlackList(); + HRESULT SetCustomOpenPropPage(HRESULT (*fpCustomOpenPropPage)(IBaseFilter* pFilter)); protected: virtual HRESULT CreateTrayIconData(); @@ -56,6 +57,7 @@ private: 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 e153f081..d9782292 100644 --- a/common/includes/LAVSplitterSettings.h +++ b/common/includes/LAVSplitterSettings.h @@ -25,6 +25,10 @@ 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, LAVSubtitleMode_ForcedOnly, @@ -185,3 +189,10 @@ interface ILAVFSettings : public IUnknown // Get the duration (in ms) of analysis for network streams (to find the streams and codec parameters) STDMETHOD_(DWORD, GetNetworkStreamAnalysisDuration)() = 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 18368f9a..a57af06e 100644 --- a/decoder/LAVAudio/LAVAudio.cpp +++ b/decoder/LAVAudio/LAVAudio.cpp @@ -132,6 +132,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; } @@ -415,6 +416,7 @@ STDMETHODIMP CLAVAudio::NonDelegatingQueryInterface(REFIID riid, void** ppv) QI(ISpecifyPropertyPages) QI(ISpecifyPropertyPages2) QI2(ILAVAudioSettings) + QI2(ILAVAudioSettingsMPCHCCustom) QI2(ILAVAudioStatus) __super::NonDelegatingQueryInterface(riid, ppv); } @@ -771,6 +773,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; +} + // ILAVAudioStatus BOOL CLAVAudio::IsSampleFormatSupported(LAVAudioSampleFormat sfCheck) { diff --git a/decoder/LAVAudio/LAVAudio.h b/decoder/LAVAudio/LAVAudio.h index 532d37c2..60fe0b7b 100644 --- a/decoder/LAVAudio/LAVAudio.h +++ b/decoder/LAVAudio/LAVAudio.h @@ -80,7 +80,8 @@ struct BufferDetails { struct DTSDecoder; [uuid("E8E73B6B-4CB3-44A4-BE99-4F7BCB96E491")] -class CLAVAudio : public CTransformFilter, public ISpecifyPropertyPages2, public ILAVAudioSettings, public ILAVAudioStatus +class CLAVAudio : public CTransformFilter, public ISpecifyPropertyPages2, + public ILAVAudioSettings, public ILAVAudioSettingsMPCHCCustom, public ILAVAudioStatus { public: CLAVAudio(LPUNKNOWN pUnk, HRESULT* phr); @@ -135,6 +136,9 @@ public: STDMETHODIMP SetSampleConvertDithering(BOOL bEnabled); STDMETHODIMP_(BOOL) GetSampleConvertDithering(); + // 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, DWORD *pChannelMask); @@ -341,4 +345,5 @@ private: } 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 5a7aeea5..6d0255af 100644 --- a/decoder/LAVAudio/LAVAudioSettings.h +++ b/decoder/LAVAudio/LAVAudioSettings.h @@ -23,6 +23,10 @@ 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); @@ -187,6 +191,13 @@ interface ILAVAudioSettings : public IUnknown STDMETHOD_(BOOL,GetSampleConvertDithering)() = 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 [uuid("A668B8F2-BA87-4F63-9D41-768F7DE9C50E")] diff --git a/decoder/LAVVideo/LAVVideo.cpp b/decoder/LAVVideo/LAVVideo.cpp index d26d87e3..ef53e79f 100644 --- a/decoder/LAVVideo/LAVVideo.cpp +++ b/decoder/LAVVideo/LAVVideo.cpp @@ -65,6 +65,7 @@ void CALLBACK CLAVVideo::StaticInit(BOOL bLoading, const CLSID *clsid) 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"); @@ -122,6 +123,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; } @@ -381,6 +383,7 @@ STDMETHODIMP CLAVVideo::NonDelegatingQueryInterface(REFIID riid, void** ppv) QI(ISpecifyPropertyPages) QI(ISpecifyPropertyPages2) QI2(ILAVVideoSettings) + QI2(ILAVVideoSettingsMPCHCCustom) QI2(ILAVVideoStatus) __super::NonDelegatingQueryInterface(riid, ppv); } @@ -1982,6 +1985,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; +} + CLAVControlThread::CLAVControlThread(CLAVVideo *pLAVVideo) : CAMThread() , m_pLAVVideo(pLAVVideo) diff --git a/decoder/LAVVideo/LAVVideo.h b/decoder/LAVVideo/LAVVideo.h index 889dd96f..7b18322f 100644 --- a/decoder/LAVVideo/LAVVideo.h +++ b/decoder/LAVVideo/LAVVideo.h @@ -53,7 +53,8 @@ typedef struct { } TimingCache; [uuid("EE30215D-164F-4A92-A4EB-9D4C13390F9F")] -class CLAVVideo : public CTransformFilter, public ISpecifyPropertyPages2, public ILAVVideoSettings, public ILAVVideoStatus, public ILAVVideoCallback +class CLAVVideo : public CTransformFilter, public ISpecifyPropertyPages2, + public ILAVVideoSettings, public ILAVVideoSettingsMPCHCCustom, public ILAVVideoStatus, public ILAVVideoCallback { public: CLAVVideo(LPUNKNOWN pUnk, HRESULT* phr); @@ -128,6 +129,9 @@ public: STDMETHODIMP SetGPUDeviceIndex(DWORD dwDevice); + // ILAVVideoSettingsMPCHCCustom + STDMETHODIMP SetPropertyPageCallback(HRESULT (*fpPropPageCallback)(IBaseFilter* pFilter)); + // ILAVVideoStatus STDMETHODIMP_(const WCHAR *) GetActiveDecoderName() { return m_Decoder.GetDecoderName(); } @@ -284,6 +288,7 @@ private: DWORD m_dwGPUDeviceIndex = DWORD_MAX; CBaseTrayIcon *m_pTrayIcon = nullptr; + HRESULT (*m_fpPropPageCallback)(IBaseFilter* pFilter) = nullptr; #ifdef DEBUG FloatingAverage<double> m_pixFmtTimingAvg; diff --git a/decoder/LAVVideo/LAVVideoSettings.h b/decoder/LAVVideo/LAVVideoSettings.h index 4401c372..8c2acd7a 100644 --- a/decoder/LAVVideo/LAVVideoSettings.h +++ b/decoder/LAVVideo/LAVVideoSettings.h @@ -23,6 +23,10 @@ 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); @@ -362,6 +366,13 @@ interface ILAVVideoSettings : public IUnknown STDMETHOD(SetGPUDeviceIndex)(DWORD dwDevice) = 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 [uuid("1CC2385F-36FA-41B1-9942-5024CE0235DC")] interface ILAVVideoStatus : public IUnknown diff --git a/demuxer/LAVSplitter/LAVSplitter.cpp b/demuxer/LAVSplitter/LAVSplitter.cpp index 7cf30e1f..91e3271f 100644 --- a/demuxer/LAVSplitter/LAVSplitter.cpp +++ b/demuxer/LAVSplitter/LAVSplitter.cpp @@ -115,6 +115,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; } @@ -309,6 +310,7 @@ STDMETHODIMP CLAVSplitter::NonDelegatingQueryInterface(REFIID riid, void** ppv) QI(ISpecifyPropertyPages2) QI2(ILAVFSettings) QI2(ILAVFSettingsInternal) + QI2(ILAVFSettingsMPCHCCustom) QI(IObjectWithSite) QI(IBufferInfo) __super::NonDelegatingQueryInterface(riid, ppv); @@ -1836,6 +1838,15 @@ STDMETHODIMP_(std::set<FormatInfo>&) 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 21cca8f6..935691f2 100644 --- a/demuxer/LAVSplitter/LAVSplitter.h +++ b/demuxer/LAVSplitter/LAVSplitter.h @@ -62,6 +62,7 @@ class CLAVSplitter , public IAMStreamSelect , public IAMOpenProgress , public ILAVFSettingsInternal + , public ILAVFSettingsMPCHCCustom , public ISpecifyPropertyPages2 , public IObjectWithSite , public IBufferInfo @@ -174,6 +175,9 @@ public: STDMETHODIMP SetNetworkStreamAnalysisDuration(DWORD dwDuration); STDMETHODIMP_(DWORD) GetNetworkStreamAnalysisDuration(); + // ILAVFSettingsMPCHCCustom + STDMETHODIMP SetPropertyPageCallback(HRESULT (*fpPropPageCallback)(IBaseFilter* pFilter)); + // ILAVSplitterSettingsInternal STDMETHODIMP_(LPCSTR) GetInputFormat() { if (m_pDemuxer) return m_pDemuxer->GetContainerFormat(); return nullptr; } STDMETHODIMP_(std::set<FormatInfo>&) GetInputFormats(); @@ -295,6 +299,7 @@ private: IUnknown *m_pSite = nullptr; CBaseTrayIcon *m_pTrayIcon = nullptr; + HRESULT (*m_fpPropPageCallback)(IBaseFilter* pFilter) = nullptr; }; [uuid("B98D13E7-55DB-4385-A33D-09FD1BA26338")] |