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