14 : m_StreamState(STREAM_FLOWING)
15 , m_StreamStateOnStop(STREAM_FLOWING)
18 , m_StreamEvent(FALSE, phr)
22 , m_FilterState(State_Stopped)
23 , m_bIsFlushing(FALSE)
24 , m_bStopSendExtra(FALSE)
38 m_bStopSendExtra = FALSE;
39 m_bStopExtraSent = FALSE;
48 if (m_FilterState == State_Stopped && m_tStartTime <
MAX_TIME) {
55 (
int)(*ptStop/10000), bSendExtra));
58 if (m_FilterState == State_Stopped && m_tStartTime > *ptStop) {
62 m_bStopSendExtra = bSendExtra;
63 m_tStopTime = *ptStop;
64 m_dwStopCookie = dwCookie;
71 m_bStopSendExtra = FALSE;
83 (
const REFERENCE_TIME *ptStart, DWORD dwCookie )
94 if (m_FilterState == State_Stopped && m_tStopTime <
MAX_TIME) {
96 m_StreamState = STREAM_FLOWING;
103 if (m_FilterState == State_Stopped && m_tStopTime >= *ptStart) {
105 m_StreamState = STREAM_DISCARDING;
107 m_tStartTime = *ptStart;
108 m_dwStartCookie = dwCookie;
116 m_StreamState = STREAM_FLOWING;
129 pInfo->tStart = m_tStartTime;
130 pInfo->tStop = m_tStopTime;
131 pInfo->dwStartCookie = m_dwStartCookie;
132 pInfo->dwStopCookie = m_dwStopCookie;
133 pInfo->dwFlags = m_bStopSendExtra ? AM_STREAM_INFO_STOP_SEND_EXTRA : 0;
134 pInfo->dwFlags |= m_tStartTime ==
MAX_TIME ? 0 : AM_STREAM_INFO_START_DEFINED;
135 pInfo->dwFlags |= m_tStopTime ==
MAX_TIME ? 0 : AM_STREAM_INFO_STOP_DEFINED;
136 switch (m_StreamState) {
142 pInfo->dwFlags |= AM_STREAM_INFO_DISCARDING;
149 void CBaseStreamControl::ExecuteStop()
152 m_StreamState = m_StreamStateOnStop;
153 if (m_dwStopCookie && m_pSink) {
156 m_pSink->Notify(EC_STREAM_CONTROL_STOPPED, (LONG_PTR)
this, m_dwStopCookie);
161 void CBaseStreamControl::ExecuteStart()
165 if (m_dwStartCookie) {
168 m_pSink->Notify(EC_STREAM_CONTROL_STARTED, (LONG_PTR)
this, m_dwStartCookie);
173 void CBaseStreamControl::CancelStop()
181 void CBaseStreamControl::CancelStart()
235 ( __in
const REFERENCE_TIME * pSampleStart, __in
const REFERENCE_TIME * pSampleStop )
240 ASSERT(pSampleStart && pSampleStop);
245 if (m_tStopTime >= *pSampleStart)
247 if (m_tStartTime >= *pSampleStop)
248 return m_StreamState;
249 if (m_tStopTime < m_tStartTime)
252 return m_StreamState;
255 if (m_tStartTime >= *pSampleStop)
258 return m_StreamState;
261 if (m_tStartTime <= m_tStopTime)
265 return m_StreamState;
271 return m_StreamState;
279 REFERENCE_TIME rtBufferStart, rtBufferStop;
280 const BOOL bNoBufferTimes =
282 FAILED(pSample->GetTime(&rtBufferStart, &rtBufferStop));
290 if (m_bIsFlushing || m_FilterState == State_Stopped)
293 if (bNoBufferTimes) {
295 state = m_StreamState;
298 state = CheckSampleTimes( &rtBufferStart, &rtBufferStop );
305 if (m_bStopSendExtra && !m_bStopExtraSent &&
307 m_FilterState != State_Stopped) {
308 m_bStopExtraSent = TRUE;
326 }
else if (m_FilterState == State_Paused) {
332 REFERENCE_TIME rtNow;
334 rtNow -= m_tRunStart;
335 lWait = LONG((rtBufferStart - rtNow)/10000);
336 if (lWait < 10)
break;
339 }
while(WaitForSingleObject(GetStreamEventHandle(), lWait) != WAIT_TIMEOUT);
350 if (m_FilterState == new_state)
368 if (m_tStartTime <= m_tStopTime) {
379 m_FilterState = new_state;
386 m_tRunStart = tStart;
390 m_FilterState = new_state;
400 m_bIsFlushing = bInProgress;