1 //------------------------------------------------------------------------------
4 // Desc: DirectShow base classes - implements CRenderedInputPin class.
6 // Copyright (c) 1992-2002 Microsoft Corporation. All rights reserved.
7 //------------------------------------------------------------------------------
10 #include <streams.h> // DirectShow base class definitions
11 #include <mmsystem.h> // Needed for definition of timeGetTime
12 #include <limits.h> // Standard data type limit definitions
13 #include <measure.h> // Used for time critical log functions
17 #pragma warning(disable:4355)
19 // Implements CRenderedInputPin class
21 CRenderedInputPin::CRenderedInputPin(TCHAR
*pObjectName
,
26 CBaseInputPin(pObjectName
, pFilter
, pLock
, phr
, pName
),
27 m_bAtEndOfStream(FALSE
),
28 m_bCompleteNotified(FALSE
)
32 CRenderedInputPin::CRenderedInputPin(CHAR
*pObjectName
,
37 CBaseInputPin(pObjectName
, pFilter
, pLock
, phr
, pName
),
38 m_bAtEndOfStream(FALSE
),
39 m_bCompleteNotified(FALSE
)
44 // Flush end of stream condition - caller should do any
45 // necessary stream level locking before calling this
47 STDMETHODIMP
CRenderedInputPin::EndOfStream()
49 HRESULT hr
= CheckStreaming();
51 // Do EC_COMPLETE handling for rendered pins
52 if (S_OK
== hr
&& !m_bAtEndOfStream
) {
53 m_bAtEndOfStream
= TRUE
;
55 EXECUTE_ASSERT(SUCCEEDED(m_pFilter
->GetState(0, &fs
)));
56 if (fs
== State_Running
) {
64 // Called to complete the flush
66 STDMETHODIMP
CRenderedInputPin::EndFlush()
68 CAutoLock
lck(m_pLock
);
70 // Clean up renderer state
71 m_bAtEndOfStream
= FALSE
;
72 m_bCompleteNotified
= FALSE
;
74 return CBaseInputPin::EndFlush();
78 // Notify of Run() from filter
80 HRESULT
CRenderedInputPin::Run(REFERENCE_TIME tStart
)
82 UNREFERENCED_PARAMETER(tStart
);
83 m_bCompleteNotified
= FALSE
;
84 if (m_bAtEndOfStream
) {
91 // Clear status on going into paused state
93 HRESULT
CRenderedInputPin::Active()
95 m_bAtEndOfStream
= FALSE
;
96 m_bCompleteNotified
= FALSE
;
97 return CBaseInputPin::Active();
101 // Do stuff to deliver end of stream
103 void CRenderedInputPin::DoCompleteHandling()
105 ASSERT(m_bAtEndOfStream
);
106 if (!m_bCompleteNotified
) {
107 m_bCompleteNotified
= TRUE
;
108 m_pFilter
->NotifyEvent(EC_COMPLETE
, S_OK
, (LONG_PTR
)(IBaseFilter
*)m_pFilter
);