Author: janderwald
Date: Thu Feb 25 17:14:54 2010
New Revision: 45681
URL:
http://svn.reactos.org/svn/reactos?rev=45681&view=rev
Log:
[BDAPLGIN]
- Simply construction of CBDAFrequencyFilter, CBDALNBInfo, CBDASignalStatistics
- Find IBDA_NetworkProvider in filter graph
- Check for IBaseFilter interface when constructing the CBDADeviceControl object
Modified:
trunk/reactos/dll/directx/bdaplgin/controlnode.cpp
trunk/reactos/dll/directx/bdaplgin/devicecontrol.cpp
trunk/reactos/dll/directx/bdaplgin/digitaldemo.cpp
trunk/reactos/dll/directx/bdaplgin/frequencyfilter.cpp
trunk/reactos/dll/directx/bdaplgin/lnbinfo.cpp
trunk/reactos/dll/directx/bdaplgin/pincontrol.cpp
trunk/reactos/dll/directx/bdaplgin/precomp.h
trunk/reactos/dll/directx/bdaplgin/signalstatistics.cpp
Modified: trunk/reactos/dll/directx/bdaplgin/controlnode.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/bdaplgin/contr…
==============================================================================
--- trunk/reactos/dll/directx/bdaplgin/controlnode.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/bdaplgin/controlnode.cpp [iso-8859-1] Thu Feb 25 17:14:54
2010
@@ -31,12 +31,12 @@
return m_Ref;
}
- CControlNode(IUnknown * pUnkOuter, ULONG NodeType, ULONG PinId) : m_Ref(0),
m_pUnkOuter(pUnkOuter), m_NodeType(NodeType), m_PinId(PinId){};
+ CControlNode(HANDLE hFile, ULONG NodeType, ULONG PinId) : m_Ref(0), m_hFile(hFile),
m_NodeType(NodeType), m_PinId(PinId){};
virtual ~CControlNode(){};
protected:
LONG m_Ref;
- IUnknown * m_pUnkOuter;
+ HANDLE m_hFile;
ULONG m_NodeType;
ULONG m_PinId;
};
@@ -60,23 +60,20 @@
}
else if(IsEqualGUID(refiid, IID_IBDA_FrequencyFilter))
{
- return CBDAFrequencyFilter_fnConstructor(m_pUnkOuter, refiid, Output);
+ return CBDAFrequencyFilter_fnConstructor(m_hFile, refiid, Output);
}
else if(IsEqualGUID(refiid, IID_IBDA_SignalStatistics))
{
- return CBDASignalStatistics_fnConstructor(m_pUnkOuter, refiid, Output);
+ return CBDASignalStatistics_fnConstructor(m_hFile, refiid, Output);
}
else if(IsEqualGUID(refiid, IID_IBDA_LNBInfo))
{
- return CBDALNBInfo_fnConstructor(m_pUnkOuter, refiid, Output);
+ return CBDALNBInfo_fnConstructor(m_hFile, refiid, Output);
}
else if(IsEqualGUID(refiid, IID_IBDA_DigitalDemodulator))
{
- return CBDADigitalDemodulator_fnConstructor(m_pUnkOuter, refiid, Output);
+ return CBDADigitalDemodulator_fnConstructor(m_hFile, refiid, Output);
}
-
-
-
StringFromCLSID(refiid, &lpstr);
swprintf(Buffer, L"CControlNode::QueryInterface: NoInterface for %s",
lpstr);
@@ -90,17 +87,14 @@
HRESULT
WINAPI
CControlNode_fnConstructor(
- IUnknown * pUnkOuter,
+ HANDLE hFile,
ULONG NodeType,
ULONG PinId,
REFIID riid,
LPVOID * ppv)
{
- // sanity check
- assert(pUnkOuter);
-
// construct device control
- CControlNode * handler = new CControlNode(pUnkOuter, NodeType, PinId);
+ CControlNode * handler = new CControlNode(hFile, NodeType, PinId);
OutputDebugStringW(L"CControlNode_fnConstructor\n");
Modified: trunk/reactos/dll/directx/bdaplgin/devicecontrol.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/bdaplgin/devic…
==============================================================================
--- trunk/reactos/dll/directx/bdaplgin/devicecontrol.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/bdaplgin/devicecontrol.cpp [iso-8859-1] Thu Feb 25 17:14:54
2010
@@ -21,6 +21,8 @@
const GUID IID_IKsObject = {0x423c13a2, 0x2070, 0x11d0, {0x9e, 0xf7, 0x00,
0xaa, 0x00, 0xa2, 0x16, 0xa1}};
const GUID KSPROPSETID_BdaTopology = {0xa14ee835, 0x0a23, 0x11d3, {0x9c, 0xc7, 0x0, 0xc0,
0x4f, 0x79, 0x71, 0xe0}};
const GUID KSMETHODSETID_BdaDeviceConfiguration = {0x71985f45, 0x1ca1, 0x11d3, {0x9c,
0xc8, 0x0, 0xc0, 0x4f, 0x79, 0x71, 0xe0}};
+const GUID IID_IBaseFilter = {0x56a86895, 0x0ad4, 0x11ce, {0xb0,0x3a,
0x00,0x20,0xaf,0x0b,0xa7,0x70}};
+
class CBDADeviceControl : public IBDA_DeviceControl,
public IBDA_Topology
@@ -103,7 +105,7 @@
reinterpret_cast<IBDA_Topology*>(*Output)->AddRef();
return NOERROR;
}
-#if 0
+
if (IsEqualIID(refiid, IID_IDistributorNotify))
{
OutputDebugStringW(L"CBDADeviceControl::QueryInterface: No
IDistributorNotify interface\n");
@@ -118,10 +120,8 @@
if (IsEqualGUID(refiid, IID_IBDA_NetworkProvider))
{
- HRESULT hr = CoCreateInstance(CLSID_DVBTNetworkProvider, 0, CLSCTX_INPROC,
IID_IBDA_NetworkProvider, (void**)Output);
- swprintf(Buffer, L"CBDADeviceControl::QueryInterface: failed to construct
IID_IBDA_NetworkProvider interface with %lx", hr);
- OutputDebugStringW(Buffer);
- return hr;
+ OutputDebugStringW(L"CBDADeviceControl::QueryInterface: No
IID_IBDA_NetworkProvider interface\n");
+ return E_NOINTERFACE;
}
if (IsEqualGUID(refiid, IID_IMatrixMixer))
@@ -141,7 +141,6 @@
OutputDebugStringW(L"CBDADeviceControl::QueryInterface: No IID_IAC3Filter
interface\n");
return E_NOINTERFACE;
}
-#endif
StringFromCLSID(refiid, &lpstr);
swprintf(Buffer, L"CBDADeviceControl::QueryInterface: NoInterface for %s",
lpstr);
@@ -385,7 +384,7 @@
if (FAILED(hr))
return hr;
- hr = CControlNode_fnConstructor(m_pUnkOuter, ulNodeType, PinId, IID_IUnknown,
(LPVOID*)ppControlNode);
+ hr = CControlNode_fnConstructor(m_Handle, ulNodeType, PinId, IID_IUnknown,
(LPVOID*)ppControlNode);
swprintf(Buffer, L"CBDADeviceControl::GetControlNode: hr %lx\n", hr);
OutputDebugStringW(Buffer);
@@ -401,6 +400,7 @@
{
HRESULT hr;
IKsObject *pObject = NULL;
+ IBaseFilter *pFilter = NULL;
HANDLE hFile;
// sanity check
@@ -409,9 +409,22 @@
// query for IKsObject
hr = pUnkOuter->QueryInterface(IID_IKsObject, (void**)&pObject);
+ if (FAILED(hr))
+ return E_NOINTERFACE;
+
// sanity check
assert(hr == NOERROR);
+ // query for IBaseFilter interface support
+ hr = pUnkOuter->QueryInterface(IID_IBaseFilter, (void**)&pFilter);
+
+ if (FAILED(hr))
+ {
+ // release
+ pObject->Release();
+ return E_NOINTERFACE;
+ }
+
// another sanity check
assert(pObject != NULL);
Modified: trunk/reactos/dll/directx/bdaplgin/digitaldemo.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/bdaplgin/digit…
==============================================================================
--- trunk/reactos/dll/directx/bdaplgin/digitaldemo.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/bdaplgin/digitaldemo.cpp [iso-8859-1] Thu Feb 25 17:14:54
2010
@@ -206,35 +206,10 @@
HRESULT
WINAPI
CBDADigitalDemodulator_fnConstructor(
- IUnknown * pUnkOuter,
+ HANDLE hFile,
REFIID riid,
LPVOID * ppv)
{
- HRESULT hr;
- IKsObject *pObject = NULL;
- HANDLE hFile;
-
- // sanity check
- assert(pUnkOuter);
-
- // query for IKsObject
- hr = pUnkOuter->QueryInterface(IID_IKsObject, (void**)&pObject);
-
- // sanity check
- assert(hr == NOERROR);
-
- // another sanity check
- assert(pObject != NULL);
-
- // get file handle
- hFile = pObject->KsGetObjectHandle();
-
- // one more sanity check
- assert(hFile != NULL && hFile != INVALID_HANDLE_VALUE);
-
- // release IKsObject interface
- pObject->Release();
-
// construct device control
CBDADigitalDemodulator * handler = new CBDADigitalDemodulator(hFile);
Modified: trunk/reactos/dll/directx/bdaplgin/frequencyfilter.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/bdaplgin/frequ…
==============================================================================
--- trunk/reactos/dll/directx/bdaplgin/frequencyfilter.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/bdaplgin/frequencyfilter.cpp [iso-8859-1] Thu Feb 25
17:14:54 2010
@@ -185,35 +185,10 @@
HRESULT
WINAPI
CBDAFrequencyFilter_fnConstructor(
- IUnknown * pUnkOuter,
+ HANDLE hFile,
REFIID riid,
LPVOID * ppv)
{
- HRESULT hr;
- IKsObject *pObject = NULL;
- HANDLE hFile;
-
- // sanity check
- assert(pUnkOuter);
-
- // query for IKsObject
- hr = pUnkOuter->QueryInterface(IID_IKsObject, (void**)&pObject);
-
- // sanity check
- assert(hr == NOERROR);
-
- // another sanity check
- assert(pObject != NULL);
-
- // get file handle
- hFile = pObject->KsGetObjectHandle();
-
- // one more sanity check
- assert(hFile != NULL && hFile != INVALID_HANDLE_VALUE);
-
- // release IKsObject interface
- pObject->Release();
-
// construct device control
CBDAFrequencyFilter * handler = new CBDAFrequencyFilter(hFile);
Modified: trunk/reactos/dll/directx/bdaplgin/lnbinfo.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/bdaplgin/lnbin…
==============================================================================
--- trunk/reactos/dll/directx/bdaplgin/lnbinfo.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/bdaplgin/lnbinfo.cpp [iso-8859-1] Thu Feb 25 17:14:54 2010
@@ -133,35 +133,10 @@
HRESULT
WINAPI
CBDALNBInfo_fnConstructor(
- IUnknown * pUnkOuter,
+ HANDLE hFile,
REFIID riid,
LPVOID * ppv)
{
- HRESULT hr;
- IKsObject *pObject = NULL;
- HANDLE hFile;
-
- // sanity check
- assert(pUnkOuter);
-
- // query for IKsObject
- hr = pUnkOuter->QueryInterface(IID_IKsObject, (void**)&pObject);
-
- // sanity check
- assert(hr == NOERROR);
-
- // another sanity check
- assert(pObject != NULL);
-
- // get file handle
- hFile = pObject->KsGetObjectHandle();
-
- // one more sanity check
- assert(hFile != NULL && hFile != INVALID_HANDLE_VALUE);
-
- // release IKsObject interface
- pObject->Release();
-
// construct device control
CBDALNBInfo * handler = new CBDALNBInfo(hFile);
Modified: trunk/reactos/dll/directx/bdaplgin/pincontrol.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/bdaplgin/pinco…
==============================================================================
--- trunk/reactos/dll/directx/bdaplgin/pincontrol.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/bdaplgin/pincontrol.cpp [iso-8859-1] Thu Feb 25 17:14:54
2010
@@ -10,6 +10,7 @@
#include "precomp.h"
const GUID IID_IBDA_PinControl = {0x0DED49D5, 0xA8B7, 0x4d5d, {0x97, 0xA1, 0x12, 0xB0,
0xC1, 0x95, 0x87, 0x4D}};
+const GUID IID_IPin = {0x56a86891, 0x0ad4, 0x11ce, {0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b,
0xa7, 0x70}};
class CBDAPinControl : public IBDA_PinControl
{
@@ -38,13 +39,14 @@
HRESULT STDMETHODCALLTYPE RegistrationContext(ULONG *pulRegistrationCtx);
- CBDAPinControl(HANDLE hFile) : m_Ref(0), m_Handle(hFile){};
+ CBDAPinControl(HANDLE hFile, IBDA_NetworkProvider * pProvider, IPin * pConnectedPin)
: m_Ref(0), m_Handle(hFile), m_pProvider(pProvider), m_pConnectedPin(pConnectedPin){};
virtual ~CBDAPinControl(){};
protected:
LONG m_Ref;
HANDLE m_Handle;
-
+ IBDA_NetworkProvider * m_pProvider;
+ IPin * m_pConnectedPin;
};
HRESULT
@@ -53,9 +55,6 @@
IN REFIID refiid,
OUT PVOID* Output)
{
- WCHAR Buffer[MAX_PATH];
- LPOLESTR lpstr;
-
if (IsEqualGUID(refiid, IID_IUnknown))
{
*Output = PVOID(this);
@@ -69,10 +68,6 @@
return NOERROR;
}
- StringFromCLSID(refiid, &lpstr);
- swprintf(Buffer, L"CBDADeviceControl::QueryInterface: NoInterface for %s",
lpstr);
- OutputDebugStringW(Buffer);
- CoTaskMemFree(lpstr);
return E_NOINTERFACE;
}
//-------------------------------------------------------------------
@@ -109,7 +104,121 @@
REFIID riid,
LPVOID * ppv)
{
- CBDAPinControl * handler = new CBDAPinControl(NULL);
+ HRESULT hr;
+ IKsObject * pObject = NULL;
+ IPin * pPin = NULL, * pConnectedPin = NULL;
+ IEnumFilters *pEnumFilters = NULL;
+ IBDA_NetworkProvider * pNetworkProvider = NULL;
+ IBaseFilter * ppFilter[1];
+ PIN_INFO PinInfo;
+ FILTER_INFO FilterInfo;
+ HANDLE hFile = INVALID_HANDLE_VALUE;
+
+ if (!pUnkOuter)
+ return E_POINTER;
+
+ // query for IKsObject interface
+ hr = pUnkOuter->QueryInterface(IID_IKsObject, (void**)&pObject);
+
+ if (FAILED(hr))
+ return hr;
+
+ // query for IPin interface
+ hr = pObject->QueryInterface(IID_IPin, (void**)&pPin);
+
+ if (FAILED(hr))
+ {
+ //clean up
+ pObject->Release();
+ return hr;
+ }
+
+ // get pin info
+ hr = pPin->QueryPinInfo(&PinInfo);
+
+ if (FAILED(hr))
+ {
+ //clean up
+ pObject->Release();
+ pPin->Release();
+ return hr;
+ }
+
+ // sanity checks
+ assert(PinInfo.dir == PINDIR_OUTPUT);
+ assert(PinInfo.pFilter != NULL);
+
+ // query filter info
+ hr = PinInfo.pFilter->QueryFilterInfo(&FilterInfo);
+
+ // sanity check
+ assert(FilterInfo.pGraph != NULL);
+
+ // get IEnumFilters interface
+ hr = FilterInfo.pGraph->EnumFilters(&pEnumFilters);
+
+ if (FAILED(hr))
+ {
+ //clean up
+ FilterInfo.pGraph->Release();
+ PinInfo.pFilter->Release();
+ pObject->Release();
+ pPin->Release();
+ return hr;
+ }
+
+ while(pEnumFilters->Next(1, ppFilter, NULL) == S_OK)
+ {
+ // check if that filter supports the IBDA_NetworkProvider interface
+ hr = ppFilter[0]->QueryInterface(IID_IBDA_NetworkProvider,
(void**)&pNetworkProvider);
+
+ // release IBaseFilter
+ ppFilter[0]->Release();
+
+ if (SUCCEEDED(hr))
+ break;
+ }
+
+ // release IEnumFilters interface
+ pEnumFilters->Release();
+
+ // release IFilterGraph interface
+ FilterInfo.pGraph->Release();
+
+ // release IBaseFilter interface
+ PinInfo.pFilter->Release();
+
+ if (pNetworkProvider)
+ {
+ // get connected pin handle
+ hr = pPin->ConnectedTo(&pConnectedPin);
+
+ // get file handle
+ hFile = pObject->KsGetObjectHandle();
+
+ if (FAILED(hr) || hFile == INVALID_HANDLE_VALUE)
+ {
+ // pin not connected
+ pNetworkProvider->Release();
+ // set zero
+ pNetworkProvider = NULL;
+ }
+ }
+
+ // release IPin
+ pPin->Release();
+
+ // release IKsObject
+ pObject->Release();
+
+
+ if (pNetworkProvider == NULL)
+ {
+ // no network provider interface in graph
+ return E_NOINTERFACE;
+ }
+
+ CBDAPinControl * handler = new CBDAPinControl(hFile, pNetworkProvider,
pConnectedPin);
OutputDebugStringW(L"CBDAPinControl_fnConstructor");
@@ -124,4 +233,4 @@
}
return NOERROR;
-}
+}
Modified: trunk/reactos/dll/directx/bdaplgin/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/bdaplgin/preco…
==============================================================================
--- trunk/reactos/dll/directx/bdaplgin/precomp.h [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/bdaplgin/precomp.h [iso-8859-1] Thu Feb 25 17:14:54 2010
@@ -54,7 +54,7 @@
HRESULT
WINAPI
CControlNode_fnConstructor(
- IUnknown * pUnkOuter,
+ HANDLE hFile,
ULONG NodeType,
ULONG PinId,
REFIID riid,
@@ -65,7 +65,7 @@
HRESULT
WINAPI
CBDAFrequencyFilter_fnConstructor(
- IUnknown * pUnkOuter,
+ HANDLE hFile,
REFIID riid,
LPVOID * ppv);
@@ -74,7 +74,7 @@
HRESULT
WINAPI
CBDASignalStatistics_fnConstructor(
- IUnknown * pUnkOuter,
+ HANDLE hFile,
REFIID riid,
LPVOID * ppv);
@@ -83,7 +83,7 @@
HRESULT
WINAPI
CBDALNBInfo_fnConstructor(
- IUnknown * pUnkOuter,
+ HANDLE hFile,
REFIID riid,
LPVOID * ppv);
@@ -91,7 +91,7 @@
HRESULT
WINAPI
CBDADigitalDemodulator_fnConstructor(
- IUnknown * pUnkOuter,
+ HANDLE hFile,
REFIID riid,
LPVOID * ppv);
Modified: trunk/reactos/dll/directx/bdaplgin/signalstatistics.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/bdaplgin/signa…
==============================================================================
--- trunk/reactos/dll/directx/bdaplgin/signalstatistics.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/bdaplgin/signalstatistics.cpp [iso-8859-1] Thu Feb 25
17:14:54 2010
@@ -169,35 +169,10 @@
HRESULT
WINAPI
CBDASignalStatistics_fnConstructor(
- IUnknown * pUnkOuter,
+ HANDLE hFile,
REFIID riid,
LPVOID * ppv)
{
- HRESULT hr;
- IKsObject *pObject = NULL;
- HANDLE hFile;
-
- // sanity check
- assert(pUnkOuter);
-
- // query for IKsObject
- hr = pUnkOuter->QueryInterface(IID_IKsObject, (void**)&pObject);
-
- // sanity check
- assert(hr == NOERROR);
-
- // another sanity check
- assert(pObject != NULL);
-
- // get file handle
- hFile = pObject->KsGetObjectHandle();
-
- // one more sanity check
- assert(hFile != NULL && hFile != INVALID_HANDLE_VALUE);
-
- // release IKsObject interface
- pObject->Release();
-
// construct device control
CBDASignalStatistics * handler = new CBDASignalStatistics(hFile);