iSelectedImage is allowed to be 0.
[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     strncpyW(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         IReferenceClock_Release(This->pClock);
426         
427         IPin_Release(This->ppPins[0]);
428         
429         HeapFree(GetProcessHeap(), 0, This->ppPins);
430         This->lpVtbl = NULL;
431         
432         TRACE("Destroying Video Renderer\n");
433         CoTaskMemFree(This);
434         
435         return 0;
436     }
437     else
438         return refCount;
439 }
440
441 /** IPersist methods **/
442
443 static HRESULT WINAPI VideoRenderer_GetClassID(IBaseFilter * iface, CLSID * pClsid)
444 {
445     VideoRendererImpl *This = (VideoRendererImpl *)iface;
446
447     TRACE("(%p/%p)->(%p)\n", This, iface, pClsid);
448
449     *pClsid = CLSID_VideoRenderer;
450
451     return S_OK;
452 }
453
454 /** IMediaFilter methods **/
455
456 static HRESULT WINAPI VideoRenderer_Stop(IBaseFilter * iface)
457 {
458     VideoRendererImpl *This = (VideoRendererImpl *)iface;
459
460     TRACE("(%p/%p)->()\n", This, iface);
461
462     EnterCriticalSection(&This->csFilter);
463     {
464         This->state = State_Stopped;
465     }
466     LeaveCriticalSection(&This->csFilter);
467     
468     return S_OK;
469 }
470
471 static HRESULT WINAPI VideoRenderer_Pause(IBaseFilter * iface)
472 {
473     VideoRendererImpl *This = (VideoRendererImpl *)iface;
474     
475     TRACE("(%p/%p)->()\n", This, iface);
476
477     EnterCriticalSection(&This->csFilter);
478     {
479         This->state = State_Paused;
480     }
481     LeaveCriticalSection(&This->csFilter);
482
483     return S_OK;
484 }
485
486 static HRESULT WINAPI VideoRenderer_Run(IBaseFilter * iface, REFERENCE_TIME tStart)
487 {
488     VideoRendererImpl *This = (VideoRendererImpl *)iface;
489
490     TRACE("(%p/%p)->(%s)\n", This, iface, wine_dbgstr_longlong(tStart));
491
492     EnterCriticalSection(&This->csFilter);
493     {
494         This->rtStreamStart = tStart;
495         This->state = State_Running;
496     }
497     LeaveCriticalSection(&This->csFilter);
498
499     return S_OK;
500 }
501
502 static HRESULT WINAPI VideoRenderer_GetState(IBaseFilter * iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState)
503 {
504     VideoRendererImpl *This = (VideoRendererImpl *)iface;
505
506     TRACE("(%p/%p)->(%ld, %p)\n", This, iface, dwMilliSecsTimeout, pState);
507
508     EnterCriticalSection(&This->csFilter);
509     {
510         *pState = This->state;
511     }
512     LeaveCriticalSection(&This->csFilter);
513
514     return S_OK;
515 }
516
517 static HRESULT WINAPI VideoRenderer_SetSyncSource(IBaseFilter * iface, IReferenceClock *pClock)
518 {
519     VideoRendererImpl *This = (VideoRendererImpl *)iface;
520
521     TRACE("(%p/%p)->(%p)\n", This, iface, pClock);
522
523     EnterCriticalSection(&This->csFilter);
524     {
525         if (This->pClock)
526             IReferenceClock_Release(This->pClock);
527         This->pClock = pClock;
528         if (This->pClock)
529             IReferenceClock_AddRef(This->pClock);
530     }
531     LeaveCriticalSection(&This->csFilter);
532
533     return S_OK;
534 }
535
536 static HRESULT WINAPI VideoRenderer_GetSyncSource(IBaseFilter * iface, IReferenceClock **ppClock)
537 {
538     VideoRendererImpl *This = (VideoRendererImpl *)iface;
539
540     TRACE("(%p/%p)->(%p)\n", This, iface, ppClock);
541
542     EnterCriticalSection(&This->csFilter);
543     {
544         *ppClock = This->pClock;
545         IReferenceClock_AddRef(This->pClock);
546     }
547     LeaveCriticalSection(&This->csFilter);
548     
549     return S_OK;
550 }
551
552 /** IBaseFilter implementation **/
553
554 static HRESULT WINAPI VideoRenderer_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum)
555 {
556     ENUMPINDETAILS epd;
557     VideoRendererImpl *This = (VideoRendererImpl *)iface;
558
559     TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
560
561     epd.cPins = 1; /* input pin */
562     epd.ppPins = This->ppPins;
563     return IEnumPinsImpl_Construct(&epd, ppEnum);
564 }
565
566 static HRESULT WINAPI VideoRenderer_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)
567 {
568     VideoRendererImpl *This = (VideoRendererImpl *)iface;
569
570     TRACE("(%p/%p)->(%p,%p)\n", This, iface, debugstr_w(Id), ppPin);
571
572     FIXME("VideoRenderer::FindPin(...)\n");
573
574     /* FIXME: critical section */
575
576     return E_NOTIMPL;
577 }
578
579 static HRESULT WINAPI VideoRenderer_QueryFilterInfo(IBaseFilter * iface, FILTER_INFO *pInfo)
580 {
581     VideoRendererImpl *This = (VideoRendererImpl *)iface;
582
583     TRACE("(%p/%p)->(%p)\n", This, iface, pInfo);
584
585     strcpyW(pInfo->achName, This->filterInfo.achName);
586     pInfo->pGraph = This->filterInfo.pGraph;
587
588     if (pInfo->pGraph)
589         IFilterGraph_AddRef(pInfo->pGraph);
590     
591     return S_OK;
592 }
593
594 static HRESULT WINAPI VideoRenderer_JoinFilterGraph(IBaseFilter * iface, IFilterGraph *pGraph, LPCWSTR pName)
595 {
596     VideoRendererImpl *This = (VideoRendererImpl *)iface;
597
598     TRACE("(%p/%p)->(%p, %s)\n", This, iface, pGraph, debugstr_w(pName));
599
600     EnterCriticalSection(&This->csFilter);
601     {
602         if (pName)
603             strcpyW(This->filterInfo.achName, pName);
604         else
605             *This->filterInfo.achName = '\0';
606         This->filterInfo.pGraph = pGraph; /* NOTE: do NOT increase ref. count */
607     }
608     LeaveCriticalSection(&This->csFilter);
609
610     return S_OK;
611 }
612
613 static HRESULT WINAPI VideoRenderer_QueryVendorInfo(IBaseFilter * iface, LPWSTR *pVendorInfo)
614 {
615     VideoRendererImpl *This = (VideoRendererImpl *)iface;
616     TRACE("(%p/%p)->(%p)\n", This, iface, pVendorInfo);
617     return E_NOTIMPL;
618 }
619
620 static const IBaseFilterVtbl VideoRenderer_Vtbl =
621 {
622     VideoRenderer_QueryInterface,
623     VideoRenderer_AddRef,
624     VideoRenderer_Release,
625     VideoRenderer_GetClassID,
626     VideoRenderer_Stop,
627     VideoRenderer_Pause,
628     VideoRenderer_Run,
629     VideoRenderer_GetState,
630     VideoRenderer_SetSyncSource,
631     VideoRenderer_GetSyncSource,
632     VideoRenderer_EnumPins,
633     VideoRenderer_FindPin,
634     VideoRenderer_QueryFilterInfo,
635     VideoRenderer_JoinFilterGraph,
636     VideoRenderer_QueryVendorInfo
637 };
638
639 static HRESULT WINAPI VideoRenderer_InputPin_EndOfStream(IPin * iface)
640 {
641     InputPin* This = (InputPin*)iface;
642     IMediaEventSink* pEventSink;
643     HRESULT hr;
644
645     TRACE("(%p/%p)->()\n", This, iface);
646
647     hr = IFilterGraph_QueryInterface(((VideoRendererImpl*)This->pin.pinInfo.pFilter)->filterInfo.pGraph, &IID_IMediaEventSink, (LPVOID*)&pEventSink);
648     if (SUCCEEDED(hr))
649     {
650         hr = IMediaEventSink_Notify(pEventSink, EC_COMPLETE, S_OK, 0);
651         IMediaEventSink_Release(pEventSink);
652     }
653
654     return hr;
655 }
656
657 static const IPinVtbl VideoRenderer_InputPin_Vtbl = 
658 {
659     InputPin_QueryInterface,
660     IPinImpl_AddRef,
661     InputPin_Release,
662     InputPin_Connect,
663     InputPin_ReceiveConnection,
664     IPinImpl_Disconnect,
665     IPinImpl_ConnectedTo,
666     IPinImpl_ConnectionMediaType,
667     IPinImpl_QueryPinInfo,
668     IPinImpl_QueryDirection,
669     IPinImpl_QueryId,
670     IPinImpl_QueryAccept,
671     IPinImpl_EnumMediaTypes,
672     IPinImpl_QueryInternalConnections,
673     VideoRenderer_InputPin_EndOfStream,
674     InputPin_BeginFlush,
675     InputPin_EndFlush,
676     InputPin_NewSegment
677 };
678
679 /*** IUnknown methods ***/
680 static HRESULT WINAPI Basicvideo_QueryInterface(IBasicVideo *iface,
681                                                 REFIID riid,
682                                                 LPVOID*ppvObj) {
683     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
684
685     TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
686
687     return VideoRenderer_QueryInterface((IBaseFilter*)This, riid, ppvObj);
688 }
689
690 static ULONG WINAPI Basicvideo_AddRef(IBasicVideo *iface) {
691     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
692
693     TRACE("(%p/%p)->()\n", This, iface);
694
695     return VideoRenderer_AddRef((IBaseFilter*)This);
696 }
697
698 static ULONG WINAPI Basicvideo_Release(IBasicVideo *iface) {
699     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
700
701     TRACE("(%p/%p)->()\n", This, iface);
702
703     return VideoRenderer_Release((IBaseFilter*)This);
704 }
705
706 /*** IDispatch methods ***/
707 static HRESULT WINAPI Basicvideo_GetTypeInfoCount(IBasicVideo *iface,
708                                                   UINT*pctinfo) {
709     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
710
711     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
712
713     return S_OK;
714 }
715
716 static HRESULT WINAPI Basicvideo_GetTypeInfo(IBasicVideo *iface,
717                                              UINT iTInfo,
718                                              LCID lcid,
719                                              ITypeInfo**ppTInfo) {
720     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
721
722     TRACE("(%p/%p)->(%d, %ld, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
723
724     return S_OK;
725 }
726
727 static HRESULT WINAPI Basicvideo_GetIDsOfNames(IBasicVideo *iface,
728                                                REFIID riid,
729                                                LPOLESTR*rgszNames,
730                                                UINT cNames,
731                                                LCID lcid,
732                                                DISPID*rgDispId) {
733     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
734
735     TRACE("(%p/%p)->(%s (%p), %p, %d, %ld, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
736
737     return S_OK;
738 }
739
740 static HRESULT WINAPI Basicvideo_Invoke(IBasicVideo *iface,
741                                         DISPID dispIdMember,
742                                         REFIID riid,
743                                         LCID lcid,
744                                         WORD wFlags,
745                                         DISPPARAMS*pDispParams,
746                                         VARIANT*pVarResult,
747                                         EXCEPINFO*pExepInfo,
748                                         UINT*puArgErr) {
749     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
750
751     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);
752
753     return S_OK;
754 }
755
756 /*** IBasicVideo methods ***/
757 static HRESULT WINAPI Basicvideo_get_AvgTimePerFrame(IBasicVideo *iface,
758                                                      REFTIME *pAvgTimePerFrame) {
759     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
760
761     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pAvgTimePerFrame);
762
763     return S_OK;
764 }
765
766 static HRESULT WINAPI Basicvideo_get_BitRate(IBasicVideo *iface,
767                                              long *pBitRate) {
768     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
769
770     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pBitRate);
771
772     return S_OK;
773 }
774
775 static HRESULT WINAPI Basicvideo_get_BitErrorRate(IBasicVideo *iface,
776                                                   long *pBitErrorRate) {
777     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
778
779     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pBitErrorRate);
780
781     return S_OK;
782 }
783
784 static HRESULT WINAPI Basicvideo_get_VideoWidth(IBasicVideo *iface,
785                                                 long *pVideoWidth) {
786     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
787
788     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pVideoWidth);
789
790     return S_OK;
791 }
792
793 static HRESULT WINAPI Basicvideo_get_VideoHeight(IBasicVideo *iface,
794                                                  long *pVideoHeight) {
795     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
796
797     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pVideoHeight);
798
799     return S_OK;
800 }
801
802 static HRESULT WINAPI Basicvideo_put_SourceLeft(IBasicVideo *iface,
803                                                 long SourceLeft) {
804     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
805
806     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, SourceLeft);
807
808     return S_OK;
809 }
810
811 static HRESULT WINAPI Basicvideo_get_SourceLeft(IBasicVideo *iface,
812                                                 long *pSourceLeft) {
813     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
814
815     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pSourceLeft);
816
817     return S_OK;
818 }
819
820 static HRESULT WINAPI Basicvideo_put_SourceWidth(IBasicVideo *iface,
821                                                  long SourceWidth) {
822     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
823
824     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, SourceWidth);
825
826     return S_OK;
827 }
828
829 static HRESULT WINAPI Basicvideo_get_SourceWidth(IBasicVideo *iface,
830                                                  long *pSourceWidth) {
831     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
832
833     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pSourceWidth);
834
835     return S_OK;
836 }
837
838 static HRESULT WINAPI Basicvideo_put_SourceTop(IBasicVideo *iface,
839                                                long SourceTop) {
840     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
841
842     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, SourceTop);
843
844     return S_OK;
845 }
846
847 static HRESULT WINAPI Basicvideo_get_SourceTop(IBasicVideo *iface,
848                                                long *pSourceTop) {
849     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
850
851     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pSourceTop);
852
853     return S_OK;
854 }
855
856 static HRESULT WINAPI Basicvideo_put_SourceHeight(IBasicVideo *iface,
857                                                   long SourceHeight) {
858     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
859
860     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, SourceHeight);
861
862     return S_OK;
863 }
864
865 static HRESULT WINAPI Basicvideo_get_SourceHeight(IBasicVideo *iface,
866                                                   long *pSourceHeight) {
867     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
868
869     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pSourceHeight);
870
871     return S_OK;
872 }
873
874 static HRESULT WINAPI Basicvideo_put_DestinationLeft(IBasicVideo *iface,
875                                                      long DestinationLeft) {
876     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
877
878     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, DestinationLeft);
879
880     return S_OK;
881 }
882
883 static HRESULT WINAPI Basicvideo_get_DestinationLeft(IBasicVideo *iface,
884                                                      long *pDestinationLeft) {
885     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
886
887     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pDestinationLeft);
888
889     return S_OK;
890 }
891
892 static HRESULT WINAPI Basicvideo_put_DestinationWidth(IBasicVideo *iface,
893                                                       long DestinationWidth) {
894     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
895
896     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, DestinationWidth);
897
898     return S_OK;
899 }
900
901 static HRESULT WINAPI Basicvideo_get_DestinationWidth(IBasicVideo *iface,
902                                                       long *pDestinationWidth) {
903     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
904
905     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pDestinationWidth);
906
907     return S_OK;
908 }
909
910 static HRESULT WINAPI Basicvideo_put_DestinationTop(IBasicVideo *iface,
911                                                     long DestinationTop) {
912     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
913
914     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, DestinationTop);
915
916     return S_OK;
917 }
918
919 static HRESULT WINAPI Basicvideo_get_DestinationTop(IBasicVideo *iface,
920                                                     long *pDestinationTop) {
921     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
922
923     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pDestinationTop);
924
925     return S_OK;
926 }
927
928 static HRESULT WINAPI Basicvideo_put_DestinationHeight(IBasicVideo *iface,
929                                                        long DestinationHeight) {
930     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
931
932     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, DestinationHeight);
933
934     return S_OK;
935 }
936
937 static HRESULT WINAPI Basicvideo_get_DestinationHeight(IBasicVideo *iface,
938                                                        long *pDestinationHeight) {
939     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
940
941     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pDestinationHeight);
942
943     return S_OK;
944 }
945
946 static HRESULT WINAPI Basicvideo_SetSourcePosition(IBasicVideo *iface,
947                                                    long Left,
948                                                    long Top,
949                                                    long Width,
950                                                    long Height) {
951     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
952
953     TRACE("(%p/%p)->(%ld, %ld, %ld, %ld): stub !!!\n", This, iface, Left, Top, Width, Height);
954
955     return S_OK;
956 }
957
958 static HRESULT WINAPI Basicvideo_GetSourcePosition(IBasicVideo *iface,
959                                                    long *pLeft,
960                                                    long *pTop,
961                                                    long *pWidth,
962                                                    long *pHeight) {
963     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
964
965     TRACE("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This, iface, pLeft, pTop, pWidth, pHeight);
966
967     return S_OK;
968 }
969
970 static HRESULT WINAPI Basicvideo_SetDefaultSourcePosition(IBasicVideo *iface) {
971     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
972
973     TRACE("(%p/%p)->(): stub !!!\n", This, iface);
974
975     return S_OK;
976 }
977
978 static HRESULT WINAPI Basicvideo_SetDestinationPosition(IBasicVideo *iface,
979                                                         long Left,
980                                                         long Top,
981                                                         long Width,
982                                                         long Height) {
983     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
984
985     TRACE("(%p/%p)->(%ld, %ld, %ld, %ld): stub !!!\n", This, iface, Left, Top, Width, Height);
986
987     return S_OK;
988 }
989
990 static HRESULT WINAPI Basicvideo_GetDestinationPosition(IBasicVideo *iface,
991                                                         long *pLeft,
992                                                         long *pTop,
993                                                         long *pWidth,
994                                                         long *pHeight) {
995     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
996
997     TRACE("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This, iface, pLeft, pTop, pWidth, pHeight);
998
999     return S_OK;
1000 }
1001
1002 static HRESULT WINAPI Basicvideo_SetDefaultDestinationPosition(IBasicVideo *iface) {
1003     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1004
1005     TRACE("(%p/%p)->(): stub !!!\n", This, iface);
1006
1007     return S_OK;
1008 }
1009
1010 static HRESULT WINAPI Basicvideo_GetVideoSize(IBasicVideo *iface,
1011                                               long *pWidth,
1012                                               long *pHeight) {
1013     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1014
1015     TRACE("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pWidth, pHeight);
1016
1017     return S_OK;
1018 }
1019
1020 static HRESULT WINAPI Basicvideo_GetVideoPaletteEntries(IBasicVideo *iface,
1021                                                         long StartIndex,
1022                                                         long Entries,
1023                                                         long *pRetrieved,
1024                                                         long *pPalette) {
1025     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1026
1027     TRACE("(%p/%p)->(%ld, %ld, %p, %p): stub !!!\n", This, iface, StartIndex, Entries, pRetrieved, pPalette);
1028
1029     return S_OK;
1030 }
1031
1032 static HRESULT WINAPI Basicvideo_GetCurrentImage(IBasicVideo *iface,
1033                                                  long *pBufferSize,
1034                                                  long *pDIBImage) {
1035     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1036
1037     TRACE("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pBufferSize, pDIBImage);
1038
1039     return S_OK;
1040 }
1041
1042 static HRESULT WINAPI Basicvideo_IsUsingDefaultSource(IBasicVideo *iface) {
1043     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1044
1045     TRACE("(%p/%p)->(): stub !!!\n", This, iface);
1046
1047     return S_OK;
1048 }
1049
1050 static HRESULT WINAPI Basicvideo_IsUsingDefaultDestination(IBasicVideo *iface) {
1051     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1052
1053     TRACE("(%p/%p)->(): stub !!!\n", This, iface);
1054
1055     return S_OK;
1056 }
1057
1058
1059 static IBasicVideoVtbl IBasicVideo_VTable =
1060 {
1061     Basicvideo_QueryInterface,
1062     Basicvideo_AddRef,
1063     Basicvideo_Release,
1064     Basicvideo_GetTypeInfoCount,
1065     Basicvideo_GetTypeInfo,
1066     Basicvideo_GetIDsOfNames,
1067     Basicvideo_Invoke,
1068     Basicvideo_get_AvgTimePerFrame,
1069     Basicvideo_get_BitRate,
1070     Basicvideo_get_BitErrorRate,
1071     Basicvideo_get_VideoWidth,
1072     Basicvideo_get_VideoHeight,
1073     Basicvideo_put_SourceLeft,
1074     Basicvideo_get_SourceLeft,
1075     Basicvideo_put_SourceWidth,
1076     Basicvideo_get_SourceWidth,
1077     Basicvideo_put_SourceTop,
1078     Basicvideo_get_SourceTop,
1079     Basicvideo_put_SourceHeight,
1080     Basicvideo_get_SourceHeight,
1081     Basicvideo_put_DestinationLeft,
1082     Basicvideo_get_DestinationLeft,
1083     Basicvideo_put_DestinationWidth,
1084     Basicvideo_get_DestinationWidth,
1085     Basicvideo_put_DestinationTop,
1086     Basicvideo_get_DestinationTop,
1087     Basicvideo_put_DestinationHeight,
1088     Basicvideo_get_DestinationHeight,
1089     Basicvideo_SetSourcePosition,
1090     Basicvideo_GetSourcePosition,
1091     Basicvideo_SetDefaultSourcePosition,
1092     Basicvideo_SetDestinationPosition,
1093     Basicvideo_GetDestinationPosition,
1094     Basicvideo_SetDefaultDestinationPosition,
1095     Basicvideo_GetVideoSize,
1096     Basicvideo_GetVideoPaletteEntries,
1097     Basicvideo_GetCurrentImage,
1098     Basicvideo_IsUsingDefaultSource,
1099     Basicvideo_IsUsingDefaultDestination
1100 };
1101
1102
1103 /*** IUnknown methods ***/
1104 static HRESULT WINAPI Videowindow_QueryInterface(IVideoWindow *iface,
1105                                                  REFIID riid,
1106                                                  LPVOID*ppvObj) {
1107     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1108
1109     TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1110
1111     return VideoRenderer_QueryInterface((IBaseFilter*)This, riid, ppvObj);
1112 }
1113
1114 static ULONG WINAPI Videowindow_AddRef(IVideoWindow *iface) {
1115     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1116
1117     TRACE("(%p/%p)->()\n", This, iface);
1118
1119     return VideoRenderer_AddRef((IBaseFilter*)This);
1120 }
1121
1122 static ULONG WINAPI Videowindow_Release(IVideoWindow *iface) {
1123     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1124
1125     TRACE("(%p/%p)->()\n", This, iface);
1126
1127     return VideoRenderer_Release((IBaseFilter*)This);
1128 }
1129
1130 /*** IDispatch methods ***/
1131 static HRESULT WINAPI Videowindow_GetTypeInfoCount(IVideoWindow *iface,
1132                                                    UINT*pctinfo) {
1133     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1134
1135     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
1136
1137     return S_OK;
1138 }
1139
1140 static HRESULT WINAPI Videowindow_GetTypeInfo(IVideoWindow *iface,
1141                                               UINT iTInfo,
1142                                               LCID lcid,
1143                                               ITypeInfo**ppTInfo) {
1144     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1145
1146     TRACE("(%p/%p)->(%d, %ld, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
1147
1148     return S_OK;
1149 }
1150
1151 static HRESULT WINAPI Videowindow_GetIDsOfNames(IVideoWindow *iface,
1152                                                 REFIID riid,
1153                                                 LPOLESTR*rgszNames,
1154                                                 UINT cNames,
1155                                                 LCID lcid,
1156                                                 DISPID*rgDispId) {
1157     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1158
1159     TRACE("(%p/%p)->(%s (%p), %p, %d, %ld, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1160
1161     return S_OK;
1162 }
1163
1164 static HRESULT WINAPI Videowindow_Invoke(IVideoWindow *iface,
1165                                          DISPID dispIdMember,
1166                                          REFIID riid,
1167                                          LCID lcid,
1168                                          WORD wFlags,
1169                                          DISPPARAMS*pDispParams,
1170                                          VARIANT*pVarResult,
1171                                          EXCEPINFO*pExepInfo,
1172                                          UINT*puArgErr) {
1173     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1174
1175     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);
1176
1177     return S_OK;
1178 }
1179
1180 /*** IVideoWindow methods ***/
1181 static HRESULT WINAPI Videowindow_put_Caption(IVideoWindow *iface,
1182                                               BSTR strCaption) {
1183     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1184
1185     TRACE("(%p/%p)->(%s (%p)): stub !!!\n", This, iface, debugstr_w(strCaption), strCaption);
1186
1187     return S_OK;
1188 }
1189
1190 static HRESULT WINAPI Videowindow_get_Caption(IVideoWindow *iface,
1191                                               BSTR *strCaption) {
1192     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1193
1194     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, strCaption);
1195
1196     return S_OK;
1197 }
1198
1199 static HRESULT WINAPI Videowindow_put_WindowStyle(IVideoWindow *iface,
1200                                                   long WindowStyle) {
1201     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1202
1203     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, WindowStyle);
1204
1205     return S_OK;
1206 }
1207
1208 static HRESULT WINAPI Videowindow_get_WindowStyle(IVideoWindow *iface,
1209                                                   long *WindowStyle) {
1210     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1211
1212     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, WindowStyle);
1213
1214     return S_OK;
1215 }
1216
1217 static HRESULT WINAPI Videowindow_put_WindowStyleEx(IVideoWindow *iface,
1218                                                     long WindowStyleEx) {
1219     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1220
1221     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, WindowStyleEx);
1222
1223     return S_OK;
1224 }
1225
1226 static HRESULT WINAPI Videowindow_get_WindowStyleEx(IVideoWindow *iface,
1227                                                     long *WindowStyleEx) {
1228     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1229
1230     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, WindowStyleEx);
1231
1232     return S_OK;
1233 }
1234
1235 static HRESULT WINAPI Videowindow_put_AutoShow(IVideoWindow *iface,
1236                                                long AutoShow) {
1237     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1238
1239     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, AutoShow);
1240
1241     return S_OK;
1242 }
1243
1244 static HRESULT WINAPI Videowindow_get_AutoShow(IVideoWindow *iface,
1245                                                long *AutoShow) {
1246     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1247
1248     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, AutoShow);
1249
1250     return S_OK;
1251 }
1252
1253 static HRESULT WINAPI Videowindow_put_WindowState(IVideoWindow *iface,
1254                                                   long WindowState) {
1255     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1256
1257     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, WindowState);
1258
1259     return S_OK;
1260 }
1261
1262 static HRESULT WINAPI Videowindow_get_WindowState(IVideoWindow *iface,
1263                                                   long *WindowState) {
1264     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1265
1266     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, WindowState);
1267
1268     return S_OK;
1269 }
1270
1271 static HRESULT WINAPI Videowindow_put_BackgroundPalette(IVideoWindow *iface,
1272                                                         long BackgroundPalette) {
1273     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1274
1275     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, BackgroundPalette);
1276
1277     return S_OK;
1278 }
1279
1280 static HRESULT WINAPI Videowindow_get_BackgroundPalette(IVideoWindow *iface,
1281                                                         long *pBackgroundPalette) {
1282     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1283
1284     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pBackgroundPalette);
1285
1286     return S_OK;
1287 }
1288
1289 static HRESULT WINAPI Videowindow_put_Visible(IVideoWindow *iface,
1290                                               long Visible) {
1291     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1292
1293     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, Visible);
1294
1295     return S_OK;
1296 }
1297
1298 static HRESULT WINAPI Videowindow_get_Visible(IVideoWindow *iface,
1299                                               long *pVisible) {
1300     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1301
1302     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pVisible);
1303
1304     return S_OK;
1305 }
1306
1307 static HRESULT WINAPI Videowindow_put_Left(IVideoWindow *iface,
1308                                            long Left) {
1309     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1310
1311     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, Left);
1312
1313     return S_OK;
1314 }
1315
1316 static HRESULT WINAPI Videowindow_get_Left(IVideoWindow *iface,
1317                                            long *pLeft) {
1318     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1319
1320     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pLeft);
1321
1322     return S_OK;
1323 }
1324
1325 static HRESULT WINAPI Videowindow_put_Width(IVideoWindow *iface,
1326                                             long Width) {
1327     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1328
1329     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, Width);
1330
1331     return S_OK;
1332 }
1333
1334 static HRESULT WINAPI Videowindow_get_Width(IVideoWindow *iface,
1335                                             long *pWidth) {
1336     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1337
1338     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pWidth);
1339
1340     return S_OK;
1341 }
1342
1343 static HRESULT WINAPI Videowindow_put_Top(IVideoWindow *iface,
1344                                           long Top) {
1345     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1346
1347     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, Top);
1348
1349     return S_OK;
1350 }
1351
1352 static HRESULT WINAPI Videowindow_get_Top(IVideoWindow *iface,
1353                                           long *pTop) {
1354     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1355
1356     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pTop);
1357
1358     return S_OK;
1359 }
1360
1361 static HRESULT WINAPI Videowindow_put_Height(IVideoWindow *iface,
1362                                              long Height) {
1363     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1364
1365     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, Height);
1366
1367     return S_OK;
1368 }
1369
1370 static HRESULT WINAPI Videowindow_get_Height(IVideoWindow *iface,
1371                                              long *pHeight) {
1372     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1373
1374     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pHeight);
1375
1376     return S_OK;
1377 }
1378
1379 static HRESULT WINAPI Videowindow_put_Owner(IVideoWindow *iface,
1380                                             OAHWND Owner) {
1381     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1382
1383     TRACE("(%p/%p)->(%08lx): stub !!!\n", This, iface, (DWORD) Owner);
1384
1385     return S_OK;
1386 }
1387
1388 static HRESULT WINAPI Videowindow_get_Owner(IVideoWindow *iface,
1389                                             OAHWND *Owner) {
1390     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1391
1392     TRACE("(%p/%p)->(%08lx): stub !!!\n", This, iface, (DWORD) Owner);
1393
1394     return S_OK;
1395 }
1396
1397 static HRESULT WINAPI Videowindow_put_MessageDrain(IVideoWindow *iface,
1398                                                    OAHWND Drain) {
1399     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1400
1401     TRACE("(%p/%p)->(%08lx): stub !!!\n", This, iface, (DWORD) Drain);
1402
1403     return S_OK;
1404 }
1405
1406 static HRESULT WINAPI Videowindow_get_MessageDrain(IVideoWindow *iface,
1407                                                    OAHWND *Drain) {
1408     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1409
1410     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, Drain);
1411
1412     return S_OK;
1413 }
1414
1415 static HRESULT WINAPI Videowindow_get_BorderColor(IVideoWindow *iface,
1416                                                   long *Color) {
1417     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1418
1419     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, Color);
1420
1421     return S_OK;
1422 }
1423
1424 static HRESULT WINAPI Videowindow_put_BorderColor(IVideoWindow *iface,
1425                                                   long Color) {
1426     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1427
1428     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, Color);
1429
1430     return S_OK;
1431 }
1432
1433 static HRESULT WINAPI Videowindow_get_FullScreenMode(IVideoWindow *iface,
1434                                                      long *FullScreenMode) {
1435     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1436
1437     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, FullScreenMode);
1438
1439     return S_OK;
1440 }
1441
1442 static HRESULT WINAPI Videowindow_put_FullScreenMode(IVideoWindow *iface,
1443                                                      long FullScreenMode) {
1444     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1445
1446     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, FullScreenMode);
1447
1448     return S_OK;
1449 }
1450
1451 static HRESULT WINAPI Videowindow_SetWindowForeground(IVideoWindow *iface,
1452                                                       long Focus) {
1453     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1454
1455     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, Focus);
1456
1457     return S_OK;
1458 }
1459
1460 static HRESULT WINAPI Videowindow_NotifyOwnerMessage(IVideoWindow *iface,
1461                                                      OAHWND hwnd,
1462                                                      long uMsg,
1463                                                      LONG_PTR wParam,
1464                                                      LONG_PTR lParam) {
1465     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1466
1467     TRACE("(%p/%p)->(%08lx, %ld, %08lx, %08lx): stub !!!\n", This, iface, (DWORD) hwnd, uMsg, wParam, lParam);
1468
1469     return S_OK;
1470 }
1471
1472 static HRESULT WINAPI Videowindow_SetWindowPosition(IVideoWindow *iface,
1473                                                     long Left,
1474                                                     long Top,
1475                                                     long Width,
1476                                                     long Height) {
1477     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1478     
1479     TRACE("(%p/%p)->(%ld, %ld, %ld, %ld): stub !!!\n", This, iface, Left, Top, Width, Height);
1480
1481     return S_OK;
1482 }
1483
1484 static HRESULT WINAPI Videowindow_GetWindowPosition(IVideoWindow *iface,
1485                                                     long *pLeft,
1486                                                     long *pTop,
1487                                                     long *pWidth,
1488                                                     long *pHeight) {
1489     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1490
1491     TRACE("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This, iface, pLeft, pTop, pWidth, pHeight);
1492
1493     return S_OK;
1494 }
1495
1496 static HRESULT WINAPI Videowindow_GetMinIdealImageSize(IVideoWindow *iface,
1497                                                        long *pWidth,
1498                                                        long *pHeight) {
1499     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1500
1501     TRACE("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pWidth, pHeight);
1502
1503     return S_OK;
1504 }
1505
1506 static HRESULT WINAPI Videowindow_GetMaxIdealImageSize(IVideoWindow *iface,
1507                                                        long *pWidth,
1508                                                        long *pHeight) {
1509     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1510
1511     TRACE("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pWidth, pHeight);
1512
1513     return S_OK;
1514 }
1515
1516 static HRESULT WINAPI Videowindow_GetRestorePosition(IVideoWindow *iface,
1517                                                      long *pLeft,
1518                                                      long *pTop,
1519                                                      long *pWidth,
1520                                                      long *pHeight) {
1521     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1522
1523     TRACE("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This, iface, pLeft, pTop, pWidth, pHeight);
1524
1525     return S_OK;
1526 }
1527
1528 static HRESULT WINAPI Videowindow_HideCursor(IVideoWindow *iface,
1529                                              long HideCursor) {
1530     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1531
1532     TRACE("(%p/%p)->(%ld): stub !!!\n", This, iface, HideCursor);
1533
1534     return S_OK;
1535 }
1536
1537 static HRESULT WINAPI Videowindow_IsCursorHidden(IVideoWindow *iface,
1538                                                  long *CursorHidden) {
1539     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1540
1541     TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, CursorHidden);
1542
1543     return S_OK;
1544 }
1545
1546 static IVideoWindowVtbl IVideoWindow_VTable =
1547 {
1548     Videowindow_QueryInterface,
1549     Videowindow_AddRef,
1550     Videowindow_Release,
1551     Videowindow_GetTypeInfoCount,
1552     Videowindow_GetTypeInfo,
1553     Videowindow_GetIDsOfNames,
1554     Videowindow_Invoke,
1555     Videowindow_put_Caption,
1556     Videowindow_get_Caption,
1557     Videowindow_put_WindowStyle,
1558     Videowindow_get_WindowStyle,
1559     Videowindow_put_WindowStyleEx,
1560     Videowindow_get_WindowStyleEx,
1561     Videowindow_put_AutoShow,
1562     Videowindow_get_AutoShow,
1563     Videowindow_put_WindowState,
1564     Videowindow_get_WindowState,
1565     Videowindow_put_BackgroundPalette,
1566     Videowindow_get_BackgroundPalette,
1567     Videowindow_put_Visible,
1568     Videowindow_get_Visible,
1569     Videowindow_put_Left,
1570     Videowindow_get_Left,
1571     Videowindow_put_Width,
1572     Videowindow_get_Width,
1573     Videowindow_put_Top,
1574     Videowindow_get_Top,
1575     Videowindow_put_Height,
1576     Videowindow_get_Height,
1577     Videowindow_put_Owner,
1578     Videowindow_get_Owner,
1579     Videowindow_put_MessageDrain,
1580     Videowindow_get_MessageDrain,
1581     Videowindow_get_BorderColor,
1582     Videowindow_put_BorderColor,
1583     Videowindow_get_FullScreenMode,
1584     Videowindow_put_FullScreenMode,
1585     Videowindow_SetWindowForeground,
1586     Videowindow_NotifyOwnerMessage,
1587     Videowindow_SetWindowPosition,
1588     Videowindow_GetWindowPosition,
1589     Videowindow_GetMinIdealImageSize,
1590     Videowindow_GetMaxIdealImageSize,
1591     Videowindow_GetRestorePosition,
1592     Videowindow_HideCursor,
1593     Videowindow_IsCursorHidden
1594 };