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