Various cosmetic changes.
[wine] / dlls / quartz / vidren.c
1 /*
2  * Implements CLSID_VideoRenderer.
3  *
4  * hidenori@a2.ctktv.ne.jp
5  *
6  * FIXME - use clock
7  */
8
9 #include "config.h"
10
11 #include <stdlib.h>
12 #include "windef.h"
13 #include "winbase.h"
14 #include "wingdi.h"
15 #include "winuser.h"
16 #include "winerror.h"
17 #include "mmsystem.h"
18 #include "strmif.h"
19 #include "control.h"
20 #include "vfwmsgs.h"
21 #include "uuids.h"
22 #include "amvideo.h"
23 #include "evcode.h"
24
25 #include "debugtools.h"
26 DEFAULT_DEBUG_CHANNEL(quartz);
27
28 #include "quartz_private.h"
29 #include "vidren.h"
30 #include "seekpass.h"
31
32
33 static const WCHAR QUARTZ_VideoRenderer_Name[] =
34 { 'V','i','d','e','o',' ','R','e','n','d','e','r','e','r',0 };
35 static const WCHAR QUARTZ_VideoRendererPin_Name[] =
36 { 'I','n',0 };
37
38 #define VIDRENMSG_UPDATE        (WM_APP+0)
39 #define VIDRENMSG_ENDTHREAD     (WM_APP+1)
40
41 static const CHAR VIDREN_szWndClass[] = "Wine_VideoRenderer";
42 static const CHAR VIDREN_szWndName[] = "Wine Video Renderer";
43
44
45
46
47 static void VIDREN_OnPaint( CVideoRendererImpl* This, HWND hwnd )
48 {
49         PAINTSTRUCT ps;
50         const VIDEOINFOHEADER* pinfo;
51         const AM_MEDIA_TYPE* pmt;
52
53         TRACE("(%p,%08x)\n",This,hwnd);
54
55         if ( !BeginPaint( hwnd, &ps ) )
56                 return;
57
58         pmt = This->pPin->pin.pmtConn;
59         if ( (!This->m_bSampleIsValid) || pmt == NULL )
60                 goto err;
61
62         pinfo = (const VIDEOINFOHEADER*)pmt->pbFormat;
63
64         StretchDIBits(
65                 ps.hdc,
66                 0, 0,
67                 abs(pinfo->bmiHeader.biWidth), abs(pinfo->bmiHeader.biHeight),
68                 0, 0,
69                 abs(pinfo->bmiHeader.biWidth), abs(pinfo->bmiHeader.biHeight),
70                 This->m_pSampleData, (BITMAPINFO*)(&pinfo->bmiHeader),
71                 DIB_RGB_COLORS, SRCCOPY );
72
73 err:
74         EndPaint( hwnd, &ps );
75 }
76
77 static void VIDREN_OnQueryNewPalette( CVideoRendererImpl* This, HWND hwnd )
78 {
79         FIXME("(%p,%08x)\n",This,hwnd);
80 }
81
82 static void VIDREN_OnUpdate( CVideoRendererImpl* This, HWND hwnd )
83 {
84         MSG     msg;
85
86         TRACE("(%p,%08x)\n",This,hwnd);
87
88         InvalidateRect(hwnd,NULL,FALSE);
89         UpdateWindow(hwnd);
90
91         /* FIXME */
92         while ( PeekMessageA(&msg,hwnd,
93                 VIDRENMSG_UPDATE,VIDRENMSG_UPDATE,
94                 PM_REMOVE) != FALSE )
95         {
96                 /* discard this message. */
97         }
98 }
99
100
101 static LRESULT CALLBACK
102 VIDREN_WndProc(
103         HWND hwnd, UINT message,
104         WPARAM wParam, LPARAM lParam )
105 {
106         CVideoRendererImpl*     This = (CVideoRendererImpl*)
107                 GetWindowLongA( hwnd, 0L );
108
109         TRACE("(%p) - %u/%u/%ld\n",This,message,wParam,lParam);
110
111         if ( message == WM_NCCREATE )
112         {
113                 This = (CVideoRendererImpl*)(((CREATESTRUCTA*)lParam)->lpCreateParams);
114                 SetWindowLongA( hwnd, 0L, (LONG)This );
115                 This->m_hwnd = hwnd;
116         }
117
118         if ( message == WM_NCDESTROY )
119         {
120                 PostQuitMessage(0);
121                 This->m_hwnd = (HWND)NULL;
122                 SetWindowLongA( hwnd, 0L, (LONG)NULL );
123                 This = NULL;
124         }
125
126         if ( This != NULL )
127         {
128                 switch ( message )
129                 {
130                 case WM_PAINT:
131                         TRACE("WM_PAINT begin\n");
132                         EnterCriticalSection( &This->m_csReceive );
133                         VIDREN_OnPaint( This, hwnd );
134                         LeaveCriticalSection( &This->m_csReceive );
135                         TRACE("WM_PAINT end\n");
136                         return 0;
137                 case WM_CLOSE:
138                         ShowWindow( hwnd, SW_HIDE );
139                         return 0;
140                 case WM_PALETTECHANGED:
141                         if ( hwnd == (HWND)wParam )
142                                 break;
143                         /* fall through */
144                 case WM_QUERYNEWPALETTE:
145                         VIDREN_OnQueryNewPalette( This, hwnd );
146                         break;
147                 case VIDRENMSG_UPDATE:
148                         VIDREN_OnUpdate( This, hwnd );
149                         return 0;
150                 case VIDRENMSG_ENDTHREAD:
151                         DestroyWindow(hwnd);
152                         return 0;
153                 default:
154                         break;
155                 }
156         }
157
158         return DefWindowProcA( hwnd, message, wParam, lParam );
159 }
160
161 static BOOL VIDREN_Register( HINSTANCE hInst )
162 {
163         WNDCLASSA       wc;
164         ATOM    atom;
165
166         wc.style = 0;
167         wc.lpfnWndProc = VIDREN_WndProc;
168         wc.cbClsExtra = 0;
169         wc.cbWndExtra = sizeof(LONG);
170         wc.hInstance = hInst;
171         wc.hIcon = LoadIconA((HINSTANCE)NULL,IDI_WINLOGOA);
172         wc.hCursor = LoadCursorA((HINSTANCE)NULL,IDC_ARROWA);
173         wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
174         wc.lpszMenuName = NULL;
175         wc.lpszClassName = VIDREN_szWndClass;
176
177         atom = RegisterClassA( &wc );
178         if ( atom != (ATOM)0 )
179                 return TRUE;
180
181         /* FIXME */
182         return FALSE;
183 }
184
185 static HWND VIDREN_Create( HWND hwndOwner, CVideoRendererImpl* This )
186 {
187         HINSTANCE hInst = (HINSTANCE)GetModuleHandleA(NULL);
188         const VIDEOINFOHEADER* pinfo;
189         DWORD   dwExStyle = 0;
190         DWORD   dwStyle = WS_POPUP|WS_CAPTION|WS_CLIPCHILDREN;
191         RECT    rcWnd;
192         HWND    hwnd;
193
194         if ( !VIDREN_Register( hInst ) )
195                 return (HWND)NULL;
196
197         pinfo = (const VIDEOINFOHEADER*)This->pPin->pin.pmtConn->pbFormat;
198
199         TRACE("width %ld, height %ld\n", pinfo->bmiHeader.biWidth, pinfo->bmiHeader.biHeight);
200
201         rcWnd.left = 0;
202         rcWnd.top = 0;
203         rcWnd.right = pinfo->bmiHeader.biWidth;
204         rcWnd.bottom = abs(pinfo->bmiHeader.biHeight);
205         AdjustWindowRectEx( &rcWnd, dwStyle, FALSE, dwExStyle );
206
207         TRACE("window width %d,height %d\n",
208                 rcWnd.right-rcWnd.left,rcWnd.bottom-rcWnd.top);
209
210         hwnd = CreateWindowExA(
211                 dwExStyle,
212                 VIDREN_szWndClass, VIDREN_szWndName,
213                 dwStyle,
214                 100,100, /* FIXME */
215                 rcWnd.right-rcWnd.left, rcWnd.bottom-rcWnd.top,
216                 hwndOwner, (HMENU)NULL,
217                 hInst, (LPVOID)This );
218         if ( hwnd != (HWND)NULL )
219                 ShowWindow(hwnd,SW_SHOW);
220
221         return hwnd;
222 }
223
224 static DWORD WINAPI VIDREN_ThreadEntry( LPVOID pv )
225 {
226         CVideoRendererImpl*     This = (CVideoRendererImpl*)pv;
227         MSG     msg;
228
229         TRACE("(%p)\n",This);
230         if ( !VIDREN_Create( (HWND)NULL, This ) )
231                 return 0;
232         TRACE("VIDREN_Create succeeded\n");
233
234         SetEvent( This->m_hEventInit );
235         TRACE("Enter message loop\n");
236
237         while ( GetMessageA(&msg,(HWND)NULL,0,0) )
238         {
239                 TranslateMessage(&msg);
240                 DispatchMessageA(&msg);
241         }
242
243         return 0;
244 }
245
246 static HRESULT VIDREN_StartThread( CVideoRendererImpl* This )
247 {
248         DWORD dwRes;
249         DWORD dwThreadId;
250         HANDLE  hEvents[2];
251
252         if ( This->m_hEventInit != (HANDLE)NULL ||
253                  This->m_hwnd != (HWND)NULL ||
254                  This->m_hThread != (HANDLE)NULL ||
255                  This->pPin->pin.pmtConn == NULL )
256                 return E_UNEXPECTED;
257
258         This->m_hEventInit = CreateEventA(NULL,TRUE,FALSE,NULL);
259         if ( This->m_hEventInit == (HANDLE)NULL )
260                 return E_OUTOFMEMORY;
261
262         This->m_hThread = CreateThread(
263                 NULL, 0,
264                 VIDREN_ThreadEntry,
265                 (LPVOID)This,
266                 0, &dwThreadId );
267         if ( This->m_hThread == (HANDLE)NULL )
268                 return E_FAIL;
269
270         hEvents[0] = This->m_hEventInit;
271         hEvents[1] = This->m_hThread;
272
273         dwRes = WaitForMultipleObjects(2,hEvents,FALSE,INFINITE);
274         if ( dwRes != WAIT_OBJECT_0 )
275                 return E_FAIL;
276
277         return S_OK;
278 }
279
280 static void VIDREN_EndThread( CVideoRendererImpl* This )
281 {
282         if ( This->m_hwnd != (HWND)NULL )
283                 PostMessageA( This->m_hwnd, VIDRENMSG_ENDTHREAD, 0, 0 );
284
285         if ( This->m_hThread != (HANDLE)NULL )
286         {
287                 WaitForSingleObject( This->m_hThread, INFINITE );
288                 CloseHandle( This->m_hThread );
289                 This->m_hThread = (HANDLE)NULL;
290         }
291         if ( This->m_hEventInit != (HANDLE)NULL )
292         {
293                 CloseHandle( This->m_hEventInit );
294                 This->m_hEventInit = (HANDLE)NULL;
295         }
296 }
297
298
299
300 /***************************************************************************
301  *
302  *      CVideoRendererImpl methods
303  *
304  */
305
306 static HRESULT CVideoRendererImpl_OnActive( CBaseFilterImpl* pImpl )
307 {
308         CVideoRendererImpl_THIS(pImpl,basefilter);
309
310         FIXME( "(%p)\n", This );
311
312         This->m_bSampleIsValid = FALSE;
313
314         return NOERROR;
315 }
316
317 static HRESULT CVideoRendererImpl_OnInactive( CBaseFilterImpl* pImpl )
318 {
319         CVideoRendererImpl_THIS(pImpl,basefilter);
320
321         FIXME( "(%p)\n", This );
322
323         EnterCriticalSection( &This->m_csReceive );
324         This->m_bSampleIsValid = FALSE;
325         LeaveCriticalSection( &This->m_csReceive );
326
327         return NOERROR;
328 }
329
330 static const CBaseFilterHandlers filterhandlers =
331 {
332         CVideoRendererImpl_OnActive, /* pOnActive */
333         CVideoRendererImpl_OnInactive, /* pOnInactive */
334         NULL, /* pOnStop */
335 };
336
337 /***************************************************************************
338  *
339  *      CVideoRendererPinImpl methods
340  *
341  */
342
343 static HRESULT CVideoRendererPinImpl_OnPreConnect( CPinBaseImpl* pImpl, IPin* pPin )
344 {
345         CVideoRendererPinImpl_THIS(pImpl,pin);
346
347         TRACE("(%p,%p)\n",This,pPin);
348
349         return NOERROR;
350 }
351
352 static HRESULT CVideoRendererPinImpl_OnPostConnect( CPinBaseImpl* pImpl, IPin* pPin )
353 {
354         CVideoRendererPinImpl_THIS(pImpl,pin);
355         const VIDEOINFOHEADER* pinfo;
356         HRESULT hr;
357
358         TRACE("(%p,%p)\n",This,pPin);
359
360         if ( This->pRender->m_pSampleData != NULL )
361         {
362                 QUARTZ_FreeMem(This->pRender->m_pSampleData);
363                 This->pRender->m_pSampleData = NULL;
364         }
365         This->pRender->m_cbSampleData = 0;
366         This->pRender->m_bSampleIsValid = FALSE;
367
368         pinfo = (const VIDEOINFOHEADER*)This->pin.pmtConn->pbFormat;
369         if ( pinfo == NULL )
370                 return E_FAIL;
371
372         This->pRender->m_bSampleIsValid = FALSE;
373         This->pRender->m_cbSampleData = DIBSIZE(pinfo->bmiHeader);
374         This->pRender->m_pSampleData = (BYTE*)QUARTZ_AllocMem(This->pRender->m_cbSampleData);
375         if ( This->pRender->m_pSampleData == NULL )
376                 return E_OUTOFMEMORY;
377
378         hr = VIDREN_StartThread(This->pRender);
379         if ( FAILED(hr) )
380                 return hr;
381
382         return NOERROR;
383 }
384
385 static HRESULT CVideoRendererPinImpl_OnDisconnect( CPinBaseImpl* pImpl )
386 {
387         CVideoRendererPinImpl_THIS(pImpl,pin);
388
389         TRACE("(%p)\n",This);
390
391         VIDREN_EndThread(This->pRender);
392
393         if ( This->pRender->m_pSampleData != NULL )
394         {
395                 QUARTZ_FreeMem(This->pRender->m_pSampleData);
396                 This->pRender->m_pSampleData = NULL;
397         }
398         This->pRender->m_cbSampleData = 0;
399         This->pRender->m_bSampleIsValid = FALSE;
400
401         if ( This->meminput.pAllocator != NULL )
402         {
403                 IMemAllocator_Decommit(This->meminput.pAllocator);
404                 IMemAllocator_Release(This->meminput.pAllocator);
405                 This->meminput.pAllocator = NULL;
406         }
407
408         return NOERROR;
409 }
410
411 static HRESULT CVideoRendererPinImpl_CheckMediaType( CPinBaseImpl* pImpl, const AM_MEDIA_TYPE* pmt )
412 {
413         CVideoRendererPinImpl_THIS(pImpl,pin);
414         const VIDEOINFOHEADER* pinfo;
415
416         TRACE("(%p,%p)\n",This,pmt);
417
418         if ( !IsEqualGUID( &pmt->majortype, &MEDIATYPE_Video ) )
419                 return E_FAIL;
420         if ( !IsEqualGUID( &pmt->formattype, &FORMAT_VideoInfo ) )
421                 return E_FAIL;
422         /*
423          * check subtype.
424          */
425         if ( !IsEqualGUID( &pmt->subtype, &MEDIASUBTYPE_RGB555 ) &&
426              !IsEqualGUID( &pmt->subtype, &MEDIASUBTYPE_RGB565 ) &&
427              !IsEqualGUID( &pmt->subtype, &MEDIASUBTYPE_RGB24 ) &&
428              !IsEqualGUID( &pmt->subtype, &MEDIASUBTYPE_RGB32 ) )
429                 return E_FAIL;
430
431         /****
432          *
433          *
434         if ( !IsEqualGUID( &pmt->subtype, &MEDIASUBTYPE_RGB8 ) &&
435              !IsEqualGUID( &pmt->subtype, &MEDIASUBTYPE_RGB555 ) &&
436              !IsEqualGUID( &pmt->subtype, &MEDIASUBTYPE_RGB565 ) &&
437              !IsEqualGUID( &pmt->subtype, &MEDIASUBTYPE_RGB24 ) &&
438              !IsEqualGUID( &pmt->subtype, &MEDIASUBTYPE_RGB32 ) )
439                 return E_FAIL;
440          *
441          ****/
442
443         pinfo = (const VIDEOINFOHEADER*)pmt->pbFormat;
444         if ( pinfo == NULL ||
445                  pinfo->bmiHeader.biSize < sizeof(BITMAPINFOHEADER) ||
446                  pinfo->bmiHeader.biWidth <= 0 ||
447                  pinfo->bmiHeader.biHeight == 0 ||
448                  pinfo->bmiHeader.biPlanes != 1 ||
449                  pinfo->bmiHeader.biCompression != 0 )
450                 return E_FAIL;
451
452         return NOERROR;
453 }
454
455 static HRESULT CVideoRendererPinImpl_Receive( CPinBaseImpl* pImpl, IMediaSample* pSample )
456 {
457         CVideoRendererPinImpl_THIS(pImpl,pin);
458         HWND hwnd;
459         BYTE*   pData = NULL;
460         LONG    lLength;
461         HRESULT hr;
462
463         TRACE( "(%p,%p)\n",This,pSample );
464
465         hwnd = This->pRender->m_hwnd;
466         if ( hwnd == (HWND)NULL ||
467                  This->pRender->m_hThread == (HWND)NULL )
468                 return E_UNEXPECTED;
469         if ( This->pRender->m_fInFlush )
470                 return S_FALSE;
471         if ( pSample == NULL )
472                 return E_POINTER;
473
474         /* FIXME - wait/skip/qualitycontrol */
475         
476
477         /* duplicate this sample. */
478         hr = IMediaSample_GetPointer(pSample,&pData);
479         if ( FAILED(hr) )
480                 return hr;
481         lLength = (LONG)IMediaSample_GetActualDataLength(pSample);
482         if ( lLength <= 0 || (lLength < (LONG)This->pRender->m_cbSampleData) )
483         {
484                 ERR( "invalid length: %ld\n", lLength );
485                 return NOERROR;
486         }
487
488         memcpy(This->pRender->m_pSampleData,pData,lLength);
489         This->pRender->m_bSampleIsValid = TRUE;
490         PostMessageA( hwnd, VIDRENMSG_UPDATE, 0, 0 );
491
492         return NOERROR;
493 }
494
495 static HRESULT CVideoRendererPinImpl_ReceiveCanBlock( CPinBaseImpl* pImpl )
496 {
497         CVideoRendererPinImpl_THIS(pImpl,pin);
498
499         TRACE( "(%p)\n", This );
500
501         /* might block. */
502         return S_OK;
503 }
504
505 static HRESULT CVideoRendererPinImpl_EndOfStream( CPinBaseImpl* pImpl )
506 {
507         CVideoRendererPinImpl_THIS(pImpl,pin);
508
509         FIXME( "(%p)\n", This );
510
511         This->pRender->m_fInFlush = FALSE;
512
513         /* FIXME - don't notify twice until stopped or seeked. */
514         return CBaseFilterImpl_MediaEventNotify(
515                 &This->pRender->basefilter, EC_COMPLETE,
516                 (LONG_PTR)S_OK, (LONG_PTR)(IBaseFilter*)(This->pRender) );
517 }
518
519 static HRESULT CVideoRendererPinImpl_BeginFlush( CPinBaseImpl* pImpl )
520 {
521         CVideoRendererPinImpl_THIS(pImpl,pin);
522
523         FIXME( "(%p)\n", This );
524
525         This->pRender->m_fInFlush = TRUE;
526         EnterCriticalSection( &This->pRender->m_csReceive );
527         This->pRender->m_bSampleIsValid = FALSE;
528         LeaveCriticalSection( &This->pRender->m_csReceive );
529
530         return NOERROR;
531 }
532
533 static HRESULT CVideoRendererPinImpl_EndFlush( CPinBaseImpl* pImpl )
534 {
535         CVideoRendererPinImpl_THIS(pImpl,pin);
536
537         FIXME( "(%p)\n", This );
538
539         This->pRender->m_fInFlush = FALSE;
540
541         return NOERROR;
542 }
543
544 static HRESULT CVideoRendererPinImpl_NewSegment( CPinBaseImpl* pImpl, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate )
545 {
546         CVideoRendererPinImpl_THIS(pImpl,pin);
547
548         FIXME( "(%p)\n", This );
549
550         This->pRender->m_fInFlush = FALSE;
551
552         return NOERROR;
553 }
554
555
556
557
558 static const CBasePinHandlers pinhandlers =
559 {
560         CVideoRendererPinImpl_OnPreConnect, /* pOnPreConnect */
561         CVideoRendererPinImpl_OnPostConnect, /* pOnPostConnect */
562         CVideoRendererPinImpl_OnDisconnect, /* pOnDisconnect */
563         CVideoRendererPinImpl_CheckMediaType, /* pCheckMediaType */
564         NULL, /* pQualityNotify */
565         CVideoRendererPinImpl_Receive, /* pReceive */
566         CVideoRendererPinImpl_ReceiveCanBlock, /* pReceiveCanBlock */
567         CVideoRendererPinImpl_EndOfStream, /* pEndOfStream */
568         CVideoRendererPinImpl_BeginFlush, /* pBeginFlush */
569         CVideoRendererPinImpl_EndFlush, /* pEndFlush */
570         CVideoRendererPinImpl_NewSegment, /* pNewSegment */
571 };
572
573
574 /***************************************************************************
575  *
576  *      new/delete CVideoRendererImpl
577  *
578  */
579
580 /* can I use offsetof safely? - FIXME? */
581 static QUARTZ_IFEntry FilterIFEntries[] =
582 {
583   { &IID_IPersist, offsetof(CVideoRendererImpl,basefilter)-offsetof(CVideoRendererImpl,unk) },
584   { &IID_IMediaFilter, offsetof(CVideoRendererImpl,basefilter)-offsetof(CVideoRendererImpl,unk) },
585   { &IID_IBaseFilter, offsetof(CVideoRendererImpl,basefilter)-offsetof(CVideoRendererImpl,unk) },
586   { &IID_IBasicVideo, offsetof(CVideoRendererImpl,basvid)-offsetof(CVideoRendererImpl,unk) },
587   { &IID_IBasicVideo2, offsetof(CVideoRendererImpl,basvid)-offsetof(CVideoRendererImpl,unk) },
588   { &IID_IVideoWindow, offsetof(CVideoRendererImpl,vidwin)-offsetof(CVideoRendererImpl,unk) },
589 };
590
591 static HRESULT CVideoRendererImpl_OnQueryInterface(
592         IUnknown* punk, const IID* piid, void** ppobj )
593 {
594         CVideoRendererImpl_THIS(punk,unk);
595
596         if ( This->pSeekPass == NULL )
597                 return E_NOINTERFACE;
598
599         if ( IsEqualGUID( &IID_IMediaPosition, piid ) ||
600                  IsEqualGUID( &IID_IMediaSeeking, piid ) )
601         {
602                 TRACE( "IMediaSeeking(or IMediaPosition) is queried\n" );
603                 return IUnknown_QueryInterface( (IUnknown*)(&This->pSeekPass->unk), piid, ppobj );
604         }
605
606         return E_NOINTERFACE;
607 }
608
609 static void QUARTZ_DestroyVideoRenderer(IUnknown* punk)
610 {
611         CVideoRendererImpl_THIS(punk,unk);
612
613         TRACE( "(%p)\n", This );
614         CVideoRendererImpl_OnInactive(&This->basefilter);
615         VIDREN_EndThread(This);
616
617         if ( This->pPin != NULL )
618         {
619                 IUnknown_Release(This->pPin->unk.punkControl);
620                 This->pPin = NULL;
621         }
622         if ( This->pSeekPass != NULL )
623         {
624                 IUnknown_Release((IUnknown*)&This->pSeekPass->unk);
625                 This->pSeekPass = NULL;
626         }
627
628         CVideoRendererImpl_UninitIBasicVideo2(This);
629         CVideoRendererImpl_UninitIVideoWindow(This);
630         CBaseFilterImpl_UninitIBaseFilter(&This->basefilter);
631
632         DeleteCriticalSection( &This->m_csReceive );
633 }
634
635 HRESULT QUARTZ_CreateVideoRenderer(IUnknown* punkOuter,void** ppobj)
636 {
637         CVideoRendererImpl*     This = NULL;
638         HRESULT hr;
639
640         TRACE("(%p,%p)\n",punkOuter,ppobj);
641
642         This = (CVideoRendererImpl*)
643                 QUARTZ_AllocObj( sizeof(CVideoRendererImpl) );
644         if ( This == NULL )
645                 return E_OUTOFMEMORY;
646         This->pSeekPass = NULL;
647         This->pPin = NULL;
648         This->m_fInFlush = FALSE;
649
650         This->m_hEventInit = (HANDLE)NULL;
651         This->m_hThread = (HANDLE)NULL;
652         This->m_hwnd = (HWND)NULL;
653         This->m_bSampleIsValid = FALSE;
654         This->m_pSampleData = NULL;
655         This->m_cbSampleData = 0;
656
657         QUARTZ_IUnkInit( &This->unk, punkOuter );
658         This->qiext.pNext = NULL;
659         This->qiext.pOnQueryInterface = &CVideoRendererImpl_OnQueryInterface;
660         QUARTZ_IUnkAddDelegation( &This->unk, &This->qiext );
661
662         hr = CBaseFilterImpl_InitIBaseFilter(
663                 &This->basefilter,
664                 This->unk.punkControl,
665                 &CLSID_VideoRenderer,
666                 QUARTZ_VideoRenderer_Name,
667                 &filterhandlers );
668         if ( SUCCEEDED(hr) )
669         {
670                 hr = CVideoRendererImpl_InitIBasicVideo2(This);
671                 if ( SUCCEEDED(hr) )
672                 {
673                         hr = CVideoRendererImpl_InitIVideoWindow(This);
674                         if ( FAILED(hr) )
675                         {
676                                 CVideoRendererImpl_UninitIBasicVideo2(This);
677                         }
678                 }
679                 if ( FAILED(hr) )
680                 {
681                         CBaseFilterImpl_UninitIBaseFilter(&This->basefilter);
682                 }
683         }
684
685         if ( FAILED(hr) )
686         {
687                 QUARTZ_FreeObj(This);
688                 return hr;
689         }
690
691         This->unk.pEntries = FilterIFEntries;
692         This->unk.dwEntries = sizeof(FilterIFEntries)/sizeof(FilterIFEntries[0]);
693         This->unk.pOnFinalRelease = QUARTZ_DestroyVideoRenderer;
694
695         InitializeCriticalSection( &This->m_csReceive );
696
697         hr = QUARTZ_CreateVideoRendererPin(
698                 This,
699                 &This->basefilter.csFilter,
700                 &This->m_csReceive,
701                 &This->pPin );
702         if ( SUCCEEDED(hr) )
703                 hr = QUARTZ_CompList_AddComp(
704                         This->basefilter.pInPins,
705                         (IUnknown*)&This->pPin->pin,
706                         NULL, 0 );
707         if ( SUCCEEDED(hr) )
708                 hr = QUARTZ_CreateSeekingPassThruInternal(
709                         (IUnknown*)&(This->unk), &This->pSeekPass,
710                         TRUE, (IPin*)&(This->pPin->pin) );
711
712         if ( FAILED(hr) )
713         {
714                 IUnknown_Release( This->unk.punkControl );
715                 return hr;
716         }
717
718         *ppobj = (void*)&(This->unk);
719
720         return S_OK;
721 }
722
723 /***************************************************************************
724  *
725  *      new/delete CVideoRendererPinImpl
726  *
727  */
728
729 /* can I use offsetof safely? - FIXME? */
730 static QUARTZ_IFEntry PinIFEntries[] =
731 {
732   { &IID_IPin, offsetof(CVideoRendererPinImpl,pin)-offsetof(CVideoRendererPinImpl,unk) },
733   { &IID_IMemInputPin, offsetof(CVideoRendererPinImpl,meminput)-offsetof(CVideoRendererPinImpl,unk) },
734 };
735
736 static void QUARTZ_DestroyVideoRendererPin(IUnknown* punk)
737 {
738         CVideoRendererPinImpl_THIS(punk,unk);
739
740         TRACE( "(%p)\n", This );
741
742         CPinBaseImpl_UninitIPin( &This->pin );
743         CMemInputPinBaseImpl_UninitIMemInputPin( &This->meminput );
744 }
745
746 HRESULT QUARTZ_CreateVideoRendererPin(
747         CVideoRendererImpl* pFilter,
748         CRITICAL_SECTION* pcsPin,
749         CRITICAL_SECTION* pcsPinReceive,
750         CVideoRendererPinImpl** ppPin)
751 {
752         CVideoRendererPinImpl*  This = NULL;
753         HRESULT hr;
754
755         TRACE("(%p,%p,%p,%p)\n",pFilter,pcsPin,pcsPinReceive,ppPin);
756
757         This = (CVideoRendererPinImpl*)
758                 QUARTZ_AllocObj( sizeof(CVideoRendererPinImpl) );
759         if ( This == NULL )
760                 return E_OUTOFMEMORY;
761
762         QUARTZ_IUnkInit( &This->unk, NULL );
763         This->pRender = pFilter;
764
765         hr = CPinBaseImpl_InitIPin(
766                 &This->pin,
767                 This->unk.punkControl,
768                 pcsPin, pcsPinReceive,
769                 &pFilter->basefilter,
770                 QUARTZ_VideoRendererPin_Name,
771                 FALSE,
772                 &pinhandlers );
773
774         if ( SUCCEEDED(hr) )
775         {
776                 hr = CMemInputPinBaseImpl_InitIMemInputPin(
777                         &This->meminput,
778                         This->unk.punkControl,
779                         &This->pin );
780                 if ( FAILED(hr) )
781                 {
782                         CPinBaseImpl_UninitIPin( &This->pin );
783                 }
784         }
785
786         if ( FAILED(hr) )
787         {
788                 QUARTZ_FreeObj(This);
789                 return hr;
790         }
791
792         This->unk.pEntries = PinIFEntries;
793         This->unk.dwEntries = sizeof(PinIFEntries)/sizeof(PinIFEntries[0]);
794         This->unk.pOnFinalRelease = QUARTZ_DestroyVideoRendererPin;
795
796         *ppPin = This;
797
798         TRACE("returned successfully.\n");
799
800         return S_OK;
801 }
802
803 /***************************************************************************
804  *
805  *      CVideoRendererImpl::IBasicVideo2
806  *
807  */
808
809
810 static HRESULT WINAPI
811 IBasicVideo2_fnQueryInterface(IBasicVideo2* iface,REFIID riid,void** ppobj)
812 {
813         CVideoRendererImpl_THIS(iface,basvid);
814
815         TRACE("(%p)->()\n",This);
816
817         return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
818 }
819
820 static ULONG WINAPI
821 IBasicVideo2_fnAddRef(IBasicVideo2* iface)
822 {
823         CVideoRendererImpl_THIS(iface,basvid);
824
825         TRACE("(%p)->()\n",This);
826
827         return IUnknown_AddRef(This->unk.punkControl);
828 }
829
830 static ULONG WINAPI
831 IBasicVideo2_fnRelease(IBasicVideo2* iface)
832 {
833         CVideoRendererImpl_THIS(iface,basvid);
834
835         TRACE("(%p)->()\n",This);
836
837         return IUnknown_Release(This->unk.punkControl);
838 }
839
840 static HRESULT WINAPI
841 IBasicVideo2_fnGetTypeInfoCount(IBasicVideo2* iface,UINT* pcTypeInfo)
842 {
843         CVideoRendererImpl_THIS(iface,basvid);
844
845         FIXME("(%p)->()\n",This);
846
847         return E_NOTIMPL;
848 }
849
850 static HRESULT WINAPI
851 IBasicVideo2_fnGetTypeInfo(IBasicVideo2* iface,UINT iTypeInfo, LCID lcid, ITypeInfo** ppobj)
852 {
853         CVideoRendererImpl_THIS(iface,basvid);
854
855         FIXME("(%p)->()\n",This);
856
857         return E_NOTIMPL;
858 }
859
860 static HRESULT WINAPI
861 IBasicVideo2_fnGetIDsOfNames(IBasicVideo2* iface,REFIID riid, LPOLESTR* ppwszName, UINT cNames, LCID lcid, DISPID* pDispId)
862 {
863         CVideoRendererImpl_THIS(iface,basvid);
864
865         FIXME("(%p)->()\n",This);
866
867         return E_NOTIMPL;
868 }
869
870 static HRESULT WINAPI
871 IBasicVideo2_fnInvoke(IBasicVideo2* iface,DISPID DispId, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarRes, EXCEPINFO* pExcepInfo, UINT* puArgErr)
872 {
873         CVideoRendererImpl_THIS(iface,basvid);
874
875         FIXME("(%p)->()\n",This);
876
877         return E_NOTIMPL;
878 }
879
880
881 static HRESULT WINAPI
882 IBasicVideo2_fnget_AvgTimePerFrame(IBasicVideo2* iface,REFTIME* prefTime)
883 {
884         CVideoRendererImpl_THIS(iface,basvid);
885
886         FIXME("(%p)->()\n",This);
887
888         return E_NOTIMPL;
889 }
890
891 static HRESULT WINAPI
892 IBasicVideo2_fnget_BitRate(IBasicVideo2* iface,long* plRate)
893 {
894         CVideoRendererImpl_THIS(iface,basvid);
895
896         FIXME("(%p)->()\n",This);
897
898         return E_NOTIMPL;
899 }
900
901 static HRESULT WINAPI
902 IBasicVideo2_fnget_BitErrorRate(IBasicVideo2* iface,long* plRate)
903 {
904         CVideoRendererImpl_THIS(iface,basvid);
905
906         FIXME("(%p)->()\n",This);
907
908         return E_NOTIMPL;
909 }
910
911 static HRESULT WINAPI
912 IBasicVideo2_fnget_VideoWidth(IBasicVideo2* iface,long* plWidth)
913 {
914         CVideoRendererImpl_THIS(iface,basvid);
915
916         FIXME("(%p)->()\n",This);
917
918         return E_NOTIMPL;
919 }
920
921 static HRESULT WINAPI
922 IBasicVideo2_fnget_VideoHeight(IBasicVideo2* iface,long* plHeight)
923 {
924         CVideoRendererImpl_THIS(iface,basvid);
925
926         FIXME("(%p)->()\n",This);
927
928         return E_NOTIMPL;
929 }
930
931 static HRESULT WINAPI
932 IBasicVideo2_fnput_SourceLeft(IBasicVideo2* iface,long lLeft)
933 {
934         CVideoRendererImpl_THIS(iface,basvid);
935
936         FIXME("(%p)->()\n",This);
937
938         return E_NOTIMPL;
939 }
940
941 static HRESULT WINAPI
942 IBasicVideo2_fnget_SourceLeft(IBasicVideo2* iface,long* plLeft)
943 {
944         CVideoRendererImpl_THIS(iface,basvid);
945
946         FIXME("(%p)->()\n",This);
947
948         return E_NOTIMPL;
949 }
950
951 static HRESULT WINAPI
952 IBasicVideo2_fnput_SourceWidth(IBasicVideo2* iface,long lWidth)
953 {
954         CVideoRendererImpl_THIS(iface,basvid);
955
956         FIXME("(%p)->()\n",This);
957
958         return E_NOTIMPL;
959 }
960
961 static HRESULT WINAPI
962 IBasicVideo2_fnget_SourceWidth(IBasicVideo2* iface,long* plWidth)
963 {
964         CVideoRendererImpl_THIS(iface,basvid);
965
966         FIXME("(%p)->()\n",This);
967
968         return E_NOTIMPL;
969 }
970
971 static HRESULT WINAPI
972 IBasicVideo2_fnput_SourceTop(IBasicVideo2* iface,long lTop)
973 {
974         CVideoRendererImpl_THIS(iface,basvid);
975
976         FIXME("(%p)->()\n",This);
977
978         return E_NOTIMPL;
979 }
980
981 static HRESULT WINAPI
982 IBasicVideo2_fnget_SourceTop(IBasicVideo2* iface,long* plTop)
983 {
984         CVideoRendererImpl_THIS(iface,basvid);
985
986         FIXME("(%p)->()\n",This);
987
988         return E_NOTIMPL;
989 }
990
991 static HRESULT WINAPI
992 IBasicVideo2_fnput_SourceHeight(IBasicVideo2* iface,long lHeight)
993 {
994         CVideoRendererImpl_THIS(iface,basvid);
995
996         FIXME("(%p)->()\n",This);
997
998         return E_NOTIMPL;
999 }
1000
1001 static HRESULT WINAPI
1002 IBasicVideo2_fnget_SourceHeight(IBasicVideo2* iface,long* plHeight)
1003 {
1004         CVideoRendererImpl_THIS(iface,basvid);
1005
1006         FIXME("(%p)->()\n",This);
1007
1008         return E_NOTIMPL;
1009 }
1010
1011 static HRESULT WINAPI
1012 IBasicVideo2_fnput_DestinationLeft(IBasicVideo2* iface,long lLeft)
1013 {
1014         CVideoRendererImpl_THIS(iface,basvid);
1015
1016         FIXME("(%p)->()\n",This);
1017
1018         return E_NOTIMPL;
1019 }
1020
1021 static HRESULT WINAPI
1022 IBasicVideo2_fnget_DestinationLeft(IBasicVideo2* iface,long* plLeft)
1023 {
1024         CVideoRendererImpl_THIS(iface,basvid);
1025
1026         FIXME("(%p)->()\n",This);
1027
1028         return E_NOTIMPL;
1029 }
1030
1031 static HRESULT WINAPI
1032 IBasicVideo2_fnput_DestinationWidth(IBasicVideo2* iface,long lWidth)
1033 {
1034         CVideoRendererImpl_THIS(iface,basvid);
1035
1036         FIXME("(%p)->()\n",This);
1037
1038         return E_NOTIMPL;
1039 }
1040
1041 static HRESULT WINAPI
1042 IBasicVideo2_fnget_DestinationWidth(IBasicVideo2* iface,long* plWidth)
1043 {
1044         CVideoRendererImpl_THIS(iface,basvid);
1045
1046         FIXME("(%p)->()\n",This);
1047
1048         return E_NOTIMPL;
1049 }
1050
1051 static HRESULT WINAPI
1052 IBasicVideo2_fnput_DestinationTop(IBasicVideo2* iface,long lTop)
1053 {
1054         CVideoRendererImpl_THIS(iface,basvid);
1055
1056         FIXME("(%p)->()\n",This);
1057
1058         return E_NOTIMPL;
1059 }
1060
1061 static HRESULT WINAPI
1062 IBasicVideo2_fnget_DestinationTop(IBasicVideo2* iface,long* plTop)
1063 {
1064         CVideoRendererImpl_THIS(iface,basvid);
1065
1066         FIXME("(%p)->()\n",This);
1067
1068         return E_NOTIMPL;
1069 }
1070
1071 static HRESULT WINAPI
1072 IBasicVideo2_fnput_DestinationHeight(IBasicVideo2* iface,long lHeight)
1073 {
1074         CVideoRendererImpl_THIS(iface,basvid);
1075
1076         FIXME("(%p)->()\n",This);
1077
1078         return E_NOTIMPL;
1079 }
1080
1081 static HRESULT WINAPI
1082 IBasicVideo2_fnget_DestinationHeight(IBasicVideo2* iface,long* plHeight)
1083 {
1084         CVideoRendererImpl_THIS(iface,basvid);
1085
1086         FIXME("(%p)->()\n",This);
1087
1088         return E_NOTIMPL;
1089 }
1090
1091 static HRESULT WINAPI
1092 IBasicVideo2_fnSetSourcePosition(IBasicVideo2* iface,long lLeft,long lTop,long lWidth,long lHeight)
1093 {
1094         CVideoRendererImpl_THIS(iface,basvid);
1095
1096         FIXME("(%p)->()\n",This);
1097
1098         return E_NOTIMPL;
1099 }
1100
1101 static HRESULT WINAPI
1102 IBasicVideo2_fnGetSourcePosition(IBasicVideo2* iface,long* plLeft,long* plTop,long* plWidth,long* plHeight)
1103 {
1104         CVideoRendererImpl_THIS(iface,basvid);
1105
1106         FIXME("(%p)->()\n",This);
1107
1108         return E_NOTIMPL;
1109 }
1110
1111 static HRESULT WINAPI
1112 IBasicVideo2_fnSetDefaultSourcePosition(IBasicVideo2* iface)
1113 {
1114         CVideoRendererImpl_THIS(iface,basvid);
1115
1116         FIXME("(%p)->()\n",This);
1117
1118         return E_NOTIMPL;
1119 }
1120
1121 static HRESULT WINAPI
1122 IBasicVideo2_fnSetDestinationPosition(IBasicVideo2* iface,long lLeft,long lTop,long lWidth,long lHeight)
1123 {
1124         CVideoRendererImpl_THIS(iface,basvid);
1125
1126         FIXME("(%p)->()\n",This);
1127
1128         return E_NOTIMPL;
1129 }
1130
1131 static HRESULT WINAPI
1132 IBasicVideo2_fnGetDestinationPosition(IBasicVideo2* iface,long* plLeft,long* plTop,long* plWidth,long* plHeight)
1133 {
1134         CVideoRendererImpl_THIS(iface,basvid);
1135
1136         FIXME("(%p)->()\n",This);
1137
1138         return E_NOTIMPL;
1139 }
1140
1141 static HRESULT WINAPI
1142 IBasicVideo2_fnSetDefaultDestinationPosition(IBasicVideo2* iface)
1143 {
1144         CVideoRendererImpl_THIS(iface,basvid);
1145
1146         FIXME("(%p)->()\n",This);
1147
1148         return E_NOTIMPL;
1149 }
1150
1151 static HRESULT WINAPI
1152 IBasicVideo2_fnGetVideoSize(IBasicVideo2* iface,long* plWidth,long* plHeight)
1153 {
1154         CVideoRendererImpl_THIS(iface,basvid);
1155
1156         FIXME("(%p)->()\n",This);
1157
1158         return E_NOTIMPL;
1159 }
1160
1161 static HRESULT WINAPI
1162 IBasicVideo2_fnGetVideoPaletteEntries(IBasicVideo2* iface,long lStart,long lCount,long* plRet,long* plPaletteEntry)
1163 {
1164         CVideoRendererImpl_THIS(iface,basvid);
1165
1166         FIXME("(%p)->()\n",This);
1167
1168         return E_NOTIMPL;
1169 }
1170
1171 static HRESULT WINAPI
1172 IBasicVideo2_fnGetCurrentImage(IBasicVideo2* iface,long* plBufferSize,long* plDIBBuffer)
1173 {
1174         CVideoRendererImpl_THIS(iface,basvid);
1175
1176         FIXME("(%p)->()\n",This);
1177
1178         return E_NOTIMPL;
1179 }
1180
1181 static HRESULT WINAPI
1182 IBasicVideo2_fnIsUsingDefaultSource(IBasicVideo2* iface)
1183 {
1184         CVideoRendererImpl_THIS(iface,basvid);
1185
1186         FIXME("(%p)->()\n",This);
1187
1188         return E_NOTIMPL;
1189 }
1190
1191 static HRESULT WINAPI
1192 IBasicVideo2_fnIsUsingDefaultDestination(IBasicVideo2* iface)
1193 {
1194         CVideoRendererImpl_THIS(iface,basvid);
1195
1196         FIXME("(%p)->()\n",This);
1197
1198         return E_NOTIMPL;
1199 }
1200
1201 static HRESULT WINAPI
1202 IBasicVideo2_fnGetPreferredAspectRatio(IBasicVideo2* iface,long* plRateX,long* plRateY)
1203 {
1204         CVideoRendererImpl_THIS(iface,basvid);
1205
1206         FIXME("(%p)->()\n",This);
1207
1208         return E_NOTIMPL;
1209 }
1210
1211
1212
1213
1214 static ICOM_VTABLE(IBasicVideo2) ibasicvideo =
1215 {
1216         ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1217         /* IUnknown fields */
1218         IBasicVideo2_fnQueryInterface,
1219         IBasicVideo2_fnAddRef,
1220         IBasicVideo2_fnRelease,
1221         /* IDispatch fields */
1222         IBasicVideo2_fnGetTypeInfoCount,
1223         IBasicVideo2_fnGetTypeInfo,
1224         IBasicVideo2_fnGetIDsOfNames,
1225         IBasicVideo2_fnInvoke,
1226         /* IBasicVideo fields */
1227         IBasicVideo2_fnget_AvgTimePerFrame,
1228         IBasicVideo2_fnget_BitRate,
1229         IBasicVideo2_fnget_BitErrorRate,
1230         IBasicVideo2_fnget_VideoWidth,
1231         IBasicVideo2_fnget_VideoHeight,
1232         IBasicVideo2_fnput_SourceLeft,
1233         IBasicVideo2_fnget_SourceLeft,
1234         IBasicVideo2_fnput_SourceWidth,
1235         IBasicVideo2_fnget_SourceWidth,
1236         IBasicVideo2_fnput_SourceTop,
1237         IBasicVideo2_fnget_SourceTop,
1238         IBasicVideo2_fnput_SourceHeight,
1239         IBasicVideo2_fnget_SourceHeight,
1240         IBasicVideo2_fnput_DestinationLeft,
1241         IBasicVideo2_fnget_DestinationLeft,
1242         IBasicVideo2_fnput_DestinationWidth,
1243         IBasicVideo2_fnget_DestinationWidth,
1244         IBasicVideo2_fnput_DestinationTop,
1245         IBasicVideo2_fnget_DestinationTop,
1246         IBasicVideo2_fnput_DestinationHeight,
1247         IBasicVideo2_fnget_DestinationHeight,
1248         IBasicVideo2_fnSetSourcePosition,
1249         IBasicVideo2_fnGetSourcePosition,
1250         IBasicVideo2_fnSetDefaultSourcePosition,
1251         IBasicVideo2_fnSetDestinationPosition,
1252         IBasicVideo2_fnGetDestinationPosition,
1253         IBasicVideo2_fnSetDefaultDestinationPosition,
1254         IBasicVideo2_fnGetVideoSize,
1255         IBasicVideo2_fnGetVideoPaletteEntries,
1256         IBasicVideo2_fnGetCurrentImage,
1257         IBasicVideo2_fnIsUsingDefaultSource,
1258         IBasicVideo2_fnIsUsingDefaultDestination,
1259         /* IBasicVideo2 fields */
1260         IBasicVideo2_fnGetPreferredAspectRatio,
1261 };
1262
1263
1264 HRESULT CVideoRendererImpl_InitIBasicVideo2( CVideoRendererImpl* This )
1265 {
1266         TRACE("(%p)\n",This);
1267         ICOM_VTBL(&This->basvid) = &ibasicvideo;
1268
1269         return NOERROR;
1270 }
1271
1272 void CVideoRendererImpl_UninitIBasicVideo2( CVideoRendererImpl* This )
1273 {
1274         TRACE("(%p)\n",This);
1275 }
1276
1277 /***************************************************************************
1278  *
1279  *      CVideoRendererImpl::IVideoWindow
1280  *
1281  */
1282
1283
1284 static HRESULT WINAPI
1285 IVideoWindow_fnQueryInterface(IVideoWindow* iface,REFIID riid,void** ppobj)
1286 {
1287         CVideoRendererImpl_THIS(iface,vidwin);
1288
1289         TRACE("(%p)->()\n",This);
1290
1291         return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
1292 }
1293
1294 static ULONG WINAPI
1295 IVideoWindow_fnAddRef(IVideoWindow* iface)
1296 {
1297         CVideoRendererImpl_THIS(iface,vidwin);
1298
1299         TRACE("(%p)->()\n",This);
1300
1301         return IUnknown_AddRef(This->unk.punkControl);
1302 }
1303
1304 static ULONG WINAPI
1305 IVideoWindow_fnRelease(IVideoWindow* iface)
1306 {
1307         CVideoRendererImpl_THIS(iface,vidwin);
1308
1309         TRACE("(%p)->()\n",This);
1310
1311         return IUnknown_Release(This->unk.punkControl);
1312 }
1313
1314 static HRESULT WINAPI
1315 IVideoWindow_fnGetTypeInfoCount(IVideoWindow* iface,UINT* pcTypeInfo)
1316 {
1317         CVideoRendererImpl_THIS(iface,vidwin);
1318
1319         FIXME("(%p)->()\n",This);
1320
1321         return E_NOTIMPL;
1322 }
1323
1324 static HRESULT WINAPI
1325 IVideoWindow_fnGetTypeInfo(IVideoWindow* iface,UINT iTypeInfo, LCID lcid, ITypeInfo** ppobj)
1326 {
1327         CVideoRendererImpl_THIS(iface,vidwin);
1328
1329         FIXME("(%p)->()\n",This);
1330
1331         return E_NOTIMPL;
1332 }
1333
1334 static HRESULT WINAPI
1335 IVideoWindow_fnGetIDsOfNames(IVideoWindow* iface,REFIID riid, LPOLESTR* ppwszName, UINT cNames, LCID lcid, DISPID* pDispId)
1336 {
1337         CVideoRendererImpl_THIS(iface,vidwin);
1338
1339         FIXME("(%p)->()\n",This);
1340
1341         return E_NOTIMPL;
1342 }
1343
1344 static HRESULT WINAPI
1345 IVideoWindow_fnInvoke(IVideoWindow* iface,DISPID DispId, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarRes, EXCEPINFO* pExcepInfo, UINT* puArgErr)
1346 {
1347         CVideoRendererImpl_THIS(iface,vidwin);
1348
1349         FIXME("(%p)->()\n",This);
1350
1351         return E_NOTIMPL;
1352 }
1353
1354
1355
1356 static HRESULT WINAPI
1357 IVideoWindow_fnput_Caption(IVideoWindow* iface,BSTR strCaption)
1358 {
1359         CVideoRendererImpl_THIS(iface,vidwin);
1360
1361         FIXME("(%p)->()\n",This);
1362
1363         return E_NOTIMPL;
1364 }
1365
1366 static HRESULT WINAPI
1367 IVideoWindow_fnget_Caption(IVideoWindow* iface,BSTR* pstrCaption)
1368 {
1369         CVideoRendererImpl_THIS(iface,vidwin);
1370
1371         FIXME("(%p)->()\n",This);
1372
1373         return E_NOTIMPL;
1374 }
1375
1376 static HRESULT WINAPI
1377 IVideoWindow_fnput_WindowStyle(IVideoWindow* iface,long lStyle)
1378 {
1379         CVideoRendererImpl_THIS(iface,vidwin);
1380
1381         FIXME("(%p)->()\n",This);
1382
1383         return E_NOTIMPL;
1384 }
1385
1386 static HRESULT WINAPI
1387 IVideoWindow_fnget_WindowStyle(IVideoWindow* iface,long* plStyle)
1388 {
1389         CVideoRendererImpl_THIS(iface,vidwin);
1390
1391         FIXME("(%p)->()\n",This);
1392
1393         return E_NOTIMPL;
1394 }
1395
1396 static HRESULT WINAPI
1397 IVideoWindow_fnput_WindowStyleEx(IVideoWindow* iface,long lExStyle)
1398 {
1399         CVideoRendererImpl_THIS(iface,vidwin);
1400
1401         FIXME("(%p)->()\n",This);
1402
1403         return E_NOTIMPL;
1404 }
1405
1406 static HRESULT WINAPI
1407 IVideoWindow_fnget_WindowStyleEx(IVideoWindow* iface,long* plExStyle)
1408 {
1409         CVideoRendererImpl_THIS(iface,vidwin);
1410
1411         FIXME("(%p)->()\n",This);
1412
1413         return E_NOTIMPL;
1414 }
1415
1416 static HRESULT WINAPI
1417 IVideoWindow_fnput_AutoShow(IVideoWindow* iface,long lAutoShow)
1418 {
1419         CVideoRendererImpl_THIS(iface,vidwin);
1420
1421         FIXME("(%p)->()\n",This);
1422
1423         return E_NOTIMPL;
1424 }
1425
1426 static HRESULT WINAPI
1427 IVideoWindow_fnget_AutoShow(IVideoWindow* iface,long* plAutoShow)
1428 {
1429         CVideoRendererImpl_THIS(iface,vidwin);
1430
1431         FIXME("(%p)->()\n",This);
1432
1433         return E_NOTIMPL;
1434 }
1435
1436 static HRESULT WINAPI
1437 IVideoWindow_fnput_WindowState(IVideoWindow* iface,long lState)
1438 {
1439         CVideoRendererImpl_THIS(iface,vidwin);
1440
1441         FIXME("(%p)->()\n",This);
1442
1443         return E_NOTIMPL;
1444 }
1445
1446 static HRESULT WINAPI
1447 IVideoWindow_fnget_WindowState(IVideoWindow* iface,long* plState)
1448 {
1449         CVideoRendererImpl_THIS(iface,vidwin);
1450
1451         FIXME("(%p)->()\n",This);
1452
1453         return E_NOTIMPL;
1454 }
1455
1456 static HRESULT WINAPI
1457 IVideoWindow_fnput_BackgroundPalette(IVideoWindow* iface,long lBackPal)
1458 {
1459         CVideoRendererImpl_THIS(iface,vidwin);
1460
1461         FIXME("(%p)->()\n",This);
1462
1463         return E_NOTIMPL;
1464 }
1465
1466 static HRESULT WINAPI
1467 IVideoWindow_fnget_BackgroundPalette(IVideoWindow* iface,long* plBackPal)
1468 {
1469         CVideoRendererImpl_THIS(iface,vidwin);
1470
1471         FIXME("(%p)->()\n",This);
1472
1473         return E_NOTIMPL;
1474 }
1475
1476 static HRESULT WINAPI
1477 IVideoWindow_fnput_Visible(IVideoWindow* iface,long lVisible)
1478 {
1479         CVideoRendererImpl_THIS(iface,vidwin);
1480
1481         FIXME("(%p)->()\n",This);
1482
1483         return E_NOTIMPL;
1484 }
1485
1486 static HRESULT WINAPI
1487 IVideoWindow_fnget_Visible(IVideoWindow* iface,long* plVisible)
1488 {
1489         CVideoRendererImpl_THIS(iface,vidwin);
1490
1491         FIXME("(%p)->()\n",This);
1492
1493         return E_NOTIMPL;
1494 }
1495
1496 static HRESULT WINAPI
1497 IVideoWindow_fnput_Left(IVideoWindow* iface,long lLeft)
1498 {
1499         CVideoRendererImpl_THIS(iface,vidwin);
1500
1501         FIXME("(%p)->()\n",This);
1502
1503         return E_NOTIMPL;
1504 }
1505
1506 static HRESULT WINAPI
1507 IVideoWindow_fnget_Left(IVideoWindow* iface,long* plLeft)
1508 {
1509         CVideoRendererImpl_THIS(iface,vidwin);
1510
1511         FIXME("(%p)->()\n",This);
1512
1513         return E_NOTIMPL;
1514 }
1515
1516 static HRESULT WINAPI
1517 IVideoWindow_fnput_Width(IVideoWindow* iface,long lWidth)
1518 {
1519         CVideoRendererImpl_THIS(iface,vidwin);
1520
1521         FIXME("(%p)->()\n",This);
1522
1523         return E_NOTIMPL;
1524 }
1525
1526 static HRESULT WINAPI
1527 IVideoWindow_fnget_Width(IVideoWindow* iface,long* plWidth)
1528 {
1529         CVideoRendererImpl_THIS(iface,vidwin);
1530
1531         FIXME("(%p)->()\n",This);
1532
1533         return E_NOTIMPL;
1534 }
1535
1536 static HRESULT WINAPI
1537 IVideoWindow_fnput_Top(IVideoWindow* iface,long lTop)
1538 {
1539         CVideoRendererImpl_THIS(iface,vidwin);
1540
1541         FIXME("(%p)->()\n",This);
1542
1543         return E_NOTIMPL;
1544 }
1545
1546 static HRESULT WINAPI
1547 IVideoWindow_fnget_Top(IVideoWindow* iface,long* plTop)
1548 {
1549         CVideoRendererImpl_THIS(iface,vidwin);
1550
1551         FIXME("(%p)->()\n",This);
1552
1553         return E_NOTIMPL;
1554 }
1555
1556 static HRESULT WINAPI
1557 IVideoWindow_fnput_Height(IVideoWindow* iface,long lHeight)
1558 {
1559         CVideoRendererImpl_THIS(iface,vidwin);
1560
1561         FIXME("(%p)->()\n",This);
1562
1563         return E_NOTIMPL;
1564 }
1565
1566 static HRESULT WINAPI
1567 IVideoWindow_fnget_Height(IVideoWindow* iface,long* plHeight)
1568 {
1569         CVideoRendererImpl_THIS(iface,vidwin);
1570
1571         FIXME("(%p)->()\n",This);
1572
1573         return E_NOTIMPL;
1574 }
1575
1576 static HRESULT WINAPI
1577 IVideoWindow_fnput_Owner(IVideoWindow* iface,OAHWND hwnd)
1578 {
1579         CVideoRendererImpl_THIS(iface,vidwin);
1580
1581         FIXME("(%p)->()\n",This);
1582
1583         return E_NOTIMPL;
1584 }
1585
1586 static HRESULT WINAPI
1587 IVideoWindow_fnget_Owner(IVideoWindow* iface,OAHWND* phwnd)
1588 {
1589         CVideoRendererImpl_THIS(iface,vidwin);
1590
1591         FIXME("(%p)->()\n",This);
1592
1593         return E_NOTIMPL;
1594 }
1595
1596 static HRESULT WINAPI
1597 IVideoWindow_fnput_MessageDrain(IVideoWindow* iface,OAHWND hwnd)
1598 {
1599         CVideoRendererImpl_THIS(iface,vidwin);
1600
1601         FIXME("(%p)->()\n",This);
1602
1603         return E_NOTIMPL;
1604 }
1605
1606 static HRESULT WINAPI
1607 IVideoWindow_fnget_MessageDrain(IVideoWindow* iface,OAHWND* phwnd)
1608 {
1609         CVideoRendererImpl_THIS(iface,vidwin);
1610
1611         FIXME("(%p)->()\n",This);
1612
1613         return E_NOTIMPL;
1614 }
1615
1616 static HRESULT WINAPI
1617 IVideoWindow_fnget_BorderColor(IVideoWindow* iface,long* plColor)
1618 {
1619         CVideoRendererImpl_THIS(iface,vidwin);
1620
1621         FIXME("(%p)->()\n",This);
1622
1623         return E_NOTIMPL;
1624 }
1625
1626 static HRESULT WINAPI
1627 IVideoWindow_fnput_BorderColor(IVideoWindow* iface,long lColor)
1628 {
1629         CVideoRendererImpl_THIS(iface,vidwin);
1630
1631         FIXME("(%p)->()\n",This);
1632
1633         return E_NOTIMPL;
1634 }
1635
1636 static HRESULT WINAPI
1637 IVideoWindow_fnget_FullScreenMode(IVideoWindow* iface,long* plMode)
1638 {
1639         CVideoRendererImpl_THIS(iface,vidwin);
1640
1641         FIXME("(%p)->()\n",This);
1642
1643         return E_NOTIMPL;
1644 }
1645
1646 static HRESULT WINAPI
1647 IVideoWindow_fnput_FullScreenMode(IVideoWindow* iface,long lMode)
1648 {
1649         CVideoRendererImpl_THIS(iface,vidwin);
1650
1651         FIXME("(%p)->()\n",This);
1652
1653         return E_NOTIMPL;
1654 }
1655
1656 static HRESULT WINAPI
1657 IVideoWindow_fnSetWindowForeground(IVideoWindow* iface,long lFocus)
1658 {
1659         CVideoRendererImpl_THIS(iface,vidwin);
1660
1661         FIXME("(%p)->()\n",This);
1662
1663         return E_NOTIMPL;
1664 }
1665
1666 static HRESULT WINAPI
1667 IVideoWindow_fnNotifyOwnerMessage(IVideoWindow* iface,OAHWND hwnd,long message,LONG_PTR wParam,LONG_PTR lParam)
1668 {
1669         CVideoRendererImpl_THIS(iface,vidwin);
1670
1671         FIXME("(%p)->()\n",This);
1672
1673         return E_NOTIMPL;
1674 }
1675
1676 static HRESULT WINAPI
1677 IVideoWindow_fnSetWindowPosition(IVideoWindow* iface,long lLeft,long lTop,long lWidth,long lHeight)
1678 {
1679         CVideoRendererImpl_THIS(iface,vidwin);
1680
1681         FIXME("(%p)->()\n",This);
1682
1683         return E_NOTIMPL;
1684 }
1685
1686 static HRESULT WINAPI
1687 IVideoWindow_fnGetWindowPosition(IVideoWindow* iface,long* plLeft,long* plTop,long* plWidth,long* plHeight)
1688 {
1689         CVideoRendererImpl_THIS(iface,vidwin);
1690
1691         FIXME("(%p)->()\n",This);
1692
1693         return E_NOTIMPL;
1694 }
1695
1696 static HRESULT WINAPI
1697 IVideoWindow_fnGetMinIdealImageSize(IVideoWindow* iface,long* plWidth,long* plHeight)
1698 {
1699         CVideoRendererImpl_THIS(iface,vidwin);
1700
1701         FIXME("(%p)->()\n",This);
1702
1703         return E_NOTIMPL;
1704 }
1705
1706 static HRESULT WINAPI
1707 IVideoWindow_fnGetMaxIdealImageSize(IVideoWindow* iface,long* plWidth,long* plHeight)
1708 {
1709         CVideoRendererImpl_THIS(iface,vidwin);
1710
1711         FIXME("(%p)->()\n",This);
1712
1713         return E_NOTIMPL;
1714 }
1715
1716 static HRESULT WINAPI
1717 IVideoWindow_fnGetRestorePosition(IVideoWindow* iface,long* plLeft,long* plTop,long* plWidth,long* plHeight)
1718 {
1719         CVideoRendererImpl_THIS(iface,vidwin);
1720
1721         FIXME("(%p)->()\n",This);
1722
1723         return E_NOTIMPL;
1724 }
1725
1726 static HRESULT WINAPI
1727 IVideoWindow_fnHideCursor(IVideoWindow* iface,long lHide)
1728 {
1729         CVideoRendererImpl_THIS(iface,vidwin);
1730
1731         FIXME("(%p)->()\n",This);
1732
1733         return E_NOTIMPL;
1734 }
1735
1736 static HRESULT WINAPI
1737 IVideoWindow_fnIsCursorHidden(IVideoWindow* iface,long* plHide)
1738 {
1739         CVideoRendererImpl_THIS(iface,vidwin);
1740
1741         FIXME("(%p)->()\n",This);
1742
1743         return E_NOTIMPL;
1744 }
1745
1746
1747
1748
1749 static ICOM_VTABLE(IVideoWindow) ivideowindow =
1750 {
1751         ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1752         /* IUnknown fields */
1753         IVideoWindow_fnQueryInterface,
1754         IVideoWindow_fnAddRef,
1755         IVideoWindow_fnRelease,
1756         /* IDispatch fields */
1757         IVideoWindow_fnGetTypeInfoCount,
1758         IVideoWindow_fnGetTypeInfo,
1759         IVideoWindow_fnGetIDsOfNames,
1760         IVideoWindow_fnInvoke,
1761         /* IVideoWindow fields */
1762         IVideoWindow_fnput_Caption,
1763         IVideoWindow_fnget_Caption,
1764         IVideoWindow_fnput_WindowStyle,
1765         IVideoWindow_fnget_WindowStyle,
1766         IVideoWindow_fnput_WindowStyleEx,
1767         IVideoWindow_fnget_WindowStyleEx,
1768         IVideoWindow_fnput_AutoShow,
1769         IVideoWindow_fnget_AutoShow,
1770         IVideoWindow_fnput_WindowState,
1771         IVideoWindow_fnget_WindowState,
1772         IVideoWindow_fnput_BackgroundPalette,
1773         IVideoWindow_fnget_BackgroundPalette,
1774         IVideoWindow_fnput_Visible,
1775         IVideoWindow_fnget_Visible,
1776         IVideoWindow_fnput_Left,
1777         IVideoWindow_fnget_Left,
1778         IVideoWindow_fnput_Width,
1779         IVideoWindow_fnget_Width,
1780         IVideoWindow_fnput_Top,
1781         IVideoWindow_fnget_Top,
1782         IVideoWindow_fnput_Height,
1783         IVideoWindow_fnget_Height,
1784         IVideoWindow_fnput_Owner,
1785         IVideoWindow_fnget_Owner,
1786         IVideoWindow_fnput_MessageDrain,
1787         IVideoWindow_fnget_MessageDrain,
1788         IVideoWindow_fnget_BorderColor,
1789         IVideoWindow_fnput_BorderColor,
1790         IVideoWindow_fnget_FullScreenMode,
1791         IVideoWindow_fnput_FullScreenMode,
1792         IVideoWindow_fnSetWindowForeground,
1793         IVideoWindow_fnNotifyOwnerMessage,
1794         IVideoWindow_fnSetWindowPosition,
1795         IVideoWindow_fnGetWindowPosition,
1796         IVideoWindow_fnGetMinIdealImageSize,
1797         IVideoWindow_fnGetMaxIdealImageSize,
1798         IVideoWindow_fnGetRestorePosition,
1799         IVideoWindow_fnHideCursor,
1800         IVideoWindow_fnIsCursorHidden,
1801
1802 };
1803
1804
1805 HRESULT CVideoRendererImpl_InitIVideoWindow( CVideoRendererImpl* This )
1806 {
1807         TRACE("(%p)\n",This);
1808         ICOM_VTBL(&This->vidwin) = &ivideowindow;
1809
1810         return NOERROR;
1811 }
1812
1813 void CVideoRendererImpl_UninitIVideoWindow( CVideoRendererImpl* This )
1814 {
1815         TRACE("(%p)\n",This);
1816 }
1817