Release 0.9.61.
[wine/gsoc-2012-control.git] / dlls / quartz / videorenderer.c
blobdb80b650df68fae92a4ab0a3154d09502c0258ce
1 /*
2 * Video Renderer (Fullscreen and Windowed using Direct Draw)
4 * Copyright 2004 Christian Costa
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.
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.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "config.h"
23 #define NONAMELESSSTRUCT
24 #define NONAMELESSUNION
25 #include "quartz_private.h"
26 #include "control_private.h"
27 #include "pin.h"
29 #include "uuids.h"
30 #include "vfwmsgs.h"
31 #include "amvideo.h"
32 #include "windef.h"
33 #include "winbase.h"
34 #include "dshow.h"
35 #include "evcode.h"
36 #include "strmif.h"
37 #include "ddraw.h"
38 #include "dvdmedia.h"
40 #include "assert.h"
41 #include "wine/unicode.h"
42 #include "wine/debug.h"
44 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
46 static BOOL wnd_class_registered = FALSE;
48 static const WCHAR wcsInputPinName[] = {'i','n','p','u','t',' ','p','i','n',0};
50 static const IBaseFilterVtbl VideoRenderer_Vtbl;
51 static const IUnknownVtbl IInner_VTable;
52 static const IBasicVideoVtbl IBasicVideo_VTable;
53 static const IVideoWindowVtbl IVideoWindow_VTable;
54 static const IPinVtbl VideoRenderer_InputPin_Vtbl;
56 typedef struct VideoRendererImpl
58 const IBaseFilterVtbl * lpVtbl;
59 const IBasicVideoVtbl * IBasicVideo_vtbl;
60 const IVideoWindowVtbl * IVideoWindow_vtbl;
61 const IUnknownVtbl * IInner_vtbl;
63 LONG refCount;
64 CRITICAL_SECTION csFilter;
65 FILTER_STATE state;
66 REFERENCE_TIME rtStreamStart;
67 IReferenceClock * pClock;
68 FILTER_INFO filterInfo;
70 InputPin *pInputPin;
72 BOOL init;
73 HANDLE hThread;
74 DWORD ThreadID;
75 HANDLE hEvent;
76 BOOL ThreadResult;
77 HWND hWnd;
78 HWND hWndMsgDrain;
79 BOOL AutoShow;
80 RECT SourceRect;
81 RECT DestRect;
82 RECT WindowPos;
83 long VideoWidth;
84 long VideoHeight;
85 IUnknown * pUnkOuter;
86 BOOL bUnkOuterValid;
87 BOOL bAggregatable;
88 REFERENCE_TIME rtLastStop;
89 } VideoRendererImpl;
91 static LRESULT CALLBACK VideoWndProcA(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
93 VideoRendererImpl* pVideoRenderer = (VideoRendererImpl*)GetWindowLongA(hwnd, 0);
94 LPRECT lprect = (LPRECT)lParam;
96 if (pVideoRenderer && pVideoRenderer->hWndMsgDrain)
98 switch(uMsg)
100 case WM_KEYDOWN:
101 case WM_KEYUP:
102 case WM_LBUTTONDBLCLK:
103 case WM_LBUTTONDOWN:
104 case WM_LBUTTONUP:
105 case WM_MBUTTONDBLCLK:
106 case WM_MBUTTONDOWN:
107 case WM_MBUTTONUP:
108 case WM_MOUSEACTIVATE:
109 case WM_MOUSEMOVE:
110 case WM_NCLBUTTONDBLCLK:
111 case WM_NCLBUTTONDOWN:
112 case WM_NCLBUTTONUP:
113 case WM_NCMBUTTONDBLCLK:
114 case WM_NCMBUTTONDOWN:
115 case WM_NCMBUTTONUP:
116 case WM_NCMOUSEMOVE:
117 case WM_NCRBUTTONDBLCLK:
118 case WM_NCRBUTTONDOWN:
119 case WM_NCRBUTTONUP:
120 case WM_RBUTTONDBLCLK:
121 case WM_RBUTTONDOWN:
122 case WM_RBUTTONUP:
123 PostMessageA(pVideoRenderer->hWndMsgDrain, uMsg, wParam, lParam);
124 break;
125 default:
126 break;
130 switch(uMsg)
132 case WM_SIZING:
133 /* TRACE("WM_SIZING %d %d %d %d\n", lprect->left, lprect->top, lprect->right, lprect->bottom); */
134 SetWindowPos(hwnd, NULL, lprect->left, lprect->top, lprect->right - lprect->left, lprect->bottom - lprect->top, SWP_NOZORDER);
135 GetClientRect(hwnd, &pVideoRenderer->DestRect);
136 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
137 pVideoRenderer->DestRect.left,
138 pVideoRenderer->DestRect.top,
139 pVideoRenderer->DestRect.right - pVideoRenderer->DestRect.left,
140 pVideoRenderer->DestRect.bottom - pVideoRenderer->DestRect.top);
141 return TRUE;
142 case WM_SIZE:
143 TRACE("WM_SIZE %d %d\n", LOWORD(lParam), HIWORD(lParam));
144 GetClientRect(hwnd, &pVideoRenderer->DestRect);
145 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
146 pVideoRenderer->DestRect.left,
147 pVideoRenderer->DestRect.top,
148 pVideoRenderer->DestRect.right - pVideoRenderer->DestRect.left,
149 pVideoRenderer->DestRect.bottom - pVideoRenderer->DestRect.top);
150 return TRUE;
151 default:
152 return DefWindowProcA(hwnd, uMsg, wParam, lParam);
154 return 0;
157 static BOOL CreateRenderingWindow(VideoRendererImpl* This)
159 WNDCLASSA winclass;
161 TRACE("(%p)->()\n", This);
163 winclass.style = 0;
164 winclass.lpfnWndProc = VideoWndProcA;
165 winclass.cbClsExtra = 0;
166 winclass.cbWndExtra = sizeof(VideoRendererImpl*);
167 winclass.hInstance = NULL;
168 winclass.hIcon = NULL;
169 winclass.hCursor = NULL;
170 winclass.hbrBackground = GetStockObject(BLACK_BRUSH);
171 winclass.lpszMenuName = NULL;
172 winclass.lpszClassName = "Wine ActiveMovie Class";
174 if (!wnd_class_registered)
176 if (!RegisterClassA(&winclass))
178 ERR("Unable to register window %u\n", GetLastError());
179 return FALSE;
181 wnd_class_registered = TRUE;
184 This->hWnd = CreateWindowExA(0, "Wine ActiveMovie Class", "Wine ActiveMovie Window", WS_SIZEBOX,
185 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL,
186 NULL, NULL, NULL);
188 if (!This->hWnd)
190 ERR("Unable to create window\n");
191 return FALSE;
194 SetWindowLongA(This->hWnd, 0, (LONG)This);
196 return TRUE;
199 static DWORD WINAPI MessageLoop(LPVOID lpParameter)
201 VideoRendererImpl* This = (VideoRendererImpl*) lpParameter;
202 MSG msg;
203 BOOL fGotMessage;
205 TRACE("Starting message loop\n");
207 if (!CreateRenderingWindow(This))
209 This->ThreadResult = FALSE;
210 SetEvent(This->hEvent);
211 return 0;
214 This->ThreadResult = TRUE;
215 SetEvent(This->hEvent);
217 while ((fGotMessage = GetMessageA(&msg, NULL, 0, 0)) != 0 && fGotMessage != -1)
219 TranslateMessage(&msg);
220 DispatchMessageA(&msg);
223 TRACE("End of message loop\n");
225 return msg.wParam;
228 static BOOL CreateRenderingSubsystem(VideoRendererImpl* This)
230 This->hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
231 if (!This->hEvent)
232 return FALSE;
234 This->hThread = CreateThread(NULL, 0, MessageLoop, (LPVOID)This, 0, &This->ThreadID);
235 if (!This->hThread)
237 CloseHandle(This->hEvent);
238 return FALSE;
241 WaitForSingleObject(This->hEvent, INFINITE);
242 CloseHandle(This->hEvent);
244 if (!This->ThreadResult)
246 CloseHandle(This->hThread);
247 return FALSE;
250 return TRUE;
253 static const IMemInputPinVtbl MemInputPin_Vtbl =
255 MemInputPin_QueryInterface,
256 MemInputPin_AddRef,
257 MemInputPin_Release,
258 MemInputPin_GetAllocator,
259 MemInputPin_NotifyAllocator,
260 MemInputPin_GetAllocatorRequirements,
261 MemInputPin_Receive,
262 MemInputPin_ReceiveMultiple,
263 MemInputPin_ReceiveCanBlock
266 static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data, DWORD size)
268 AM_MEDIA_TYPE amt;
269 HRESULT hr = S_OK;
270 DDSURFACEDESC sdesc;
271 int width;
272 int height;
273 LPBYTE palette = NULL;
274 HDC hDC;
275 BITMAPINFOHEADER *bmiHeader;
277 TRACE("%p %p %d\n", This, data, size);
279 sdesc.dwSize = sizeof(sdesc);
280 hr = IPin_ConnectionMediaType((IPin *)This->pInputPin, &amt);
281 if (FAILED(hr)) {
282 ERR("Unable to retrieve media type\n");
283 return hr;
286 if (IsEqualIID(&amt.formattype, &FORMAT_VideoInfo))
288 bmiHeader = &((VIDEOINFOHEADER *)amt.pbFormat)->bmiHeader;
290 else if (IsEqualIID(&amt.formattype, &FORMAT_VideoInfo2))
292 bmiHeader = &((VIDEOINFOHEADER2 *)amt.pbFormat)->bmiHeader;
294 else
296 FIXME("Unknown type %s\n", debugstr_guid(&amt.subtype));
297 return VFW_E_RUNTIME_ERROR;
301 TRACE("biSize = %d\n", bmiHeader->biSize);
302 TRACE("biWidth = %d\n", bmiHeader->biWidth);
303 TRACE("biHeight = %d\n", bmiHeader->biHeight);
304 TRACE("biPlanes = %d\n", bmiHeader->biPlanes);
305 TRACE("biBitCount = %d\n", bmiHeader->biBitCount);
306 TRACE("biCompression = %s\n", debugstr_an((LPSTR)&(bmiHeader->biCompression), 4));
307 TRACE("biSizeImage = %d\n", bmiHeader->biSizeImage);
309 width = bmiHeader->biWidth;
310 height = bmiHeader->biHeight;
311 palette = ((LPBYTE)bmiHeader) + bmiHeader->biSize;
313 if (!This->init)
315 if (!This->WindowPos.right || !This->WindowPos.bottom)
316 This->WindowPos = This->SourceRect;
318 TRACE("WindowPos: %d %d %d %d\n", This->WindowPos.left, This->WindowPos.top, This->WindowPos.right, This->WindowPos.bottom);
319 SetWindowPos(This->hWnd, NULL,
320 This->WindowPos.left,
321 This->WindowPos.top,
322 This->WindowPos.right - This->WindowPos.left,
323 This->WindowPos.bottom - This->WindowPos.top,
324 SWP_NOZORDER|SWP_NOMOVE);
326 GetClientRect(This->hWnd, &This->DestRect);
327 This->init = TRUE;
330 hDC = GetDC(This->hWnd);
332 if (!hDC) {
333 ERR("Cannot get DC from window!\n");
334 return E_FAIL;
337 TRACE("Src Rect: %d %d %d %d\n", This->SourceRect.left, This->SourceRect.top, This->SourceRect.right, This->SourceRect.bottom);
338 TRACE("Dst Rect: %d %d %d %d\n", This->DestRect.left, This->DestRect.top, This->DestRect.right, This->DestRect.bottom);
340 StretchDIBits(hDC, This->DestRect.left, This->DestRect.top, This->DestRect.right -This->DestRect.left,
341 This->DestRect.bottom - This->DestRect.top, This->SourceRect.left, This->SourceRect.top,
342 This->SourceRect.right - This->SourceRect.left, This->SourceRect.bottom - This->SourceRect.top,
343 data, (BITMAPINFO *)bmiHeader, DIB_RGB_COLORS, SRCCOPY);
345 ReleaseDC(This->hWnd, hDC);
346 if (This->AutoShow)
347 ShowWindow(This->hWnd, SW_SHOW);
349 return S_OK;
352 static HRESULT VideoRenderer_Sample(LPVOID iface, IMediaSample * pSample)
354 VideoRendererImpl *This = (VideoRendererImpl *)iface;
355 LPBYTE pbSrcStream = NULL;
356 long cbSrcStream = 0;
357 REFERENCE_TIME tStart, tStop;
358 HRESULT hr;
360 if (This->state == State_Stopped)
361 return S_FALSE;
363 TRACE("%p %p\n", iface, pSample);
365 hr = IMediaSample_GetTime(pSample, &tStart, &tStop);
366 if (FAILED(hr))
367 ERR("Cannot get sample time (%x)\n", hr);
369 if (This->rtLastStop != tStart)
371 if (IMediaSample_IsDiscontinuity(pSample) == S_FALSE)
372 ERR("Unexpected discontinuity: Last: %u.%03u, tStart: %u.%03u\n",
373 (DWORD)(This->rtLastStop / 10000000),
374 (DWORD)((This->rtLastStop / 10000)%1000),
375 (DWORD)(tStart / 10000000), (DWORD)((tStart / 10000)%1000));
376 This->rtLastStop = tStart;
379 /* Preroll means the sample isn't shown, this is used for key frames and things like that */
380 if (IMediaSample_IsPreroll(pSample) == S_OK)
382 This->rtLastStop = tStop;
383 return S_OK;
386 hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
387 if (FAILED(hr))
389 ERR("Cannot get pointer to sample data (%x)\n", hr);
390 return hr;
393 cbSrcStream = IMediaSample_GetActualDataLength(pSample);
395 TRACE("val %p %ld\n", pbSrcStream, cbSrcStream);
397 #if 0 /* For debugging purpose */
399 int i;
400 for(i = 0; i < cbSrcStream; i++)
402 if ((i!=0) && !(i%16))
403 TRACE("\n");
404 TRACE("%02x ", pbSrcStream[i]);
406 TRACE("\n");
408 #endif
410 if (This->pClock && This->state == State_Running)
412 REFERENCE_TIME time, trefstart, trefstop;
413 LONG delta;
415 /* Perhaps I <SHOULD> use the reference clock AdviseTime function here
416 * I'm not going to! When I tried, it seemed to generate lag and
417 * it caused instability.
419 IReferenceClock_GetTime(This->pClock, &time);
421 trefstart = This->rtStreamStart;
422 trefstop = (REFERENCE_TIME)((double)(tStop - tStart) / This->pInputPin->dRate) + This->rtStreamStart;
423 delta = (LONG)((trefstart-time)/10000);
424 This->rtStreamStart = trefstop;
425 This->rtLastStop = tStop;
427 if (delta > 0)
429 TRACE("Sleeping for %u ms\n", delta);
430 Sleep(delta);
432 else if (time > trefstop)
434 TRACE("Dropping sample: Time: %lld ms trefstop: %lld ms!\n", time/10000, trefstop/10000);
435 This->rtLastStop = tStop;
436 return S_OK;
439 This->rtLastStop = tStop;
441 VideoRenderer_SendSampleData(This, pbSrcStream, cbSrcStream);
443 return S_OK;
446 static HRESULT VideoRenderer_QueryAccept(LPVOID iface, const AM_MEDIA_TYPE * pmt)
448 if (!IsEqualIID(&pmt->majortype, &MEDIATYPE_Video))
449 return S_FALSE;
451 if (IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB32) ||
452 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB24) ||
453 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB565) ||
454 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB8))
456 VideoRendererImpl* This = (VideoRendererImpl*) iface;
458 if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo))
460 VIDEOINFOHEADER *format = (VIDEOINFOHEADER *)pmt->pbFormat;
461 This->SourceRect.left = 0;
462 This->SourceRect.top = 0;
463 This->SourceRect.right = This->VideoWidth = format->bmiHeader.biWidth;
464 This->SourceRect.bottom = This->VideoHeight = format->bmiHeader.biHeight;
466 else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2))
468 VIDEOINFOHEADER2 *format2 = (VIDEOINFOHEADER2 *)pmt->pbFormat;
470 This->SourceRect.left = 0;
471 This->SourceRect.top = 0;
472 This->SourceRect.right = This->VideoWidth = format2->bmiHeader.biWidth;
473 This->SourceRect.bottom = This->VideoHeight = format2->bmiHeader.biHeight;
475 else
477 WARN("Format type %s not supported\n", debugstr_guid(&pmt->formattype));
478 return S_FALSE;
480 return S_OK;
482 return S_FALSE;
485 HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
487 HRESULT hr;
488 PIN_INFO piInput;
489 VideoRendererImpl * pVideoRenderer;
491 TRACE("(%p, %p)\n", pUnkOuter, ppv);
493 *ppv = NULL;
495 pVideoRenderer = CoTaskMemAlloc(sizeof(VideoRendererImpl));
496 pVideoRenderer->pUnkOuter = pUnkOuter;
497 pVideoRenderer->bUnkOuterValid = FALSE;
498 pVideoRenderer->bAggregatable = FALSE;
499 pVideoRenderer->IInner_vtbl = &IInner_VTable;
501 pVideoRenderer->lpVtbl = &VideoRenderer_Vtbl;
502 pVideoRenderer->IBasicVideo_vtbl = &IBasicVideo_VTable;
503 pVideoRenderer->IVideoWindow_vtbl = &IVideoWindow_VTable;
505 pVideoRenderer->refCount = 1;
506 InitializeCriticalSection(&pVideoRenderer->csFilter);
507 pVideoRenderer->csFilter.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": VideoRendererImpl.csFilter");
508 pVideoRenderer->state = State_Stopped;
509 pVideoRenderer->pClock = NULL;
510 pVideoRenderer->init = 0;
511 pVideoRenderer->AutoShow = 1;
512 pVideoRenderer->rtLastStop = -1;
513 ZeroMemory(&pVideoRenderer->filterInfo, sizeof(FILTER_INFO));
515 /* construct input pin */
516 piInput.dir = PINDIR_INPUT;
517 piInput.pFilter = (IBaseFilter *)pVideoRenderer;
518 lstrcpynW(piInput.achName, wcsInputPinName, sizeof(piInput.achName) / sizeof(piInput.achName[0]));
520 hr = InputPin_Construct(&VideoRenderer_InputPin_Vtbl, &piInput, VideoRenderer_Sample, (LPVOID)pVideoRenderer, VideoRenderer_QueryAccept, NULL, &pVideoRenderer->csFilter, (IPin **)&pVideoRenderer->pInputPin);
522 if (SUCCEEDED(hr))
524 *ppv = (LPVOID)pVideoRenderer;
526 else
528 pVideoRenderer->csFilter.DebugInfo->Spare[0] = 0;
529 DeleteCriticalSection(&pVideoRenderer->csFilter);
530 CoTaskMemFree(pVideoRenderer);
533 if (!CreateRenderingSubsystem(pVideoRenderer))
534 return E_FAIL;
536 return hr;
539 HRESULT VideoRendererDefault_create(IUnknown * pUnkOuter, LPVOID * ppv)
541 /* TODO: Attempt to use the VMR-7 renderer instead when possible */
542 return VideoRenderer_create(pUnkOuter, ppv);
545 static HRESULT WINAPI VideoRendererInner_QueryInterface(IUnknown * iface, REFIID riid, LPVOID * ppv)
547 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
548 TRACE("(%p/%p)->(%s, %p)\n", This, iface, qzdebugstr_guid(riid), ppv);
550 if (This->bAggregatable)
551 This->bUnkOuterValid = TRUE;
553 *ppv = NULL;
555 if (IsEqualIID(riid, &IID_IUnknown))
556 *ppv = (LPVOID)&(This->IInner_vtbl);
557 else if (IsEqualIID(riid, &IID_IPersist))
558 *ppv = (LPVOID)This;
559 else if (IsEqualIID(riid, &IID_IMediaFilter))
560 *ppv = (LPVOID)This;
561 else if (IsEqualIID(riid, &IID_IBaseFilter))
562 *ppv = (LPVOID)This;
563 else if (IsEqualIID(riid, &IID_IBasicVideo))
564 *ppv = (LPVOID)&(This->IBasicVideo_vtbl);
565 else if (IsEqualIID(riid, &IID_IVideoWindow))
566 *ppv = (LPVOID)&(This->IVideoWindow_vtbl);
568 if (*ppv)
570 IUnknown_AddRef((IUnknown *)(*ppv));
571 return S_OK;
574 if (!IsEqualIID(riid, &IID_IPin))
575 FIXME("No interface for %s!\n", qzdebugstr_guid(riid));
577 return E_NOINTERFACE;
580 static ULONG WINAPI VideoRendererInner_AddRef(IUnknown * iface)
582 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
583 ULONG refCount = InterlockedIncrement(&This->refCount);
585 TRACE("(%p/%p)->() AddRef from %d\n", This, iface, refCount - 1);
587 return refCount;
590 static ULONG WINAPI VideoRendererInner_Release(IUnknown * iface)
592 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
593 ULONG refCount = InterlockedDecrement(&This->refCount);
595 TRACE("(%p/%p)->() Release from %d\n", This, iface, refCount + 1);
597 if (!refCount)
599 IPin *pConnectedTo;
601 DestroyWindow(This->hWnd);
602 PostThreadMessageA(This->ThreadID, WM_QUIT, 0, 0);
603 WaitForSingleObject(This->hThread, INFINITE);
604 CloseHandle(This->hThread);
606 if (This->pClock)
607 IReferenceClock_Release(This->pClock);
609 if (SUCCEEDED(IPin_ConnectedTo((IPin *)This->pInputPin, &pConnectedTo)))
611 IPin_Disconnect(pConnectedTo);
612 IPin_Release(pConnectedTo);
614 IPin_Disconnect((IPin *)This->pInputPin);
616 IPin_Release((IPin *)This->pInputPin);
618 This->lpVtbl = NULL;
620 This->csFilter.DebugInfo->Spare[0] = 0;
621 DeleteCriticalSection(&This->csFilter);
623 TRACE("Destroying Video Renderer\n");
624 CoTaskMemFree(This);
626 return 0;
628 else
629 return refCount;
632 static const IUnknownVtbl IInner_VTable =
634 VideoRendererInner_QueryInterface,
635 VideoRendererInner_AddRef,
636 VideoRendererInner_Release
639 static HRESULT WINAPI VideoRenderer_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv)
641 VideoRendererImpl *This = (VideoRendererImpl *)iface;
643 if (This->bAggregatable)
644 This->bUnkOuterValid = TRUE;
646 if (This->pUnkOuter)
648 if (This->bAggregatable)
649 return IUnknown_QueryInterface(This->pUnkOuter, riid, ppv);
651 if (IsEqualIID(riid, &IID_IUnknown))
653 HRESULT hr;
655 IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
656 hr = IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
657 IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
658 This->bAggregatable = TRUE;
659 return hr;
662 *ppv = NULL;
663 return E_NOINTERFACE;
666 return IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
669 static ULONG WINAPI VideoRenderer_AddRef(IBaseFilter * iface)
671 VideoRendererImpl *This = (VideoRendererImpl *)iface;
673 if (This->pUnkOuter && This->bUnkOuterValid)
674 return IUnknown_AddRef(This->pUnkOuter);
675 return IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
678 static ULONG WINAPI VideoRenderer_Release(IBaseFilter * iface)
680 VideoRendererImpl *This = (VideoRendererImpl *)iface;
682 if (This->pUnkOuter && This->bUnkOuterValid)
683 return IUnknown_Release(This->pUnkOuter);
684 return IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
687 /** IPersist methods **/
689 static HRESULT WINAPI VideoRenderer_GetClassID(IBaseFilter * iface, CLSID * pClsid)
691 VideoRendererImpl *This = (VideoRendererImpl *)iface;
693 TRACE("(%p/%p)->(%p)\n", This, iface, pClsid);
695 *pClsid = CLSID_VideoRenderer;
697 return S_OK;
700 /** IMediaFilter methods **/
702 static HRESULT WINAPI VideoRenderer_Stop(IBaseFilter * iface)
704 VideoRendererImpl *This = (VideoRendererImpl *)iface;
706 TRACE("(%p/%p)->()\n", This, iface);
708 EnterCriticalSection(&This->csFilter);
710 This->state = State_Stopped;
712 LeaveCriticalSection(&This->csFilter);
714 return S_OK;
717 static HRESULT WINAPI VideoRenderer_Pause(IBaseFilter * iface)
719 VideoRendererImpl *This = (VideoRendererImpl *)iface;
721 TRACE("(%p/%p)->()\n", This, iface);
723 EnterCriticalSection(&This->csFilter);
725 if (This->state == State_Stopped)
726 This->pInputPin->end_of_stream = 0;
728 This->state = State_Paused;
730 LeaveCriticalSection(&This->csFilter);
732 return S_OK;
735 static HRESULT WINAPI VideoRenderer_Run(IBaseFilter * iface, REFERENCE_TIME tStart)
737 VideoRendererImpl *This = (VideoRendererImpl *)iface;
739 TRACE("(%p/%p)->(%s)\n", This, iface, wine_dbgstr_longlong(tStart));
741 EnterCriticalSection(&This->csFilter);
742 if (This->state != State_Running)
744 if (This->state == State_Stopped)
745 This->pInputPin->end_of_stream = 0;
747 This->rtStreamStart = tStart;
748 This->state = State_Running;
750 LeaveCriticalSection(&This->csFilter);
752 return S_OK;
755 static HRESULT WINAPI VideoRenderer_GetState(IBaseFilter * iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState)
757 VideoRendererImpl *This = (VideoRendererImpl *)iface;
759 TRACE("(%p/%p)->(%d, %p)\n", This, iface, dwMilliSecsTimeout, pState);
761 EnterCriticalSection(&This->csFilter);
763 *pState = This->state;
765 LeaveCriticalSection(&This->csFilter);
767 return S_OK;
770 static HRESULT WINAPI VideoRenderer_SetSyncSource(IBaseFilter * iface, IReferenceClock *pClock)
772 VideoRendererImpl *This = (VideoRendererImpl *)iface;
774 TRACE("(%p/%p)->(%p)\n", This, iface, pClock);
776 EnterCriticalSection(&This->csFilter);
778 if (This->pClock)
779 IReferenceClock_Release(This->pClock);
780 This->pClock = pClock;
781 if (This->pClock)
782 IReferenceClock_AddRef(This->pClock);
784 LeaveCriticalSection(&This->csFilter);
786 return S_OK;
789 static HRESULT WINAPI VideoRenderer_GetSyncSource(IBaseFilter * iface, IReferenceClock **ppClock)
791 VideoRendererImpl *This = (VideoRendererImpl *)iface;
793 TRACE("(%p/%p)->(%p)\n", This, iface, ppClock);
795 EnterCriticalSection(&This->csFilter);
797 *ppClock = This->pClock;
798 if (This->pClock)
799 IReferenceClock_AddRef(This->pClock);
801 LeaveCriticalSection(&This->csFilter);
803 return S_OK;
806 /** IBaseFilter implementation **/
808 static HRESULT VideoRenderer_GetPin(IBaseFilter *iface, ULONG pos, IPin **pin, DWORD *lastsynctick)
810 VideoRendererImpl *This = (VideoRendererImpl *)iface;
812 /* Our pins are static, not changing so setting static tick count is ok */
813 *lastsynctick = 0;
815 if (pos >= 1)
816 return S_FALSE;
818 *pin = (IPin *)This->pInputPin;
819 IPin_AddRef(*pin);
820 return S_OK;
823 static HRESULT WINAPI VideoRenderer_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum)
825 VideoRendererImpl *This = (VideoRendererImpl *)iface;
827 TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
829 return IEnumPinsImpl_Construct(ppEnum, VideoRenderer_GetPin, iface);
832 static HRESULT WINAPI VideoRenderer_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)
834 VideoRendererImpl *This = (VideoRendererImpl *)iface;
836 TRACE("(%p/%p)->(%p,%p)\n", This, iface, debugstr_w(Id), ppPin);
838 FIXME("VideoRenderer::FindPin(...)\n");
840 /* FIXME: critical section */
842 return E_NOTIMPL;
845 static HRESULT WINAPI VideoRenderer_QueryFilterInfo(IBaseFilter * iface, FILTER_INFO *pInfo)
847 VideoRendererImpl *This = (VideoRendererImpl *)iface;
849 TRACE("(%p/%p)->(%p)\n", This, iface, pInfo);
851 strcpyW(pInfo->achName, This->filterInfo.achName);
852 pInfo->pGraph = This->filterInfo.pGraph;
854 if (pInfo->pGraph)
855 IFilterGraph_AddRef(pInfo->pGraph);
857 return S_OK;
860 static HRESULT WINAPI VideoRenderer_JoinFilterGraph(IBaseFilter * iface, IFilterGraph *pGraph, LPCWSTR pName)
862 VideoRendererImpl *This = (VideoRendererImpl *)iface;
864 TRACE("(%p/%p)->(%p, %s)\n", This, iface, pGraph, debugstr_w(pName));
866 EnterCriticalSection(&This->csFilter);
868 if (pName)
869 strcpyW(This->filterInfo.achName, pName);
870 else
871 *This->filterInfo.achName = '\0';
872 This->filterInfo.pGraph = pGraph; /* NOTE: do NOT increase ref. count */
874 LeaveCriticalSection(&This->csFilter);
876 return S_OK;
879 static HRESULT WINAPI VideoRenderer_QueryVendorInfo(IBaseFilter * iface, LPWSTR *pVendorInfo)
881 VideoRendererImpl *This = (VideoRendererImpl *)iface;
882 TRACE("(%p/%p)->(%p)\n", This, iface, pVendorInfo);
883 return E_NOTIMPL;
886 static const IBaseFilterVtbl VideoRenderer_Vtbl =
888 VideoRenderer_QueryInterface,
889 VideoRenderer_AddRef,
890 VideoRenderer_Release,
891 VideoRenderer_GetClassID,
892 VideoRenderer_Stop,
893 VideoRenderer_Pause,
894 VideoRenderer_Run,
895 VideoRenderer_GetState,
896 VideoRenderer_SetSyncSource,
897 VideoRenderer_GetSyncSource,
898 VideoRenderer_EnumPins,
899 VideoRenderer_FindPin,
900 VideoRenderer_QueryFilterInfo,
901 VideoRenderer_JoinFilterGraph,
902 VideoRenderer_QueryVendorInfo
905 static HRESULT WINAPI VideoRenderer_InputPin_EndOfStream(IPin * iface)
907 InputPin* This = (InputPin*)iface;
908 IMediaEventSink* pEventSink;
909 HRESULT hr;
911 TRACE("(%p/%p)->()\n", This, iface);
913 hr = IFilterGraph_QueryInterface(((VideoRendererImpl*)This->pin.pinInfo.pFilter)->filterInfo.pGraph, &IID_IMediaEventSink, (LPVOID*)&pEventSink);
914 if (SUCCEEDED(hr))
916 hr = IMediaEventSink_Notify(pEventSink, EC_COMPLETE, S_OK, 0);
917 IMediaEventSink_Release(pEventSink);
920 return hr;
923 static const IPinVtbl VideoRenderer_InputPin_Vtbl =
925 InputPin_QueryInterface,
926 IPinImpl_AddRef,
927 InputPin_Release,
928 InputPin_Connect,
929 InputPin_ReceiveConnection,
930 IPinImpl_Disconnect,
931 IPinImpl_ConnectedTo,
932 IPinImpl_ConnectionMediaType,
933 IPinImpl_QueryPinInfo,
934 IPinImpl_QueryDirection,
935 IPinImpl_QueryId,
936 IPinImpl_QueryAccept,
937 IPinImpl_EnumMediaTypes,
938 IPinImpl_QueryInternalConnections,
939 VideoRenderer_InputPin_EndOfStream,
940 InputPin_BeginFlush,
941 InputPin_EndFlush,
942 InputPin_NewSegment
945 /*** IUnknown methods ***/
946 static HRESULT WINAPI Basicvideo_QueryInterface(IBasicVideo *iface,
947 REFIID riid,
948 LPVOID*ppvObj) {
949 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
951 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
953 return VideoRenderer_QueryInterface((IBaseFilter*)This, riid, ppvObj);
956 static ULONG WINAPI Basicvideo_AddRef(IBasicVideo *iface) {
957 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
959 TRACE("(%p/%p)->()\n", This, iface);
961 return VideoRenderer_AddRef((IBaseFilter*)This);
964 static ULONG WINAPI Basicvideo_Release(IBasicVideo *iface) {
965 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
967 TRACE("(%p/%p)->()\n", This, iface);
969 return VideoRenderer_Release((IBaseFilter*)This);
972 /*** IDispatch methods ***/
973 static HRESULT WINAPI Basicvideo_GetTypeInfoCount(IBasicVideo *iface,
974 UINT*pctinfo) {
975 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
977 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
979 return S_OK;
982 static HRESULT WINAPI Basicvideo_GetTypeInfo(IBasicVideo *iface,
983 UINT iTInfo,
984 LCID lcid,
985 ITypeInfo**ppTInfo) {
986 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
988 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
990 return S_OK;
993 static HRESULT WINAPI Basicvideo_GetIDsOfNames(IBasicVideo *iface,
994 REFIID riid,
995 LPOLESTR*rgszNames,
996 UINT cNames,
997 LCID lcid,
998 DISPID*rgDispId) {
999 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1001 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1003 return S_OK;
1006 static HRESULT WINAPI Basicvideo_Invoke(IBasicVideo *iface,
1007 DISPID dispIdMember,
1008 REFIID riid,
1009 LCID lcid,
1010 WORD wFlags,
1011 DISPPARAMS*pDispParams,
1012 VARIANT*pVarResult,
1013 EXCEPINFO*pExepInfo,
1014 UINT*puArgErr) {
1015 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1017 FIXME("(%p/%p)->(%d, %s (%p), %d, %04x, %p, %p, %p, %p): stub !!!\n", This, iface, dispIdMember, debugstr_guid(riid), riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
1019 return S_OK;
1022 /*** IBasicVideo methods ***/
1023 static HRESULT WINAPI Basicvideo_get_AvgTimePerFrame(IBasicVideo *iface,
1024 REFTIME *pAvgTimePerFrame) {
1025 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1027 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pAvgTimePerFrame);
1029 return S_OK;
1032 static HRESULT WINAPI Basicvideo_get_BitRate(IBasicVideo *iface,
1033 long *pBitRate) {
1034 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1036 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBitRate);
1038 return S_OK;
1041 static HRESULT WINAPI Basicvideo_get_BitErrorRate(IBasicVideo *iface,
1042 long *pBitErrorRate) {
1043 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1045 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBitErrorRate);
1047 return S_OK;
1050 static HRESULT WINAPI Basicvideo_get_VideoWidth(IBasicVideo *iface,
1051 long *pVideoWidth) {
1052 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1054 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoWidth);
1056 *pVideoWidth = This->VideoWidth;
1058 return S_OK;
1061 static HRESULT WINAPI Basicvideo_get_VideoHeight(IBasicVideo *iface,
1062 long *pVideoHeight) {
1063 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1065 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoHeight);
1067 *pVideoHeight = This->VideoHeight;
1069 return S_OK;
1072 static HRESULT WINAPI Basicvideo_put_SourceLeft(IBasicVideo *iface,
1073 long SourceLeft) {
1074 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1076 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceLeft);
1078 This->SourceRect.left = SourceLeft;
1080 return S_OK;
1083 static HRESULT WINAPI Basicvideo_get_SourceLeft(IBasicVideo *iface,
1084 long *pSourceLeft) {
1085 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1087 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceLeft);
1089 *pSourceLeft = This->SourceRect.left;
1091 return S_OK;
1094 static HRESULT WINAPI Basicvideo_put_SourceWidth(IBasicVideo *iface,
1095 long SourceWidth) {
1096 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1098 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceWidth);
1100 This->SourceRect.right = This->SourceRect.left + SourceWidth;
1102 return S_OK;
1105 static HRESULT WINAPI Basicvideo_get_SourceWidth(IBasicVideo *iface,
1106 long *pSourceWidth) {
1107 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1109 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceWidth);
1111 *pSourceWidth = This->SourceRect.right - This->SourceRect.left;
1113 return S_OK;
1116 static HRESULT WINAPI Basicvideo_put_SourceTop(IBasicVideo *iface,
1117 long SourceTop) {
1118 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1120 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceTop);
1122 This->SourceRect.top = SourceTop;
1124 return S_OK;
1127 static HRESULT WINAPI Basicvideo_get_SourceTop(IBasicVideo *iface,
1128 long *pSourceTop) {
1129 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1131 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceTop);
1133 *pSourceTop = This->SourceRect.top;
1135 return S_OK;
1138 static HRESULT WINAPI Basicvideo_put_SourceHeight(IBasicVideo *iface,
1139 long SourceHeight) {
1140 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1142 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceHeight);
1144 This->SourceRect.bottom = This->SourceRect.top + SourceHeight;
1146 return S_OK;
1149 static HRESULT WINAPI Basicvideo_get_SourceHeight(IBasicVideo *iface,
1150 long *pSourceHeight) {
1151 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1153 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceHeight);
1155 *pSourceHeight = This->SourceRect.bottom - This->SourceRect.top;
1157 return S_OK;
1160 static HRESULT WINAPI Basicvideo_put_DestinationLeft(IBasicVideo *iface,
1161 long DestinationLeft) {
1162 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1164 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationLeft);
1166 This->DestRect.left = DestinationLeft;
1168 return S_OK;
1171 static HRESULT WINAPI Basicvideo_get_DestinationLeft(IBasicVideo *iface,
1172 long *pDestinationLeft) {
1173 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1175 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationLeft);
1177 *pDestinationLeft = This->DestRect.left;
1179 return S_OK;
1182 static HRESULT WINAPI Basicvideo_put_DestinationWidth(IBasicVideo *iface,
1183 long DestinationWidth) {
1184 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1186 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationWidth);
1188 This->DestRect.right = This->DestRect.left + DestinationWidth;
1190 return S_OK;
1193 static HRESULT WINAPI Basicvideo_get_DestinationWidth(IBasicVideo *iface,
1194 long *pDestinationWidth) {
1195 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1197 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationWidth);
1199 *pDestinationWidth = This->DestRect.right - This->DestRect.left;
1201 return S_OK;
1204 static HRESULT WINAPI Basicvideo_put_DestinationTop(IBasicVideo *iface,
1205 long DestinationTop) {
1206 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1208 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationTop);
1210 This->DestRect.top = DestinationTop;
1212 return S_OK;
1215 static HRESULT WINAPI Basicvideo_get_DestinationTop(IBasicVideo *iface,
1216 long *pDestinationTop) {
1217 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1219 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationTop);
1221 *pDestinationTop = This->DestRect.top;
1223 return S_OK;
1226 static HRESULT WINAPI Basicvideo_put_DestinationHeight(IBasicVideo *iface,
1227 long DestinationHeight) {
1228 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1230 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationHeight);
1232 This->DestRect.right = This->DestRect.left + DestinationHeight;
1234 return S_OK;
1237 static HRESULT WINAPI Basicvideo_get_DestinationHeight(IBasicVideo *iface,
1238 long *pDestinationHeight) {
1239 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1241 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationHeight);
1243 *pDestinationHeight = This->DestRect.right - This->DestRect.left;
1245 return S_OK;
1248 static HRESULT WINAPI Basicvideo_SetSourcePosition(IBasicVideo *iface,
1249 long Left,
1250 long Top,
1251 long Width,
1252 long Height) {
1253 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1255 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
1257 This->SourceRect.left = Left;
1258 This->SourceRect.top = Top;
1259 This->SourceRect.right = Left + Width;
1260 This->SourceRect.bottom = Top + Height;
1262 return S_OK;
1265 static HRESULT WINAPI Basicvideo_GetSourcePosition(IBasicVideo *iface,
1266 long *pLeft,
1267 long *pTop,
1268 long *pWidth,
1269 long *pHeight) {
1270 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1272 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1274 *pLeft = This->SourceRect.left;
1275 *pTop = This->SourceRect.top;
1276 *pWidth = This->SourceRect.right - This->SourceRect.left;
1277 *pHeight = This->SourceRect.bottom - This->SourceRect.top;
1279 return S_OK;
1282 static HRESULT WINAPI Basicvideo_SetDefaultSourcePosition(IBasicVideo *iface) {
1283 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1285 TRACE("(%p/%p)->()\n", This, iface);
1287 This->SourceRect.left = 0;
1288 This->SourceRect.top = 0;
1289 This->SourceRect.right = This->VideoWidth;
1290 This->SourceRect.bottom = This->VideoHeight;
1292 return S_OK;
1295 static HRESULT WINAPI Basicvideo_SetDestinationPosition(IBasicVideo *iface,
1296 long Left,
1297 long Top,
1298 long Width,
1299 long Height) {
1300 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1302 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
1304 This->DestRect.left = Left;
1305 This->DestRect.top = Top;
1306 This->DestRect.right = Left + Width;
1307 This->DestRect.bottom = Top + Height;
1309 return S_OK;
1312 static HRESULT WINAPI Basicvideo_GetDestinationPosition(IBasicVideo *iface,
1313 long *pLeft,
1314 long *pTop,
1315 long *pWidth,
1316 long *pHeight) {
1317 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1319 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1321 *pLeft = This->DestRect.left;
1322 *pTop = This->DestRect.top;
1323 *pWidth = This->DestRect.right - This->DestRect.left;
1324 *pHeight = This->DestRect.bottom - This->DestRect.top;
1326 return S_OK;
1329 static HRESULT WINAPI Basicvideo_SetDefaultDestinationPosition(IBasicVideo *iface) {
1330 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1331 RECT rect;
1333 TRACE("(%p/%p)->()\n", This, iface);
1335 if (!GetClientRect(This->hWnd, &rect))
1336 return E_FAIL;
1338 This->SourceRect.left = 0;
1339 This->SourceRect.top = 0;
1340 This->SourceRect.right = rect.right;
1341 This->SourceRect.bottom = rect.bottom;
1343 return S_OK;
1346 static HRESULT WINAPI Basicvideo_GetVideoSize(IBasicVideo *iface,
1347 long *pWidth,
1348 long *pHeight) {
1349 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1351 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
1353 *pWidth = This->VideoWidth;
1354 *pHeight = This->VideoHeight;
1356 return S_OK;
1359 static HRESULT WINAPI Basicvideo_GetVideoPaletteEntries(IBasicVideo *iface,
1360 long StartIndex,
1361 long Entries,
1362 long *pRetrieved,
1363 long *pPalette) {
1364 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1366 FIXME("(%p/%p)->(%ld, %ld, %p, %p): stub !!!\n", This, iface, StartIndex, Entries, pRetrieved, pPalette);
1368 return S_OK;
1371 static HRESULT WINAPI Basicvideo_GetCurrentImage(IBasicVideo *iface,
1372 long *pBufferSize,
1373 long *pDIBImage) {
1374 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1376 FIXME("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pBufferSize, pDIBImage);
1378 return S_OK;
1381 static HRESULT WINAPI Basicvideo_IsUsingDefaultSource(IBasicVideo *iface) {
1382 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1384 FIXME("(%p/%p)->(): stub !!!\n", This, iface);
1386 return S_OK;
1389 static HRESULT WINAPI Basicvideo_IsUsingDefaultDestination(IBasicVideo *iface) {
1390 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1392 FIXME("(%p/%p)->(): stub !!!\n", This, iface);
1394 return S_OK;
1398 static const IBasicVideoVtbl IBasicVideo_VTable =
1400 Basicvideo_QueryInterface,
1401 Basicvideo_AddRef,
1402 Basicvideo_Release,
1403 Basicvideo_GetTypeInfoCount,
1404 Basicvideo_GetTypeInfo,
1405 Basicvideo_GetIDsOfNames,
1406 Basicvideo_Invoke,
1407 Basicvideo_get_AvgTimePerFrame,
1408 Basicvideo_get_BitRate,
1409 Basicvideo_get_BitErrorRate,
1410 Basicvideo_get_VideoWidth,
1411 Basicvideo_get_VideoHeight,
1412 Basicvideo_put_SourceLeft,
1413 Basicvideo_get_SourceLeft,
1414 Basicvideo_put_SourceWidth,
1415 Basicvideo_get_SourceWidth,
1416 Basicvideo_put_SourceTop,
1417 Basicvideo_get_SourceTop,
1418 Basicvideo_put_SourceHeight,
1419 Basicvideo_get_SourceHeight,
1420 Basicvideo_put_DestinationLeft,
1421 Basicvideo_get_DestinationLeft,
1422 Basicvideo_put_DestinationWidth,
1423 Basicvideo_get_DestinationWidth,
1424 Basicvideo_put_DestinationTop,
1425 Basicvideo_get_DestinationTop,
1426 Basicvideo_put_DestinationHeight,
1427 Basicvideo_get_DestinationHeight,
1428 Basicvideo_SetSourcePosition,
1429 Basicvideo_GetSourcePosition,
1430 Basicvideo_SetDefaultSourcePosition,
1431 Basicvideo_SetDestinationPosition,
1432 Basicvideo_GetDestinationPosition,
1433 Basicvideo_SetDefaultDestinationPosition,
1434 Basicvideo_GetVideoSize,
1435 Basicvideo_GetVideoPaletteEntries,
1436 Basicvideo_GetCurrentImage,
1437 Basicvideo_IsUsingDefaultSource,
1438 Basicvideo_IsUsingDefaultDestination
1442 /*** IUnknown methods ***/
1443 static HRESULT WINAPI Videowindow_QueryInterface(IVideoWindow *iface,
1444 REFIID riid,
1445 LPVOID*ppvObj) {
1446 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1448 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1450 return VideoRenderer_QueryInterface((IBaseFilter*)This, riid, ppvObj);
1453 static ULONG WINAPI Videowindow_AddRef(IVideoWindow *iface) {
1454 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1456 TRACE("(%p/%p)->()\n", This, iface);
1458 return VideoRenderer_AddRef((IBaseFilter*)This);
1461 static ULONG WINAPI Videowindow_Release(IVideoWindow *iface) {
1462 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1464 TRACE("(%p/%p)->()\n", This, iface);
1466 return VideoRenderer_Release((IBaseFilter*)This);
1469 /*** IDispatch methods ***/
1470 static HRESULT WINAPI Videowindow_GetTypeInfoCount(IVideoWindow *iface,
1471 UINT*pctinfo) {
1472 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1474 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
1476 return S_OK;
1479 static HRESULT WINAPI Videowindow_GetTypeInfo(IVideoWindow *iface,
1480 UINT iTInfo,
1481 LCID lcid,
1482 ITypeInfo**ppTInfo) {
1483 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1485 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
1487 return S_OK;
1490 static HRESULT WINAPI Videowindow_GetIDsOfNames(IVideoWindow *iface,
1491 REFIID riid,
1492 LPOLESTR*rgszNames,
1493 UINT cNames,
1494 LCID lcid,
1495 DISPID*rgDispId) {
1496 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1498 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1500 return S_OK;
1503 static HRESULT WINAPI Videowindow_Invoke(IVideoWindow *iface,
1504 DISPID dispIdMember,
1505 REFIID riid,
1506 LCID lcid,
1507 WORD wFlags,
1508 DISPPARAMS*pDispParams,
1509 VARIANT*pVarResult,
1510 EXCEPINFO*pExepInfo,
1511 UINT*puArgErr) {
1512 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1514 FIXME("(%p/%p)->(%d, %s (%p), %d, %04x, %p, %p, %p, %p): stub !!!\n", This, iface, dispIdMember, debugstr_guid(riid), riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
1516 return S_OK;
1519 /*** IVideoWindow methods ***/
1520 static HRESULT WINAPI Videowindow_put_Caption(IVideoWindow *iface,
1521 BSTR strCaption) {
1522 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1524 TRACE("(%p/%p)->(%s (%p))\n", This, iface, debugstr_w(strCaption), strCaption);
1526 if (!SetWindowTextW(This->hWnd, strCaption))
1527 return E_FAIL;
1529 return S_OK;
1532 static HRESULT WINAPI Videowindow_get_Caption(IVideoWindow *iface,
1533 BSTR *strCaption) {
1534 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1536 TRACE("(%p/%p)->(%p)\n", This, iface, strCaption);
1538 GetWindowTextW(This->hWnd, (LPWSTR)strCaption, 100);
1540 return S_OK;
1543 static HRESULT WINAPI Videowindow_put_WindowStyle(IVideoWindow *iface,
1544 long WindowStyle) {
1545 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1546 LONG old;
1548 old = GetWindowLongA(This->hWnd, GWL_STYLE);
1550 TRACE("(%p/%p)->(%x -> %lx)\n", This, iface, old, WindowStyle);
1552 if (WindowStyle & (WS_DISABLED|WS_HSCROLL|WS_ICONIC|WS_MAXIMIZE|WS_MINIMIZE|WS_VSCROLL))
1553 return E_INVALIDARG;
1555 SetWindowLongA(This->hWnd, GWL_STYLE, WindowStyle);
1557 return S_OK;
1560 static HRESULT WINAPI Videowindow_get_WindowStyle(IVideoWindow *iface,
1561 long *WindowStyle) {
1562 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1564 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyle);
1566 *WindowStyle = GetWindowLongA(This->hWnd, GWL_STYLE);
1568 return S_OK;
1571 static HRESULT WINAPI Videowindow_put_WindowStyleEx(IVideoWindow *iface,
1572 long WindowStyleEx) {
1573 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1575 TRACE("(%p/%p)->(%ld)\n", This, iface, WindowStyleEx);
1577 if (WindowStyleEx & (WS_DISABLED|WS_HSCROLL|WS_ICONIC|WS_MAXIMIZE|WS_MINIMIZE|WS_VSCROLL))
1578 return E_INVALIDARG;
1580 if (!SetWindowLongA(This->hWnd, GWL_EXSTYLE, WindowStyleEx))
1581 return E_FAIL;
1583 return S_OK;
1586 static HRESULT WINAPI Videowindow_get_WindowStyleEx(IVideoWindow *iface,
1587 long *WindowStyleEx) {
1588 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1590 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyleEx);
1592 *WindowStyleEx = GetWindowLongA(This->hWnd, GWL_EXSTYLE);
1594 return S_OK;
1597 static HRESULT WINAPI Videowindow_put_AutoShow(IVideoWindow *iface,
1598 long AutoShow) {
1599 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1601 TRACE("(%p/%p)->(%ld)\n", This, iface, AutoShow);
1603 This->AutoShow = 1; /* FXIME: Should be AutoShow */;
1605 return S_OK;
1608 static HRESULT WINAPI Videowindow_get_AutoShow(IVideoWindow *iface,
1609 long *AutoShow) {
1610 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1612 TRACE("(%p/%p)->(%p)\n", This, iface, AutoShow);
1614 *AutoShow = This->AutoShow;
1616 return S_OK;
1619 static HRESULT WINAPI Videowindow_put_WindowState(IVideoWindow *iface,
1620 long WindowState) {
1621 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1623 FIXME("(%p/%p)->(%ld): stub !!!\n", This, iface, WindowState);
1625 return S_OK;
1628 static HRESULT WINAPI Videowindow_get_WindowState(IVideoWindow *iface,
1629 long *WindowState) {
1630 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1632 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, WindowState);
1634 return S_OK;
1637 static HRESULT WINAPI Videowindow_put_BackgroundPalette(IVideoWindow *iface,
1638 long BackgroundPalette) {
1639 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1641 FIXME("(%p/%p)->(%ld): stub !!!\n", This, iface, BackgroundPalette);
1643 return S_OK;
1646 static HRESULT WINAPI Videowindow_get_BackgroundPalette(IVideoWindow *iface,
1647 long *pBackgroundPalette) {
1648 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1650 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBackgroundPalette);
1652 return S_OK;
1655 static HRESULT WINAPI Videowindow_put_Visible(IVideoWindow *iface,
1656 long Visible) {
1657 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1659 TRACE("(%p/%p)->(%ld)\n", This, iface, Visible);
1661 ShowWindow(This->hWnd, Visible ? SW_SHOW : SW_HIDE);
1663 return S_OK;
1666 static HRESULT WINAPI Videowindow_get_Visible(IVideoWindow *iface,
1667 long *pVisible) {
1668 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1670 TRACE("(%p/%p)->(%p)\n", This, iface, pVisible);
1672 *pVisible = IsWindowVisible(This->hWnd);
1674 return S_OK;
1677 static HRESULT WINAPI Videowindow_put_Left(IVideoWindow *iface,
1678 long Left) {
1679 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1681 TRACE("(%p/%p)->(%ld)\n", This, iface, Left);
1683 if (!SetWindowPos(This->hWnd, NULL, Left, This->WindowPos.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE))
1684 return E_FAIL;
1686 This->WindowPos.left = Left;
1688 return S_OK;
1691 static HRESULT WINAPI Videowindow_get_Left(IVideoWindow *iface,
1692 long *pLeft) {
1693 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1695 TRACE("(%p/%p)->(%p)\n", This, iface, pLeft);
1697 *pLeft = This->WindowPos.left;
1699 return S_OK;
1702 static HRESULT WINAPI Videowindow_put_Width(IVideoWindow *iface,
1703 long Width) {
1704 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1706 TRACE("(%p/%p)->(%ld)\n", This, iface, Width);
1708 if (!SetWindowPos(This->hWnd, NULL, 0, 0, Width, This->WindowPos.bottom-This->WindowPos.top, SWP_NOZORDER|SWP_NOMOVE))
1709 return E_FAIL;
1711 This->WindowPos.right = This->WindowPos.left + Width;
1713 return S_OK;
1716 static HRESULT WINAPI Videowindow_get_Width(IVideoWindow *iface,
1717 long *pWidth) {
1718 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1720 TRACE("(%p/%p)->(%p)\n", This, iface, pWidth);
1722 *pWidth = This->WindowPos.right - This->WindowPos.left;
1724 return S_OK;
1727 static HRESULT WINAPI Videowindow_put_Top(IVideoWindow *iface,
1728 long Top) {
1729 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1731 TRACE("(%p/%p)->(%ld)\n", This, iface, Top);
1733 if (!SetWindowPos(This->hWnd, NULL, This->WindowPos.left, Top, 0, 0, SWP_NOZORDER|SWP_NOSIZE))
1734 return E_FAIL;
1736 This->WindowPos.top = Top;
1738 return S_OK;
1741 static HRESULT WINAPI Videowindow_get_Top(IVideoWindow *iface,
1742 long *pTop) {
1743 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1745 TRACE("(%p/%p)->(%p)\n", This, iface, pTop);
1747 *pTop = This->WindowPos.top;
1749 return S_OK;
1752 static HRESULT WINAPI Videowindow_put_Height(IVideoWindow *iface,
1753 long Height) {
1754 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1756 TRACE("(%p/%p)->(%ld)\n", This, iface, Height);
1758 if (!SetWindowPos(This->hWnd, NULL, 0, 0, This->WindowPos.right-This->WindowPos.left, Height, SWP_NOZORDER|SWP_NOMOVE))
1759 return E_FAIL;
1761 This->WindowPos.bottom = This->WindowPos.top + Height;
1763 return S_OK;
1766 static HRESULT WINAPI Videowindow_get_Height(IVideoWindow *iface,
1767 long *pHeight) {
1768 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1770 TRACE("(%p/%p)->(%p)\n", This, iface, pHeight);
1772 *pHeight = This->WindowPos.bottom - This->WindowPos.top;
1774 return S_OK;
1777 static HRESULT WINAPI Videowindow_put_Owner(IVideoWindow *iface,
1778 OAHWND Owner) {
1779 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1781 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Owner);
1783 SetParent(This->hWnd, (HWND)Owner);
1785 return S_OK;
1788 static HRESULT WINAPI Videowindow_get_Owner(IVideoWindow *iface,
1789 OAHWND *Owner) {
1790 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1792 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Owner);
1794 *(HWND*)Owner = GetParent(This->hWnd);
1796 return S_OK;
1799 static HRESULT WINAPI Videowindow_put_MessageDrain(IVideoWindow *iface,
1800 OAHWND Drain) {
1801 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1803 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Drain);
1805 This->hWndMsgDrain = (HWND)Drain;
1807 return S_OK;
1810 static HRESULT WINAPI Videowindow_get_MessageDrain(IVideoWindow *iface,
1811 OAHWND *Drain) {
1812 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1814 TRACE("(%p/%p)->(%p)\n", This, iface, Drain);
1816 *Drain = (OAHWND)This->hWndMsgDrain;
1818 return S_OK;
1821 static HRESULT WINAPI Videowindow_get_BorderColor(IVideoWindow *iface,
1822 long *Color) {
1823 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1825 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, Color);
1827 return S_OK;
1830 static HRESULT WINAPI Videowindow_put_BorderColor(IVideoWindow *iface,
1831 long Color) {
1832 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1834 FIXME("(%p/%p)->(%ld): stub !!!\n", This, iface, Color);
1836 return S_OK;
1839 static HRESULT WINAPI Videowindow_get_FullScreenMode(IVideoWindow *iface,
1840 long *FullScreenMode) {
1841 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1843 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, FullScreenMode);
1845 return S_OK;
1848 static HRESULT WINAPI Videowindow_put_FullScreenMode(IVideoWindow *iface,
1849 long FullScreenMode) {
1850 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1852 FIXME("(%p/%p)->(%ld): stub !!!\n", This, iface, FullScreenMode);
1854 return S_OK;
1857 static HRESULT WINAPI Videowindow_SetWindowForeground(IVideoWindow *iface,
1858 long Focus) {
1859 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1860 BOOL ret;
1861 IPin* pPin;
1862 HRESULT hr;
1864 TRACE("(%p/%p)->(%ld)\n", This, iface, Focus);
1866 if ((Focus != FALSE) && (Focus != TRUE))
1867 return E_INVALIDARG;
1869 hr = IPin_ConnectedTo((IPin *)This->pInputPin, &pPin);
1870 if ((hr != S_OK) || !pPin)
1871 return VFW_E_NOT_CONNECTED;
1873 if (Focus)
1874 ret = SetForegroundWindow(This->hWnd);
1875 else
1876 ret = SetWindowPos(This->hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
1878 if (!ret)
1879 return E_FAIL;
1881 return S_OK;
1884 static HRESULT WINAPI Videowindow_NotifyOwnerMessage(IVideoWindow *iface,
1885 OAHWND hwnd,
1886 long uMsg,
1887 LONG_PTR wParam,
1888 LONG_PTR lParam) {
1889 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1891 TRACE("(%p/%p)->(%08x, %ld, %08lx, %08lx)\n", This, iface, (DWORD) hwnd, uMsg, wParam, lParam);
1893 if (!PostMessageA(This->hWnd, uMsg, wParam, lParam))
1894 return E_FAIL;
1896 return S_OK;
1899 static HRESULT WINAPI Videowindow_SetWindowPosition(IVideoWindow *iface,
1900 long Left,
1901 long Top,
1902 long Width,
1903 long Height) {
1904 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1906 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
1908 if (!SetWindowPos(This->hWnd, NULL, Left, Top, Width, Height, SWP_NOZORDER))
1909 return E_FAIL;
1911 This->WindowPos.left = Left;
1912 This->WindowPos.top = Top;
1913 This->WindowPos.right = Left + Width;
1914 This->WindowPos.bottom = Top + Height;
1916 return S_OK;
1919 static HRESULT WINAPI Videowindow_GetWindowPosition(IVideoWindow *iface,
1920 long *pLeft,
1921 long *pTop,
1922 long *pWidth,
1923 long *pHeight) {
1924 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1926 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1928 *pLeft = This->WindowPos.left;
1929 *pTop = This->WindowPos.top;
1930 *pWidth = This->WindowPos.right - This->WindowPos.left;
1931 *pHeight = This->WindowPos.bottom - This->WindowPos.top;
1933 return S_OK;
1936 static HRESULT WINAPI Videowindow_GetMinIdealImageSize(IVideoWindow *iface,
1937 long *pWidth,
1938 long *pHeight) {
1939 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1941 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This, iface, pWidth, pHeight);
1943 *pWidth = This->VideoWidth;
1944 *pHeight = This->VideoHeight;
1946 return S_OK;
1949 static HRESULT WINAPI Videowindow_GetMaxIdealImageSize(IVideoWindow *iface,
1950 long *pWidth,
1951 long *pHeight) {
1952 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1954 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This, iface, pWidth, pHeight);
1956 *pWidth = This->VideoWidth;
1957 *pHeight = This->VideoHeight;
1959 return S_OK;
1962 static HRESULT WINAPI Videowindow_GetRestorePosition(IVideoWindow *iface,
1963 long *pLeft,
1964 long *pTop,
1965 long *pWidth,
1966 long *pHeight) {
1967 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1969 FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This, iface, pLeft, pTop, pWidth, pHeight);
1971 return S_OK;
1974 static HRESULT WINAPI Videowindow_HideCursor(IVideoWindow *iface,
1975 long HideCursor) {
1976 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1978 FIXME("(%p/%p)->(%ld): stub !!!\n", This, iface, HideCursor);
1980 return S_OK;
1983 static HRESULT WINAPI Videowindow_IsCursorHidden(IVideoWindow *iface,
1984 long *CursorHidden) {
1985 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1987 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, CursorHidden);
1989 return S_OK;
1992 static const IVideoWindowVtbl IVideoWindow_VTable =
1994 Videowindow_QueryInterface,
1995 Videowindow_AddRef,
1996 Videowindow_Release,
1997 Videowindow_GetTypeInfoCount,
1998 Videowindow_GetTypeInfo,
1999 Videowindow_GetIDsOfNames,
2000 Videowindow_Invoke,
2001 Videowindow_put_Caption,
2002 Videowindow_get_Caption,
2003 Videowindow_put_WindowStyle,
2004 Videowindow_get_WindowStyle,
2005 Videowindow_put_WindowStyleEx,
2006 Videowindow_get_WindowStyleEx,
2007 Videowindow_put_AutoShow,
2008 Videowindow_get_AutoShow,
2009 Videowindow_put_WindowState,
2010 Videowindow_get_WindowState,
2011 Videowindow_put_BackgroundPalette,
2012 Videowindow_get_BackgroundPalette,
2013 Videowindow_put_Visible,
2014 Videowindow_get_Visible,
2015 Videowindow_put_Left,
2016 Videowindow_get_Left,
2017 Videowindow_put_Width,
2018 Videowindow_get_Width,
2019 Videowindow_put_Top,
2020 Videowindow_get_Top,
2021 Videowindow_put_Height,
2022 Videowindow_get_Height,
2023 Videowindow_put_Owner,
2024 Videowindow_get_Owner,
2025 Videowindow_put_MessageDrain,
2026 Videowindow_get_MessageDrain,
2027 Videowindow_get_BorderColor,
2028 Videowindow_put_BorderColor,
2029 Videowindow_get_FullScreenMode,
2030 Videowindow_put_FullScreenMode,
2031 Videowindow_SetWindowForeground,
2032 Videowindow_NotifyOwnerMessage,
2033 Videowindow_SetWindowPosition,
2034 Videowindow_GetWindowPosition,
2035 Videowindow_GetMinIdealImageSize,
2036 Videowindow_GetMaxIdealImageSize,
2037 Videowindow_GetRestorePosition,
2038 Videowindow_HideCursor,
2039 Videowindow_IsCursorHidden