123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- #ifndef __strmctl_h__
- #define __strmctl_h__
- class CBaseStreamControl : public IAMStreamControl
- {
- public:
-
- enum StreamControlState
- { STREAM_FLOWING = 0x1000,
- STREAM_DISCARDING
- };
- private:
- enum StreamControlState m_StreamState;
- enum StreamControlState m_StreamStateOnStop;
-
- REFERENCE_TIME m_tStartTime;
- REFERENCE_TIME m_tStopTime;
- DWORD m_dwStartCookie;
- DWORD m_dwStopCookie;
- volatile BOOL m_bIsFlushing;
- volatile BOOL m_bStopSendExtra;
- volatile BOOL m_bStopExtraSent;
- CCritSec m_CritSec;
-
-
-
-
- CAMEvent m_StreamEvent;
-
-
- void ExecuteStop();
- void ExecuteStart();
- void CancelStop();
- void CancelStart();
-
-
-
- IReferenceClock * m_pRefClock;
-
-
- IMediaEventSink * m_pSink;
-
-
- FILTER_STATE m_FilterState;
-
-
- REFERENCE_TIME m_tRunStart;
-
-
-
-
-
-
-
-
-
-
- enum StreamControlState CheckSampleTimes( __in const REFERENCE_TIME * pSampleStart,
- __in const REFERENCE_TIME * pSampleStop );
- public:
-
-
-
-
- CBaseStreamControl(__inout_opt HRESULT *phr = NULL);
- ~CBaseStreamControl();
-
-
-
-
-
-
-
-
-
-
-
-
-
- void SetSyncSource( IReferenceClock * pRefClock )
- {
- CAutoLock lck(&m_CritSec);
- if (m_pRefClock) m_pRefClock->Release();
- m_pRefClock = pRefClock;
- if (m_pRefClock) m_pRefClock->AddRef();
- }
-
-
-
-
- void SetFilterGraph( IMediaEventSink *pSink ) {
- m_pSink = pSink;
- }
-
-
-
-
- void NotifyFilterState( FILTER_STATE new_state, REFERENCE_TIME tStart = 0 );
-
-
-
- void Flushing( BOOL bInProgress );
-
-
-
- STDMETHODIMP StopAt( const REFERENCE_TIME * ptStop = NULL,
- BOOL bSendExtra = FALSE,
- DWORD dwCookie = 0 );
- STDMETHODIMP StartAt( const REFERENCE_TIME * ptStart = NULL,
- DWORD dwCookie = 0 );
- STDMETHODIMP GetInfo( __out AM_STREAM_INFO *pInfo);
-
-
-
-
-
-
-
- enum StreamControlState CheckStreamState( IMediaSample * pSample );
- private:
-
-
-
- HANDLE GetStreamEventHandle() const { return m_StreamEvent; }
- enum StreamControlState GetStreamState() const { return m_StreamState; }
- BOOL IsStreaming() const { return m_StreamState == STREAM_FLOWING; }
- };
- #endif
|