[KSPROXY]
[reactos.git] / reactos / dll / directx / ksproxy / cvpconfig.cpp
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 (janderwald@reactos.org)
8 */
9 #include "precomp.h"
10
11 class CVPConfig : public IVPConfig,
12 public IDistributorNotify
13 {
14 public:
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
62 protected:
63 LONG m_Ref;
64 };
65
66
67 HRESULT
68 STDMETHODCALLTYPE
69 CVPConfig::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
101 HRESULT
102 STDMETHODCALLTYPE
103 CVPConfig::Stop()
104 {
105 #ifdef KSPROXY_TRACE
106 OutputDebugStringW(L"UNIMPLEMENTED\n");
107 #endif
108 return E_NOTIMPL;
109 }
110
111 HRESULT
112 STDMETHODCALLTYPE
113 CVPConfig::Pause()
114 {
115 #ifdef KSPROXY_TRACE
116 OutputDebugStringW(L"UNIMPLEMENTED\n");
117 #endif
118 return E_NOTIMPL;
119 }
120
121 HRESULT
122 STDMETHODCALLTYPE
123 CVPConfig::Run(
124 REFERENCE_TIME tStart)
125 {
126 #ifdef KSPROXY_TRACE
127 OutputDebugStringW(L"UNIMPLEMENTED\n");
128 #endif
129 return E_NOTIMPL;
130 }
131
132 HRESULT
133 STDMETHODCALLTYPE
134 CVPConfig::SetSyncSource(
135 IReferenceClock *pClock)
136 {
137 #ifdef KSPROXY_TRACE
138 OutputDebugStringW(L"UNIMPLEMENTED\n");
139 #endif
140 return E_NOTIMPL;
141 }
142
143 HRESULT
144 STDMETHODCALLTYPE
145 CVPConfig::NotifyGraphChange()
146 {
147 #ifdef KSPROXY_TRACE
148 OutputDebugStringW(L"UNIMPLEMENTED\n");
149 #endif
150 return E_NOTIMPL;
151 }
152
153 //-------------------------------------------------------------------
154 // IVPBaseConfig
155 //
156 HRESULT
157 STDMETHODCALLTYPE
158 CVPConfig::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
168 HRESULT
169 STDMETHODCALLTYPE
170 CVPConfig::SetConnectInfo(
171 DWORD dwChosenEntry)
172 {
173 #ifdef KSPROXY_TRACE
174 OutputDebugStringW(L"UNIMPLEMENTED\n");
175 #endif
176 return E_NOTIMPL;
177 }
178
179 HRESULT
180 STDMETHODCALLTYPE
181 CVPConfig::GetVPDataInfo(
182 LPAMVPDATAINFO pamvpDataInfo)
183 {
184 #ifdef KSPROXY_TRACE
185 OutputDebugStringW(L"UNIMPLEMENTED\n");
186 #endif
187 return E_NOTIMPL;
188 }
189
190 HRESULT
191 STDMETHODCALLTYPE
192 CVPConfig::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
202 HRESULT
203 STDMETHODCALLTYPE
204 CVPConfig::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
214 HRESULT
215 STDMETHODCALLTYPE
216 CVPConfig::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
226 HRESULT
227 STDMETHODCALLTYPE
228 CVPConfig::SetVideoFormat(
229 DWORD dwChosenEntry)
230 {
231 #ifdef KSPROXY_TRACE
232 OutputDebugStringW(L"UNIMPLEMENTED\n");
233 #endif
234 return E_NOTIMPL;
235 }
236
237 HRESULT
238 STDMETHODCALLTYPE
239 CVPConfig::SetInvertPolarity()
240 {
241 #ifdef KSPROXY_TRACE
242 OutputDebugStringW(L"UNIMPLEMENTED\n");
243 #endif
244 return E_NOTIMPL;
245 }
246
247 HRESULT
248 STDMETHODCALLTYPE
249 CVPConfig::GetOverlaySurface(
250 LPDIRECTDRAWSURFACE* ppddOverlaySurface)
251 {
252 #ifdef KSPROXY_TRACE
253 OutputDebugStringW(L"UNIMPLEMENTED\n");
254 #endif
255 return E_NOTIMPL;
256 }
257
258 HRESULT
259 STDMETHODCALLTYPE
260 CVPConfig::SetDirectDrawKernelHandle(
261 ULONG_PTR dwDDKernelHandle)
262 {
263 #ifdef KSPROXY_TRACE
264 OutputDebugStringW(L"UNIMPLEMENTED\n");
265 #endif
266 return E_NOTIMPL;
267 }
268
269 HRESULT
270 STDMETHODCALLTYPE
271 CVPConfig::SetVideoPortID(
272 IN DWORD dwVideoPortID)
273 {
274 #ifdef KSPROXY_TRACE
275 OutputDebugStringW(L"UNIMPLEMENTED\n");
276 #endif
277 return E_NOTIMPL;
278 }
279
280
281 HRESULT
282 STDMETHODCALLTYPE
283 CVPConfig::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
294 HRESULT
295 STDMETHODCALLTYPE
296 CVPConfig::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
311 HRESULT
312 STDMETHODCALLTYPE
313 CVPConfig::IsVPDecimationAllowed(
314 LPBOOL pbIsDecimationAllowed)
315 {
316 #ifdef KSPROXY_TRACE
317 OutputDebugStringW(L"UNIMPLEMENTED\n");
318 #endif
319 return E_NOTIMPL;
320 }
321
322 HRESULT
323 STDMETHODCALLTYPE
324 CVPConfig::SetScalingFactors(
325 LPAMVPSIZE pamvpSize)
326 {
327 #ifdef KSPROXY_TRACE
328 OutputDebugStringW(L"UNIMPLEMENTED\n");
329 #endif
330 return E_NOTIMPL;
331 }
332
333
334 HRESULT
335 WINAPI
336 CVPConfig_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