MultiIOInputPin.cpp

Go to the documentation of this file.
00001 
00034 #include "MultiIOInputPin.h"
00035 
00036 #include "MultiIOBaseFilter.h"
00037 
00038 CMultiIOInputPin::CMultiIOInputPin(CMultiIOBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr, LPCWSTR pName, int nIndex)
00039 : CBaseInputPin(NAME("TM Multi Input Pin"), pFilter, pLock, phr, pName),
00040 m_pFilter(pFilter),
00041 m_nIndex(nIndex)
00042 {
00043 }
00044 
00045 CMultiIOInputPin::~CMultiIOInputPin(void)
00046 {
00047 }
00048 
00049 HRESULT CMultiIOInputPin::CheckMediaType( const CMediaType* mtIn )
00050 {
00051         return m_pFilter->CheckInputType(mtIn);
00052 }
00053 
00054 HRESULT CMultiIOInputPin::BreakConnect()
00055 {
00056         HRESULT hr = CBaseInputPin::BreakConnect();
00057         m_pFilter->OnDisconnect(m_nIndex);
00058         return hr;
00059 }
00060 
00061 HRESULT CMultiIOInputPin::CompleteConnect( IPin *pReceivePin )
00062 {
00063         HRESULT hr = CBaseInputPin::CompleteConnect(pReceivePin);
00064         if (SUCCEEDED(hr))
00065         {
00066                 m_pFilter->OnConnect(m_nIndex, RTVC_IN);
00067         }
00068         return hr;
00069 }
00070 
00071 STDMETHODIMP CMultiIOInputPin::Receive( IMediaSample *pSample )
00072 {
00073         //Copied from CTransformInputPin
00074         HRESULT hr;
00075         CAutoLock lck(&m_pFilter->m_csReceive);
00076         ASSERT(pSample);
00077 
00078         // check all is well with the base class
00079         hr = CBaseInputPin::Receive(pSample);
00080         if (S_OK == hr) {
00081                 hr = m_pFilter->Receive(pSample, m_nIndex);
00082         }
00083         return hr;
00084 }
00085 
00086 HRESULT CMultiIOInputPin::SetMediaType( const CMediaType* mtIn )
00087 {
00088         // Set the base class media type (should always succeed)
00089         HRESULT hr = CBasePin::SetMediaType(mtIn);
00090         if (FAILED(hr)) {
00091                 return hr;
00092         }
00093 
00094         // check the transform can be done (should always succeed)
00095         ASSERT(SUCCEEDED(m_pFilter->CheckInputType(mtIn)));
00096 
00097         return m_pFilter->SetMediaType(PINDIR_INPUT, mtIn, m_nIndex);
00098 }
00099 
00100 STDMETHODIMP CMultiIOInputPin::EndOfStream()
00101 {
00102         HRESULT hr = CBaseInputPin::EndOfStream();
00103         if (FAILED(hr))
00104         {
00105                 return hr;
00106         }
00107         return m_pFilter->EndOfStream(m_nIndex);
00108 }
00109 
00110 STDMETHODIMP CMultiIOInputPin::BeginFlush()
00111 {
00112         HRESULT hr = CBaseInputPin::BeginFlush();
00113         if (FAILED(hr))
00114         {
00115                 return hr;
00116         }
00117         return m_pFilter->BeginFlush(m_nIndex);
00118 }
00119 
00120 STDMETHODIMP CMultiIOInputPin::EndFlush()
00121 {
00122         HRESULT hr = CBaseInputPin::EndFlush();
00123         if (FAILED(hr))
00124         {
00125                 return hr;
00126         }
00127         return m_pFilter->EndFlush(m_nIndex);
00128 }
00129 
00130 STDMETHODIMP CMultiIOInputPin::NewSegment( REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate )
00131 {
00132         HRESULT hr = CBaseInputPin::NewSegment(tStart, tStop, dRate);
00133         if (FAILED(hr))
00134         {
00135                 return hr;
00136         }
00137         return m_pFilter->NewSegment(tStart, tStop, dRate, m_nIndex );
00138 }

Generated on Fri Mar 13 14:12:38 2009 for RTVC by  doxygen 1.5.3