Reactos
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS WDM Streaming ActiveMovie Proxy
4 * FILE: dll/directx/ksproxy/cvpconfig.cpp
5 * PURPOSE: IVPConfig interface
6 *
7 * PROGRAMMERS: Johannes Anderwald (johannes.anderwald@reactos.org)
8 */
9#include "precomp.h"
10
11class CVPConfig : public IVPConfig,
12 public IDistributorNotify
13{
14public:
15 STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
16
17 STDMETHODIMP_(ULONG) AddRef()
18 {
19 InterlockedIncrement(&m_Ref);
20 return m_Ref;
21 }
22 STDMETHODIMP_(ULONG) Release()
23 {
24 InterlockedDecrement(&m_Ref);
25
26 if (!m_Ref)
27 {
28 delete this;
29 return 0;
30 }
31 return m_Ref;
32 }
33
34 // IDistributorNotify interface
35 HRESULT STDMETHODCALLTYPE Stop();
36 HRESULT STDMETHODCALLTYPE Pause();
37 HRESULT STDMETHODCALLTYPE Run(REFERENCE_TIME tStart);
38 HRESULT STDMETHODCALLTYPE SetSyncSource(IReferenceClock *pClock);
39 HRESULT STDMETHODCALLTYPE NotifyGraphChange();
40
41 // IVPBaseConfig
42 HRESULT STDMETHODCALLTYPE GetConnectInfo(LPDWORD pdwNumConnectInfo, IN OUT LPDDVIDEOPORTCONNECT pddVPConnectInfo);
43 HRESULT STDMETHODCALLTYPE SetConnectInfo(DWORD dwChosenEntry);
44 HRESULT STDMETHODCALLTYPE GetVPDataInfo(LPAMVPDATAINFO pamvpDataInfo);
45 HRESULT STDMETHODCALLTYPE GetMaxPixelRate(LPAMVPSIZE pamvpSize, OUT LPDWORD pdwMaxPixelsPerSecond);
46 HRESULT STDMETHODCALLTYPE InformVPInputFormats(DWORD dwNumFormats, IN LPDDPIXELFORMAT pDDPixelFormats);
47 HRESULT STDMETHODCALLTYPE GetVideoFormats(LPDWORD pdwNumFormats, IN OUT LPDDPIXELFORMAT pddPixelFormats);
48 HRESULT STDMETHODCALLTYPE SetVideoFormat(DWORD dwChosenEntry);
49 HRESULT STDMETHODCALLTYPE SetInvertPolarity();
50 HRESULT STDMETHODCALLTYPE GetOverlaySurface(LPDIRECTDRAWSURFACE* ppddOverlaySurface);
51 HRESULT STDMETHODCALLTYPE SetDirectDrawKernelHandle(ULONG_PTR dwDDKernelHandle);
52 HRESULT STDMETHODCALLTYPE SetVideoPortID(IN DWORD dwVideoPortID);
53 HRESULT STDMETHODCALLTYPE SetDDSurfaceKernelHandles(DWORD cHandles, IN ULONG_PTR *rgDDKernelHandles);
54 HRESULT STDMETHODCALLTYPE SetSurfaceParameters(DWORD dwPitch, IN DWORD dwXOrigin, IN DWORD dwYOrigin);
55 // IVPConfig
56 HRESULT STDMETHODCALLTYPE IsVPDecimationAllowed(LPBOOL pbIsDecimationAllowed);
57 HRESULT STDMETHODCALLTYPE SetScalingFactors(LPAMVPSIZE pamvpSize);
58
59 CVPConfig() : m_Ref(0){}
60 virtual ~CVPConfig(){}
61
62protected:
63 LONG m_Ref;
64};
65
66
67HRESULT
68STDMETHODCALLTYPE
69CVPConfig::QueryInterface(
70 IN REFIID refiid,
71 OUT PVOID* Output)
72{
73 if (IsEqualGUID(refiid, IID_IUnknown))
74 {
75 *Output = PVOID(this);
76 reinterpret_cast<IUnknown*>(*Output)->AddRef();
77 return NOERROR;
78 }
79 if (IsEqualGUID(refiid, IID_IDistributorNotify))
80 {
81 *Output = (IDistributorNotify*)(this);
82 reinterpret_cast<IDistributorNotify*>(*Output)->AddRef();
83 return NOERROR;
84 }
85
86 if (IsEqualGUID(refiid, IID_IVPConfig))
87 {
88 *Output = (IVPConfig*)(this);
89 reinterpret_cast<IVPConfig*>(*Output)->AddRef();
90 return NOERROR;
91 }
92
93 return E_NOINTERFACE;
94}
95
96//-------------------------------------------------------------------
97// IDistributorNotify interface
98//
99
100
101HRESULT
102STDMETHODCALLTYPE
103CVPConfig::Stop()
104{
105#ifdef KSPROXY_TRACE
106 OutputDebugStringW(L"UNIMPLEMENTED\n");
107#endif
108 return E_NOTIMPL;
109}
110
111HRESULT
112STDMETHODCALLTYPE
113CVPConfig::Pause()
114{
115#ifdef KSPROXY_TRACE
116 OutputDebugStringW(L"UNIMPLEMENTED\n");
117#endif
118 return E_NOTIMPL;
119}
120
121HRESULT
122STDMETHODCALLTYPE
123CVPConfig::Run(
124 REFERENCE_TIME tStart)
125{
126#ifdef KSPROXY_TRACE
127 OutputDebugStringW(L"UNIMPLEMENTED\n");
128#endif
129 return E_NOTIMPL;
130}
131
132HRESULT
133STDMETHODCALLTYPE
134CVPConfig::SetSyncSource(
135 IReferenceClock *pClock)
136{
137#ifdef KSPROXY_TRACE
138 OutputDebugStringW(L"UNIMPLEMENTED\n");
139#endif
140 return E_NOTIMPL;
141}
142
143HRESULT
144STDMETHODCALLTYPE
145CVPConfig::NotifyGraphChange()
146{
147#ifdef KSPROXY_TRACE
148 OutputDebugStringW(L"UNIMPLEMENTED\n");
149#endif
150 return E_NOTIMPL;
151}
152
153//-------------------------------------------------------------------
154// IVPBaseConfig
155//
156HRESULT
157STDMETHODCALLTYPE
158CVPConfig::GetConnectInfo(
159 LPDWORD pdwNumConnectInfo,
160 IN OUT LPDDVIDEOPORTCONNECT pddVPConnectInfo)
161{
162#ifdef KSPROXY_TRACE
163 OutputDebugStringW(L"UNIMPLEMENTED\n");
164#endif
165 return E_NOTIMPL;
166}
167
168HRESULT
169STDMETHODCALLTYPE
170CVPConfig::SetConnectInfo(
171 DWORD dwChosenEntry)
172{
173#ifdef KSPROXY_TRACE
174 OutputDebugStringW(L"UNIMPLEMENTED\n");
175#endif
176 return E_NOTIMPL;
177}
178
179HRESULT
180STDMETHODCALLTYPE
181CVPConfig::GetVPDataInfo(
182 LPAMVPDATAINFO pamvpDataInfo)
183{
184#ifdef KSPROXY_TRACE
185 OutputDebugStringW(L"UNIMPLEMENTED\n");
186#endif
187 return E_NOTIMPL;
188}
189
190HRESULT
191STDMETHODCALLTYPE
192CVPConfig::GetMaxPixelRate(
193 LPAMVPSIZE pamvpSize,
194 OUT LPDWORD pdwMaxPixelsPerSecond)
195{
196#ifdef KSPROXY_TRACE
197 OutputDebugStringW(L"UNIMPLEMENTED\n");
198#endif
199 return E_NOTIMPL;
200}
201
202HRESULT
203STDMETHODCALLTYPE
204CVPConfig::InformVPInputFormats(
205 DWORD dwNumFormats,
206 IN LPDDPIXELFORMAT pDDPixelFormats)
207{
208#ifdef KSPROXY_TRACE
209 OutputDebugStringW(L"UNIMPLEMENTED\n");
210#endif
211 return E_NOTIMPL;
212}
213
214HRESULT
215STDMETHODCALLTYPE
216CVPConfig::GetVideoFormats(
217 LPDWORD pdwNumFormats,
218 IN OUT LPDDPIXELFORMAT pddPixelFormats)
219{
220#ifdef KSPROXY_TRACE
221 OutputDebugStringW(L"UNIMPLEMENTED\n");
222#endif
223 return E_NOTIMPL;
224}
225
226HRESULT
227STDMETHODCALLTYPE
228CVPConfig::SetVideoFormat(
229 DWORD dwChosenEntry)
230{
231#ifdef KSPROXY_TRACE
232 OutputDebugStringW(L"UNIMPLEMENTED\n");
233#endif
234 return E_NOTIMPL;
235}
236
237HRESULT
238STDMETHODCALLTYPE
239CVPConfig::SetInvertPolarity()
240{
241#ifdef KSPROXY_TRACE
242 OutputDebugStringW(L"UNIMPLEMENTED\n");
243#endif
244 return E_NOTIMPL;
245}
246
247HRESULT
248STDMETHODCALLTYPE
249CVPConfig::GetOverlaySurface(
250 LPDIRECTDRAWSURFACE* ppddOverlaySurface)
251{
252#ifdef KSPROXY_TRACE
253 OutputDebugStringW(L"UNIMPLEMENTED\n");
254#endif
255 return E_NOTIMPL;
256}
257
258HRESULT
259STDMETHODCALLTYPE
260CVPConfig::SetDirectDrawKernelHandle(
261 ULONG_PTR dwDDKernelHandle)
262{
263#ifdef KSPROXY_TRACE
264 OutputDebugStringW(L"UNIMPLEMENTED\n");
265#endif
266 return E_NOTIMPL;
267}
268
269HRESULT
270STDMETHODCALLTYPE
271CVPConfig::SetVideoPortID(
272 IN DWORD dwVideoPortID)
273{
274#ifdef KSPROXY_TRACE
275 OutputDebugStringW(L"UNIMPLEMENTED\n");
276#endif
277 return E_NOTIMPL;
278}
279
280
281HRESULT
282STDMETHODCALLTYPE
283CVPConfig::SetDDSurfaceKernelHandles(
284 DWORD cHandles,
285 IN ULONG_PTR *rgDDKernelHandles)
286{
287#ifdef KSPROXY_TRACE
288 OutputDebugStringW(L"UNIMPLEMENTED\n");
289#endif
290 return E_NOTIMPL;
291}
292
293
294HRESULT
295STDMETHODCALLTYPE
296CVPConfig::SetSurfaceParameters(
297 DWORD dwPitch,
298 IN DWORD dwXOrigin,
299 IN DWORD dwYOrigin)
300{
301#ifdef KSPROXY_TRACE
302 OutputDebugStringW(L"UNIMPLEMENTED\n");
303#endif
304 return E_NOTIMPL;
305}
306
307//-------------------------------------------------------------------
308// IVPConfig
309//
310
311HRESULT
312STDMETHODCALLTYPE
313CVPConfig::IsVPDecimationAllowed(
314 LPBOOL pbIsDecimationAllowed)
315{
316#ifdef KSPROXY_TRACE
317 OutputDebugStringW(L"UNIMPLEMENTED\n");
318#endif
319 return E_NOTIMPL;
320}
321
322HRESULT
323STDMETHODCALLTYPE
324CVPConfig::SetScalingFactors(
325 LPAMVPSIZE pamvpSize)
326{
327#ifdef KSPROXY_TRACE
328 OutputDebugStringW(L"UNIMPLEMENTED\n");
329#endif
330 return E_NOTIMPL;
331}
332
333
334HRESULT
335WINAPI
336CVPConfig_Constructor(
337 IUnknown * pUnkOuter,
338 REFIID riid,
339 LPVOID * ppv)
340{
341#ifdef KSPROXY_TRACE
342 OutputDebugStringW(L"CVPConfig_Constructor\n");
343#endif
344
345 CVPConfig * handler = new CVPConfig();
346
347 if (!handler)
348 return E_OUTOFMEMORY;
349
350 if (FAILED(handler->QueryInterface(riid, ppv)))
351 {
352 /* not supported */
353 delete handler;
354 return E_NOINTERFACE;
355 }
356
357 return NOERROR;
358}
359