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
23 #define NONAMELESSSTRUCT
24 #define NONAMELESSUNION
25 #include "quartz_private.h"
26 #include "control_private.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;
64 CRITICAL_SECTION csFilter;
66 REFERENCE_TIME rtStreamStart;
67 IReferenceClock * pClock;
68 FILTER_INFO filterInfo;
90 REFERENCE_TIME rtLastStop;
91 MediaSeekingImpl mediaSeeking;
94 /* During pause we can hold a single sample, for use in GetCurrentImage */
95 IMediaSample *sample_held;
98 static LRESULT CALLBACK VideoWndProcA(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
100 VideoRendererImpl* pVideoRenderer = (VideoRendererImpl*)GetWindowLongPtrW(hwnd, 0);
101 LPRECT lprect = (LPRECT)lParam;
103 if (pVideoRenderer && pVideoRenderer->hWndMsgDrain)
109 case WM_LBUTTONDBLCLK:
112 case WM_MBUTTONDBLCLK:
115 case WM_MOUSEACTIVATE:
117 case WM_NCLBUTTONDBLCLK:
118 case WM_NCLBUTTONDOWN:
120 case WM_NCMBUTTONDBLCLK:
121 case WM_NCMBUTTONDOWN:
124 case WM_NCRBUTTONDBLCLK:
125 case WM_NCRBUTTONDOWN:
127 case WM_RBUTTONDBLCLK:
130 PostMessageA(pVideoRenderer->hWndMsgDrain, uMsg, wParam, lParam);
140 /* TRACE("WM_SIZING %d %d %d %d\n", lprect->left, lprect->top, lprect->right, lprect->bottom); */
141 SetWindowPos(hwnd, NULL, lprect->left, lprect->top, lprect->right - lprect->left, lprect->bottom - lprect->top, SWP_NOZORDER);
142 GetClientRect(hwnd, &pVideoRenderer->DestRect);
143 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
144 pVideoRenderer->DestRect.left,
145 pVideoRenderer->DestRect.top,
146 pVideoRenderer->DestRect.right - pVideoRenderer->DestRect.left,
147 pVideoRenderer->DestRect.bottom - pVideoRenderer->DestRect.top);
150 TRACE("WM_SIZE %d %d\n", LOWORD(lParam), HIWORD(lParam));
151 GetClientRect(hwnd, &pVideoRenderer->DestRect);
152 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
153 pVideoRenderer->DestRect.left,
154 pVideoRenderer->DestRect.top,
155 pVideoRenderer->DestRect.right - pVideoRenderer->DestRect.left,
156 pVideoRenderer->DestRect.bottom - pVideoRenderer->DestRect.top);
159 return DefWindowProcA(hwnd, uMsg, wParam, lParam);
164 static BOOL CreateRenderingWindow(VideoRendererImpl* This)
168 TRACE("(%p)->()\n", This);
171 winclass.lpfnWndProc = VideoWndProcA;
172 winclass.cbClsExtra = 0;
173 winclass.cbWndExtra = sizeof(VideoRendererImpl*);
174 winclass.hInstance = NULL;
175 winclass.hIcon = NULL;
176 winclass.hCursor = NULL;
177 winclass.hbrBackground = GetStockObject(BLACK_BRUSH);
178 winclass.lpszMenuName = NULL;
179 winclass.lpszClassName = "Wine ActiveMovie Class";
181 if (!wnd_class_registered)
183 if (!RegisterClassA(&winclass))
185 ERR("Unable to register window %u\n", GetLastError());
188 wnd_class_registered = TRUE;
191 This->hWnd = CreateWindowExA(0, "Wine ActiveMovie Class", "Wine ActiveMovie Window", WS_SIZEBOX,
192 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL,
197 ERR("Unable to create window\n");
201 SetWindowLongPtrW(This->hWnd, 0, (LONG_PTR)This);
206 static DWORD WINAPI MessageLoop(LPVOID lpParameter)
208 VideoRendererImpl* This = lpParameter;
212 TRACE("Starting message loop\n");
214 if (!CreateRenderingWindow(This))
216 This->ThreadResult = FALSE;
217 SetEvent(This->hEvent);
221 This->ThreadResult = TRUE;
222 SetEvent(This->hEvent);
224 while ((fGotMessage = GetMessageA(&msg, NULL, 0, 0)) != 0 && fGotMessage != -1)
226 TranslateMessage(&msg);
227 DispatchMessageA(&msg);
230 TRACE("End of message loop\n");
235 static BOOL CreateRenderingSubsystem(VideoRendererImpl* This)
237 This->hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
241 This->hThread = CreateThread(NULL, 0, MessageLoop, This, 0, &This->ThreadID);
244 CloseHandle(This->hEvent);
248 WaitForSingleObject(This->hEvent, INFINITE);
250 if (!This->ThreadResult)
252 CloseHandle(This->hEvent);
253 CloseHandle(This->hThread);
260 static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data, DWORD size)
266 BITMAPINFOHEADER *bmiHeader;
268 TRACE("(%p)->(%p, %d)\n", This, data, size);
270 sdesc.dwSize = sizeof(sdesc);
271 hr = IPin_ConnectionMediaType((IPin *)This->pInputPin, &amt);
273 ERR("Unable to retrieve media type\n");
277 if (IsEqualIID(&amt.formattype, &FORMAT_VideoInfo))
279 bmiHeader = &((VIDEOINFOHEADER *)amt.pbFormat)->bmiHeader;
281 else if (IsEqualIID(&amt.formattype, &FORMAT_VideoInfo2))
283 bmiHeader = &((VIDEOINFOHEADER2 *)amt.pbFormat)->bmiHeader;
287 FIXME("Unknown type %s\n", debugstr_guid(&amt.subtype));
288 return VFW_E_RUNTIME_ERROR;
291 TRACE("biSize = %d\n", bmiHeader->biSize);
292 TRACE("biWidth = %d\n", bmiHeader->biWidth);
293 TRACE("biHeight = %d\n", bmiHeader->biHeight);
294 TRACE("biPlanes = %d\n", bmiHeader->biPlanes);
295 TRACE("biBitCount = %d\n", bmiHeader->biBitCount);
296 TRACE("biCompression = %s\n", debugstr_an((LPSTR)&(bmiHeader->biCompression), 4));
297 TRACE("biSizeImage = %d\n", bmiHeader->biSizeImage);
301 DWORD style = GetWindowLongW(This->hWnd, GWL_STYLE);
302 DWORD style_ex = GetWindowLongW(This->hWnd, GWL_EXSTYLE);
304 if (!This->WindowPos.right || !This->WindowPos.bottom)
305 This->WindowPos = This->SourceRect;
307 AdjustWindowRectEx(&This->WindowPos, style, TRUE, style_ex);
309 TRACE("WindowPos: %d %d %d %d\n", This->WindowPos.left, This->WindowPos.top, This->WindowPos.right, This->WindowPos.bottom);
310 SetWindowPos(This->hWnd, NULL,
311 This->WindowPos.left,
313 This->WindowPos.right - This->WindowPos.left,
314 This->WindowPos.bottom - This->WindowPos.top,
315 SWP_NOZORDER|SWP_NOMOVE);
317 GetClientRect(This->hWnd, &This->DestRect);
321 hDC = GetDC(This->hWnd);
324 ERR("Cannot get DC from window!\n");
328 TRACE("Src Rect: %d %d %d %d\n", This->SourceRect.left, This->SourceRect.top, This->SourceRect.right, This->SourceRect.bottom);
329 TRACE("Dst Rect: %d %d %d %d\n", This->DestRect.left, This->DestRect.top, This->DestRect.right, This->DestRect.bottom);
331 StretchDIBits(hDC, This->DestRect.left, This->DestRect.top, This->DestRect.right -This->DestRect.left,
332 This->DestRect.bottom - This->DestRect.top, This->SourceRect.left, This->SourceRect.top,
333 This->SourceRect.right - This->SourceRect.left, This->SourceRect.bottom - This->SourceRect.top,
334 data, (BITMAPINFO *)bmiHeader, DIB_RGB_COLORS, SRCCOPY);
336 ReleaseDC(This->hWnd, hDC);
338 ShowWindow(This->hWnd, SW_SHOW);
343 static HRESULT VideoRenderer_Sample(LPVOID iface, IMediaSample * pSample)
345 VideoRendererImpl *This = iface;
346 LPBYTE pbSrcStream = NULL;
347 LONG cbSrcStream = 0;
348 REFERENCE_TIME tStart, tStop;
351 TRACE("(%p)->(%p)\n", iface, pSample);
353 EnterCriticalSection(&This->csFilter);
355 if (This->pInputPin->flushing || This->pInputPin->end_of_stream)
357 LeaveCriticalSection(&This->csFilter);
361 if (This->state == State_Stopped)
363 LeaveCriticalSection(&This->csFilter);
364 return VFW_E_WRONG_STATE;
367 hr = IMediaSample_GetTime(pSample, &tStart, &tStop);
369 ERR("Cannot get sample time (%x)\n", hr);
371 if (This->rtLastStop != tStart && This->state == State_Running)
374 delta = tStart - This->rtLastStop;
375 if ((delta < -100000 || delta > 100000) &&
376 IMediaSample_IsDiscontinuity(pSample) == S_FALSE)
377 ERR("Unexpected discontinuity: Last: %u.%03u, tStart: %u.%03u\n",
378 (DWORD)(This->rtLastStop / 10000000),
379 (DWORD)((This->rtLastStop / 10000)%1000),
380 (DWORD)(tStart / 10000000), (DWORD)((tStart / 10000)%1000));
381 This->rtLastStop = tStart;
384 /* Preroll means the sample isn't shown, this is used for key frames and things like that */
385 if (IMediaSample_IsPreroll(pSample) == S_OK)
387 This->rtLastStop = tStop;
388 LeaveCriticalSection(&This->csFilter);
392 hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
395 ERR("Cannot get pointer to sample data (%x)\n", hr);
396 LeaveCriticalSection(&This->csFilter);
400 cbSrcStream = IMediaSample_GetActualDataLength(pSample);
402 TRACE("val %p %d\n", pbSrcStream, cbSrcStream);
404 #if 0 /* For debugging purpose */
407 for(i = 0; i < cbSrcStream; i++)
409 if ((i!=0) && !(i%16))
411 TRACE("%02x ", pbSrcStream[i]);
417 SetEvent(This->hEvent);
418 if (This->state == State_Paused)
420 This->sample_held = pSample;
421 LeaveCriticalSection(&This->csFilter);
422 WaitForSingleObject(This->blocked, INFINITE);
423 EnterCriticalSection(&This->csFilter);
424 This->sample_held = NULL;
425 if (This->state == State_Paused)
428 LeaveCriticalSection(&This->csFilter);
431 if (This->state == State_Stopped)
433 LeaveCriticalSection(&This->csFilter);
434 return VFW_E_WRONG_STATE;
438 if (This->pClock && This->state == State_Running)
440 REFERENCE_TIME time, trefstart, trefstop;
443 /* Perhaps I <SHOULD> use the reference clock AdviseTime function here
444 * I'm not going to! When I tried, it seemed to generate lag and
445 * it caused instability.
447 IReferenceClock_GetTime(This->pClock, &time);
449 trefstart = This->rtStreamStart;
450 trefstop = (REFERENCE_TIME)((double)(tStop - tStart) / This->pInputPin->dRate) + This->rtStreamStart;
451 delta = (LONG)((trefstart-time)/10000);
452 This->rtStreamStart = trefstop;
453 This->rtLastStop = tStop;
457 TRACE("Sleeping for %u ms\n", delta);
460 else if (time > trefstop)
462 TRACE("Dropping sample: Time: %u.%03u ms trefstop: %u.%03u ms!\n",
463 (DWORD)(time / 10000000), (DWORD)((time / 10000)%1000),
464 (DWORD)(trefstop / 10000000), (DWORD)((trefstop / 10000)%1000) );
465 This->rtLastStop = tStop;
466 LeaveCriticalSection(&This->csFilter);
470 This->rtLastStop = tStop;
472 VideoRenderer_SendSampleData(This, pbSrcStream, cbSrcStream);
474 LeaveCriticalSection(&This->csFilter);
478 static HRESULT VideoRenderer_QueryAccept(LPVOID iface, const AM_MEDIA_TYPE * pmt)
480 if (!IsEqualIID(&pmt->majortype, &MEDIATYPE_Video))
483 if (IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB32) ||
484 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB24) ||
485 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB565) ||
486 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB8))
488 VideoRendererImpl* This = iface;
491 if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo))
493 VIDEOINFOHEADER *format = (VIDEOINFOHEADER *)pmt->pbFormat;
494 This->SourceRect.left = 0;
495 This->SourceRect.top = 0;
496 This->SourceRect.right = This->VideoWidth = format->bmiHeader.biWidth;
497 height = format->bmiHeader.biHeight;
499 This->SourceRect.bottom = This->VideoHeight = -height;
501 This->SourceRect.bottom = This->VideoHeight = height;
503 else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2))
505 VIDEOINFOHEADER2 *format2 = (VIDEOINFOHEADER2 *)pmt->pbFormat;
507 This->SourceRect.left = 0;
508 This->SourceRect.top = 0;
509 This->SourceRect.right = This->VideoWidth = format2->bmiHeader.biWidth;
510 height = format2->bmiHeader.biHeight;
512 This->SourceRect.bottom = This->VideoHeight = -height;
514 This->SourceRect.bottom = This->VideoHeight = height;
518 WARN("Format type %s not supported\n", debugstr_guid(&pmt->formattype));
526 static inline VideoRendererImpl *impl_from_IMediaSeeking( IMediaSeeking *iface )
528 return (VideoRendererImpl *)((char*)iface - FIELD_OFFSET(VideoRendererImpl, mediaSeeking.lpVtbl));
531 static HRESULT WINAPI VideoRendererImpl_Seeking_QueryInterface(IMediaSeeking * iface, REFIID riid, LPVOID * ppv)
533 VideoRendererImpl *This = impl_from_IMediaSeeking(iface);
535 return IUnknown_QueryInterface((IUnknown *)This, riid, ppv);
538 static ULONG WINAPI VideoRendererImpl_Seeking_AddRef(IMediaSeeking * iface)
540 VideoRendererImpl *This = impl_from_IMediaSeeking(iface);
542 return IUnknown_AddRef((IUnknown *)This);
545 static ULONG WINAPI VideoRendererImpl_Seeking_Release(IMediaSeeking * iface)
547 VideoRendererImpl *This = impl_from_IMediaSeeking(iface);
549 return IUnknown_Release((IUnknown *)This);
552 static const IMediaSeekingVtbl VideoRendererImpl_Seeking_Vtbl =
554 VideoRendererImpl_Seeking_QueryInterface,
555 VideoRendererImpl_Seeking_AddRef,
556 VideoRendererImpl_Seeking_Release,
557 MediaSeekingImpl_GetCapabilities,
558 MediaSeekingImpl_CheckCapabilities,
559 MediaSeekingImpl_IsFormatSupported,
560 MediaSeekingImpl_QueryPreferredFormat,
561 MediaSeekingImpl_GetTimeFormat,
562 MediaSeekingImpl_IsUsingTimeFormat,
563 MediaSeekingImpl_SetTimeFormat,
564 MediaSeekingImpl_GetDuration,
565 MediaSeekingImpl_GetStopPosition,
566 MediaSeekingImpl_GetCurrentPosition,
567 MediaSeekingImpl_ConvertTimeFormat,
568 MediaSeekingImpl_SetPositions,
569 MediaSeekingImpl_GetPositions,
570 MediaSeekingImpl_GetAvailable,
571 MediaSeekingImpl_SetRate,
572 MediaSeekingImpl_GetRate,
573 MediaSeekingImpl_GetPreroll
576 static HRESULT VideoRendererImpl_Change(IBaseFilter *iface)
578 TRACE("(%p)->()\n", iface);
582 HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
586 VideoRendererImpl * pVideoRenderer;
588 TRACE("(%p, %p)\n", pUnkOuter, ppv);
592 pVideoRenderer = CoTaskMemAlloc(sizeof(VideoRendererImpl));
593 pVideoRenderer->pUnkOuter = pUnkOuter;
594 pVideoRenderer->bUnkOuterValid = FALSE;
595 pVideoRenderer->bAggregatable = FALSE;
596 pVideoRenderer->IInner_vtbl = &IInner_VTable;
598 pVideoRenderer->lpVtbl = &VideoRenderer_Vtbl;
599 pVideoRenderer->IBasicVideo_vtbl = &IBasicVideo_VTable;
600 pVideoRenderer->IVideoWindow_vtbl = &IVideoWindow_VTable;
602 pVideoRenderer->refCount = 1;
603 InitializeCriticalSection(&pVideoRenderer->csFilter);
604 pVideoRenderer->csFilter.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": VideoRendererImpl.csFilter");
605 pVideoRenderer->state = State_Stopped;
606 pVideoRenderer->pClock = NULL;
607 pVideoRenderer->init = 0;
608 pVideoRenderer->AutoShow = 1;
609 pVideoRenderer->rtLastStop = -1;
610 ZeroMemory(&pVideoRenderer->filterInfo, sizeof(FILTER_INFO));
611 ZeroMemory(&pVideoRenderer->SourceRect, sizeof(RECT));
612 ZeroMemory(&pVideoRenderer->DestRect, sizeof(RECT));
613 ZeroMemory(&pVideoRenderer->WindowPos, sizeof(RECT));
614 pVideoRenderer->hWndMsgDrain = NULL;
615 pVideoRenderer->WindowStyle = WS_OVERLAPPED;
617 /* construct input pin */
618 piInput.dir = PINDIR_INPUT;
619 piInput.pFilter = (IBaseFilter *)pVideoRenderer;
620 lstrcpynW(piInput.achName, wcsInputPinName, sizeof(piInput.achName) / sizeof(piInput.achName[0]));
622 hr = InputPin_Construct(&VideoRenderer_InputPin_Vtbl, &piInput, VideoRenderer_Sample, (LPVOID)pVideoRenderer, VideoRenderer_QueryAccept, NULL, &pVideoRenderer->csFilter, NULL, (IPin **)&pVideoRenderer->pInputPin);
626 MediaSeekingImpl_Init((IBaseFilter*)pVideoRenderer, VideoRendererImpl_Change, VideoRendererImpl_Change, VideoRendererImpl_Change, &pVideoRenderer->mediaSeeking, &pVideoRenderer->csFilter);
627 pVideoRenderer->mediaSeeking.lpVtbl = &VideoRendererImpl_Seeking_Vtbl;
629 pVideoRenderer->sample_held = NULL;
630 *ppv = pVideoRenderer;
634 pVideoRenderer->csFilter.DebugInfo->Spare[0] = 0;
635 DeleteCriticalSection(&pVideoRenderer->csFilter);
636 CoTaskMemFree(pVideoRenderer);
639 if (!CreateRenderingSubsystem(pVideoRenderer))
642 pVideoRenderer->blocked = CreateEventW(NULL, FALSE, FALSE, NULL);
643 if (!pVideoRenderer->blocked)
645 hr = HRESULT_FROM_WIN32(GetLastError());
646 IUnknown_Release((IUnknown *)pVideoRenderer);
652 HRESULT VideoRendererDefault_create(IUnknown * pUnkOuter, LPVOID * ppv)
654 /* TODO: Attempt to use the VMR-7 renderer instead when possible */
655 return VideoRenderer_create(pUnkOuter, ppv);
658 static HRESULT WINAPI VideoRendererInner_QueryInterface(IUnknown * iface, REFIID riid, LPVOID * ppv)
660 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
661 TRACE("(%p/%p)->(%s, %p)\n", This, iface, qzdebugstr_guid(riid), ppv);
663 if (This->bAggregatable)
664 This->bUnkOuterValid = TRUE;
668 if (IsEqualIID(riid, &IID_IUnknown))
669 *ppv = &This->IInner_vtbl;
670 else if (IsEqualIID(riid, &IID_IPersist))
672 else if (IsEqualIID(riid, &IID_IMediaFilter))
674 else if (IsEqualIID(riid, &IID_IBaseFilter))
676 else if (IsEqualIID(riid, &IID_IBasicVideo))
677 *ppv = &This->IBasicVideo_vtbl;
678 else if (IsEqualIID(riid, &IID_IVideoWindow))
679 *ppv = &This->IVideoWindow_vtbl;
680 else if (IsEqualIID(riid, &IID_IMediaSeeking))
681 *ppv = &This->mediaSeeking;
685 IUnknown_AddRef((IUnknown *)(*ppv));
689 if (!IsEqualIID(riid, &IID_IPin))
690 FIXME("No interface for %s!\n", qzdebugstr_guid(riid));
692 return E_NOINTERFACE;
695 static ULONG WINAPI VideoRendererInner_AddRef(IUnknown * iface)
697 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
698 ULONG refCount = InterlockedIncrement(&This->refCount);
700 TRACE("(%p/%p)->() AddRef from %d\n", This, iface, refCount - 1);
705 static ULONG WINAPI VideoRendererInner_Release(IUnknown * iface)
707 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
708 ULONG refCount = InterlockedDecrement(&This->refCount);
710 TRACE("(%p/%p)->() Release from %d\n", This, iface, refCount + 1);
716 DestroyWindow(This->hWnd);
717 PostThreadMessageA(This->ThreadID, WM_QUIT, 0, 0);
718 WaitForSingleObject(This->hThread, INFINITE);
719 CloseHandle(This->hThread);
720 CloseHandle(This->hEvent);
723 IReferenceClock_Release(This->pClock);
725 if (SUCCEEDED(IPin_ConnectedTo((IPin *)This->pInputPin, &pConnectedTo)))
727 IPin_Disconnect(pConnectedTo);
728 IPin_Release(pConnectedTo);
730 IPin_Disconnect((IPin *)This->pInputPin);
732 IPin_Release((IPin *)This->pInputPin);
736 This->csFilter.DebugInfo->Spare[0] = 0;
737 DeleteCriticalSection(&This->csFilter);
739 TRACE("Destroying Video Renderer\n");
748 static const IUnknownVtbl IInner_VTable =
750 VideoRendererInner_QueryInterface,
751 VideoRendererInner_AddRef,
752 VideoRendererInner_Release
755 static HRESULT WINAPI VideoRenderer_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv)
757 VideoRendererImpl *This = (VideoRendererImpl *)iface;
759 if (This->bAggregatable)
760 This->bUnkOuterValid = TRUE;
764 if (This->bAggregatable)
765 return IUnknown_QueryInterface(This->pUnkOuter, riid, ppv);
767 if (IsEqualIID(riid, &IID_IUnknown))
771 IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
772 hr = IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
773 IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
774 This->bAggregatable = TRUE;
779 return E_NOINTERFACE;
782 return IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
785 static ULONG WINAPI VideoRenderer_AddRef(IBaseFilter * iface)
787 VideoRendererImpl *This = (VideoRendererImpl *)iface;
789 if (This->pUnkOuter && This->bUnkOuterValid)
790 return IUnknown_AddRef(This->pUnkOuter);
791 return IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
794 static ULONG WINAPI VideoRenderer_Release(IBaseFilter * iface)
796 VideoRendererImpl *This = (VideoRendererImpl *)iface;
798 if (This->pUnkOuter && This->bUnkOuterValid)
799 return IUnknown_Release(This->pUnkOuter);
800 return IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
803 /** IPersist methods **/
805 static HRESULT WINAPI VideoRenderer_GetClassID(IBaseFilter * iface, CLSID * pClsid)
807 VideoRendererImpl *This = (VideoRendererImpl *)iface;
809 TRACE("(%p/%p)->(%p)\n", This, iface, pClsid);
811 *pClsid = CLSID_VideoRenderer;
816 /** IMediaFilter methods **/
818 static HRESULT WINAPI VideoRenderer_Stop(IBaseFilter * iface)
820 VideoRendererImpl *This = (VideoRendererImpl *)iface;
822 TRACE("(%p/%p)->()\n", This, iface);
824 EnterCriticalSection(&This->csFilter);
826 This->state = State_Stopped;
827 SetEvent(This->hEvent);
828 SetEvent(This->blocked);
830 LeaveCriticalSection(&This->csFilter);
835 static HRESULT WINAPI VideoRenderer_Pause(IBaseFilter * iface)
837 VideoRendererImpl *This = (VideoRendererImpl *)iface;
839 TRACE("(%p/%p)->()\n", This, iface);
841 EnterCriticalSection(&This->csFilter);
842 if (This->state != State_Paused)
844 if (This->state == State_Stopped)
846 This->pInputPin->end_of_stream = 0;
847 ResetEvent(This->hEvent);
850 This->state = State_Paused;
851 ResetEvent(This->blocked);
853 LeaveCriticalSection(&This->csFilter);
858 static HRESULT WINAPI VideoRenderer_Run(IBaseFilter * iface, REFERENCE_TIME tStart)
860 VideoRendererImpl *This = (VideoRendererImpl *)iface;
862 TRACE("(%p/%p)->(%s)\n", This, iface, wine_dbgstr_longlong(tStart));
864 EnterCriticalSection(&This->csFilter);
865 if (This->state != State_Running)
867 if (This->state == State_Stopped)
869 This->pInputPin->end_of_stream = 0;
870 ResetEvent(This->hEvent);
872 SetEvent(This->blocked);
874 This->rtStreamStart = tStart;
875 This->state = State_Running;
877 LeaveCriticalSection(&This->csFilter);
882 static HRESULT WINAPI VideoRenderer_GetState(IBaseFilter * iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState)
884 VideoRendererImpl *This = (VideoRendererImpl *)iface;
887 TRACE("(%p/%p)->(%d, %p)\n", This, iface, dwMilliSecsTimeout, pState);
889 if (WaitForSingleObject(This->hEvent, dwMilliSecsTimeout) == WAIT_TIMEOUT)
890 hr = VFW_S_STATE_INTERMEDIATE;
894 EnterCriticalSection(&This->csFilter);
896 *pState = This->state;
898 LeaveCriticalSection(&This->csFilter);
903 static HRESULT WINAPI VideoRenderer_SetSyncSource(IBaseFilter * iface, IReferenceClock *pClock)
905 VideoRendererImpl *This = (VideoRendererImpl *)iface;
907 TRACE("(%p/%p)->(%p)\n", This, iface, pClock);
909 EnterCriticalSection(&This->csFilter);
912 IReferenceClock_Release(This->pClock);
913 This->pClock = pClock;
915 IReferenceClock_AddRef(This->pClock);
917 LeaveCriticalSection(&This->csFilter);
922 static HRESULT WINAPI VideoRenderer_GetSyncSource(IBaseFilter * iface, IReferenceClock **ppClock)
924 VideoRendererImpl *This = (VideoRendererImpl *)iface;
926 TRACE("(%p/%p)->(%p)\n", This, iface, ppClock);
928 EnterCriticalSection(&This->csFilter);
930 *ppClock = This->pClock;
932 IReferenceClock_AddRef(This->pClock);
934 LeaveCriticalSection(&This->csFilter);
939 /** IBaseFilter implementation **/
941 static HRESULT VideoRenderer_GetPin(IBaseFilter *iface, ULONG pos, IPin **pin, DWORD *lastsynctick)
943 VideoRendererImpl *This = (VideoRendererImpl *)iface;
945 /* Our pins are static, not changing so setting static tick count is ok */
951 *pin = (IPin *)This->pInputPin;
956 static HRESULT WINAPI VideoRenderer_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum)
958 VideoRendererImpl *This = (VideoRendererImpl *)iface;
960 TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
962 return IEnumPinsImpl_Construct(ppEnum, VideoRenderer_GetPin, iface);
965 static HRESULT WINAPI VideoRenderer_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)
967 VideoRendererImpl *This = (VideoRendererImpl *)iface;
969 FIXME("(%p/%p)->(%p,%p): stub !!!\n", This, iface, debugstr_w(Id), ppPin);
971 /* FIXME: critical section */
976 static HRESULT WINAPI VideoRenderer_QueryFilterInfo(IBaseFilter * iface, FILTER_INFO *pInfo)
978 VideoRendererImpl *This = (VideoRendererImpl *)iface;
980 TRACE("(%p/%p)->(%p)\n", This, iface, pInfo);
982 strcpyW(pInfo->achName, This->filterInfo.achName);
983 pInfo->pGraph = This->filterInfo.pGraph;
986 IFilterGraph_AddRef(pInfo->pGraph);
991 static HRESULT WINAPI VideoRenderer_JoinFilterGraph(IBaseFilter * iface, IFilterGraph *pGraph, LPCWSTR pName)
993 VideoRendererImpl *This = (VideoRendererImpl *)iface;
995 TRACE("(%p/%p)->(%p, %s)\n", This, iface, pGraph, debugstr_w(pName));
997 EnterCriticalSection(&This->csFilter);
1000 strcpyW(This->filterInfo.achName, pName);
1002 *This->filterInfo.achName = '\0';
1003 This->filterInfo.pGraph = pGraph; /* NOTE: do NOT increase ref. count */
1005 LeaveCriticalSection(&This->csFilter);
1010 static HRESULT WINAPI VideoRenderer_QueryVendorInfo(IBaseFilter * iface, LPWSTR *pVendorInfo)
1012 VideoRendererImpl *This = (VideoRendererImpl *)iface;
1013 TRACE("(%p/%p)->(%p)\n", This, iface, pVendorInfo);
1017 static const IBaseFilterVtbl VideoRenderer_Vtbl =
1019 VideoRenderer_QueryInterface,
1020 VideoRenderer_AddRef,
1021 VideoRenderer_Release,
1022 VideoRenderer_GetClassID,
1024 VideoRenderer_Pause,
1026 VideoRenderer_GetState,
1027 VideoRenderer_SetSyncSource,
1028 VideoRenderer_GetSyncSource,
1029 VideoRenderer_EnumPins,
1030 VideoRenderer_FindPin,
1031 VideoRenderer_QueryFilterInfo,
1032 VideoRenderer_JoinFilterGraph,
1033 VideoRenderer_QueryVendorInfo
1036 static HRESULT WINAPI VideoRenderer_InputPin_EndOfStream(IPin * iface)
1038 InputPin* This = (InputPin*)iface;
1039 IMediaEventSink* pEventSink;
1042 TRACE("(%p/%p)->()\n", This, iface);
1044 hr = IFilterGraph_QueryInterface(((VideoRendererImpl*)This->pin.pinInfo.pFilter)->filterInfo.pGraph, &IID_IMediaEventSink, (LPVOID*)&pEventSink);
1047 hr = IMediaEventSink_Notify(pEventSink, EC_COMPLETE, S_OK, 0);
1048 IMediaEventSink_Release(pEventSink);
1054 static HRESULT WINAPI VideoRenderer_InputPin_BeginFlush(IPin * iface)
1056 InputPin* This = (InputPin*)iface;
1057 VideoRendererImpl *pVideoRenderer = (VideoRendererImpl *)This->pin.pinInfo.pFilter;
1060 TRACE("(%p/%p)->()\n", This, iface);
1062 EnterCriticalSection(This->pin.pCritSec);
1063 if (pVideoRenderer->state == State_Paused)
1064 SetEvent(pVideoRenderer->blocked);
1066 hr = InputPin_BeginFlush(iface);
1067 LeaveCriticalSection(This->pin.pCritSec);
1072 static HRESULT WINAPI VideoRenderer_InputPin_EndFlush(IPin * iface)
1074 InputPin* This = (InputPin*)iface;
1075 VideoRendererImpl *pVideoRenderer = (VideoRendererImpl *)This->pin.pinInfo.pFilter;
1078 TRACE("(%p/%p)->()\n", This, iface);
1080 EnterCriticalSection(This->pin.pCritSec);
1081 if (pVideoRenderer->state == State_Paused)
1082 ResetEvent(pVideoRenderer->blocked);
1084 hr = InputPin_EndFlush(iface);
1085 LeaveCriticalSection(This->pin.pCritSec);
1090 static const IPinVtbl VideoRenderer_InputPin_Vtbl =
1092 InputPin_QueryInterface,
1096 InputPin_ReceiveConnection,
1097 IPinImpl_Disconnect,
1098 IPinImpl_ConnectedTo,
1099 IPinImpl_ConnectionMediaType,
1100 IPinImpl_QueryPinInfo,
1101 IPinImpl_QueryDirection,
1103 IPinImpl_QueryAccept,
1104 IPinImpl_EnumMediaTypes,
1105 IPinImpl_QueryInternalConnections,
1106 VideoRenderer_InputPin_EndOfStream,
1107 VideoRenderer_InputPin_BeginFlush,
1108 VideoRenderer_InputPin_EndFlush,
1112 /*** IUnknown methods ***/
1113 static HRESULT WINAPI Basicvideo_QueryInterface(IBasicVideo *iface,
1116 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1118 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1120 return VideoRenderer_QueryInterface((IBaseFilter*)This, riid, ppvObj);
1123 static ULONG WINAPI Basicvideo_AddRef(IBasicVideo *iface) {
1124 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1126 TRACE("(%p/%p)->()\n", This, iface);
1128 return VideoRenderer_AddRef((IBaseFilter*)This);
1131 static ULONG WINAPI Basicvideo_Release(IBasicVideo *iface) {
1132 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1134 TRACE("(%p/%p)->()\n", This, iface);
1136 return VideoRenderer_Release((IBaseFilter*)This);
1139 /*** IDispatch methods ***/
1140 static HRESULT WINAPI Basicvideo_GetTypeInfoCount(IBasicVideo *iface,
1142 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1144 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
1149 static HRESULT WINAPI Basicvideo_GetTypeInfo(IBasicVideo *iface,
1152 ITypeInfo**ppTInfo) {
1153 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1155 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
1160 static HRESULT WINAPI Basicvideo_GetIDsOfNames(IBasicVideo *iface,
1166 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1168 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1173 static HRESULT WINAPI Basicvideo_Invoke(IBasicVideo *iface,
1174 DISPID dispIdMember,
1178 DISPPARAMS*pDispParams,
1180 EXCEPINFO*pExepInfo,
1182 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1184 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);
1189 /*** IBasicVideo methods ***/
1190 static HRESULT WINAPI Basicvideo_get_AvgTimePerFrame(IBasicVideo *iface,
1191 REFTIME *pAvgTimePerFrame) {
1193 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1195 if (!This->pInputPin->pin.pConnectedTo)
1196 return VFW_E_NOT_CONNECTED;
1198 TRACE("(%p/%p)->(%p)\n", This, iface, pAvgTimePerFrame);
1200 pmt = &This->pInputPin->pin.mtCurrent;
1201 if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo)) {
1202 VIDEOINFOHEADER *vih = (VIDEOINFOHEADER*)pmt->pbFormat;
1203 *pAvgTimePerFrame = vih->AvgTimePerFrame;
1204 } else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2)) {
1205 VIDEOINFOHEADER2 *vih = (VIDEOINFOHEADER2*)pmt->pbFormat;
1206 *pAvgTimePerFrame = vih->AvgTimePerFrame;
1208 ERR("Unknown format type %s\n", qzdebugstr_guid(&pmt->formattype));
1209 *pAvgTimePerFrame = 0;
1214 static HRESULT WINAPI Basicvideo_get_BitRate(IBasicVideo *iface,
1216 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1218 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBitRate);
1223 static HRESULT WINAPI Basicvideo_get_BitErrorRate(IBasicVideo *iface,
1224 LONG *pBitErrorRate) {
1225 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1227 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBitErrorRate);
1232 static HRESULT WINAPI Basicvideo_get_VideoWidth(IBasicVideo *iface,
1233 LONG *pVideoWidth) {
1234 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1236 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoWidth);
1238 *pVideoWidth = This->VideoWidth;
1243 static HRESULT WINAPI Basicvideo_get_VideoHeight(IBasicVideo *iface,
1244 LONG *pVideoHeight) {
1245 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1247 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoHeight);
1249 *pVideoHeight = This->VideoHeight;
1254 static HRESULT WINAPI Basicvideo_put_SourceLeft(IBasicVideo *iface,
1256 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1258 TRACE("(%p/%p)->(%d)\n", This, iface, SourceLeft);
1260 This->SourceRect.left = SourceLeft;
1265 static HRESULT WINAPI Basicvideo_get_SourceLeft(IBasicVideo *iface,
1266 LONG *pSourceLeft) {
1267 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1269 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceLeft);
1271 *pSourceLeft = This->SourceRect.left;
1276 static HRESULT WINAPI Basicvideo_put_SourceWidth(IBasicVideo *iface,
1278 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1280 TRACE("(%p/%p)->(%d)\n", This, iface, SourceWidth);
1282 This->SourceRect.right = This->SourceRect.left + SourceWidth;
1287 static HRESULT WINAPI Basicvideo_get_SourceWidth(IBasicVideo *iface,
1288 LONG *pSourceWidth) {
1289 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1291 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceWidth);
1293 *pSourceWidth = This->SourceRect.right - This->SourceRect.left;
1298 static HRESULT WINAPI Basicvideo_put_SourceTop(IBasicVideo *iface,
1300 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1302 TRACE("(%p/%p)->(%d)\n", This, iface, SourceTop);
1304 This->SourceRect.top = SourceTop;
1309 static HRESULT WINAPI Basicvideo_get_SourceTop(IBasicVideo *iface,
1311 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1313 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceTop);
1315 *pSourceTop = This->SourceRect.top;
1320 static HRESULT WINAPI Basicvideo_put_SourceHeight(IBasicVideo *iface,
1321 LONG SourceHeight) {
1322 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1324 TRACE("(%p/%p)->(%d)\n", This, iface, SourceHeight);
1326 This->SourceRect.bottom = This->SourceRect.top + SourceHeight;
1331 static HRESULT WINAPI Basicvideo_get_SourceHeight(IBasicVideo *iface,
1332 LONG *pSourceHeight) {
1333 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1335 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceHeight);
1337 *pSourceHeight = This->SourceRect.bottom - This->SourceRect.top;
1342 static HRESULT WINAPI Basicvideo_put_DestinationLeft(IBasicVideo *iface,
1343 LONG DestinationLeft) {
1344 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1346 TRACE("(%p/%p)->(%d)\n", This, iface, DestinationLeft);
1348 This->DestRect.left = DestinationLeft;
1353 static HRESULT WINAPI Basicvideo_get_DestinationLeft(IBasicVideo *iface,
1354 LONG *pDestinationLeft) {
1355 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1357 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationLeft);
1359 *pDestinationLeft = This->DestRect.left;
1364 static HRESULT WINAPI Basicvideo_put_DestinationWidth(IBasicVideo *iface,
1365 LONG DestinationWidth) {
1366 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1368 TRACE("(%p/%p)->(%d)\n", This, iface, DestinationWidth);
1370 This->DestRect.right = This->DestRect.left + DestinationWidth;
1375 static HRESULT WINAPI Basicvideo_get_DestinationWidth(IBasicVideo *iface,
1376 LONG *pDestinationWidth) {
1377 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1379 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationWidth);
1381 *pDestinationWidth = This->DestRect.right - This->DestRect.left;
1386 static HRESULT WINAPI Basicvideo_put_DestinationTop(IBasicVideo *iface,
1387 LONG DestinationTop) {
1388 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1390 TRACE("(%p/%p)->(%d)\n", This, iface, DestinationTop);
1392 This->DestRect.top = DestinationTop;
1397 static HRESULT WINAPI Basicvideo_get_DestinationTop(IBasicVideo *iface,
1398 LONG *pDestinationTop) {
1399 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1401 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationTop);
1403 *pDestinationTop = This->DestRect.top;
1408 static HRESULT WINAPI Basicvideo_put_DestinationHeight(IBasicVideo *iface,
1409 LONG DestinationHeight) {
1410 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1412 TRACE("(%p/%p)->(%d)\n", This, iface, DestinationHeight);
1414 This->DestRect.right = This->DestRect.left + DestinationHeight;
1419 static HRESULT WINAPI Basicvideo_get_DestinationHeight(IBasicVideo *iface,
1420 LONG *pDestinationHeight) {
1421 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1423 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationHeight);
1425 *pDestinationHeight = This->DestRect.right - This->DestRect.left;
1430 static HRESULT WINAPI Basicvideo_SetSourcePosition(IBasicVideo *iface,
1435 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1437 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height);
1439 This->SourceRect.left = Left;
1440 This->SourceRect.top = Top;
1441 This->SourceRect.right = Left + Width;
1442 This->SourceRect.bottom = Top + Height;
1447 static HRESULT WINAPI Basicvideo_GetSourcePosition(IBasicVideo *iface,
1452 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1454 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1456 *pLeft = This->SourceRect.left;
1457 *pTop = This->SourceRect.top;
1458 *pWidth = This->SourceRect.right - This->SourceRect.left;
1459 *pHeight = This->SourceRect.bottom - This->SourceRect.top;
1464 static HRESULT WINAPI Basicvideo_SetDefaultSourcePosition(IBasicVideo *iface) {
1465 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1467 TRACE("(%p/%p)->()\n", This, iface);
1469 This->SourceRect.left = 0;
1470 This->SourceRect.top = 0;
1471 This->SourceRect.right = This->VideoWidth;
1472 This->SourceRect.bottom = This->VideoHeight;
1477 static HRESULT WINAPI Basicvideo_SetDestinationPosition(IBasicVideo *iface,
1482 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1484 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height);
1486 This->DestRect.left = Left;
1487 This->DestRect.top = Top;
1488 This->DestRect.right = Left + Width;
1489 This->DestRect.bottom = Top + Height;
1494 static HRESULT WINAPI Basicvideo_GetDestinationPosition(IBasicVideo *iface,
1499 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1501 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1503 *pLeft = This->DestRect.left;
1504 *pTop = This->DestRect.top;
1505 *pWidth = This->DestRect.right - This->DestRect.left;
1506 *pHeight = This->DestRect.bottom - This->DestRect.top;
1511 static HRESULT WINAPI Basicvideo_SetDefaultDestinationPosition(IBasicVideo *iface) {
1512 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1515 TRACE("(%p/%p)->()\n", This, iface);
1517 if (!GetClientRect(This->hWnd, &rect))
1520 This->SourceRect.left = 0;
1521 This->SourceRect.top = 0;
1522 This->SourceRect.right = rect.right;
1523 This->SourceRect.bottom = rect.bottom;
1528 static HRESULT WINAPI Basicvideo_GetVideoSize(IBasicVideo *iface,
1531 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1533 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
1535 *pWidth = This->VideoWidth;
1536 *pHeight = This->VideoHeight;
1541 static HRESULT WINAPI Basicvideo_GetVideoPaletteEntries(IBasicVideo *iface,
1546 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1548 FIXME("(%p/%p)->(%d, %d, %p, %p): stub !!!\n", This, iface, StartIndex, Entries, pRetrieved, pPalette);
1553 static HRESULT WINAPI Basicvideo_GetCurrentImage(IBasicVideo *iface,
1556 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1557 BITMAPINFOHEADER *bmiHeader;
1559 AM_MEDIA_TYPE *amt = &This->pInputPin->pin.mtCurrent;
1562 FIXME("(%p/%p)->(%p, %p): partial stub\n", This, iface, pBufferSize, pDIBImage);
1564 EnterCriticalSection(&This->csFilter);
1566 if (!This->sample_held)
1568 LeaveCriticalSection(&This->csFilter);
1569 return (This->state == State_Paused ? E_UNEXPECTED : VFW_E_NOT_PAUSED);
1572 if (IsEqualIID(&amt->formattype, &FORMAT_VideoInfo))
1574 bmiHeader = &((VIDEOINFOHEADER *)amt->pbFormat)->bmiHeader;
1576 else if (IsEqualIID(&amt->formattype, &FORMAT_VideoInfo2))
1578 bmiHeader = &((VIDEOINFOHEADER2 *)amt->pbFormat)->bmiHeader;
1582 FIXME("Unknown type %s\n", debugstr_guid(&amt->subtype));
1583 LeaveCriticalSection(&This->csFilter);
1584 return VFW_E_RUNTIME_ERROR;
1587 needed_size = bmiHeader->biSize;
1588 needed_size += IMediaSample_GetActualDataLength(This->sample_held);
1592 *pBufferSize = needed_size;
1593 LeaveCriticalSection(&This->csFilter);
1597 if (needed_size < *pBufferSize)
1599 ERR("Buffer too small %u/%u\n", needed_size, *pBufferSize);
1600 LeaveCriticalSection(&This->csFilter);
1603 *pBufferSize = needed_size;
1605 memcpy(pDIBImage, bmiHeader, bmiHeader->biSize);
1606 IMediaSample_GetPointer(This->sample_held, (BYTE **)&ptr);
1607 memcpy((char *)pDIBImage + bmiHeader->biSize, ptr, IMediaSample_GetActualDataLength(This->sample_held));
1609 LeaveCriticalSection(&This->csFilter);
1614 static HRESULT WINAPI Basicvideo_IsUsingDefaultSource(IBasicVideo *iface) {
1615 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1617 FIXME("(%p/%p)->(): stub !!!\n", This, iface);
1622 static HRESULT WINAPI Basicvideo_IsUsingDefaultDestination(IBasicVideo *iface) {
1623 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1625 FIXME("(%p/%p)->(): stub !!!\n", This, iface);
1631 static const IBasicVideoVtbl IBasicVideo_VTable =
1633 Basicvideo_QueryInterface,
1636 Basicvideo_GetTypeInfoCount,
1637 Basicvideo_GetTypeInfo,
1638 Basicvideo_GetIDsOfNames,
1640 Basicvideo_get_AvgTimePerFrame,
1641 Basicvideo_get_BitRate,
1642 Basicvideo_get_BitErrorRate,
1643 Basicvideo_get_VideoWidth,
1644 Basicvideo_get_VideoHeight,
1645 Basicvideo_put_SourceLeft,
1646 Basicvideo_get_SourceLeft,
1647 Basicvideo_put_SourceWidth,
1648 Basicvideo_get_SourceWidth,
1649 Basicvideo_put_SourceTop,
1650 Basicvideo_get_SourceTop,
1651 Basicvideo_put_SourceHeight,
1652 Basicvideo_get_SourceHeight,
1653 Basicvideo_put_DestinationLeft,
1654 Basicvideo_get_DestinationLeft,
1655 Basicvideo_put_DestinationWidth,
1656 Basicvideo_get_DestinationWidth,
1657 Basicvideo_put_DestinationTop,
1658 Basicvideo_get_DestinationTop,
1659 Basicvideo_put_DestinationHeight,
1660 Basicvideo_get_DestinationHeight,
1661 Basicvideo_SetSourcePosition,
1662 Basicvideo_GetSourcePosition,
1663 Basicvideo_SetDefaultSourcePosition,
1664 Basicvideo_SetDestinationPosition,
1665 Basicvideo_GetDestinationPosition,
1666 Basicvideo_SetDefaultDestinationPosition,
1667 Basicvideo_GetVideoSize,
1668 Basicvideo_GetVideoPaletteEntries,
1669 Basicvideo_GetCurrentImage,
1670 Basicvideo_IsUsingDefaultSource,
1671 Basicvideo_IsUsingDefaultDestination
1675 /*** IUnknown methods ***/
1676 static HRESULT WINAPI Videowindow_QueryInterface(IVideoWindow *iface,
1679 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1681 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1683 return VideoRenderer_QueryInterface((IBaseFilter*)This, riid, ppvObj);
1686 static ULONG WINAPI Videowindow_AddRef(IVideoWindow *iface) {
1687 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1689 TRACE("(%p/%p)->()\n", This, iface);
1691 return VideoRenderer_AddRef((IBaseFilter*)This);
1694 static ULONG WINAPI Videowindow_Release(IVideoWindow *iface) {
1695 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1697 TRACE("(%p/%p)->()\n", This, iface);
1699 return VideoRenderer_Release((IBaseFilter*)This);
1702 /*** IDispatch methods ***/
1703 static HRESULT WINAPI Videowindow_GetTypeInfoCount(IVideoWindow *iface,
1705 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1707 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
1712 static HRESULT WINAPI Videowindow_GetTypeInfo(IVideoWindow *iface,
1715 ITypeInfo**ppTInfo) {
1716 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1718 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
1723 static HRESULT WINAPI Videowindow_GetIDsOfNames(IVideoWindow *iface,
1729 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1731 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1736 static HRESULT WINAPI Videowindow_Invoke(IVideoWindow *iface,
1737 DISPID dispIdMember,
1741 DISPPARAMS*pDispParams,
1743 EXCEPINFO*pExepInfo,
1745 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1747 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);
1752 /*** IVideoWindow methods ***/
1753 static HRESULT WINAPI Videowindow_put_Caption(IVideoWindow *iface,
1755 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1757 TRACE("(%p/%p)->(%s (%p))\n", This, iface, debugstr_w(strCaption), strCaption);
1759 if (!SetWindowTextW(This->hWnd, strCaption))
1765 static HRESULT WINAPI Videowindow_get_Caption(IVideoWindow *iface,
1767 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1769 TRACE("(%p/%p)->(%p)\n", This, iface, strCaption);
1771 GetWindowTextW(This->hWnd, (LPWSTR)strCaption, 100);
1776 static HRESULT WINAPI Videowindow_put_WindowStyle(IVideoWindow *iface,
1778 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1781 old = GetWindowLongA(This->hWnd, GWL_STYLE);
1783 TRACE("(%p/%p)->(%x -> %x)\n", This, iface, old, WindowStyle);
1785 if (WindowStyle & (WS_DISABLED|WS_HSCROLL|WS_ICONIC|WS_MAXIMIZE|WS_MINIMIZE|WS_VSCROLL))
1786 return E_INVALIDARG;
1788 SetWindowLongA(This->hWnd, GWL_STYLE, WindowStyle);
1789 SetWindowPos(This->hWnd,0,0,0,0,0,SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOZORDER);
1790 This->WindowStyle = WindowStyle;
1795 static HRESULT WINAPI Videowindow_get_WindowStyle(IVideoWindow *iface,
1796 LONG *WindowStyle) {
1797 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1799 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyle);
1801 *WindowStyle = This->WindowStyle;
1806 static HRESULT WINAPI Videowindow_put_WindowStyleEx(IVideoWindow *iface,
1807 LONG WindowStyleEx) {
1808 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1810 TRACE("(%p/%p)->(%d)\n", This, iface, WindowStyleEx);
1812 if (!SetWindowLongA(This->hWnd, GWL_EXSTYLE, WindowStyleEx))
1818 static HRESULT WINAPI Videowindow_get_WindowStyleEx(IVideoWindow *iface,
1819 LONG *WindowStyleEx) {
1820 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1822 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyleEx);
1824 *WindowStyleEx = GetWindowLongA(This->hWnd, GWL_EXSTYLE);
1829 static HRESULT WINAPI Videowindow_put_AutoShow(IVideoWindow *iface,
1831 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1833 TRACE("(%p/%p)->(%d)\n", This, iface, AutoShow);
1835 This->AutoShow = AutoShow;
1840 static HRESULT WINAPI Videowindow_get_AutoShow(IVideoWindow *iface,
1842 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1844 TRACE("(%p/%p)->(%p)\n", This, iface, AutoShow);
1846 *AutoShow = This->AutoShow;
1851 static HRESULT WINAPI Videowindow_put_WindowState(IVideoWindow *iface,
1853 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1855 TRACE("(%p/%p)->(%d)\n", This, iface, WindowState);
1856 ShowWindow(This->hWnd, WindowState);
1860 static HRESULT WINAPI Videowindow_get_WindowState(IVideoWindow *iface,
1861 LONG *WindowState) {
1862 WINDOWPLACEMENT place;
1863 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1865 place.length = sizeof(place);
1866 GetWindowPlacement(This->hWnd, &place);
1867 TRACE("(%p/%p)->(%p)\n", This, iface, WindowState);
1868 *WindowState = place.showCmd;
1873 static HRESULT WINAPI Videowindow_put_BackgroundPalette(IVideoWindow *iface,
1874 LONG BackgroundPalette) {
1875 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1877 FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, BackgroundPalette);
1882 static HRESULT WINAPI Videowindow_get_BackgroundPalette(IVideoWindow *iface,
1883 LONG *pBackgroundPalette) {
1884 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1886 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBackgroundPalette);
1891 static HRESULT WINAPI Videowindow_put_Visible(IVideoWindow *iface,
1893 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1895 TRACE("(%p/%p)->(%d)\n", This, iface, Visible);
1897 ShowWindow(This->hWnd, Visible ? SW_SHOW : SW_HIDE);
1902 static HRESULT WINAPI Videowindow_get_Visible(IVideoWindow *iface,
1904 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1906 TRACE("(%p/%p)->(%p)\n", This, iface, pVisible);
1908 *pVisible = IsWindowVisible(This->hWnd);
1913 static HRESULT WINAPI Videowindow_put_Left(IVideoWindow *iface,
1915 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1917 TRACE("(%p/%p)->(%d)\n", This, iface, Left);
1919 if (!SetWindowPos(This->hWnd, NULL, Left, This->WindowPos.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE))
1922 This->WindowPos.left = Left;
1927 static HRESULT WINAPI Videowindow_get_Left(IVideoWindow *iface,
1929 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1931 TRACE("(%p/%p)->(%p)\n", This, iface, pLeft);
1933 *pLeft = This->WindowPos.left;
1938 static HRESULT WINAPI Videowindow_put_Width(IVideoWindow *iface,
1940 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1942 TRACE("(%p/%p)->(%d)\n", This, iface, Width);
1944 if (!SetWindowPos(This->hWnd, NULL, 0, 0, Width, This->WindowPos.bottom-This->WindowPos.top, SWP_NOZORDER|SWP_NOMOVE))
1947 This->WindowPos.right = This->WindowPos.left + Width;
1952 static HRESULT WINAPI Videowindow_get_Width(IVideoWindow *iface,
1954 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1956 TRACE("(%p/%p)->(%p)\n", This, iface, pWidth);
1958 *pWidth = This->WindowPos.right - This->WindowPos.left;
1963 static HRESULT WINAPI Videowindow_put_Top(IVideoWindow *iface,
1965 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1967 TRACE("(%p/%p)->(%d)\n", This, iface, Top);
1969 if (!SetWindowPos(This->hWnd, NULL, This->WindowPos.left, Top, 0, 0, SWP_NOZORDER|SWP_NOSIZE))
1972 This->WindowPos.top = Top;
1977 static HRESULT WINAPI Videowindow_get_Top(IVideoWindow *iface,
1979 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1981 TRACE("(%p/%p)->(%p)\n", This, iface, pTop);
1983 *pTop = This->WindowPos.top;
1988 static HRESULT WINAPI Videowindow_put_Height(IVideoWindow *iface,
1990 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1992 TRACE("(%p/%p)->(%d)\n", This, iface, Height);
1994 if (!SetWindowPos(This->hWnd, NULL, 0, 0, This->WindowPos.right-This->WindowPos.left, Height, SWP_NOZORDER|SWP_NOMOVE))
1997 This->WindowPos.bottom = This->WindowPos.top + Height;
2002 static HRESULT WINAPI Videowindow_get_Height(IVideoWindow *iface,
2004 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2006 TRACE("(%p/%p)->(%p)\n", This, iface, pHeight);
2008 *pHeight = This->WindowPos.bottom - This->WindowPos.top;
2013 static HRESULT WINAPI Videowindow_put_Owner(IVideoWindow *iface,
2015 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2017 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Owner);
2019 SetParent(This->hWnd, (HWND)Owner);
2020 if (This->WindowStyle & WS_CHILD)
2022 LONG old = GetWindowLongA(This->hWnd, GWL_STYLE);
2023 if (old != This->WindowStyle)
2025 SetWindowLongA(This->hWnd, GWL_STYLE, This->WindowStyle);
2026 SetWindowPos(This->hWnd,0,0,0,0,0,SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOZORDER);
2033 static HRESULT WINAPI Videowindow_get_Owner(IVideoWindow *iface,
2035 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2037 TRACE("(%p/%p)->(%p)\n", This, iface, Owner);
2039 *(HWND*)Owner = GetParent(This->hWnd);
2044 static HRESULT WINAPI Videowindow_put_MessageDrain(IVideoWindow *iface,
2046 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2048 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Drain);
2050 This->hWndMsgDrain = (HWND)Drain;
2055 static HRESULT WINAPI Videowindow_get_MessageDrain(IVideoWindow *iface,
2057 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2059 TRACE("(%p/%p)->(%p)\n", This, iface, Drain);
2061 *Drain = (OAHWND)This->hWndMsgDrain;
2066 static HRESULT WINAPI Videowindow_get_BorderColor(IVideoWindow *iface,
2068 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2070 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, Color);
2075 static HRESULT WINAPI Videowindow_put_BorderColor(IVideoWindow *iface,
2077 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2079 FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, Color);
2084 static HRESULT WINAPI Videowindow_get_FullScreenMode(IVideoWindow *iface,
2085 LONG *FullScreenMode) {
2086 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2088 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, FullScreenMode);
2093 static HRESULT WINAPI Videowindow_put_FullScreenMode(IVideoWindow *iface,
2094 LONG FullScreenMode) {
2095 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2097 FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, FullScreenMode);
2102 static HRESULT WINAPI Videowindow_SetWindowForeground(IVideoWindow *iface,
2104 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2109 TRACE("(%p/%p)->(%d)\n", This, iface, Focus);
2111 if ((Focus != FALSE) && (Focus != TRUE))
2112 return E_INVALIDARG;
2114 hr = IPin_ConnectedTo((IPin *)This->pInputPin, &pPin);
2115 if ((hr != S_OK) || !pPin)
2116 return VFW_E_NOT_CONNECTED;
2119 ret = SetForegroundWindow(This->hWnd);
2121 ret = SetWindowPos(This->hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
2129 static HRESULT WINAPI Videowindow_NotifyOwnerMessage(IVideoWindow *iface,
2134 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2136 TRACE("(%p/%p)->(%08lx, %d, %08lx, %08lx)\n", This, iface, hwnd, uMsg, wParam, lParam);
2138 if (!PostMessageA(This->hWnd, uMsg, wParam, lParam))
2144 static HRESULT WINAPI Videowindow_SetWindowPosition(IVideoWindow *iface,
2149 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2151 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height);
2153 if (!SetWindowPos(This->hWnd, NULL, Left, Top, Width, Height, SWP_NOZORDER))
2156 This->WindowPos.left = Left;
2157 This->WindowPos.top = Top;
2158 This->WindowPos.right = Left + Width;
2159 This->WindowPos.bottom = Top + Height;
2164 static HRESULT WINAPI Videowindow_GetWindowPosition(IVideoWindow *iface,
2169 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2171 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
2173 *pLeft = This->WindowPos.left;
2174 *pTop = This->WindowPos.top;
2175 *pWidth = This->WindowPos.right - This->WindowPos.left;
2176 *pHeight = This->WindowPos.bottom - This->WindowPos.top;
2181 static HRESULT WINAPI Videowindow_GetMinIdealImageSize(IVideoWindow *iface,
2184 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2186 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This, iface, pWidth, pHeight);
2188 *pWidth = This->VideoWidth;
2189 *pHeight = This->VideoHeight;
2194 static HRESULT WINAPI Videowindow_GetMaxIdealImageSize(IVideoWindow *iface,
2197 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2199 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This, iface, pWidth, pHeight);
2201 *pWidth = This->VideoWidth;
2202 *pHeight = This->VideoHeight;
2207 static HRESULT WINAPI Videowindow_GetRestorePosition(IVideoWindow *iface,
2212 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2214 FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This, iface, pLeft, pTop, pWidth, pHeight);
2219 static HRESULT WINAPI Videowindow_HideCursor(IVideoWindow *iface,
2221 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2223 FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, HideCursor);
2228 static HRESULT WINAPI Videowindow_IsCursorHidden(IVideoWindow *iface,
2229 LONG *CursorHidden) {
2230 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2232 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, CursorHidden);
2237 static const IVideoWindowVtbl IVideoWindow_VTable =
2239 Videowindow_QueryInterface,
2241 Videowindow_Release,
2242 Videowindow_GetTypeInfoCount,
2243 Videowindow_GetTypeInfo,
2244 Videowindow_GetIDsOfNames,
2246 Videowindow_put_Caption,
2247 Videowindow_get_Caption,
2248 Videowindow_put_WindowStyle,
2249 Videowindow_get_WindowStyle,
2250 Videowindow_put_WindowStyleEx,
2251 Videowindow_get_WindowStyleEx,
2252 Videowindow_put_AutoShow,
2253 Videowindow_get_AutoShow,
2254 Videowindow_put_WindowState,
2255 Videowindow_get_WindowState,
2256 Videowindow_put_BackgroundPalette,
2257 Videowindow_get_BackgroundPalette,
2258 Videowindow_put_Visible,
2259 Videowindow_get_Visible,
2260 Videowindow_put_Left,
2261 Videowindow_get_Left,
2262 Videowindow_put_Width,
2263 Videowindow_get_Width,
2264 Videowindow_put_Top,
2265 Videowindow_get_Top,
2266 Videowindow_put_Height,
2267 Videowindow_get_Height,
2268 Videowindow_put_Owner,
2269 Videowindow_get_Owner,
2270 Videowindow_put_MessageDrain,
2271 Videowindow_get_MessageDrain,
2272 Videowindow_get_BorderColor,
2273 Videowindow_put_BorderColor,
2274 Videowindow_get_FullScreenMode,
2275 Videowindow_put_FullScreenMode,
2276 Videowindow_SetWindowForeground,
2277 Videowindow_NotifyOwnerMessage,
2278 Videowindow_SetWindowPosition,
2279 Videowindow_GetWindowPosition,
2280 Videowindow_GetMinIdealImageSize,
2281 Videowindow_GetMaxIdealImageSize,
2282 Videowindow_GetRestorePosition,
2283 Videowindow_HideCursor,
2284 Videowindow_IsCursorHidden