mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
[BDAPLGIN]
- Enhance debug traces [KSPROXY] - Check if the input / output pin has any methods while enumerating them [MSDVBNP] - Implement IBaseFilter::Stop, IBaseFilter::Run, IBaseFilter::Pause - Fix missing AddRef in IBaseFilter::QueryFilterInfo - Implement IBDA_NetworkProvider::RegisterDeviceFilter, IBDA_NetworkProvider::UnRegisterDeviceFilter - Partly implement ITuner::put_TuneRequest - ReactOS DVBT Network Provider is now able to tune a channel, though sound is missing svn path=/trunk/; revision=46471
This commit is contained in:
parent
7456c01cae
commit
833d3c5b7f
12 changed files with 694 additions and 58 deletions
|
@ -472,8 +472,8 @@ CBDADeviceControl::GetControlNode(ULONG ulInputPinId, ULONG ulOutputPinId, ULONG
|
|||
hr = KsSynchronousDeviceControl(m_Handle, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSP_BDA_NODE_PIN) + sizeof(ULONG), &PinId, sizeof(ULONG), &BytesReturned);
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDADeviceControl::GetControlNode: hr %lx, BytesReturned %lu PinId %lu\n", hr, BytesReturned, PinId);
|
||||
WCHAR Buffer[200];
|
||||
swprintf(Buffer, L"CBDADeviceControl::GetControlNode: hr %lx, BytesReturned %lu PinId %lu ulInputPinId %lu ulOutputPinId %lu ulNodeType %lu\n", hr, BytesReturned, PinId, ulInputPinId, ulOutputPinId, ulNodeType);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ CBDADigitalDemodulator::put_ModulationType(ModulationType *pModulationType)
|
|||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDADigitalDemodulator::put_ModulationType: hr %lx\n", hr);
|
||||
swprintf(Buffer, L"CBDADigitalDemodulator::put_ModulationType: pModulationType %lu hr %lx\n", *pModulationType, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
@ -142,7 +142,7 @@ CBDADigitalDemodulator::put_InnerFECMethod(FECMethod *pFECMethod)
|
|||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDADigitalDemodulator::put_InnerFECMethod: hr %lx\n", hr);
|
||||
swprintf(Buffer, L"CBDADigitalDemodulator::put_InnerFECMethod: pFECMethod %lu hr %lx\n", *pFECMethod, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
@ -172,7 +172,7 @@ CBDADigitalDemodulator::put_InnerFECRate(BinaryConvolutionCodeRate *pFECRate)
|
|||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDADigitalDemodulator::put_InnerFECRate: hr %lx\n", hr);
|
||||
swprintf(Buffer, L"CBDADigitalDemodulator::put_InnerFECRate: pFECRate %lu hr %lx\n", *pFECRate, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
@ -202,7 +202,7 @@ CBDADigitalDemodulator::put_OuterFECMethod(FECMethod *pFECMethod)
|
|||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDADigitalDemodulator::put_OuterFECMethod: hr %lx\n", hr);
|
||||
swprintf(Buffer, L"CBDADigitalDemodulator::put_OuterFECMethod: pFECMethod %lu hr %lx\n", *pFECMethod, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
@ -232,7 +232,7 @@ CBDADigitalDemodulator::put_OuterFECRate(BinaryConvolutionCodeRate *pFECRate)
|
|||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDADigitalDemodulator::put_OuterFECRate: hr %lx\n", hr);
|
||||
swprintf(Buffer, L"CBDADigitalDemodulator::put_OuterFECRate: pFECRate %lu hr %lx\n", *pFECRate, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
@ -262,7 +262,7 @@ CBDADigitalDemodulator::put_SymbolRate(ULONG *pSymbolRate)
|
|||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDADigitalDemodulator::put_SymbolRate: hr %lx\n", hr);
|
||||
swprintf(Buffer, L"CBDADigitalDemodulator::put_SymbolRate: pSymbolRate %lu hr %lx\n", *pSymbolRate, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
@ -292,7 +292,7 @@ CBDADigitalDemodulator::put_SpectralInversion(SpectralInversion *pSpectralInvers
|
|||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDADigitalDemodulator::put_SpectralInversion: hr %lx\n", hr);
|
||||
swprintf(Buffer, L"CBDADigitalDemodulator::put_SpectralInversion: pSpectralInversion %lu hr %lx\n", *pSpectralInversion, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ CBDAFrequencyFilter::put_Frequency(ULONG ulFrequency)
|
|||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDAFrequencyFilter::put_Frequency: m_NodeId %lu hr %lx\n", m_NodeId, hr);
|
||||
swprintf(Buffer, L"CBDAFrequencyFilter::put_Frequency: m_NodeId %lu ulFrequency %lu hr %lx\n", m_NodeId, ulFrequency, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
@ -152,7 +152,7 @@ CBDAFrequencyFilter::put_Polarity(Polarisation Polarity)
|
|||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDAFrequencyFilter::put_Polarity: m_NodeId %lu hr %lx\n", m_NodeId, hr);
|
||||
swprintf(Buffer, L"CBDAFrequencyFilter::put_Polarity: m_NodeId %lu Polarity %lu hr %lx\n", m_NodeId, Polarity, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
@ -182,7 +182,7 @@ CBDAFrequencyFilter::put_Range(ULONG ulRange)
|
|||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDAFrequencyFilter::put_Polarity: m_NodeId %lu hr %lx\n", m_NodeId, hr);
|
||||
swprintf(Buffer, L"CBDAFrequencyFilter::put_Range: m_NodeId %lu ulRange %lu hr %lx\n", m_NodeId, ulRange, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
@ -212,7 +212,7 @@ CBDAFrequencyFilter::put_Bandwidth(ULONG ulBandwidth)
|
|||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDAFrequencyFilter::put_Bandwidth: m_NodeId %lu hr %lx\n", m_NodeId, hr);
|
||||
swprintf(Buffer, L"CBDAFrequencyFilter::put_Bandwidth: m_NodeId %lu ulBandwidth %lu hr %lx\n", m_NodeId, ulBandwidth, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
@ -241,7 +241,7 @@ CBDAFrequencyFilter::put_FrequencyMultiplier(ULONG ulMultiplier)
|
|||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDAFrequencyFilter::put_FrequencyMultiplier: m_NodeId %lu hr %lx\n", m_NodeId, hr);
|
||||
swprintf(Buffer, L"CBDAFrequencyFilter::put_FrequencyMultiplier: m_NodeId %lu ulMultiplier %lu hr %lx\n", m_NodeId, ulMultiplier, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ CBDALNBInfo::put_LocalOscilatorFrequencyLowBand(ULONG ulLOFLow)
|
|||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDALNBInfo::put_LocalOscilatorFrequencyLowBand: m_NodeId %lu hr %lx\n", m_NodeId, hr);
|
||||
swprintf(Buffer, L"CBDALNBInfo::put_LocalOscilatorFrequencyLowBand: m_NodeId %lu ulLOFLow %lu hr %lx\n", m_NodeId, ulLOFLow, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
@ -132,7 +132,7 @@ CBDALNBInfo::put_LocalOscilatorFrequencyHighBand(ULONG ulLOFHigh)
|
|||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDALNBInfo::put_LocalOscilatorFrequencyHighBand: m_NodeId %lu hr %lx\n", m_NodeId, hr);
|
||||
swprintf(Buffer, L"CBDALNBInfo::put_LocalOscilatorFrequencyHighBand: m_NodeId %lu ulLOFHigh %lu hr %lx\n", m_NodeId, ulLOFHigh, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
@ -162,7 +162,7 @@ CBDALNBInfo::put_HighLowSwitchFrequency(ULONG ulSwitchFrequency)
|
|||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDALNBInfo::put_HighLowSwitchFrequency: m_NodeId %lu hr %lx\n", m_NodeId, hr);
|
||||
swprintf(Buffer, L"CBDALNBInfo::put_HighLowSwitchFrequency: m_NodeId %lu ulSwitchFrequency %lu hr %lx\n", m_NodeId, ulSwitchFrequency, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -64,6 +64,14 @@ CEnumPins::QueryInterface(
|
|||
return NOERROR;
|
||||
}
|
||||
|
||||
WCHAR Buffer[100];
|
||||
LPOLESTR lpstr;
|
||||
StringFromCLSID(refiid, &lpstr);
|
||||
swprintf(Buffer, L"CEnumPins::QueryInterface: NoInterface for %s\n", lpstr);
|
||||
OutputDebugStringW(Buffer);
|
||||
CoTaskMemFree(lpstr);
|
||||
|
||||
DebugBreak();
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1629,6 +1629,7 @@ CInputPin::CreatePinHandle(
|
|||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::CreatePinHandle GetSupportedSets failed\n");
|
||||
DebugBreak();
|
||||
#endif
|
||||
return hr;
|
||||
}
|
||||
|
@ -1639,6 +1640,7 @@ CInputPin::CreatePinHandle(
|
|||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::CreatePinHandle LoadProxyPlugins failed\n");
|
||||
DebugBreak();
|
||||
#endif
|
||||
return hr;
|
||||
}
|
||||
|
@ -1683,6 +1685,8 @@ CInputPin::GetSupportedSets(
|
|||
|
||||
Length = NumProperty + NumMethods + NumEvents;
|
||||
|
||||
assert(Length);
|
||||
|
||||
// allocate guid buffer
|
||||
pGuid = (LPGUID)CoTaskMemAlloc(Length);
|
||||
if (!pGuid)
|
||||
|
@ -1695,6 +1699,12 @@ CInputPin::GetSupportedSets(
|
|||
NumMethods /= sizeof(GUID);
|
||||
NumEvents /= sizeof(GUID);
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
WCHAR Buffer[200];
|
||||
swprintf(Buffer, L"CInputPin::GetSupportedSets NumProperty %lu NumMethods %lu NumEvents %lu\n", NumProperty, NumMethods, NumEvents);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
// get all properties
|
||||
hr = KsSynchronousDeviceControl(m_hPin, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSPROPERTY), (PVOID)pGuid, Length, &BytesReturned);
|
||||
if (FAILED(hr))
|
||||
|
@ -1705,7 +1715,7 @@ CInputPin::GetSupportedSets(
|
|||
Length -= BytesReturned;
|
||||
|
||||
// get all methods
|
||||
if (Length)
|
||||
if (Length && NumMethods)
|
||||
{
|
||||
hr = KsSynchronousDeviceControl(m_hPin, IOCTL_KS_METHOD, (PVOID)&Property, sizeof(KSPROPERTY), (PVOID)&pGuid[NumProperty], Length, &BytesReturned);
|
||||
if (FAILED(hr))
|
||||
|
@ -1717,7 +1727,7 @@ CInputPin::GetSupportedSets(
|
|||
}
|
||||
|
||||
// get all events
|
||||
if (Length)
|
||||
if (Length && NumEvents)
|
||||
{
|
||||
hr = KsSynchronousDeviceControl(m_hPin, IOCTL_KS_ENABLE_EVENT, (PVOID)&Property, sizeof(KSPROPERTY), (PVOID)&pGuid[NumProperty+NumMethods], Length, &BytesReturned);
|
||||
if (FAILED(hr))
|
||||
|
@ -1728,12 +1738,6 @@ CInputPin::GetSupportedSets(
|
|||
Length -= BytesReturned;
|
||||
}
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
WCHAR Buffer[200];
|
||||
swprintf(Buffer, L"NumProperty %lu NumMethods %lu NumEvents %lu\n", NumProperty, NumMethods, NumEvents);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
*pOutGuid = pGuid;
|
||||
*NumGuids = NumProperty+NumEvents+NumMethods;
|
||||
return S_OK;
|
||||
|
@ -1779,6 +1783,7 @@ CInputPin::LoadProxyPlugins(
|
|||
{
|
||||
// store plugin
|
||||
m_Plugins.push_back(pUnknown);
|
||||
DebugBreak();
|
||||
}
|
||||
// close key
|
||||
RegCloseKey(hSubKey);
|
||||
|
|
|
@ -1985,8 +1985,12 @@ COutputPin::CreatePin(
|
|||
hr = CreatePinHandle(Medium, Interface, pmt);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
m_InterfaceHandler->Release();
|
||||
m_InterfaceHandler = InterfaceHandler;
|
||||
#ifdef KSPROXY_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"COutputPin::CreatePinHandle failed with %lx\n", hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
return hr;
|
||||
}
|
||||
|
||||
if (!m_InterfaceHandler)
|
||||
|
@ -2181,6 +2185,7 @@ COutputPin::CreatePinHandle(
|
|||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::CreatePinHandle GetSupportedSets failed\n");
|
||||
DebugBreak();
|
||||
#endif
|
||||
return hr;
|
||||
}
|
||||
|
@ -2191,6 +2196,7 @@ COutputPin::CreatePinHandle(
|
|||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::CreatePinHandle LoadProxyPlugins failed\n");
|
||||
DebugBreak();
|
||||
#endif
|
||||
return hr;
|
||||
}
|
||||
|
@ -2234,6 +2240,8 @@ COutputPin::GetSupportedSets(
|
|||
|
||||
Length = NumProperty + NumMethods + NumEvents;
|
||||
|
||||
assert(Length);
|
||||
|
||||
// allocate guid buffer
|
||||
pGuid = (LPGUID)CoTaskMemAlloc(Length);
|
||||
if (!pGuid)
|
||||
|
@ -2256,7 +2264,7 @@ COutputPin::GetSupportedSets(
|
|||
Length -= BytesReturned;
|
||||
|
||||
// get all methods
|
||||
if (Length)
|
||||
if (Length && NumMethods)
|
||||
{
|
||||
hr = KsSynchronousDeviceControl(m_hPin, IOCTL_KS_METHOD, (PVOID)&Property, sizeof(KSPROPERTY), (PVOID)&pGuid[NumProperty], Length, &BytesReturned);
|
||||
if (FAILED(hr))
|
||||
|
@ -2268,7 +2276,7 @@ COutputPin::GetSupportedSets(
|
|||
}
|
||||
|
||||
// get all events
|
||||
if (Length)
|
||||
if (Length && NumEvents)
|
||||
{
|
||||
hr = KsSynchronousDeviceControl(m_hPin, IOCTL_KS_ENABLE_EVENT, (PVOID)&Property, sizeof(KSPROPERTY), (PVOID)&pGuid[NumProperty+NumMethods], Length, &BytesReturned);
|
||||
if (FAILED(hr))
|
||||
|
@ -2330,6 +2338,7 @@ COutputPin::LoadProxyPlugins(
|
|||
{
|
||||
// store plugin
|
||||
m_Plugins.push_back(pUnknown);
|
||||
DebugBreak();
|
||||
}
|
||||
// close key
|
||||
RegCloseKey(hSubKey);
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
|
||||
#include "precomp.h"
|
||||
|
||||
const GUID CLSID_DVBTNetworkProvider = {0x216c62df, 0x6d7f, 0x4e9a, {0x85, 0x71, 0x5, 0xf1, 0x4e, 0xdb, 0x76, 0x6a}};
|
||||
|
||||
static INTERFACE_TABLE InterfaceTable[] =
|
||||
{
|
||||
{&CLSID_DVBTNetworkProvider, CNetworkProvider_fnConstructor},
|
||||
|
|
|
@ -8,11 +8,15 @@
|
|||
*/
|
||||
#include "precomp.h"
|
||||
|
||||
#define DEVICE_FILTER_MASK (0x80000000)
|
||||
|
||||
class CNetworkProvider : public IBaseFilter,
|
||||
public IAMovieSetup,
|
||||
public IBDA_NetworkProvider
|
||||
{
|
||||
public:
|
||||
typedef std::vector<IUnknown*>DeviceFilterStack;
|
||||
|
||||
STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
|
||||
|
||||
STDMETHODIMP_(ULONG) AddRef()
|
||||
|
@ -58,7 +62,7 @@ public:
|
|||
HRESULT STDMETHODCALLTYPE RegisterDeviceFilter(IUnknown *pUnkFilterControl, ULONG *ppvRegisitrationContext);
|
||||
HRESULT STDMETHODCALLTYPE UnRegisterDeviceFilter(ULONG pvRegistrationContext);
|
||||
|
||||
CNetworkProvider() : m_Ref(0), m_pGraph(0), m_ReferenceClock(0), m_FilterState(State_Stopped) {m_Pins[0] = 0;};
|
||||
CNetworkProvider(LPCGUID ClassID);
|
||||
virtual ~CNetworkProvider(){};
|
||||
|
||||
protected:
|
||||
|
@ -67,6 +71,9 @@ protected:
|
|||
IReferenceClock * m_ReferenceClock;
|
||||
FILTER_STATE m_FilterState;
|
||||
IPin * m_Pins[1];
|
||||
GUID m_ClassID;
|
||||
DeviceFilterStack m_DeviceFilters;
|
||||
IScanningTuner * m_Tuner;
|
||||
};
|
||||
|
||||
HRESULT
|
||||
|
@ -75,6 +82,9 @@ CNetworkProvider::QueryInterface(
|
|||
IN REFIID refiid,
|
||||
OUT PVOID* Output)
|
||||
{
|
||||
ULONG Index;
|
||||
HRESULT hr;
|
||||
|
||||
*Output = NULL;
|
||||
|
||||
if (IsEqualGUID(refiid, IID_IUnknown))
|
||||
|
@ -94,7 +104,47 @@ CNetworkProvider::QueryInterface(
|
|||
IsEqualGUID(refiid, IID_IScanningTuner))
|
||||
{
|
||||
// construct scanning tuner
|
||||
return CScanningTunner_fnConstructor(NULL, refiid, Output);
|
||||
if (!m_Tuner)
|
||||
{
|
||||
HRESULT hr = CScanningTunner_fnConstructor(m_DeviceFilters, refiid, (void**)&m_Tuner);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
}
|
||||
m_Tuner->AddRef();
|
||||
*Output = (IUnknown*)m_Tuner;
|
||||
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
if (IsEqualGUID(refiid, IID_IBDA_NetworkProvider))
|
||||
{
|
||||
*Output = (IBDA_NetworkProvider*)(this);
|
||||
reinterpret_cast<IBDA_NetworkProvider*>(*Output)->AddRef();
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
for(Index = 0; Index < m_DeviceFilters.size(); Index++)
|
||||
{
|
||||
// get device filter
|
||||
IUnknown *pFilter = m_DeviceFilters[Index];
|
||||
|
||||
if (!pFilter)
|
||||
continue;
|
||||
|
||||
// query for requested interface
|
||||
hr = pFilter->QueryInterface(refiid, Output);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
#ifdef MSDVBNP_TRACE
|
||||
WCHAR Buffer[MAX_PATH];
|
||||
LPOLESTR lpstr;
|
||||
StringFromCLSID(refiid, &lpstr);
|
||||
swprintf(Buffer, L"CNetworkProvider::QueryInterface: DeviceFilter %lu supports %s !!!\n", Index, lpstr);
|
||||
OutputDebugStringW(Buffer);
|
||||
CoTaskMemFree(lpstr);
|
||||
#endif
|
||||
return hr;
|
||||
}
|
||||
}
|
||||
|
||||
WCHAR Buffer[MAX_PATH];
|
||||
|
@ -103,11 +153,23 @@ CNetworkProvider::QueryInterface(
|
|||
swprintf(Buffer, L"CNetworkProvider::QueryInterface: NoInterface for %s !!!\n", lpstr);
|
||||
OutputDebugStringW(Buffer);
|
||||
CoTaskMemFree(lpstr);
|
||||
|
||||
DebugBreak();
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
CNetworkProvider::CNetworkProvider(LPCGUID ClassID) : m_Ref(0),
|
||||
m_pGraph(0),
|
||||
m_ReferenceClock(0),
|
||||
m_FilterState(State_Stopped),
|
||||
m_DeviceFilters(),
|
||||
m_Tuner(0)
|
||||
{
|
||||
m_Pins[0] = 0;
|
||||
|
||||
CopyMemory(&m_ClassID, ClassID, sizeof(GUID));
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// IBaseFilter interface
|
||||
//
|
||||
|
@ -117,24 +179,29 @@ STDMETHODCALLTYPE
|
|||
CNetworkProvider::GetClassID(
|
||||
CLSID *pClassID)
|
||||
{
|
||||
OutputDebugStringW(L"CNetworkProvider::GetClassID : NotImplemented\n");
|
||||
return E_NOTIMPL;
|
||||
OutputDebugStringW(L"CNetworkProvider::GetClassID\n");
|
||||
CopyMemory(&pClassID, &m_ClassID, sizeof(GUID));
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CNetworkProvider::Stop()
|
||||
{
|
||||
OutputDebugStringW(L"CNetworkProvider::Stop : NotImplemented\n");
|
||||
return E_NOTIMPL;
|
||||
OutputDebugStringW(L"CNetworkProvider::Stop\n");
|
||||
m_FilterState = State_Stopped;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CNetworkProvider::Pause()
|
||||
{
|
||||
OutputDebugStringW(L"CNetworkProvider::Pause : NotImplemented\n");
|
||||
return E_NOTIMPL;
|
||||
OutputDebugStringW(L"CNetworkProvider::Pause\n");
|
||||
|
||||
m_FilterState = State_Paused;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
|
@ -142,8 +209,10 @@ STDMETHODCALLTYPE
|
|||
CNetworkProvider::Run(
|
||||
REFERENCE_TIME tStart)
|
||||
{
|
||||
OutputDebugStringW(L"CNetworkProvider::Run : NotImplemented\n");
|
||||
return E_NOTIMPL;
|
||||
OutputDebugStringW(L"CNetworkProvider::Run\n");
|
||||
|
||||
m_FilterState = State_Running;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
|
@ -166,7 +235,6 @@ CNetworkProvider::SetSyncSource(
|
|||
pClock->AddRef();
|
||||
|
||||
}
|
||||
|
||||
if (m_ReferenceClock)
|
||||
{
|
||||
m_ReferenceClock->Release();
|
||||
|
@ -227,6 +295,9 @@ CNetworkProvider::QueryFilterInfo(
|
|||
pInfo->achName[0] = L'\0';
|
||||
pInfo->pGraph = m_pGraph;
|
||||
|
||||
if (m_pGraph)
|
||||
m_pGraph->AddRef();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -257,7 +328,6 @@ STDMETHODCALLTYPE
|
|||
CNetworkProvider::QueryVendorInfo(
|
||||
LPWSTR *pVendorInfo)
|
||||
{
|
||||
OutputDebugStringW(L"CNetworkProvider::QueryVendorInfo : NotImplemented\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -336,16 +406,95 @@ CNetworkProvider::RegisterDeviceFilter(
|
|||
IUnknown *pUnkFilterControl,
|
||||
ULONG *ppvRegisitrationContext)
|
||||
{
|
||||
OutputDebugStringW(L"CNetworkProvider::RegisterDeviceFilter : NotImplemented\n");
|
||||
return E_NOTIMPL;
|
||||
HRESULT hr;
|
||||
IBDA_DeviceControl * pDeviceControl = NULL;
|
||||
IBDA_Topology *pTopology = NULL;
|
||||
|
||||
OutputDebugStringW(L"CNetworkProvider::RegisterDeviceFilter\n");
|
||||
|
||||
if (!pUnkFilterControl || !ppvRegisitrationContext)
|
||||
{
|
||||
//invalid argument
|
||||
return E_POINTER;
|
||||
}
|
||||
|
||||
// the filter must support IBDA_DeviceControl and IBDA_Topology
|
||||
hr = pUnkFilterControl->QueryInterface(IID_IBDA_DeviceControl, (void**)&pDeviceControl);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
OutputDebugStringW(L"CNetworkProvider::RegisterDeviceFilter Filter does not support IBDA_DeviceControl\n");
|
||||
return hr;
|
||||
}
|
||||
|
||||
hr = pUnkFilterControl->QueryInterface(IID_IBDA_Topology, (void**)&pTopology);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
pDeviceControl->Release();
|
||||
OutputDebugStringW(L"CNetworkProvider::RegisterDeviceFilter Filter does not support IID_IBDA_Topology\n");
|
||||
return hr;
|
||||
}
|
||||
|
||||
//TODO
|
||||
// analyize device filter
|
||||
|
||||
// increment reference
|
||||
pUnkFilterControl->AddRef();
|
||||
|
||||
// release IBDA_DeviceControl interface
|
||||
pDeviceControl->Release();
|
||||
|
||||
// release IBDA_Topology interface
|
||||
pTopology->Release();
|
||||
|
||||
// store registration ctx
|
||||
*ppvRegisitrationContext = (m_DeviceFilters.size() | DEVICE_FILTER_MASK);
|
||||
|
||||
// store filter
|
||||
m_DeviceFilters.push_back(pUnkFilterControl);
|
||||
|
||||
OutputDebugStringW(L"CNetworkProvider::RegisterDeviceFilter complete\n");
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CNetworkProvider::UnRegisterDeviceFilter(ULONG pvRegistrationContext)
|
||||
{
|
||||
OutputDebugStringW(L"CNetworkProvider::UnRegisterDeviceFilter : NotImplemented\n");
|
||||
return E_NOTIMPL;
|
||||
ULONG Index;
|
||||
IUnknown * pUnknown;
|
||||
|
||||
OutputDebugStringW(L"CNetworkProvider::UnRegisterDeviceFilter\n");
|
||||
|
||||
if (!(pvRegistrationContext & DEVICE_FILTER_MASK))
|
||||
{
|
||||
// invalid argument
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
// get real index
|
||||
Index = pvRegistrationContext & ~DEVICE_FILTER_MASK;
|
||||
|
||||
if (Index >= m_DeviceFilters.size())
|
||||
{
|
||||
// invalid argument
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
pUnknown = m_DeviceFilters[Index];
|
||||
if (!pUnknown)
|
||||
{
|
||||
// filter was already de-registered
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
// remove from vector
|
||||
m_DeviceFilters[Index] = NULL;
|
||||
|
||||
// release extra reference
|
||||
pUnknown->Release();
|
||||
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
|
@ -355,7 +504,7 @@ CNetworkProvider_fnConstructor(
|
|||
REFIID riid,
|
||||
LPVOID * ppv)
|
||||
{
|
||||
CNetworkProvider * handler = new CNetworkProvider();
|
||||
CNetworkProvider * handler = new CNetworkProvider(&CLSID_DVBTNetworkProvider);
|
||||
|
||||
#ifdef MSDVBNP_TRACE
|
||||
WCHAR Buffer[MAX_PATH];
|
||||
|
|
|
@ -8,8 +8,10 @@
|
|||
*/
|
||||
#include "precomp.h"
|
||||
|
||||
#ifndef _MSC_VER
|
||||
const GUID KSDATAFORMAT_TYPE_BDA_ANTENNA = {0x71985f41, 0x1ca1, 0x11d3, {0x9c, 0xc8, 0x0, 0xc0, 0x4f, 0x79, 0x71, 0xe0}};
|
||||
const GUID GUID_NULL = {0x00000000L, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};
|
||||
#endif
|
||||
|
||||
class CPin : public IPin
|
||||
{
|
||||
|
|
|
@ -9,15 +9,18 @@
|
|||
#include <ks.h>
|
||||
#define __STREAMS__
|
||||
#include <ksproxy.h>
|
||||
#include <ksmedia.h>
|
||||
#include <stdio.h>
|
||||
#include <wchar.h>
|
||||
#include <tchar.h>
|
||||
#include <uuids.h>
|
||||
#include <bdatypes.h>
|
||||
#include <bdaiface.h>
|
||||
#include <bdatif.h>
|
||||
#include <bdamedia.h>
|
||||
#include <tuner.h>
|
||||
#include <assert.h>
|
||||
#include <vector>
|
||||
|
||||
typedef HRESULT (CALLBACK *LPFNCREATEINSTANCE)(IUnknown* pUnkOuter, REFIID riid, LPVOID* ppvObject);
|
||||
|
||||
|
@ -46,7 +49,7 @@ CNetworkProvider_fnConstructor(
|
|||
HRESULT
|
||||
WINAPI
|
||||
CScanningTunner_fnConstructor(
|
||||
IUnknown *pUnknown,
|
||||
std::vector<IUnknown*> & m_DeviceFilter,
|
||||
REFIID riid,
|
||||
LPVOID * ppv);
|
||||
|
||||
|
@ -79,4 +82,8 @@ CEnumMediaTypes_fnConstructor(
|
|||
REFIID riid,
|
||||
LPVOID * ppv);
|
||||
|
||||
#ifndef _MSC_VER
|
||||
extern const GUID CLSID_DVBTNetworkProvider;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -48,12 +48,19 @@ public:
|
|||
HRESULT STDMETHODCALLTYPE ScanDown(long MillisecondsPause);
|
||||
HRESULT STDMETHODCALLTYPE AutoProgram();
|
||||
|
||||
CScanningTunner() : m_Ref(0), m_TuningSpace(0){};
|
||||
virtual ~CScanningTunner(){};
|
||||
|
||||
CScanningTunner(std::vector<IUnknown*> & DeviceFilters) : m_Ref(0), m_TuningSpace(0), m_DeviceFilters(DeviceFilters){};
|
||||
virtual ~CScanningTunner() {};
|
||||
HRESULT STDMETHODCALLTYPE StartChanges();
|
||||
HRESULT STDMETHODCALLTYPE CommitChanges();
|
||||
HRESULT STDMETHODCALLTYPE CheckChanges();
|
||||
HRESULT STDMETHODCALLTYPE SetLnbInfo(IBDA_LNBInfo * pLnbInfo, ULONG ulLOFLow, ULONG ulLOFHigh, ULONG ulSwitchFrequency);
|
||||
HRESULT STDMETHODCALLTYPE SetDigitalDemodulator(IBDA_DigitalDemodulator * pDigitalDemo, ModulationType ModType, FECMethod InnerFEC, BinaryConvolutionCodeRate InnerFECRate, FECMethod OuterFEC, BinaryConvolutionCodeRate OuterFECRate, ULONG SymbolRate);
|
||||
HRESULT SetFrequency(IBDA_FrequencyFilter * pFrequency, ULONG FrequencyMultiplier, ULONG Frequency, Polarisation Polarity, ULONG Range, ULONG Bandwidth);
|
||||
HRESULT STDMETHODCALLTYPE performDVBTTune(IDVBTuneRequest * pDVBTRequest, IDVBTLocator *pDVBTLocator);
|
||||
protected:
|
||||
LONG m_Ref;
|
||||
ITuningSpace * m_TuningSpace;
|
||||
std::vector<IUnknown*> & m_DeviceFilters;
|
||||
};
|
||||
|
||||
HRESULT
|
||||
|
@ -140,8 +147,48 @@ STDMETHODCALLTYPE
|
|||
CScanningTunner::put_TuneRequest(
|
||||
ITuneRequest *TuneRequest)
|
||||
{
|
||||
OutputDebugStringW(L"CScanningTunner::put_TuneRequest : NotImplemented\n");
|
||||
return E_NOTIMPL;
|
||||
IDVBTuneRequest * pDVBTRequest;
|
||||
ILocator *pLocator;
|
||||
IDVBTLocator *pDVBTLocator;
|
||||
HRESULT hr;
|
||||
|
||||
|
||||
OutputDebugStringW(L"CScanningTunner::put_TuneRequest\n");
|
||||
|
||||
// query for IDVBTuneRequest interface
|
||||
hr = TuneRequest->QueryInterface(IID_IDVBTuneRequest, (void**)&pDVBTRequest);
|
||||
|
||||
// sanity check
|
||||
assert(hr == NOERROR);
|
||||
|
||||
// get the IDVBTLocator
|
||||
hr = pDVBTRequest->get_Locator((ILocator**)&pLocator);
|
||||
|
||||
// sanity check
|
||||
assert(hr == NOERROR);
|
||||
assert(pLocator);
|
||||
|
||||
hr = pLocator->QueryInterface(IID_ILocator, (void**)&pDVBTLocator);
|
||||
|
||||
// sanity check
|
||||
assert(hr == NOERROR);
|
||||
|
||||
|
||||
StartChanges();
|
||||
CommitChanges();
|
||||
StartChanges();
|
||||
|
||||
hr = performDVBTTune(pDVBTRequest, pDVBTLocator);
|
||||
|
||||
|
||||
pDVBTLocator->Release();
|
||||
pDVBTRequest->Release();
|
||||
|
||||
CheckChanges();
|
||||
CommitChanges();
|
||||
StartChanges();
|
||||
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
|
@ -233,20 +280,431 @@ CScanningTunner::AutoProgram()
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CScanningTunner::performDVBTTune(
|
||||
IDVBTuneRequest * pDVBTRequest,
|
||||
IDVBTLocator *pDVBTLocator)
|
||||
{
|
||||
HRESULT hr;
|
||||
ULONG Index;
|
||||
IBDA_Topology *pTopo;
|
||||
IUnknown *pNode;
|
||||
IBDA_FrequencyFilter * pFrequency;
|
||||
IBDA_LNBInfo * pLnbInfo;
|
||||
IBDA_DigitalDemodulator *pDigitalDemo;
|
||||
LONG BandWidth;
|
||||
LONG Frequency;
|
||||
LONG SymbolRate;
|
||||
FECMethod InnerFEC, OuterFEC;
|
||||
BinaryConvolutionCodeRate InnerFECRate, OuterFECRate;
|
||||
ModulationType Modulation;
|
||||
|
||||
pDVBTLocator->get_Bandwidth(&BandWidth);
|
||||
pDVBTLocator->get_CarrierFrequency(&Frequency);
|
||||
pDVBTLocator->get_InnerFEC(&InnerFEC);
|
||||
pDVBTLocator->get_InnerFECRate(&InnerFECRate);
|
||||
pDVBTLocator->get_Modulation(&Modulation);
|
||||
pDVBTLocator->get_OuterFEC(&OuterFEC);
|
||||
pDVBTLocator->get_OuterFECRate(&OuterFECRate);
|
||||
pDVBTLocator->get_SymbolRate(&SymbolRate);
|
||||
|
||||
|
||||
WCHAR Buffer[1000];
|
||||
swprintf(Buffer, L"BandWidth %lu Frequency %lu Rate %lu InnerFEC %ld OuterFEC %ld InnerFECRate %ld OuterFECRate %ld Modulation %lu\n",
|
||||
BandWidth, Frequency, SymbolRate, InnerFEC, OuterFEC, InnerFECRate, OuterFECRate, Modulation);
|
||||
|
||||
OutputDebugStringW(Buffer);
|
||||
|
||||
|
||||
|
||||
for(Index = 0; Index < m_DeviceFilters.size(); Index++)
|
||||
{
|
||||
// get device filter
|
||||
IUnknown * pFilter = m_DeviceFilters[Index];
|
||||
|
||||
if (!pFilter)
|
||||
continue;
|
||||
|
||||
hr = pFilter->QueryInterface(IID_IBDA_Topology, (void**)&pTopo);
|
||||
// sanity check
|
||||
assert(hr == NOERROR);
|
||||
|
||||
pNode = NULL;
|
||||
hr = pTopo->GetControlNode(0, 1, 0, &pNode); //HACK
|
||||
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CScanningTunner::performDVBTTune GetControlNode %lx\n", hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
|
||||
if (FAILED(hr))
|
||||
continue;
|
||||
|
||||
// sanity check
|
||||
assert(hr == NOERROR);
|
||||
assert(pNode);
|
||||
|
||||
hr = pNode->QueryInterface(IID_IBDA_FrequencyFilter, (void**)&pFrequency);
|
||||
|
||||
swprintf(Buffer, L"CScanningTunner::performDVBTTune IID_IBDA_FrequencyFilter hr %lx\n", hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
|
||||
// sanity check
|
||||
assert(hr == NOERROR);
|
||||
|
||||
hr = SetFrequency(pFrequency, 1000 /* FIXME */, Frequency, BDA_POLARISATION_NOT_DEFINED /* FIXME */, BDA_RANGE_NOT_SET /* FIXME */, BandWidth);
|
||||
|
||||
swprintf(Buffer, L"CScanningTunner::performDVBTTune SetFrequency hr %lx\n", hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
|
||||
//sanity check
|
||||
assert(hr == NOERROR);
|
||||
|
||||
// release interface
|
||||
pFrequency->Release();
|
||||
|
||||
|
||||
hr = pNode->QueryInterface(IID_IBDA_LNBInfo, (void**)&pLnbInfo);
|
||||
|
||||
swprintf(Buffer, L"CScanningTunner::performDVBTTune IID_IBDA_LNBInfo hr %lx\n", hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
|
||||
// sanity check
|
||||
assert(hr == NOERROR);
|
||||
|
||||
hr = SetLnbInfo(pLnbInfo, ULONG_MAX /* FIXME */, ULONG_MAX /* FIXME*/, ULONG_MAX /*FIXME*/);
|
||||
|
||||
|
||||
swprintf(Buffer, L"CScanningTunner::performDVBTTune SetLnbInfo hr %lx\n", hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
|
||||
// sanity check
|
||||
assert(hr == NOERROR);
|
||||
|
||||
// release interface
|
||||
pLnbInfo->Release();
|
||||
|
||||
hr = pNode->QueryInterface(IID_IBDA_DigitalDemodulator, (void**)&pDigitalDemo);
|
||||
|
||||
swprintf(Buffer, L"CScanningTunner::performDVBTTune IID_IBDA_DigitalDemodulator hr %lx\n", hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
|
||||
// sanity check
|
||||
assert(hr == NOERROR);
|
||||
|
||||
hr = SetDigitalDemodulator(pDigitalDemo, Modulation, InnerFEC, InnerFECRate, OuterFEC, OuterFECRate, SymbolRate);
|
||||
|
||||
swprintf(Buffer, L"CScanningTunner::performDVBTTune SetDigitalDemodulator hr %lx\n", hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
|
||||
// sanity check
|
||||
assert(hr == NOERROR);
|
||||
|
||||
// release interface
|
||||
pDigitalDemo->Release();
|
||||
|
||||
// release control node
|
||||
pNode->Release();
|
||||
|
||||
// release IBDA_Topology;
|
||||
pTopo->Release();
|
||||
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CScanningTunner::CheckChanges()
|
||||
{
|
||||
ULONG Index;
|
||||
HRESULT hResult = NOERROR;
|
||||
IBDA_DeviceControl * pDeviceControl;
|
||||
|
||||
for(Index = 0; Index < m_DeviceFilters.size(); Index++)
|
||||
{
|
||||
// get filter
|
||||
IUnknown * pFilter = m_DeviceFilters[Index];
|
||||
|
||||
if (!pFilter)
|
||||
continue;
|
||||
|
||||
// query for IBDA_DeviceControl interface
|
||||
hResult = pFilter->QueryInterface(IID_IBDA_DeviceControl, (void**)&pDeviceControl);
|
||||
|
||||
// sanity check
|
||||
assert(hResult == NOERROR);
|
||||
|
||||
//start changes
|
||||
hResult = pDeviceControl->CheckChanges();
|
||||
|
||||
// fix for unimplemented
|
||||
if (hResult == E_NOTIMPL)
|
||||
hResult = NOERROR;
|
||||
|
||||
// release interface
|
||||
pDeviceControl->Release();
|
||||
|
||||
if (FAILED(hResult))
|
||||
{
|
||||
//shouldnt happen
|
||||
break;
|
||||
}
|
||||
}
|
||||
// done
|
||||
return hResult;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CScanningTunner::CommitChanges()
|
||||
{
|
||||
ULONG Index;
|
||||
HRESULT hResult = NOERROR;
|
||||
IBDA_DeviceControl * pDeviceControl;
|
||||
|
||||
for(Index = 0; Index < m_DeviceFilters.size(); Index++)
|
||||
{
|
||||
// get filter
|
||||
IUnknown * pFilter = m_DeviceFilters[Index];
|
||||
|
||||
if (!pFilter)
|
||||
continue;
|
||||
|
||||
// query for IBDA_DeviceControl interface
|
||||
HRESULT hr = pFilter->QueryInterface(IID_IBDA_DeviceControl, (void**)&pDeviceControl);
|
||||
|
||||
// sanity check
|
||||
assert(hr == NOERROR);
|
||||
|
||||
//start changes
|
||||
hr = pDeviceControl->CommitChanges();
|
||||
|
||||
// fix for unimplemented
|
||||
if (hr == E_NOTIMPL)
|
||||
hr = NOERROR;
|
||||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
pDeviceControl->StartChanges();
|
||||
pDeviceControl->CommitChanges();
|
||||
hResult = E_UNEXPECTED;
|
||||
}
|
||||
|
||||
// release interface
|
||||
pDeviceControl->Release();
|
||||
|
||||
}
|
||||
|
||||
//done
|
||||
return hResult;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CScanningTunner::StartChanges()
|
||||
{
|
||||
ULONG Index;
|
||||
IBDA_DeviceControl * pDeviceControl;
|
||||
|
||||
for(Index = 0; Index < m_DeviceFilters.size(); Index++)
|
||||
{
|
||||
// get filter
|
||||
IUnknown * pFilter = m_DeviceFilters[Index];
|
||||
|
||||
if (!pFilter)
|
||||
continue;
|
||||
|
||||
// query for IBDA_DeviceControl interface
|
||||
HRESULT hr = pFilter->QueryInterface(IID_IBDA_DeviceControl, (void**)&pDeviceControl);
|
||||
|
||||
// sanity check
|
||||
assert(hr == NOERROR);
|
||||
|
||||
//start changes
|
||||
hr = pDeviceControl->StartChanges();
|
||||
|
||||
// release interface
|
||||
pDeviceControl->Release();
|
||||
|
||||
// fix for unimplemented
|
||||
if (hr == E_NOTIMPL)
|
||||
hr = NOERROR;
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
}
|
||||
|
||||
// now commit the changes
|
||||
for(Index = 0; Index < m_DeviceFilters.size(); Index++)
|
||||
{
|
||||
// get filter
|
||||
IUnknown * pFilter = m_DeviceFilters[Index];
|
||||
|
||||
if (!pFilter)
|
||||
continue;
|
||||
|
||||
// query for IBDA_DeviceControl interface
|
||||
HRESULT hr = pFilter->QueryInterface(IID_IBDA_DeviceControl, (void**)&pDeviceControl);
|
||||
|
||||
// sanity check
|
||||
assert(hr == NOERROR);
|
||||
|
||||
hr = pDeviceControl->CommitChanges();
|
||||
|
||||
// release interface
|
||||
pDeviceControl->Release();
|
||||
}
|
||||
|
||||
// done
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CScanningTunner::SetLnbInfo(
|
||||
IBDA_LNBInfo * pLnbInfo,
|
||||
ULONG ulLOFLow,
|
||||
ULONG ulLOFHigh,
|
||||
ULONG ulSwitchFrequency)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
hr = pLnbInfo->put_LocalOscilatorFrequencyLowBand(ulLOFLow);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND) || hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_SET_NOT_FOUND))
|
||||
hr = NOERROR;
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = pLnbInfo->put_LocalOscilatorFrequencyHighBand(ulLOFHigh);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND) || hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_SET_NOT_FOUND))
|
||||
hr = NOERROR;
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = pLnbInfo->put_HighLowSwitchFrequency(ulSwitchFrequency);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND) || hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_SET_NOT_FOUND))
|
||||
hr = NOERROR;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
CScanningTunner::SetFrequency(
|
||||
IBDA_FrequencyFilter * pFrequency,
|
||||
ULONG FrequencyMultiplier,
|
||||
ULONG Frequency,
|
||||
Polarisation Polarity,
|
||||
ULONG Range,
|
||||
ULONG Bandwidth)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
hr = pFrequency->put_FrequencyMultiplier(FrequencyMultiplier);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = pFrequency->put_Frequency(Frequency);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = pFrequency->put_Polarity(Polarity);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND))
|
||||
hr = NOERROR;
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = pFrequency->put_Range(Range);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND))
|
||||
hr = NOERROR;
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = pFrequency->put_Bandwidth(Bandwidth);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CScanningTunner::SetDigitalDemodulator(
|
||||
IBDA_DigitalDemodulator * pDigitalDemo,
|
||||
ModulationType ModType,
|
||||
FECMethod InnerFEC,
|
||||
BinaryConvolutionCodeRate InnerFECRate,
|
||||
FECMethod OuterFEC,
|
||||
BinaryConvolutionCodeRate OuterFECRate,
|
||||
ULONG SymbolRate)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
hr = pDigitalDemo->put_ModulationType(&ModType);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND) || hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_SET_NOT_FOUND))
|
||||
hr = NOERROR;
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = pDigitalDemo->put_InnerFECMethod(&InnerFEC);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND) || hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_SET_NOT_FOUND))
|
||||
hr = NOERROR;
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = pDigitalDemo->put_InnerFECRate(&InnerFECRate);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND) || hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_SET_NOT_FOUND))
|
||||
hr = NOERROR;
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = pDigitalDemo->put_OuterFECMethod(&OuterFEC);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND) || hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_SET_NOT_FOUND))
|
||||
hr = NOERROR;
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = pDigitalDemo->put_OuterFECRate(&OuterFECRate);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND) || hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_SET_NOT_FOUND))
|
||||
hr = NOERROR;
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = pDigitalDemo->put_SymbolRate(&SymbolRate);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND) || hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_SET_NOT_FOUND))
|
||||
hr = NOERROR;
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
SpectralInversion Inversion = BDA_SPECTRAL_INVERSION_NOT_DEFINED;
|
||||
hr = pDigitalDemo->put_SpectralInversion(&Inversion);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND) || hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_SET_NOT_FOUND))
|
||||
hr = NOERROR;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
HRESULT
|
||||
WINAPI
|
||||
CScanningTunner_fnConstructor(
|
||||
IUnknown *pUnknown,
|
||||
std::vector<IUnknown*> & DeviceFilter,
|
||||
REFIID riid,
|
||||
LPVOID * ppv)
|
||||
{
|
||||
CScanningTunner * handler = new CScanningTunner();
|
||||
CScanningTunner * handler = new CScanningTunner(DeviceFilter);
|
||||
|
||||
#ifdef MSDVBNP_TRACE
|
||||
WCHAR Buffer[MAX_PATH];
|
||||
LPOLESTR lpstr;
|
||||
StringFromCLSID(riid, &lpstr);
|
||||
swprintf(Buffer, L"CScanningTunner_fnConstructor riid %s pUnknown %p\n", lpstr, pUnknown);
|
||||
swprintf(Buffer, L"CScanningTunner_fnConstructor riid %s\n", lpstr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue