2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS BDA Proxy
4 * FILE: dll/directx/bdaplgin/digitaldemo.cpp
5 * PURPOSE: IBDA_DigitalDemodulator interface
7 * PROGRAMMERS: Johannes Anderwald (janderwald@reactos.org)
12 const GUID IID_IBDA_DigitalDemodulator
= {0xef30f379, 0x985b, 0x4d10, {0xb6, 0x40, 0xa7, 0x9d, 0x5e, 0x04, 0xe1, 0xe0}};
13 const GUID KSPROPSETID_BdaDigitalDemodulator
= {0xef30f379, 0x985b, 0x4d10, {0xb6, 0x40, 0xa7, 0x9d, 0x5e, 0x4, 0xe1, 0xe0}};
15 class CBDADigitalDemodulator
: public IBDA_DigitalDemodulator
18 STDMETHODIMP
QueryInterface( REFIID InterfaceId
, PVOID
* Interface
);
20 STDMETHODIMP_(ULONG
) AddRef()
22 InterlockedIncrement(&m_Ref
);
25 STDMETHODIMP_(ULONG
) Release()
27 InterlockedDecrement(&m_Ref
);
35 //IBDA_DigitalDemodulator methods
36 HRESULT STDMETHODCALLTYPE
put_ModulationType(ModulationType
*pModulationType
);
37 HRESULT STDMETHODCALLTYPE
get_ModulationType(ModulationType
*pModulationType
);
38 HRESULT STDMETHODCALLTYPE
put_InnerFECMethod(FECMethod
*pFECMethod
);
39 HRESULT STDMETHODCALLTYPE
get_InnerFECMethod(FECMethod
*pFECMethod
);
40 HRESULT STDMETHODCALLTYPE
put_InnerFECRate(BinaryConvolutionCodeRate
*pFECRate
);
41 HRESULT STDMETHODCALLTYPE
get_InnerFECRate(BinaryConvolutionCodeRate
*pFECRate
);
42 HRESULT STDMETHODCALLTYPE
put_OuterFECMethod(FECMethod
*pFECMethod
);
43 HRESULT STDMETHODCALLTYPE
get_OuterFECMethod(FECMethod
*pFECMethod
);
44 HRESULT STDMETHODCALLTYPE
put_OuterFECRate(BinaryConvolutionCodeRate
*pFECRate
);
45 HRESULT STDMETHODCALLTYPE
get_OuterFECRate(BinaryConvolutionCodeRate
*pFECRate
);
46 HRESULT STDMETHODCALLTYPE
put_SymbolRate(ULONG
*pSymbolRate
);
47 HRESULT STDMETHODCALLTYPE
get_SymbolRate(ULONG
*pSymbolRate
);
48 HRESULT STDMETHODCALLTYPE
put_SpectralInversion(SpectralInversion
*pSpectralInversion
);
49 HRESULT STDMETHODCALLTYPE
get_SpectralInversion(SpectralInversion
*pSpectralInversion
);
51 CBDADigitalDemodulator(HANDLE hFile
, ULONG NodeId
) : m_Ref(0), m_hFile(hFile
), m_NodeId(NodeId
){};
52 ~CBDADigitalDemodulator(){};
62 CBDADigitalDemodulator::QueryInterface(
68 if (IsEqualGUID(refiid
, IID_IUnknown
))
70 *Output
= PVOID(this);
71 reinterpret_cast<IUnknown
*>(*Output
)->AddRef();
75 if (IsEqualGUID(refiid
, IID_IBDA_DigitalDemodulator
))
77 *Output
= (IBDA_DigitalDemodulator
*)(this);
78 reinterpret_cast<IBDA_DigitalDemodulator
*>(*Output
)->AddRef();
83 WCHAR Buffer
[MAX_PATH
];
85 StringFromCLSID(refiid
, &lpstr
);
86 swprintf(Buffer
, L
"CBDADigitalDemodulator::QueryInterface: NoInterface for %s", lpstr
);
87 OutputDebugStringW(Buffer
);
96 CBDADigitalDemodulator::put_ModulationType(ModulationType
*pModulationType
)
104 Node
.Property
.Set
= KSPROPSETID_BdaDigitalDemodulator
;
105 Node
.Property
.Id
= KSPROPERTY_BDA_MODULATION_TYPE
;
106 Node
.Property
.Flags
= KSPROPERTY_TYPE_TOPOLOGY
| KSPROPERTY_TYPE_SET
;
107 Node
.NodeId
= m_NodeId
;
110 hr
= KsSynchronousDeviceControl(m_hFile
, IOCTL_KS_PROPERTY
, (PVOID
)&Node
, sizeof(KSP_NODE
), pModulationType
, sizeof(ModulationType
), &BytesReturned
);
112 #ifdef BDAPLGIN_TRACE
114 swprintf(Buffer
, L
"CBDADigitalDemodulator::put_ModulationType: hr %lx, BytesReturned %lu\n", hr
, BytesReturned
);
115 OutputDebugStringW(Buffer
);
123 CBDADigitalDemodulator::get_ModulationType(ModulationType
*pModulationType
)
125 return E_NOINTERFACE
;
130 CBDADigitalDemodulator::put_InnerFECMethod(FECMethod
*pFECMethod
)
137 Node
.Property
.Set
= KSPROPSETID_BdaDigitalDemodulator
;
138 Node
.Property
.Id
= KSPROPERTY_BDA_INNER_FEC_TYPE
;
139 Node
.Property
.Flags
= KSPROPERTY_TYPE_TOPOLOGY
| KSPROPERTY_TYPE_SET
;
140 Node
.NodeId
= m_NodeId
;
143 hr
= KsSynchronousDeviceControl(m_hFile
, IOCTL_KS_PROPERTY
, (PVOID
)&Node
, sizeof(KSP_NODE
), pFECMethod
, sizeof(FECMethod
), &BytesReturned
);
145 #ifdef BDAPLGIN_TRACE
147 swprintf(Buffer
, L
"CBDADigitalDemodulator::put_InnerFECMethod: hr %lx, BytesReturned %lu\n", hr
, BytesReturned
);
148 OutputDebugStringW(Buffer
);
156 CBDADigitalDemodulator::get_InnerFECMethod(FECMethod
*pFECMethod
)
158 return E_NOINTERFACE
;
163 CBDADigitalDemodulator::put_InnerFECRate(BinaryConvolutionCodeRate
*pFECRate
)
171 Node
.Property
.Set
= KSPROPSETID_BdaDigitalDemodulator
;
172 Node
.Property
.Id
= KSPROPERTY_BDA_INNER_FEC_RATE
;
173 Node
.Property
.Flags
= KSPROPERTY_TYPE_TOPOLOGY
| KSPROPERTY_TYPE_SET
;
174 Node
.NodeId
= m_NodeId
;
177 hr
= KsSynchronousDeviceControl(m_hFile
, IOCTL_KS_PROPERTY
, (PVOID
)&Node
, sizeof(KSP_NODE
), pFECRate
, sizeof(BinaryConvolutionCodeRate
), &BytesReturned
);
179 #ifdef BDAPLGIN_TRACE
181 swprintf(Buffer
, L
"CBDADigitalDemodulator::put_InnerFECRate: hr %lx, BytesReturned %lu\n", hr
, BytesReturned
);
182 OutputDebugStringW(Buffer
);
190 CBDADigitalDemodulator::get_InnerFECRate(BinaryConvolutionCodeRate
*pFECRate
)
192 return E_NOINTERFACE
;
197 CBDADigitalDemodulator::put_OuterFECMethod(FECMethod
*pFECMethod
)
204 Node
.Property
.Set
= KSPROPSETID_BdaDigitalDemodulator
;
205 Node
.Property
.Id
= KSPROPERTY_BDA_OUTER_FEC_TYPE
;
206 Node
.Property
.Flags
= KSPROPERTY_TYPE_TOPOLOGY
| KSPROPERTY_TYPE_SET
;
207 Node
.NodeId
= m_NodeId
;
210 hr
= KsSynchronousDeviceControl(m_hFile
, IOCTL_KS_PROPERTY
, (PVOID
)&Node
, sizeof(KSP_NODE
), pFECMethod
, sizeof(FECMethod
), &BytesReturned
);
212 #ifdef BDAPLGIN_TRACE
214 swprintf(Buffer
, L
"CBDADigitalDemodulator::put_OuterFECMethod: hr %lx, BytesReturned %lu\n", hr
, BytesReturned
);
215 OutputDebugStringW(Buffer
);
223 STDMETHODCALLTYPE
CBDADigitalDemodulator::get_OuterFECMethod(FECMethod
*pFECMethod
)
225 return E_NOINTERFACE
;
230 CBDADigitalDemodulator::put_OuterFECRate(BinaryConvolutionCodeRate
*pFECRate
)
238 Node
.Property
.Set
= KSPROPSETID_BdaDigitalDemodulator
;
239 Node
.Property
.Id
= KSPROPERTY_BDA_OUTER_FEC_RATE
;
240 Node
.Property
.Flags
= KSPROPERTY_TYPE_TOPOLOGY
| KSPROPERTY_TYPE_SET
;
241 Node
.NodeId
= m_NodeId
;
244 hr
= KsSynchronousDeviceControl(m_hFile
, IOCTL_KS_PROPERTY
, (PVOID
)&Node
, sizeof(KSP_NODE
), pFECRate
, sizeof(BinaryConvolutionCodeRate
), &BytesReturned
);
246 #ifdef BDAPLGIN_TRACE
248 swprintf(Buffer
, L
"CBDADigitalDemodulator::put_OuterFECRate: hr %lx, BytesReturned %lu\n", hr
, BytesReturned
);
249 OutputDebugStringW(Buffer
);
257 CBDADigitalDemodulator::get_OuterFECRate(BinaryConvolutionCodeRate
*pFECRate
)
259 return E_NOINTERFACE
;
264 CBDADigitalDemodulator::put_SymbolRate(ULONG
*pSymbolRate
)
271 Node
.Property
.Set
= KSPROPSETID_BdaDigitalDemodulator
;
272 Node
.Property
.Id
= KSPROPERTY_BDA_SYMBOL_RATE
;
273 Node
.Property
.Flags
= KSPROPERTY_TYPE_TOPOLOGY
| KSPROPERTY_TYPE_SET
;
274 Node
.NodeId
= m_NodeId
;
277 hr
= KsSynchronousDeviceControl(m_hFile
, IOCTL_KS_PROPERTY
, (PVOID
)&Node
, sizeof(KSP_NODE
), pSymbolRate
, sizeof(ULONG
), &BytesReturned
);
279 #ifdef BDAPLGIN_TRACE
281 swprintf(Buffer
, L
"CBDADigitalDemodulator::put_SymbolRate: hr %lx, BytesReturned %lu\n", hr
, BytesReturned
);
282 OutputDebugStringW(Buffer
);
290 CBDADigitalDemodulator::get_SymbolRate(ULONG
*pSymbolRate
)
292 return E_NOINTERFACE
;
297 CBDADigitalDemodulator::put_SpectralInversion(SpectralInversion
*pSpectralInversion
)
304 Node
.Property
.Set
= KSPROPSETID_BdaDigitalDemodulator
;
305 Node
.Property
.Id
= KSPROPERTY_BDA_SPECTRAL_INVERSION
;
306 Node
.Property
.Flags
= KSPROPERTY_TYPE_TOPOLOGY
| KSPROPERTY_TYPE_SET
;
307 Node
.NodeId
= m_NodeId
;
310 hr
= KsSynchronousDeviceControl(m_hFile
, IOCTL_KS_PROPERTY
, (PVOID
)&Node
, sizeof(KSP_NODE
), pSpectralInversion
, sizeof(SpectralInversion
), &BytesReturned
);
312 #ifdef BDAPLGIN_TRACE
314 swprintf(Buffer
, L
"CBDADigitalDemodulator::put_SpectralInversion: hr %lx, BytesReturned %lu\n", hr
, BytesReturned
);
315 OutputDebugStringW(Buffer
);
323 CBDADigitalDemodulator::get_SpectralInversion(SpectralInversion
*pSpectralInversion
)
325 return E_NOINTERFACE
;
331 CBDADigitalDemodulator_fnConstructor(
337 // construct device control
338 CBDADigitalDemodulator
* handler
= new CBDADigitalDemodulator(hFile
, NodeId
);
340 #ifdef BDAPLGIN_TRACE
341 OutputDebugStringW(L
"CBDADigitalDemodulator_fnConstructor\n");
345 return E_OUTOFMEMORY
;
347 if (FAILED(handler
->QueryInterface(riid
, ppv
)))
351 return E_NOINTERFACE
;