Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortetsuo55 <tetsuo55@users.sourceforge.net>2010-04-09 01:14:58 +0400
committertetsuo55 <tetsuo55@users.sourceforge.net>2010-04-09 01:14:58 +0400
commita9b7bf3fb3e1334d8defd05ca4cfae870b4912e5 (patch)
tree2dab453d94d5e003379a6cc895eceb84c80e23ec /src/filters/switcher/AudioSwitcher/StreamSwitcher.h
parentaafd49a91f7c2fa9c7103971c16fa6e1b29e8bfd (diff)
astyle formatting cleanup to make the sourcecode more accessible
switch used: astyle --style=ansi --min-conditional-indent=0 --pad=oper --unpad=paren http://astyle.sourceforge.net/ git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1783 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/switcher/AudioSwitcher/StreamSwitcher.h')
-rw-r--r--src/filters/switcher/AudioSwitcher/StreamSwitcher.h254
1 files changed, 138 insertions, 116 deletions
diff --git a/src/filters/switcher/AudioSwitcher/StreamSwitcher.h b/src/filters/switcher/AudioSwitcher/StreamSwitcher.h
index e6a7f17b7..38fe41f84 100644
--- a/src/filters/switcher/AudioSwitcher/StreamSwitcher.h
+++ b/src/filters/switcher/AudioSwitcher/StreamSwitcher.h
@@ -32,25 +32,25 @@
CComQIPtr<IMediaSeeking> _pMS((IUnknown*)(INonDelegatingUnknown*)m_pGraph); \
LONGLONG _rtNow = 0; \
if(_pMS) _hr = _pMS->GetCurrentPosition(&_rtNow); \
-
+
#define ResumeGraph \
if(SUCCEEDED(_hr) && _pMS && _fs != State_Stopped) \
_hr = _pMS->SetPositions(&_rtNow, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning); \
\
if(_fs == State_Running && _pMS) \
_pMC->Run(); \
-
+
class CStreamSwitcherFilter;
class CStreamSwitcherPassThru : public IMediaSeeking, public CMediaPosition
{
protected:
- CStreamSwitcherFilter* m_pFilter;
+ CStreamSwitcherFilter* m_pFilter;
public:
CStreamSwitcherPassThru(LPUNKNOWN, HRESULT* phr, CStreamSwitcherFilter* pFilter);
- DECLARE_IUNKNOWN
+ DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
// IMediaSeeking methods
@@ -94,184 +94,206 @@ protected:
CStreamSwitcherInputPin* m_pPin;
CMediaType m_mt;
- bool m_fMediaTypeChanged;
+ bool m_fMediaTypeChanged;
public:
- CStreamSwitcherAllocator(CStreamSwitcherInputPin* pPin, HRESULT* phr);
+ CStreamSwitcherAllocator(CStreamSwitcherInputPin* pPin, HRESULT* phr);
#ifdef DEBUG
- ~CStreamSwitcherAllocator();
+ ~CStreamSwitcherAllocator();
#endif
- STDMETHODIMP_(ULONG) NonDelegatingAddRef();
- STDMETHODIMP_(ULONG) NonDelegatingRelease();
+ STDMETHODIMP_(ULONG) NonDelegatingAddRef();
+ STDMETHODIMP_(ULONG) NonDelegatingRelease();
- STDMETHODIMP GetBuffer(
- IMediaSample** ppBuffer,
- REFERENCE_TIME* pStartTime, REFERENCE_TIME* pEndTime,
- DWORD dwFlags);
+ STDMETHODIMP GetBuffer(
+ IMediaSample** ppBuffer,
+ REFERENCE_TIME* pStartTime, REFERENCE_TIME* pEndTime,
+ DWORD dwFlags);
- void NotifyMediaType(const CMediaType& mt);
+ void NotifyMediaType(const CMediaType& mt);
};
[uuid("DA395FA3-4A3E-4D85-805E-0BEFF53D4BCD")]
-interface IStreamSwitcherInputPin : public IUnknown
+interface IStreamSwitcherInputPin :
+public IUnknown
{
- STDMETHOD_(bool, IsActive)() = 0;
+ STDMETHOD_(bool, IsActive)() = 0;
};
class CStreamSwitcherInputPin : public CBaseInputPin, public IPinConnection, public IStreamSwitcherInputPin
{
- friend class CStreamSwitcherAllocator;
+ friend class CStreamSwitcherAllocator;
- CStreamSwitcherAllocator m_Allocator;
+ CStreamSwitcherAllocator m_Allocator;
- BOOL m_bSampleSkipped;
- BOOL m_bQualityChanged;
- BOOL m_bUsingOwnAllocator;
+ BOOL m_bSampleSkipped;
+ BOOL m_bQualityChanged;
+ BOOL m_bUsingOwnAllocator;
- CAMEvent m_evBlock;
- bool m_fCanBlock;
- HRESULT Active();
- HRESULT Inactive();
+ CAMEvent m_evBlock;
+ bool m_fCanBlock;
+ HRESULT Active();
+ HRESULT Inactive();
- HRESULT QueryAcceptDownstream(const AM_MEDIA_TYPE* pmt);
+ HRESULT QueryAcceptDownstream(const AM_MEDIA_TYPE* pmt);
- HRESULT InitializeOutputSample(IMediaSample* pInSample, IMediaSample** ppOutSample);
+ HRESULT InitializeOutputSample(IMediaSample* pInSample, IMediaSample** ppOutSample);
- HANDLE m_hNotifyEvent;
+ HANDLE m_hNotifyEvent;
public:
CStreamSwitcherInputPin(CStreamSwitcherFilter* pFilter, HRESULT* phr, LPCWSTR pName);
- DECLARE_IUNKNOWN
+ DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- CMediaType& CurrentMediaType() {return m_mt;}
- IMemAllocator* CurrentAllocator() {return m_pAllocator;}
-
- bool IsUsingOwnAllocator() {return m_bUsingOwnAllocator == TRUE;}
-
- void Block(bool fBlock);
-
- CCritSec m_csReceive;
-
- // pure virtual
- HRESULT CheckMediaType(const CMediaType* pmt);
-
- // virtual
- HRESULT CheckConnect(IPin* pPin);
- HRESULT CompleteConnect(IPin* pReceivePin);
-
- // IPin
- STDMETHODIMP QueryAccept(const AM_MEDIA_TYPE* pmt);
- STDMETHODIMP ReceiveConnection(IPin* pConnector, const AM_MEDIA_TYPE* pmt);
- STDMETHODIMP GetAllocator(IMemAllocator** ppAllocator);
- STDMETHODIMP NotifyAllocator(IMemAllocator* pAllocator, BOOL bReadOnly);
- STDMETHODIMP BeginFlush();
+ CMediaType& CurrentMediaType()
+ {
+ return m_mt;
+ }
+ IMemAllocator* CurrentAllocator()
+ {
+ return m_pAllocator;
+ }
+
+ bool IsUsingOwnAllocator()
+ {
+ return m_bUsingOwnAllocator == TRUE;
+ }
+
+ void Block(bool fBlock);
+
+ CCritSec m_csReceive;
+
+ // pure virtual
+ HRESULT CheckMediaType(const CMediaType* pmt);
+
+ // virtual
+ HRESULT CheckConnect(IPin* pPin);
+ HRESULT CompleteConnect(IPin* pReceivePin);
+
+ // IPin
+ STDMETHODIMP QueryAccept(const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP ReceiveConnection(IPin* pConnector, const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP GetAllocator(IMemAllocator** ppAllocator);
+ STDMETHODIMP NotifyAllocator(IMemAllocator* pAllocator, BOOL bReadOnly);
+ STDMETHODIMP BeginFlush();
STDMETHODIMP EndFlush();
- STDMETHODIMP EndOfStream();
+ STDMETHODIMP EndOfStream();
- // IMemInputPin
+ // IMemInputPin
STDMETHODIMP Receive(IMediaSample* pSample);
- STDMETHODIMP NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+ STDMETHODIMP NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
- // IPinConnection
- STDMETHODIMP DynamicQueryAccept(const AM_MEDIA_TYPE* pmt);
- STDMETHODIMP NotifyEndOfStream(HANDLE hNotifyEvent);
- STDMETHODIMP IsEndPin();
- STDMETHODIMP DynamicDisconnect();
+ // IPinConnection
+ STDMETHODIMP DynamicQueryAccept(const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP NotifyEndOfStream(HANDLE hNotifyEvent);
+ STDMETHODIMP IsEndPin();
+ STDMETHODIMP DynamicDisconnect();
- // IStreamSwitcherInputPin
- STDMETHODIMP_(bool) IsActive();
+ // IStreamSwitcherInputPin
+ STDMETHODIMP_(bool) IsActive();
};
class CStreamSwitcherOutputPin : public CBaseOutputPin, public IStreamBuilder
{
- CComPtr<IUnknown> m_pStreamSwitcherPassThru;
- CComPtr<IPinConnection> m_pPinConnection;
+ CComPtr<IUnknown> m_pStreamSwitcherPassThru;
+ CComPtr<IPinConnection> m_pPinConnection;
- HRESULT QueryAcceptUpstream(const AM_MEDIA_TYPE* pmt);
+ HRESULT QueryAcceptUpstream(const AM_MEDIA_TYPE* pmt);
public:
CStreamSwitcherOutputPin(CStreamSwitcherFilter* pFilter, HRESULT* phr);
- DECLARE_IUNKNOWN
+ DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- CMediaType& CurrentMediaType() {return m_mt;}
- IMemAllocator* CurrentAllocator() {return m_pAllocator;}
- IPinConnection* CurrentPinConnection() {return m_pPinConnection;}
-
- // pure virtual
- HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
-
- // virtual
- HRESULT CheckConnect(IPin* pPin);
- HRESULT BreakConnect();
- HRESULT CompleteConnect(IPin* pReceivePin);
-
- HRESULT CheckMediaType(const CMediaType* pmt);
- HRESULT GetMediaType(int iPosition, CMediaType* pmt);
-
- // IPin
- STDMETHODIMP QueryAccept(const AM_MEDIA_TYPE* pmt);
-
- // IQualityControl
- STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
-
- // IStreamBuilder
- STDMETHODIMP Render(IPin* ppinOut, IGraphBuilder* pGraph);
- STDMETHODIMP Backout(IPin* ppinOut, IGraphBuilder* pGraph);
+ CMediaType& CurrentMediaType()
+ {
+ return m_mt;
+ }
+ IMemAllocator* CurrentAllocator()
+ {
+ return m_pAllocator;
+ }
+ IPinConnection* CurrentPinConnection()
+ {
+ return m_pPinConnection;
+ }
+
+ // pure virtual
+ HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
+
+ // virtual
+ HRESULT CheckConnect(IPin* pPin);
+ HRESULT BreakConnect();
+ HRESULT CompleteConnect(IPin* pReceivePin);
+
+ HRESULT CheckMediaType(const CMediaType* pmt);
+ HRESULT GetMediaType(int iPosition, CMediaType* pmt);
+
+ // IPin
+ STDMETHODIMP QueryAccept(const AM_MEDIA_TYPE* pmt);
+
+ // IQualityControl
+ STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
+
+ // IStreamBuilder
+ STDMETHODIMP Render(IPin* ppinOut, IGraphBuilder* pGraph);
+ STDMETHODIMP Backout(IPin* ppinOut, IGraphBuilder* pGraph);
};
class CStreamSwitcherFilter : public CBaseFilter, public IAMStreamSelect
{
- friend class CStreamSwitcherInputPin;
- friend class CStreamSwitcherOutputPin;
- friend class CStreamSwitcherPassThru;
+ friend class CStreamSwitcherInputPin;
+ friend class CStreamSwitcherOutputPin;
+ friend class CStreamSwitcherPassThru;
- CAtlList<CStreamSwitcherInputPin*> m_pInputs;
- CStreamSwitcherInputPin* m_pInput;
- CStreamSwitcherOutputPin* m_pOutput;
+ CAtlList<CStreamSwitcherInputPin*> m_pInputs;
+ CStreamSwitcherInputPin* m_pInput;
+ CStreamSwitcherOutputPin* m_pOutput;
- CCritSec m_csState, m_csPins;
+ CCritSec m_csState, m_csPins;
- HRESULT CompleteConnect(PIN_DIRECTION dir, CBasePin* pPin, IPin* pReceivePin);
+ HRESULT CompleteConnect(PIN_DIRECTION dir, CBasePin* pPin, IPin* pReceivePin);
protected:
- void SelectInput(CStreamSwitcherInputPin* pInput);
+ void SelectInput(CStreamSwitcherInputPin* pInput);
public:
- CStreamSwitcherFilter(LPUNKNOWN lpunk, HRESULT* phr, const CLSID& clsid);
- virtual ~CStreamSwitcherFilter();
+ CStreamSwitcherFilter(LPUNKNOWN lpunk, HRESULT* phr, const CLSID& clsid);
+ virtual ~CStreamSwitcherFilter();
- DECLARE_IUNKNOWN
+ DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- int GetPinCount();
- CBasePin* GetPin(int n);
+ int GetPinCount();
+ CBasePin* GetPin(int n);
- int GetConnectedInputPinCount();
- CStreamSwitcherInputPin* GetConnectedInputPin(int n);
- CStreamSwitcherInputPin* GetInputPin();
- CStreamSwitcherOutputPin* GetOutputPin();
+ int GetConnectedInputPinCount();
+ CStreamSwitcherInputPin* GetConnectedInputPin(int n);
+ CStreamSwitcherInputPin* GetInputPin();
+ CStreamSwitcherOutputPin* GetOutputPin();
- bool m_fResetOutputMediaType;
- void ResetOutputMediaType() {m_fResetOutputMediaType = true;}
+ bool m_fResetOutputMediaType;
+ void ResetOutputMediaType()
+ {
+ m_fResetOutputMediaType = true;
+ }
- // override these
- virtual HRESULT CheckMediaType(const CMediaType* pmt) = 0;
- virtual HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
- virtual CMediaType CreateNewOutputMediaType(CMediaType mt, long& cbBuffer);
- virtual void OnNewOutputMediaType(const CMediaType& mtIn, const CMediaType& mtOut) {}
+ // override these
+ virtual HRESULT CheckMediaType(const CMediaType* pmt) = 0;
+ virtual HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
+ virtual CMediaType CreateNewOutputMediaType(CMediaType mt, long& cbBuffer);
+ virtual void OnNewOutputMediaType(const CMediaType& mtIn, const CMediaType& mtOut) {}
- // and maybe these
+ // and maybe these
virtual HRESULT DeliverEndOfStream();
virtual HRESULT DeliverBeginFlush();
virtual HRESULT DeliverEndFlush();
virtual HRESULT DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
- // IAMStreamSelect
+ // IAMStreamSelect
STDMETHODIMP Count(DWORD* pcStreams);
STDMETHODIMP Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD* pdwFlags, LCID* plcid, DWORD* pdwGroup, WCHAR** ppszName, IUnknown** ppObject, IUnknown** ppUnk);
STDMETHODIMP Enable(long lIndex, DWORD dwFlags);