Author: janderwald Date: Thu Apr 1 21:20:12 2010 New Revision: 46646
URL: http://svn.reactos.org/svn/reactos?rev=46646&view=rev Log: [MSDVBNP] - Remove DebugBreak - Implement IPin::Connect, IPin::ReceiveConnection, IPin::Disconnect, IPin::ConnectedTo - Remove spaces - DVBT Network Provider can now connect tv tuner in ReactOS
Modified: trunk/reactos/dll/directx/msdvbnp/msdvbnp.cpp trunk/reactos/dll/directx/msdvbnp/networkprovider.cpp trunk/reactos/dll/directx/msdvbnp/pin.cpp
Modified: trunk/reactos/dll/directx/msdvbnp/msdvbnp.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/msdvbnp/msdvbnp... ============================================================================== --- trunk/reactos/dll/directx/msdvbnp/msdvbnp.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/directx/msdvbnp/msdvbnp.cpp [iso-8859-1] Thu Apr 1 21:20:12 2010 @@ -122,7 +122,7 @@ { UINT i; HRESULT hres = E_OUTOFMEMORY; - IClassFactory * pcf = NULL; + IClassFactory * pcf = NULL;
if (!ppv) return E_INVALIDARG; @@ -138,7 +138,7 @@ } }
- if (!pcf) + if (!pcf) { return CLASS_E_CLASSNOTAVAILABLE; }
Modified: trunk/reactos/dll/directx/msdvbnp/networkprovider.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/msdvbnp/network... ============================================================================== --- trunk/reactos/dll/directx/msdvbnp/networkprovider.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/directx/msdvbnp/networkprovider.cpp [iso-8859-1] Thu Apr 1 21:20:12 2010 @@ -201,7 +201,6 @@ swprintf(Buffer, L"CNetworkProvider::QueryInterface: NoInterface for %s !!!\n", lpstr); OutputDebugStringW(Buffer); CoTaskMemFree(lpstr); - DebugBreak();
return E_NOINTERFACE; }
Modified: trunk/reactos/dll/directx/msdvbnp/pin.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/msdvbnp/pin.cpp... ============================================================================== --- trunk/reactos/dll/directx/msdvbnp/pin.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/directx/msdvbnp/pin.cpp [iso-8859-1] Thu Apr 1 21:20:12 2010 @@ -51,7 +51,7 @@ HRESULT STDMETHODCALLTYPE EndFlush(); HRESULT STDMETHODCALLTYPE NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
- CPin(IBaseFilter * ParentFilter) : m_Ref(0), m_ParentFilter(ParentFilter){}; + CPin(IBaseFilter * ParentFilter); virtual ~CPin(){};
static LPCWSTR PIN_ID; @@ -59,10 +59,30 @@ protected: LONG m_Ref; IBaseFilter * m_ParentFilter; + AM_MEDIA_TYPE m_MediaType; + IPin * m_Pin; };
LPCWSTR CPin::PIN_ID = L"Antenna Out"; + + +CPin::CPin( + IBaseFilter * ParentFilter) : m_Ref(0), + m_ParentFilter(ParentFilter), + m_Pin(0) +{ + m_MediaType.majortype = KSDATAFORMAT_TYPE_BDA_ANTENNA; + m_MediaType.subtype = MEDIASUBTYPE_None; + m_MediaType.formattype = FORMAT_None; + m_MediaType.bFixedSizeSamples = true; + m_MediaType.bTemporalCompression = false; + m_MediaType.lSampleSize = sizeof(CHAR); + m_MediaType.pUnk = NULL; + m_MediaType.cbFormat = 0; + m_MediaType.pbFormat = NULL; +} +
HRESULT STDMETHODCALLTYPE @@ -100,36 +120,97 @@ STDMETHODCALLTYPE CPin::Connect(IPin *pReceivePin, const AM_MEDIA_TYPE *pmt) { + HRESULT hr; OutputDebugStringW(L"CPin::Connect called\n"); - return E_NOTIMPL; + + if (pmt) + { + hr = pReceivePin->QueryAccept(pmt); + if (FAILED(hr)) + { + OutputDebugStringW(L"CPin::Connect QueryAccept failed\n"); + return hr; + } + } + else + { + // query accept + hr = pReceivePin->QueryAccept(&m_MediaType); + if (FAILED(hr)) + { + OutputDebugStringW(L"CPin::Connect QueryAccept pmt default failed\n"); + return hr; + } + + pmt = &m_MediaType; + } + + // receive connection; + hr = pReceivePin->ReceiveConnection((IPin*)this, pmt); + if (SUCCEEDED(hr)) + { + // increment reference count + pReceivePin->AddRef(); + m_Pin = pReceivePin; + OutputDebugStringW(L"CPin::Connect success\n"); + } + + return hr; }
HRESULT STDMETHODCALLTYPE CPin::ReceiveConnection(IPin *pConnector, const AM_MEDIA_TYPE *pmt) { - OutputDebugStringW(L"CPin::ReceiveConnection called\n"); - return E_NOTIMPL; -} + return E_UNEXPECTED; +} + HRESULT STDMETHODCALLTYPE CPin::Disconnect( void) { - OutputDebugStringW(L"CPin::Disconnect called\n"); - return E_NOTIMPL; +#ifdef MSDVBNP_TRACE + OutputDebugStringW(L"CPin::Disconnect\n"); +#endif + + if (!m_Pin) + { + // pin was not connected + return S_FALSE; + } + + m_Pin->Release(); + m_Pin = NULL; + + return S_OK; } HRESULT STDMETHODCALLTYPE CPin::ConnectedTo(IPin **pPin) { - OutputDebugStringW(L"CPin::ConnectedTo called\n"); +#ifdef MSDVBNP_TRACE + OutputDebugStringW(L"CPin::ConnectedTo\n"); +#endif + + if (!pPin) + return E_POINTER; + + if (m_Pin) + { + // increment reference count + m_Pin->AddRef(); + *pPin = m_Pin; + return S_OK; + } + + *pPin = NULL; return VFW_E_NOT_CONNECTED; } HRESULT STDMETHODCALLTYPE CPin::ConnectionMediaType(AM_MEDIA_TYPE *pmt) { - OutputDebugStringW(L"CPin::ConnectionMediaType called\n"); + OutputDebugStringW(L"CPin::ConnectionMediaType NotImplemented\n"); return E_NOTIMPL; } HRESULT @@ -170,7 +251,7 @@ STDMETHODCALLTYPE CPin::QueryAccept(const AM_MEDIA_TYPE *pmt) { - OutputDebugStringW(L"CPin::QueryAccept called\n"); + OutputDebugStringW(L"CPin::QueryAccept NotImplemented\n"); return E_NOTIMPL; } HRESULT @@ -200,35 +281,35 @@ STDMETHODCALLTYPE CPin::QueryInternalConnections(IPin **apPin, ULONG *nPin) { - OutputDebugStringW(L"CPin::QueryInternalConnections called\n"); + OutputDebugStringW(L"CPin::QueryInternalConnections NotImplemented\n"); return E_NOTIMPL; } HRESULT STDMETHODCALLTYPE CPin::EndOfStream( void) { - OutputDebugStringW(L"CPin::EndOfStream called\n"); + OutputDebugStringW(L"CPin::EndOfStream NotImplemented\n"); return E_NOTIMPL; } HRESULT STDMETHODCALLTYPE CPin::BeginFlush( void) { - OutputDebugStringW(L"CPin::BeginFlush called\n"); + OutputDebugStringW(L"CPin::BeginFlush NotImplemented\n"); return E_NOTIMPL; } HRESULT STDMETHODCALLTYPE CPin::EndFlush( void) { - OutputDebugStringW(L"CPin::EndFlush called\n"); + OutputDebugStringW(L"CPin::EndFlush NotImplemented\n"); return E_NOTIMPL; } HRESULT STDMETHODCALLTYPE CPin::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate) { - OutputDebugStringW(L"CPin::NewSegment called\n"); + OutputDebugStringW(L"CPin::NewSegment NotImplemented\n"); return E_NOTIMPL; }