Don't open device if already open.
[wine] / dlls / quartz / videorenderer.c
1 /*
2  * Video Renderer (Fullscreen and Windowed using Direct Draw)
3  *
4  * Copyright 2004 Christian Costa
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #include "config.h"
22
23 #define NONAMELESSSTRUCT
24 #define NONAMELESSUNION
25 #include "quartz_private.h"
26 #include "control_private.h"
27 #include "pin.h"
28
29 #include "uuids.h"
30 #include "mmreg.h"
31 #include "vfwmsgs.h"
32 #include "amvideo.h"
33 #include "fourcc.h"
34 #include "windef.h"
35 #include "winbase.h"
36 #include "dshow.h"
37 #include "evcode.h"
38 #include "strmif.h"
39 #include "ddraw.h"
40
41 #include "wine/unicode.h"
42 #include "wine/debug.h"
43
44 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
45
46 static const WCHAR wcsInputPinName[] = {'i','n','p','u','t',' ','p','i','n',0};
47
48 static const IBaseFilterVtbl VideoRenderer_Vtbl;
49 static IBasicVideoVtbl IBasicVideo_VTable;
50 static IVideoWindowVtbl IVideoWindow_VTable;
51 static const IPinVtbl VideoRenderer_InputPin_Vtbl;
52
53 typedef struct VideoRendererImpl
54 {
55     const IBaseFilterVtbl * lpVtbl;
56     IBasicVideoVtbl * IBasicVideo_vtbl;
57     IVideoWindowVtbl * IVideoWindow_vtbl;
58
59     ULONG refCount;
60     CRITICAL_SECTION csFilter;
61     FILTER_STATE state;
62     REFERENCE_TIME rtStreamStart;
63     IReferenceClock * pClock;
64     FILTER_INFO filterInfo;
65
66     InputPin * pInputPin;
67     IPin ** ppPins;
68
69     LPDIRECTDRAW ddraw;
70     LPDIRECTDRAWSURFACE surface;
71     LPDIRECTDRAWSURFACE backbuffer;
72     int init;
73 } VideoRendererImpl;
74
75 static const IMemInputPinVtbl MemInputPin_Vtbl = 
76 {
77     MemInputPin_QueryInterface,
78     MemInputPin_AddRef,
79     MemInputPin_Release,
80     MemInputPin_GetAllocator,
81     MemInputPin_NotifyAllocator,
82     MemInputPin_GetAllocatorRequirements,
83     MemInputPin_Receive,
84     MemInputPin_ReceiveMultiple,
85     MemInputPin_ReceiveCanBlock
86 };
87
88 static HRESULT VideoRenderer_InputPin_Construct(const PIN_INFO * pPinInfo, SAMPLEPROC pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, IPin ** ppPin)
89 {
90     InputPin * pPinImpl;
91
92     *ppPin = NULL;
93
94     if (pPinInfo->dir != PINDIR_INPUT)
95     {
96         ERR("Pin direction(%x) != PINDIR_INPUT\n", pPinInfo->dir);
97         return E_INVALIDARG;
98     }
99
100     pPinImpl = CoTaskMemAlloc(sizeof(*pPinImpl));
101
102     if (!pPinImpl)
103         return E_OUTOFMEMORY;
104
105     if (SUCCEEDED(InputPin_Init(pPinInfo, pSampleProc, pUserData, pQueryAccept, pCritSec, pPinImpl)))
106     {
107         pPinImpl->pin.lpVtbl = &VideoRenderer_InputPin_Vtbl;
108         pPinImpl->lpVtblMemInput = &MemInputPin_Vtbl;
109       
110         *ppPin = (IPin *)(&pPinImpl->pin.lpVtbl);
111         return S_OK;
112     }
113     return E_FAIL;
114 }
115
116 static HRESULT VideoRenderer_CreatePrimarySurface(IBaseFilter * iface)
117 {
118     HRESULT hr;
119     DDSURFACEDESC sdesc;
120     DDSCAPS ddscaps;
121     VideoRendererImpl *This = (VideoRendererImpl *)iface;
122         
123     hr = DirectDrawCreate(NULL, &This->ddraw, NULL);
124
125     if (FAILED(hr)) {
126         ERR("Cannot create Direct Draw object\n");
127         return hr;
128     }
129
130     hr = IDirectDraw_SetCooperativeLevel(This->ddraw, NULL, DDSCL_FULLSCREEN|DDSCL_EXCLUSIVE);
131     if (FAILED(hr)) {
132         ERR("Cannot set fulscreen mode\n");
133         return hr;
134     }
135     
136     sdesc.dwSize = sizeof(sdesc);
137     sdesc.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
138     sdesc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP;
139     sdesc.dwBackBufferCount = 1;
140
141     hr = IDirectDraw_CreateSurface(This->ddraw, &sdesc, &This->surface, NULL);
142     if (FAILED(hr)) {
143         ERR("Cannot create surface\n");
144         return hr;
145     }
146
147     hr = IDirectDrawSurface_GetSurfaceDesc(This->surface, &sdesc);
148     if (FAILED(hr)) {
149         ERR("Cannot get surface information\n");
150         return hr;
151     }
152     TRACE("Width = %ld\n", sdesc.dwWidth);
153     TRACE("Height = %ld\n", sdesc.dwHeight);
154     TRACE("Pitch = %ld\n", sdesc.u1.lPitch);
155     TRACE("Depth = %ld\n", sdesc.ddpfPixelFormat.u1.dwRGBBitCount);
156     
157     ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
158     hr = IDirectDrawSurface_GetAttachedSurface(This->surface, &ddscaps, &This->backbuffer);
159     if (FAILED(hr)) {
160         ERR("Cannot get backbuffer\n");
161         return hr;
162     }
163
164     return S_OK;
165 }
166
167 static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data, DWORD size)
168 {
169     VIDEOINFOHEADER* format;
170     AM_MEDIA_TYPE amt;
171     HRESULT hr = S_OK;
172     int i = 0;
173     int j = 0;
174     LPBYTE ptr;
175     DDSURFACEDESC sdesc;
176     int width;
177     int height;
178     LPBYTE palette = NULL;
179
180     TRACE("%p %p %ld\n", This, data, size);
181
182     sdesc.dwSize = sizeof(sdesc);
183     hr = IPin_ConnectionMediaType(This->ppPins[0], &amt);
184     if (FAILED(hr)) {
185         ERR("Unable to retrieve media type\n");
186         return hr;
187     }
188     format = (VIDEOINFOHEADER*)amt.pbFormat;
189
190     TRACE("biSize = %ld\n", format->bmiHeader.biSize);
191     TRACE("biWidth = %ld\n", format->bmiHeader.biWidth);
192     TRACE("biHeigth = %ld\n", format->bmiHeader.biHeight);
193     TRACE("biPlanes = %d\n", format->bmiHeader.biPlanes);
194     TRACE("biBitCount = %d\n", format->bmiHeader.biBitCount);
195     TRACE("biCompression = %s\n", debugstr_an((LPSTR)&(format->bmiHeader.biCompression), 4));
196     TRACE("biSizeImage = %ld\n", format->bmiHeader.biSizeImage);
197
198     width = format->bmiHeader.biWidth;
199     height = format->bmiHeader.biHeight;
200     palette = ((LPBYTE)&format->bmiHeader) + format->bmiHeader.biSize;
201  
202     hr = IDirectDrawSurface_Lock(This->backbuffer, NULL, &sdesc, DDLOCK_WRITEONLY, NULL);
203     if (FAILED(hr)) {
204         ERR("Cannot lock backbuffer\n");
205         return hr;
206     }
207
208     ptr = sdesc.lpSurface;
209
210     /* FIXME: We may use Direct Draw services to do the conversion for us */
211     if ((sdesc.ddpfPixelFormat.u1.dwRGBBitCount == 24) || (sdesc.ddpfPixelFormat.u1.dwRGBBitCount == 32))
212     {
213         if (format->bmiHeader.biBitCount == 8)
214         {
215             int psz = sdesc.ddpfPixelFormat.u1.dwRGBBitCount == 32 ? 4 : 3;
216             for (j = 0; j < height; j++)
217                 for (i = 0; i < width; i++)
218                 {
219                     *(ptr + i*psz + 0 + j * sdesc.u1.lPitch) = palette[*(data + i + 0 + (height-1-j) * width)*4 + 0];
220                     *(ptr + i*psz + 1 + j * sdesc.u1.lPitch) = palette[*(data + i + 0 + (height-1-j) * width)*4 + 1];
221                     *(ptr + i*psz + 2 + j * sdesc.u1.lPitch) = palette[*(data + i + 0 + (height-1-j) * width)*4 + 2];
222                     if (psz == 4)
223                         *(ptr + i*psz + 3 + j * sdesc.u1.lPitch) = 0xFF;
224                 }
225         }
226         else if ((format->bmiHeader.biBitCount == 24) || (format->bmiHeader.biBitCount == 32))
227         {
228             int dpsz = sdesc.ddpfPixelFormat.u1.dwRGBBitCount == 32 ? 4 : 3;
229             int spsz = format->bmiHeader.biBitCount == 32 ? 4 : 3;
230             for (j = 0; j < height; j++)
231                 for (i = 0; i < width; i++)
232                 {
233                     *(ptr + i*dpsz + 0 + j * sdesc.u1.lPitch) = *(data + (i + 0 + (height-1-j) * width)*spsz + 0);
234                     *(ptr + i*dpsz + 1 + j * sdesc.u1.lPitch) = *(data + (i + 0 + (height-1-j) * width)*spsz + 1);
235                     *(ptr + i*dpsz + 2 + j * sdesc.u1.lPitch) = *(data + (i + 0 + (height-1-j) * width)*spsz + 2);
236                     if (dpsz == 4)
237                         *(ptr + i*dpsz + 3 + j * sdesc.u1.lPitch) = 0xFF;
238                 }
239         }
240         else
241             FIXME("Source size with a depths other than 8 (paletted), 24 or 32 bits are not yet supported\n");
242     }
243     else
244         FIXME("Destination depths with a depth other than 24 or 32 bits are not yet supported\n");     
245
246     hr = IDirectDrawSurface_Unlock(This->backbuffer, NULL);
247     if (FAILED(hr)) {
248         ERR("Cannot unlock backbuffer\n");
249         return hr;
250     }
251
252     hr = IDirectDrawSurface_Flip(This->surface, NULL, DDFLIP_WAIT);
253     if (FAILED(hr)) {
254         ERR("Cannot unlock backbuffer\n");
255         return hr;
256     }
257     
258     return S_OK;
259 }
260
261 static HRESULT VideoRenderer_Sample(LPVOID iface, IMediaSample * pSample)
262 {
263     VideoRendererImpl *This = (VideoRendererImpl *)iface;
264     LPBYTE pbSrcStream = NULL;
265     long cbSrcStream = 0;
266     REFERENCE_TIME tStart, tStop;
267     HRESULT hr;
268
269     TRACE("%p %p\n", iface, pSample);
270     
271     hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
272     if (FAILED(hr))
273     {
274         ERR("Cannot get pointer to sample data (%lx)\n", hr);
275         return hr;
276     }
277
278     hr = IMediaSample_GetTime(pSample, &tStart, &tStop);
279     if (FAILED(hr))
280         ERR("Cannot get sample time (%lx)\n", hr);
281
282     cbSrcStream = IMediaSample_GetActualDataLength(pSample);
283
284     TRACE("val %p %ld\n", pbSrcStream, cbSrcStream);
285
286 #if 0 /* For debugging purpose */
287     {
288         int i;
289         for(i = 0; i < cbSrcStream; i++)
290         {
291             if ((i!=0) && !(i%16))
292                 DPRINTF("\n");
293             DPRINTF("%02x ", pbSrcStream[i]);
294         }
295         DPRINTF("\n");
296     }
297 #endif
298     
299     if (!This->init)
300     {
301         This->init = 1;
302         hr = VideoRenderer_CreatePrimarySurface(iface);
303         if (FAILED(hr))
304         {
305             ERR("Unable to create primary surface\n");
306         }
307     }
308
309     VideoRenderer_SendSampleData(This, pbSrcStream, cbSrcStream);
310
311     return S_OK;
312 }
313
314 static HRESULT VideoRenderer_QueryAccept(LPVOID iface, const AM_MEDIA_TYPE * pmt)
315 {
316     if ((IsEqualIID(&pmt->majortype, &MEDIATYPE_Video) && IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB32)) ||
317         (IsEqualIID(&pmt->majortype, &MEDIATYPE_Video) && IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB24)) ||
318         (IsEqualIID(&pmt->majortype, &MEDIATYPE_Video) && IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB565)) ||
319         (IsEqualIID(&pmt->majortype, &MEDIATYPE_Video) && IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB8)))
320         return S_OK;
321     return S_FALSE;
322 }
323
324 HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
325 {
326     HRESULT hr;
327     PIN_INFO piInput;
328     VideoRendererImpl * pVideoRenderer;
329
330     TRACE("(%p, %p)\n", pUnkOuter, ppv);
331
332     *ppv = NULL;
333
334     if (pUnkOuter)
335         return CLASS_E_NOAGGREGATION;
336     
337     pVideoRenderer = CoTaskMemAlloc(sizeof(VideoRendererImpl));
338
339     pVideoRenderer->lpVtbl = &VideoRenderer_Vtbl;
340     pVideoRenderer->IBasicVideo_vtbl = &IBasicVideo_VTable;
341     pVideoRenderer->IVideoWindow_vtbl = &IVideoWindow_VTable;
342     
343     pVideoRenderer->refCount = 1;
344     InitializeCriticalSection(&pVideoRenderer->csFilter);
345     pVideoRenderer->state = State_Stopped;
346     pVideoRenderer->pClock = NULL;
347     pVideoRenderer->init = 0;
348     ZeroMemory(&pVideoRenderer->filterInfo, sizeof(FILTER_INFO));
349
350     pVideoRenderer->ppPins = CoTaskMemAlloc(1 * sizeof(IPin *));
351
352     /* construct input pin */
353     piInput.dir = PINDIR_INPUT;
354     piInput.pFilter = (IBaseFilter *)pVideoRenderer;
355     lstrcpynW(piInput.achName, wcsInputPinName, sizeof(piInput.achName) / sizeof(piInput.achName[0]));
356
357     hr = VideoRenderer_InputPin_Construct(&piInput, VideoRenderer_Sample, (LPVOID)pVideoRenderer, VideoRenderer_QueryAccept, &pVideoRenderer->csFilter, (IPin **)&pVideoRenderer->pInputPin);
358
359     if (SUCCEEDED(hr))
360     {
361         pVideoRenderer->ppPins[0] = (IPin *)pVideoRenderer->pInputPin;
362         *ppv = (LPVOID)pVideoRenderer;
363     }
364     else
365     {
366         CoTaskMemFree(pVideoRenderer->ppPins);
367         DeleteCriticalSection(&pVideoRenderer->csFilter);
368         CoTaskMemFree(pVideoRenderer);
369     }
370
371     return hr;
372 }
373
374 static HRESULT WINAPI VideoRenderer_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv)
375 {
376     VideoRendererImpl *This = (VideoRendererImpl *)iface;
377     TRACE("(%p/%p)->(%s, %p)\n", This, iface, qzdebugstr_guid(riid), ppv);
378
379     *ppv = NULL;
380
381     if (IsEqualIID(riid, &IID_IUnknown))
382         *ppv = (LPVOID)This;
383     else if (IsEqualIID(riid, &IID_IPersist))
384         *ppv = (LPVOID)This;
385     else if (IsEqualIID(riid, &IID_IMediaFilter))
386         *ppv = (LPVOID)This;
387     else if (IsEqualIID(riid, &IID_IBaseFilter))
388         *ppv = (LPVOID)This;
389     else if (IsEqualIID(riid, &IID_IBasicVideo))
390         *ppv = (LPVOID)&(This->IBasicVideo_vtbl);
391     else if (IsEqualIID(riid, &IID_IVideoWindow))
392         *ppv = (LPVOID)&(This->IVideoWindow_vtbl);
393
394     if (*ppv)
395     {
396         IUnknown_AddRef((IUnknown *)(*ppv));
397         return S_OK;
398     }
399
400     FIXME("No interface for %s!\n", qzdebugstr_guid(riid));
401
402     return E_NOINTERFACE;
403 }
404
405 static ULONG WINAPI VideoRenderer_AddRef(IBaseFilter * iface)
406 {
407     VideoRendererImpl *This = (VideoRendererImpl *)iface;
408     ULONG refCount = InterlockedIncrement(&This->refCount);
409
410     TRACE("(%p/%p)->() AddRef from %ld\n", This, iface, refCount - 1);
411
412     return refCount;
413 }
414
415 static ULONG WINAPI VideoRenderer_Release(IBaseFilter * iface)
416 {
417     VideoRendererImpl *This = (VideoRendererImpl *)iface;
418     ULONG refCount = InterlockedDecrement(&This->refCount);
419
420     TRACE("(%p/%p)->() Release from %ld\n", This, iface, refCount + 1);
421
422     if (!refCount)
423     {
424         DeleteCriticalSection(&This->csFilter);
425
426         if (This->pClock)
427             IReferenceClock_Release(This->pClock);
428         
429         IPin_Release(This->ppPins[0]);
430         
431         HeapFree(GetProcessHeap(), 0, This->ppPins);
432         This->lpVtbl = NULL;
433         
434         TRACE("Destroying Video Renderer\n");
435         CoTaskMemFree(This);
436         
437         return 0;
438     }
439     else
440         return refCount;
441 }
442
443 /** IPersist methods **/
444
445 static HRESULT WINAPI VideoRenderer_GetClassID(IBaseFilter * iface, CLSID * pClsid)
446 {
447     VideoRendererImpl *This = (VideoRendererImpl *)iface;
448
449     TRACE("(%p/%p)->(%p)\n", This, iface, pClsid);
450
451     *pClsid = CLSID_VideoRenderer;
452
453     return S_OK;
454 }
455
456 /** IMediaFilter methods **/
457
458 static HRESULT WINAPI VideoRenderer_Stop(IBaseFilter * iface)
459 {
460     VideoRendererImpl *This = (VideoRendererImpl *)iface;
461
462     TRACE("(%p/%p)->()\n", This, iface);
463
464     EnterCriticalSection(&This->csFilter);
465     {
466         This->state = State_Stopped;
467     }
468     LeaveCriticalSection(&This->csFilter);
469     
470     return S_OK;
471 }
472
473 static HRESULT WINAPI VideoRenderer_Pause(IBaseFilter * iface)
474 {
475     VideoRendererImpl *This = (VideoRendererImpl *)iface;
476     
477     TRACE("(%p/%p)->()\n", This, iface);
478
479     EnterCriticalSection(&This->csFilter);
480     {
481         This->state = State_Paused;
482     }
483     LeaveCriticalSection(&This->csFilter);
484
485     return S_OK;
486 }
487
488 static HRESULT WINAPI VideoRenderer_Run(IBaseFilter * iface, REFERENCE_TIME tStart)
489 {
490     VideoRendererImpl *This = (VideoRendererImpl *)iface;
491
492     TRACE("(%p/%p)->(%s)\n", This, iface, wine_dbgstr_longlong(tStart));
493
494     EnterCriticalSection(&This->csFilter);
495     {
496         This->rtStreamStart = tStart;
497         This->state = State_Running;
498     }
499     LeaveCriticalSection(&This->csFilter);
500
501     return S_OK;
502 }
503
504 static HRESULT WINAPI VideoRenderer_GetState(IBaseFilter * iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState)
505 {
506     VideoRendererImpl *This = (VideoRendererImpl *)iface;
507
508     TRACE("(%p/%p)->(%ld, %p)\n", This, iface, dwMilliSecsTimeout, pState);
509
510     EnterCriticalSection(&This->csFilter);
511     {
512         *pState = This->state;
513     }
514     LeaveCriticalSection(&This->csFilter);
515
516     return S_OK;
517 }
518
519 static HRESULT WINAPI VideoRenderer_SetSyncSource(IBaseFilter * iface, IReferenceClock *pClock)
520 {
521     VideoRendererImpl *This = (VideoRendererImpl *)iface;
522
523     TRACE("(%p/%p)->(%p)\n", This, iface, pClock);
524
525     EnterCriticalSection(&This->csFilter);
526     {
527         if (This->pClock)
528             IReferenceClock_Release(This->pClock);
529         This->pClock = pClock;
530         if (This->pClock)
531             IReferenceClock_AddRef(This->pClock);
532     }
533     LeaveCriticalSection(&This->csFilter);
534
535     return S_OK;
536 }
537
538 static HRESULT WINAPI VideoRenderer_GetSyncSource(IBaseFilter * iface, IReferenceClock **ppClock)
539 {
540     VideoRendererImpl *This = (VideoRendererImpl *)iface;
541
542     TRACE("(%p/%p)->(%p)\n", This, iface, ppClock);
543
544     EnterCriticalSection(&This->csFilter);
545     {
546         *ppClock = This->pClock;
547         IReferenceClock_AddRef(This->pClock);
548     }
549     LeaveCriticalSection(&This->csFilter);
550     
551     return S_OK;
552 }
553
554 /** IBaseFilter implementation **/
555
556 static HRESULT WINAPI VideoRenderer_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum)
557 {
558     ENUMPINDETAILS epd;
559     VideoRendererImpl *This = (VideoRendererImpl *)iface;
560
561     TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
562
563     epd.cPins = 1; /* input pin */
564     epd.ppPins = This->ppPins;
565     return IEnumPinsImpl_Construct(&epd, ppEnum);
566 }
567
568 static HRESULT WINAPI VideoRenderer_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)
569 {
570     VideoRendererImpl *This = (VideoRendererImpl *)iface;
571
572     TRACE("(%p/%p)->(%p,%p)\n", This, iface, debugstr_w(Id), ppPin);
573
574     FIXME("VideoRenderer::FindPin(...)\n");
575
576     /* FIXME: critical section */
577
578     return E_NOTIMPL;
579 }
580
581 static HRESULT WINAPI VideoRenderer_QueryFilterInfo(IBaseFilter * iface, FILTER_INFO *pInfo)
582 {
583     VideoRendererImpl *This = (VideoRendererImpl *)iface;
584
585     TRACE("(%p/%p)->(%p)\n", This, iface, pInfo);
586
587     strcpyW(pInfo->achName, This->filterInfo.achName);
588     pInfo->pGraph = This->filterInfo.pGraph;
589
590     if (pInfo->pGraph)
591         IFilterGraph_AddRef(pInfo->pGraph);
592     
593     return S_OK;
594 }
595
596 static HRESULT WINAPI VideoRenderer_JoinFilterGraph(IBaseFilter * iface, IFilterGraph *pGraph, LPCWSTR pName)
597 {
598     VideoRendererImpl *This = (VideoRendererImpl *)iface;
599
600     TRACE("(%p/%p)->(%p, %s)\n", This, iface, pGraph, debugstr_w(pName));
601
602     EnterCriticalSection(&This->csFilter);
603     {
604         if (pName)
605             strcpyW(This->filterInfo.achName, pName);
606         else
607             *This->filterInfo.achName = '\0';
608         This->filterInfo.pGraph = pGraph; /* NOTE: do NOT increase ref. count */
609     }
610     LeaveCriticalSection(&This->csFilter);
611
612     return S_OK;
613 }
614
615 static HRESULT WINAPI VideoRenderer_QueryVendorInfo(IBaseFilter * iface, LPWSTR *pVendorInfo)
616 {
617     VideoRendererImpl *This = (VideoRendererImpl *)iface;
618     TRACE("(%p/%p)->(%p)\n", This, iface, pVendorInfo);
619     return E_NOTIMPL;
620 }
621
622 static const IBaseFilterVtbl VideoRenderer_Vtbl =
623 {
624     VideoRenderer_QueryInterface,
625     VideoRenderer_AddRef,
626     VideoRenderer_Release,
627     VideoRenderer_GetClassID,
628     VideoRenderer_Stop,
629     VideoRenderer_Pause,
630     VideoRenderer_Run,
631     VideoRenderer_GetState,
632     VideoRenderer_SetSyncSource,
633     VideoRenderer_GetSyncSource,
634     VideoRenderer_EnumPins,
635     VideoRenderer_FindPin,
636     VideoRenderer_QueryFilterInfo,
637     VideoRenderer_JoinFilterGraph,
638     VideoRenderer_QueryVendorInfo
639 };
640
641 static HRESULT WINAPI VideoRenderer_InputPin_EndOfStream(IPin * iface)
642 {
643     InputPin* This = (InputPin*)iface;
644     IMediaEventSink* pEventSink;
645     HRESULT hr;
646
647     TRACE("(%p/%p)->()\n", This, iface);
648
649     hr = IFilterGraph_QueryInterface(((VideoRendererImpl*)This->pin.pinInfo.pFilter)->filterInfo.pGraph, &IID_IMediaEventSink, (LPVOID*)&pEventSink);
650     if (SUCCEEDED(hr))
651     {
652         hr = IMediaEventSink_Notify(pEventSink, EC_COMPLETE, S_OK, 0);
653         IMediaEventSink_Release(pEventSink);
654     }
655
656     return hr;
657 }
658
659 static const IPinVtbl VideoRenderer_InputPin_Vtbl = 
660 {
661     InputPin_QueryInterface,
662     IPinImpl_AddRef,
663     InputPin_Release,
664     InputPin_Connect,
665     InputPin_ReceiveConnection,
666     IPinImpl_Disconnect,
667     IPinImpl_ConnectedTo,
668     IPinImpl_ConnectionMediaType,
669     IPinImpl_QueryPinInfo,
670     IPinImpl_QueryDirection,
671     IPinImpl_QueryId,
672     IPinImpl_QueryAccept,
673     IPinImpl_EnumMediaTypes,
674     IPinImpl_QueryInternalConnections,
675     VideoRenderer_InputPin_EndOfStream,
676     InputPin_BeginFlush,
677     InputPin_EndFlush,
678     InputPin_NewSegment
679 };
680
681 /*** IUnknown methods ***/
682 static HRESULT WINAPI Basicvideo_QueryInterface(IBasicVideo *iface,
683                                                 REFIID riid,
684                                                 LPVOID*ppvObj) {
685     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
686
687     TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
688
689     return VideoRenderer_QueryInterface((IBaseFilter*)This, riid, ppvObj);
690 }
691
692 static ULONG WINAPI Basicvideo_AddRef(IBasicVideo *iface) {
693     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
694
695     TRACE("(%p/%p)->()\n", This, iface);
696
697     return VideoRenderer_AddRef((IBaseFilter*)This);
698 }
699
700 static ULONG WINAPI Basicvideo_Release(IBasicVideo *iface) {
701     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
702
703     TRACE("(%p/%p)->()\n", This, iface);
704
705     return VideoRenderer_Release((IBaseFilter*)This);
706 }
707
708 /*** IDispatch methods ***/
709 static HRESULT WINAPI Basicvideo_GetTypeInfoCount(IBasicVideo *iface,
710                                                   UINT*pctinfo) {
711     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
712
713     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
714
715     return S_OK;
716 }
717
718 static HRESULT WINAPI Basicvideo_GetTypeInfo(IBasicVideo *iface,
719                                              UINT iTInfo,
720                                              LCID lcid,
721                                              ITypeInfo**ppTInfo) {
722     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
723
724     TRACE("(%p/%p)->(%d, %ld, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
725
726     return S_OK;
727 }
728
729 static HRESULT WINAPI Basicvideo_GetIDsOfNames(IBasicVideo *iface,
730                                                REFIID riid,
731                                                LPOLESTR*rgszNames,
732                                                UINT cNames,
733                                                LCID lcid,
734                                                DISPID*rgDispId) {
735     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
736
737     TRACE("(%p/%p)->(%s (%p), %p, %d, %ld, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
738
739     return S_OK;
740 }
741
742 static HRESULT WINAPI Basicvideo_Invoke(IBasicVideo *iface,
743                                         DISPID dispIdMember,
744                                         REFIID riid,
745                                         LCID lcid,
746                                         WORD wFlags,
747                                         DISPPARAMS*pDispParams,
748                                         VARIANT*pVarResult,
749                                         EXCEPINFO*pExepInfo,
750                                         UINT*puArgErr) {
751     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
752
753     TRACE("(%p/%p)->(%ld, %s (%p), %ld, %04x, %p, %p, %p, %p): stub !!!\n", This, iface, dispIdMember, debugstr_guid(riid), riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
754
755     return S_OK;
756 }
757
758 /*** IBasicVideo methods ***/
759 static HRESULT WINAPI Basicvideo_get_AvgTimePerFrame(IBasicVideo *iface,
760                                                      REFTIME *pAvgTimePerFrame) {
761     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
762
763     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pAvgTimePerFrame);
764
765     return S_OK;
766 }
767
768 static HRESULT WINAPI Basicvideo_get_BitRate(IBasicVideo *iface,
769                                              long *pBitRate) {
770     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
771
772     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pBitRate);
773
774     return S_OK;
775 }
776
777 static HRESULT WINAPI Basicvideo_get_BitErrorRate(IBasicVideo *iface,
778                                                   long *pBitErrorRate) {
779     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
780
781     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pBitErrorRate);
782
783     return S_OK;
784 }
785
786 static HRESULT WINAPI Basicvideo_get_VideoWidth(IBasicVideo *iface,
787                                                 long *pVideoWidth) {
788     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
789
790     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pVideoWidth);
791
792     return S_OK;
793 }
794
795 static HRESULT WINAPI Basicvideo_get_VideoHeight(IBasicVideo *iface,
796                                                  long *pVideoHeight) {
797     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
798
799     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pVideoHeight);
800
801     return S_OK;
802 }
803
804 static HRESULT WINAPI Basicvideo_put_SourceLeft(IBasicVideo *iface,
805                                                 long SourceLeft) {
806     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
807
808     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, SourceLeft);
809
810     return S_OK;
811 }
812
813 static HRESULT WINAPI Basicvideo_get_SourceLeft(IBasicVideo *iface,
814                                                 long *pSourceLeft) {
815     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
816
817     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pSourceLeft);
818
819     return S_OK;
820 }
821
822 static HRESULT WINAPI Basicvideo_put_SourceWidth(IBasicVideo *iface,
823                                                  long SourceWidth) {
824     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
825
826     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, SourceWidth);
827
828     return S_OK;
829 }
830
831 static HRESULT WINAPI Basicvideo_get_SourceWidth(IBasicVideo *iface,
832                                                  long *pSourceWidth) {
833     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
834
835     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pSourceWidth);
836
837     return S_OK;
838 }
839
840 static HRESULT WINAPI Basicvideo_put_SourceTop(IBasicVideo *iface,
841                                                long SourceTop) {
842     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
843
844     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, SourceTop);
845
846     return S_OK;
847 }
848
849 static HRESULT WINAPI Basicvideo_get_SourceTop(IBasicVideo *iface,
850                                                long *pSourceTop) {
851     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
852
853     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pSourceTop);
854
855     return S_OK;
856 }
857
858 static HRESULT WINAPI Basicvideo_put_SourceHeight(IBasicVideo *iface,
859                                                   long SourceHeight) {
860     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
861
862     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, SourceHeight);
863
864     return S_OK;
865 }
866
867 static HRESULT WINAPI Basicvideo_get_SourceHeight(IBasicVideo *iface,
868                                                   long *pSourceHeight) {
869     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
870
871     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pSourceHeight);
872
873     return S_OK;
874 }
875
876 static HRESULT WINAPI Basicvideo_put_DestinationLeft(IBasicVideo *iface,
877                                                      long DestinationLeft) {
878     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
879
880     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, DestinationLeft);
881
882     return S_OK;
883 }
884
885 static HRESULT WINAPI Basicvideo_get_DestinationLeft(IBasicVideo *iface,
886                                                      long *pDestinationLeft) {
887     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
888
889     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pDestinationLeft);
890
891     return S_OK;
892 }
893
894 static HRESULT WINAPI Basicvideo_put_DestinationWidth(IBasicVideo *iface,
895                                                       long DestinationWidth) {
896     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
897
898     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, DestinationWidth);
899
900     return S_OK;
901 }
902
903 static HRESULT WINAPI Basicvideo_get_DestinationWidth(IBasicVideo *iface,
904                                                       long *pDestinationWidth) {
905     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
906
907     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pDestinationWidth);
908
909     return S_OK;
910 }
911
912 static HRESULT WINAPI Basicvideo_put_DestinationTop(IBasicVideo *iface,
913                                                     long DestinationTop) {
914     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
915
916     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, DestinationTop);
917
918     return S_OK;
919 }
920
921 static HRESULT WINAPI Basicvideo_get_DestinationTop(IBasicVideo *iface,
922                                                     long *pDestinationTop) {
923     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
924
925     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pDestinationTop);
926
927     return S_OK;
928 }
929
930 static HRESULT WINAPI Basicvideo_put_DestinationHeight(IBasicVideo *iface,
931                                                        long DestinationHeight) {
932     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
933
934     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, DestinationHeight);
935
936     return S_OK;
937 }
938
939 static HRESULT WINAPI Basicvideo_get_DestinationHeight(IBasicVideo *iface,
940                                                        long *pDestinationHeight) {
941     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
942
943     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pDestinationHeight);
944
945     return S_OK;
946 }
947
948 static HRESULT WINAPI Basicvideo_SetSourcePosition(IBasicVideo *iface,
949                                                    long Left,
950                                                    long Top,
951                                                    long Width,
952                                                    long Height) {
953     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
954
955     TRACE("(%p/%p)->(%ld, %ld, %ld, %ld): stub !!!\n", This, iface, Left, Top, Width, Height);
956
957     return S_OK;
958 }
959
960 static HRESULT WINAPI Basicvideo_GetSourcePosition(IBasicVideo *iface,
961                                                    long *pLeft,
962                                                    long *pTop,
963                                                    long *pWidth,
964                                                    long *pHeight) {
965     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
966
967     TRACE("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This, iface, pLeft, pTop, pWidth, pHeight);
968
969     return S_OK;
970 }
971
972 static HRESULT WINAPI Basicvideo_SetDefaultSourcePosition(IBasicVideo *iface) {
973     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
974
975     TRACE("(%p/%p)->(): stub !!!\n", This, iface);
976
977     return S_OK;
978 }
979
980 static HRESULT WINAPI Basicvideo_SetDestinationPosition(IBasicVideo *iface,
981                                                         long Left,
982                                                         long Top,
983                                                         long Width,
984                                                         long Height) {
985     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
986
987     TRACE("(%p/%p)->(%ld, %ld, %ld, %ld): stub !!!\n", This, iface, Left, Top, Width, Height);
988
989     return S_OK;
990 }
991
992 static HRESULT WINAPI Basicvideo_GetDestinationPosition(IBasicVideo *iface,
993                                                         long *pLeft,
994                                                         long *pTop,
995                                                         long *pWidth,
996                                                         long *pHeight) {
997     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
998
999     TRACE("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This, iface, pLeft, pTop, pWidth, pHeight);
1000
1001     return S_OK;
1002 }
1003
1004 static HRESULT WINAPI Basicvideo_SetDefaultDestinationPosition(IBasicVideo *iface) {
1005     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1006
1007     TRACE("(%p/%p)->(): stub !!!\n", This, iface);
1008
1009     return S_OK;
1010 }
1011
1012 static HRESULT WINAPI Basicvideo_GetVideoSize(IBasicVideo *iface,
1013                                               long *pWidth,
1014                                               long *pHeight) {
1015     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1016
1017     TRACE("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pWidth, pHeight);
1018
1019     return S_OK;
1020 }
1021
1022 static HRESULT WINAPI Basicvideo_GetVideoPaletteEntries(IBasicVideo *iface,
1023                                                         long StartIndex,
1024                                                         long Entries,
1025                                                         long *pRetrieved,
1026                                                         long *pPalette) {
1027     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1028
1029     TRACE("(%p/%p)->(%ld, %ld, %p, %p): stub !!!\n", This, iface, StartIndex, Entries, pRetrieved, pPalette);
1030
1031     return S_OK;
1032 }
1033
1034 static HRESULT WINAPI Basicvideo_GetCurrentImage(IBasicVideo *iface,
1035                                                  long *pBufferSize,
1036                                                  long *pDIBImage) {
1037     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1038
1039     TRACE("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pBufferSize, pDIBImage);
1040
1041     return S_OK;
1042 }
1043
1044 static HRESULT WINAPI Basicvideo_IsUsingDefaultSource(IBasicVideo *iface) {
1045     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1046
1047     TRACE("(%p/%p)->(): stub !!!\n", This, iface);
1048
1049     return S_OK;
1050 }
1051
1052 static HRESULT WINAPI Basicvideo_IsUsingDefaultDestination(IBasicVideo *iface) {
1053     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1054
1055     TRACE("(%p/%p)->(): stub !!!\n", This, iface);
1056
1057     return S_OK;
1058 }
1059
1060
1061 static IBasicVideoVtbl IBasicVideo_VTable =
1062 {
1063     Basicvideo_QueryInterface,
1064     Basicvideo_AddRef,
1065     Basicvideo_Release,
1066     Basicvideo_GetTypeInfoCount,
1067     Basicvideo_GetTypeInfo,
1068     Basicvideo_GetIDsOfNames,
1069     Basicvideo_Invoke,
1070     Basicvideo_get_AvgTimePerFrame,
1071     Basicvideo_get_BitRate,
1072     Basicvideo_get_BitErrorRate,
1073     Basicvideo_get_VideoWidth,
1074     Basicvideo_get_VideoHeight,
1075     Basicvideo_put_SourceLeft,
1076     Basicvideo_get_SourceLeft,
1077     Basicvideo_put_SourceWidth,
1078     Basicvideo_get_SourceWidth,
1079     Basicvideo_put_SourceTop,
1080     Basicvideo_get_SourceTop,
1081     Basicvideo_put_SourceHeight,
1082     Basicvideo_get_SourceHeight,
1083     Basicvideo_put_DestinationLeft,
1084     Basicvideo_get_DestinationLeft,
1085     Basicvideo_put_DestinationWidth,
1086     Basicvideo_get_DestinationWidth,
1087     Basicvideo_put_DestinationTop,
1088     Basicvideo_get_DestinationTop,
1089     Basicvideo_put_DestinationHeight,
1090     Basicvideo_get_DestinationHeight,
1091     Basicvideo_SetSourcePosition,
1092     Basicvideo_GetSourcePosition,
1093     Basicvideo_SetDefaultSourcePosition,
1094     Basicvideo_SetDestinationPosition,
1095     Basicvideo_GetDestinationPosition,
1096     Basicvideo_SetDefaultDestinationPosition,
1097     Basicvideo_GetVideoSize,
1098     Basicvideo_GetVideoPaletteEntries,
1099     Basicvideo_GetCurrentImage,
1100     Basicvideo_IsUsingDefaultSource,
1101     Basicvideo_IsUsingDefaultDestination
1102 };
1103
1104
1105 /*** IUnknown methods ***/
1106 static HRESULT WINAPI Videowindow_QueryInterface(IVideoWindow *iface,
1107                                                  REFIID riid,
1108                                                  LPVOID*ppvObj) {
1109     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1110
1111     TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1112
1113     return VideoRenderer_QueryInterface((IBaseFilter*)This, riid, ppvObj);
1114 }
1115
1116 static ULONG WINAPI Videowindow_AddRef(IVideoWindow *iface) {
1117     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1118
1119     TRACE("(%p/%p)->()\n", This, iface);
1120
1121     return VideoRenderer_AddRef((IBaseFilter*)This);
1122 }
1123
1124 static ULONG WINAPI Videowindow_Release(IVideoWindow *iface) {
1125     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1126
1127     TRACE("(%p/%p)->()\n", This, iface);
1128
1129     return VideoRenderer_Release((IBaseFilter*)This);
1130 }
1131
1132 /*** IDispatch methods ***/
1133 static HRESULT WINAPI Videowindow_GetTypeInfoCount(IVideoWindow *iface,
1134                                                    UINT*pctinfo) {
1135     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1136
1137     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
1138
1139     return S_OK;
1140 }
1141
1142 static HRESULT WINAPI Videowindow_GetTypeInfo(IVideoWindow *iface,
1143                                               UINT iTInfo,
1144                                               LCID lcid,
1145                                               ITypeInfo**ppTInfo) {
1146     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1147
1148     TRACE("(%p/%p)->(%d, %ld, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
1149
1150     return S_OK;
1151 }
1152
1153 static HRESULT WINAPI Videowindow_GetIDsOfNames(IVideoWindow *iface,
1154                                                 REFIID riid,
1155                                                 LPOLESTR*rgszNames,
1156                                                 UINT cNames,
1157                                                 LCID lcid,
1158                                                 DISPID*rgDispId) {
1159     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1160
1161     TRACE("(%p/%p)->(%s (%p), %p, %d, %ld, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1162
1163     return S_OK;
1164 }
1165
1166 static HRESULT WINAPI Videowindow_Invoke(IVideoWindow *iface,
1167                                          DISPID dispIdMember,
1168                                          REFIID riid,
1169                                          LCID lcid,
1170                                          WORD wFlags,
1171                                          DISPPARAMS*pDispParams,
1172                                          VARIANT*pVarResult,
1173                                          EXCEPINFO*pExepInfo,
1174                                          UINT*puArgErr) {
1175     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1176
1177     TRACE("(%p/%p)->(%ld, %s (%p), %ld, %04x, %p, %p, %p, %p): stub !!!\n", This, iface, dispIdMember, debugstr_guid(riid), riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
1178
1179     return S_OK;
1180 }
1181
1182 /*** IVideoWindow methods ***/
1183 static HRESULT WINAPI Videowindow_put_Caption(IVideoWindow *iface,
1184                                               BSTR strCaption) {
1185     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1186
1187     TRACE("(%p/%p)->(%s (%p)): stub !!!\n", This, iface, debugstr_w(strCaption), strCaption);
1188
1189     return S_OK;
1190 }
1191
1192 static HRESULT WINAPI Videowindow_get_Caption(IVideoWindow *iface,
1193                                               BSTR *strCaption) {
1194     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1195
1196     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, strCaption);
1197
1198     return S_OK;
1199 }
1200
1201 static HRESULT WINAPI Videowindow_put_WindowStyle(IVideoWindow *iface,
1202                                                   long WindowStyle) {
1203     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1204
1205     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, WindowStyle);
1206
1207     return S_OK;
1208 }
1209
1210 static HRESULT WINAPI Videowindow_get_WindowStyle(IVideoWindow *iface,
1211                                                   long *WindowStyle) {
1212     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1213
1214     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, WindowStyle);
1215
1216     return S_OK;
1217 }
1218
1219 static HRESULT WINAPI Videowindow_put_WindowStyleEx(IVideoWindow *iface,
1220                                                     long WindowStyleEx) {
1221     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1222
1223     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, WindowStyleEx);
1224
1225     return S_OK;
1226 }
1227
1228 static HRESULT WINAPI Videowindow_get_WindowStyleEx(IVideoWindow *iface,
1229                                                     long *WindowStyleEx) {
1230     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1231
1232     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, WindowStyleEx);
1233
1234     return S_OK;
1235 }
1236
1237 static HRESULT WINAPI Videowindow_put_AutoShow(IVideoWindow *iface,
1238                                                long AutoShow) {
1239     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1240
1241     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, AutoShow);
1242
1243     return S_OK;
1244 }
1245
1246 static HRESULT WINAPI Videowindow_get_AutoShow(IVideoWindow *iface,
1247                                                long *AutoShow) {
1248     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1249
1250     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, AutoShow);
1251
1252     return S_OK;
1253 }
1254
1255 static HRESULT WINAPI Videowindow_put_WindowState(IVideoWindow *iface,
1256                                                   long WindowState) {
1257     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1258
1259     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, WindowState);
1260
1261     return S_OK;
1262 }
1263
1264 static HRESULT WINAPI Videowindow_get_WindowState(IVideoWindow *iface,
1265                                                   long *WindowState) {
1266     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1267
1268     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, WindowState);
1269
1270     return S_OK;
1271 }
1272
1273 static HRESULT WINAPI Videowindow_put_BackgroundPalette(IVideoWindow *iface,
1274                                                         long BackgroundPalette) {
1275     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1276
1277     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, BackgroundPalette);
1278
1279     return S_OK;
1280 }
1281
1282 static HRESULT WINAPI Videowindow_get_BackgroundPalette(IVideoWindow *iface,
1283                                                         long *pBackgroundPalette) {
1284     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1285
1286     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pBackgroundPalette);
1287
1288     return S_OK;
1289 }
1290
1291 static HRESULT WINAPI Videowindow_put_Visible(IVideoWindow *iface,
1292                                               long Visible) {
1293     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1294
1295     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, Visible);
1296
1297     return S_OK;
1298 }
1299
1300 static HRESULT WINAPI Videowindow_get_Visible(IVideoWindow *iface,
1301                                               long *pVisible) {
1302     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1303
1304     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pVisible);
1305
1306     return S_OK;
1307 }
1308
1309 static HRESULT WINAPI Videowindow_put_Left(IVideoWindow *iface,
1310                                            long Left) {
1311     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1312
1313     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, Left);
1314
1315     return S_OK;
1316 }
1317
1318 static HRESULT WINAPI Videowindow_get_Left(IVideoWindow *iface,
1319                                            long *pLeft) {
1320     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1321
1322     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pLeft);
1323
1324     return S_OK;
1325 }
1326
1327 static HRESULT WINAPI Videowindow_put_Width(IVideoWindow *iface,
1328                                             long Width) {
1329     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1330
1331     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, Width);
1332
1333     return S_OK;
1334 }
1335
1336 static HRESULT WINAPI Videowindow_get_Width(IVideoWindow *iface,
1337                                             long *pWidth) {
1338     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1339
1340     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pWidth);
1341
1342     return S_OK;
1343 }
1344
1345 static HRESULT WINAPI Videowindow_put_Top(IVideoWindow *iface,
1346                                           long Top) {
1347     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1348
1349     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, Top);
1350
1351     return S_OK;
1352 }
1353
1354 static HRESULT WINAPI Videowindow_get_Top(IVideoWindow *iface,
1355                                           long *pTop) {
1356     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1357
1358     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pTop);
1359
1360     return S_OK;
1361 }
1362
1363 static HRESULT WINAPI Videowindow_put_Height(IVideoWindow *iface,
1364                                              long Height) {
1365     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1366
1367     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, Height);
1368
1369     return S_OK;
1370 }
1371
1372 static HRESULT WINAPI Videowindow_get_Height(IVideoWindow *iface,
1373                                              long *pHeight) {
1374     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1375
1376     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pHeight);
1377
1378     return S_OK;
1379 }
1380
1381 static HRESULT WINAPI Videowindow_put_Owner(IVideoWindow *iface,
1382                                             OAHWND Owner) {
1383     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1384
1385     TRACE("(%p/%p)->(%08lx): stub !!!\n", This, iface, (DWORD) Owner);
1386
1387     return S_OK;
1388 }
1389
1390 static HRESULT WINAPI Videowindow_get_Owner(IVideoWindow *iface,
1391                                             OAHWND *Owner) {
1392     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1393
1394     TRACE("(%p/%p)->(%08lx): stub !!!\n", This, iface, (DWORD) Owner);
1395
1396     return S_OK;
1397 }
1398
1399 static HRESULT WINAPI Videowindow_put_MessageDrain(IVideoWindow *iface,
1400                                                    OAHWND Drain) {
1401     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1402
1403     TRACE("(%p/%p)->(%08lx): stub !!!\n", This, iface, (DWORD) Drain);
1404
1405     return S_OK;
1406 }
1407
1408 static HRESULT WINAPI Videowindow_get_MessageDrain(IVideoWindow *iface,
1409                                                    OAHWND *Drain) {
1410     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1411
1412     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, Drain);
1413
1414     return S_OK;
1415 }
1416
1417 static HRESULT WINAPI Videowindow_get_BorderColor(IVideoWindow *iface,
1418                                                   long *Color) {
1419     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1420
1421     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, Color);
1422
1423     return S_OK;
1424 }
1425
1426 static HRESULT WINAPI Videowindow_put_BorderColor(IVideoWindow *iface,
1427                                                   long Color) {
1428     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1429
1430     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, Color);
1431
1432     return S_OK;
1433 }
1434
1435 static HRESULT WINAPI Videowindow_get_FullScreenMode(IVideoWindow *iface,
1436                                                      long *FullScreenMode) {
1437     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1438
1439     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, FullScreenMode);
1440
1441     return S_OK;
1442 }
1443
1444 static HRESULT WINAPI Videowindow_put_FullScreenMode(IVideoWindow *iface,
1445                                                      long FullScreenMode) {
1446     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1447
1448     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, FullScreenMode);
1449
1450     return S_OK;
1451 }
1452
1453 static HRESULT WINAPI Videowindow_SetWindowForeground(IVideoWindow *iface,
1454                                                       long Focus) {
1455     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1456
1457     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, Focus);
1458
1459     return S_OK;
1460 }
1461
1462 static HRESULT WINAPI Videowindow_NotifyOwnerMessage(IVideoWindow *iface,
1463                                                      OAHWND hwnd,
1464                                                      long uMsg,
1465                                                      LONG_PTR wParam,
1466                                                      LONG_PTR lParam) {
1467     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1468
1469     TRACE("(%p/%p)->(%08lx, %ld, %08lx, %08lx): stub !!!\n", This, iface, (DWORD) hwnd, uMsg, wParam, lParam);
1470
1471     return S_OK;
1472 }
1473
1474 static HRESULT WINAPI Videowindow_SetWindowPosition(IVideoWindow *iface,
1475                                                     long Left,
1476                                                     long Top,
1477                                                     long Width,
1478                                                     long Height) {
1479     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1480     
1481     TRACE("(%p/%p)->(%ld, %ld, %ld, %ld): stub !!!\n", This, iface, Left, Top, Width, Height);
1482
1483     return S_OK;
1484 }
1485
1486 static HRESULT WINAPI Videowindow_GetWindowPosition(IVideoWindow *iface,
1487                                                     long *pLeft,
1488                                                     long *pTop,
1489                                                     long *pWidth,
1490                                                     long *pHeight) {
1491     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1492
1493     TRACE("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This, iface, pLeft, pTop, pWidth, pHeight);
1494
1495     return S_OK;
1496 }
1497
1498 static HRESULT WINAPI Videowindow_GetMinIdealImageSize(IVideoWindow *iface,
1499                                                        long *pWidth,
1500                                                        long *pHeight) {
1501     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1502
1503     TRACE("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pWidth, pHeight);
1504
1505     return S_OK;
1506 }
1507
1508 static HRESULT WINAPI Videowindow_GetMaxIdealImageSize(IVideoWindow *iface,
1509                                                        long *pWidth,
1510                                                        long *pHeight) {
1511     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1512
1513     TRACE("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pWidth, pHeight);
1514
1515     return S_OK;
1516 }
1517
1518 static HRESULT WINAPI Videowindow_GetRestorePosition(IVideoWindow *iface,
1519                                                      long *pLeft,
1520                                                      long *pTop,
1521                                                      long *pWidth,
1522                                                      long *pHeight) {
1523     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1524
1525     TRACE("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This, iface, pLeft, pTop, pWidth, pHeight);
1526
1527     return S_OK;
1528 }
1529
1530 static HRESULT WINAPI Videowindow_HideCursor(IVideoWindow *iface,
1531                                              long HideCursor) {
1532     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1533
1534     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, HideCursor);
1535
1536     return S_OK;
1537 }
1538
1539 static HRESULT WINAPI Videowindow_IsCursorHidden(IVideoWindow *iface,
1540                                                  long *CursorHidden) {
1541     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1542
1543     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, CursorHidden);
1544
1545     return S_OK;
1546 }
1547
1548 static IVideoWindowVtbl IVideoWindow_VTable =
1549 {
1550     Videowindow_QueryInterface,
1551     Videowindow_AddRef,
1552     Videowindow_Release,
1553     Videowindow_GetTypeInfoCount,
1554     Videowindow_GetTypeInfo,
1555     Videowindow_GetIDsOfNames,
1556     Videowindow_Invoke,
1557     Videowindow_put_Caption,
1558     Videowindow_get_Caption,
1559     Videowindow_put_WindowStyle,
1560     Videowindow_get_WindowStyle,
1561     Videowindow_put_WindowStyleEx,
1562     Videowindow_get_WindowStyleEx,
1563     Videowindow_put_AutoShow,
1564     Videowindow_get_AutoShow,
1565     Videowindow_put_WindowState,
1566     Videowindow_get_WindowState,
1567     Videowindow_put_BackgroundPalette,
1568     Videowindow_get_BackgroundPalette,
1569     Videowindow_put_Visible,
1570     Videowindow_get_Visible,
1571     Videowindow_put_Left,
1572     Videowindow_get_Left,
1573     Videowindow_put_Width,
1574     Videowindow_get_Width,
1575     Videowindow_put_Top,
1576     Videowindow_get_Top,
1577     Videowindow_put_Height,
1578     Videowindow_get_Height,
1579     Videowindow_put_Owner,
1580     Videowindow_get_Owner,
1581     Videowindow_put_MessageDrain,
1582     Videowindow_get_MessageDrain,
1583     Videowindow_get_BorderColor,
1584     Videowindow_put_BorderColor,
1585     Videowindow_get_FullScreenMode,
1586     Videowindow_put_FullScreenMode,
1587     Videowindow_SetWindowForeground,
1588     Videowindow_NotifyOwnerMessage,
1589     Videowindow_SetWindowPosition,
1590     Videowindow_GetWindowPosition,
1591     Videowindow_GetMinIdealImageSize,
1592     Videowindow_GetMaxIdealImageSize,
1593     Videowindow_GetRestorePosition,
1594     Videowindow_HideCursor,
1595     Videowindow_IsCursorHidden
1596 };