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;
55 static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl;
56 static const IQualityControlVtbl VideoRenderer_QualityControl_Vtbl = {
57 QualityControlImpl_QueryInterface,
58 QualityControlImpl_AddRef,
59 QualityControlImpl_Release,
60 QualityControlImpl_Notify,
61 QualityControlImpl_SetSink
64 typedef struct VideoRendererImpl
67 const IBasicVideoVtbl * IBasicVideo_vtbl;
68 const IVideoWindowVtbl * IVideoWindow_vtbl;
69 const IUnknownVtbl * IInner_vtbl;
70 const IAMFilterMiscFlagsVtbl *IAMFilterMiscFlags_vtbl;
71 IUnknown *seekthru_unk;
72 QualityControlImpl qcimpl;
74 BaseInputPin *pInputPin;
97 /* During pause we can hold a single sample, for use in GetCurrentImage */
98 IMediaSample *sample_held;
101 static LRESULT CALLBACK VideoWndProcW(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
103 VideoRendererImpl* pVideoRenderer = (VideoRendererImpl*)GetWindowLongPtrW(hwnd, 0);
104 LPRECT lprect = (LPRECT)lParam;
106 if (pVideoRenderer && pVideoRenderer->hWndMsgDrain)
112 case WM_LBUTTONDBLCLK:
115 case WM_MBUTTONDBLCLK:
118 case WM_MOUSEACTIVATE:
120 case WM_NCLBUTTONDBLCLK:
121 case WM_NCLBUTTONDOWN:
123 case WM_NCMBUTTONDBLCLK:
124 case WM_NCMBUTTONDOWN:
127 case WM_NCRBUTTONDBLCLK:
128 case WM_NCRBUTTONDOWN:
130 case WM_RBUTTONDBLCLK:
133 PostMessageW(pVideoRenderer->hWndMsgDrain, uMsg, wParam, lParam);
143 /* TRACE("WM_SIZING %d %d %d %d\n", lprect->left, lprect->top, lprect->right, lprect->bottom); */
144 SetWindowPos(hwnd, NULL, lprect->left, lprect->top, lprect->right - lprect->left, lprect->bottom - lprect->top, SWP_NOZORDER);
145 GetClientRect(hwnd, &pVideoRenderer->DestRect);
146 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
147 pVideoRenderer->DestRect.left,
148 pVideoRenderer->DestRect.top,
149 pVideoRenderer->DestRect.right - pVideoRenderer->DestRect.left,
150 pVideoRenderer->DestRect.bottom - pVideoRenderer->DestRect.top);
153 TRACE("WM_SIZE %d %d\n", LOWORD(lParam), HIWORD(lParam));
154 GetClientRect(hwnd, &pVideoRenderer->DestRect);
155 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
156 pVideoRenderer->DestRect.left,
157 pVideoRenderer->DestRect.top,
158 pVideoRenderer->DestRect.right - pVideoRenderer->DestRect.left,
159 pVideoRenderer->DestRect.bottom - pVideoRenderer->DestRect.top);
162 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
167 static const WCHAR classnameW[] = { 'W','i','n','e',' ','A','c','t','i','v','e','M','o','v','i','e',' ','C','l','a','s','s',0 };
168 static const WCHAR windownameW[] = { 'A','c','t','i','v','e','M','o','v','i','e',' ','W','i','n','d','o','w',0 };
170 static BOOL video_register_windowclass(void) {
172 if (wnd_class_registered)
176 winclass.lpfnWndProc = VideoWndProcW;
177 winclass.cbClsExtra = 0;
178 winclass.cbWndExtra = sizeof(VideoRendererImpl*);
179 winclass.hInstance = NULL;
180 winclass.hIcon = NULL;
181 winclass.hCursor = NULL;
182 winclass.hbrBackground = GetStockObject(BLACK_BRUSH);
183 winclass.lpszMenuName = NULL;
184 winclass.lpszClassName = classnameW;
185 if (!RegisterClassW(&winclass))
187 ERR("Unable to register window class: %u\n", GetLastError());
190 wnd_class_registered = 1;
194 void video_unregister_windowclass(void) {
195 if (!wnd_class_registered)
197 UnregisterClassW(classnameW, NULL);
200 static BOOL CreateRenderingWindow(VideoRendererImpl* This)
202 TRACE("(%p)->()\n", This);
203 if (!video_register_windowclass())
205 This->hWnd = CreateWindowExW(0, classnameW, windownameW, WS_SIZEBOX,
206 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL,
211 ERR("Unable to create window\n");
215 SetWindowLongPtrW(This->hWnd, 0, (LONG_PTR)This);
220 static DWORD WINAPI MessageLoop(LPVOID lpParameter)
222 VideoRendererImpl* This = lpParameter;
226 TRACE("Starting message loop\n");
228 if (!CreateRenderingWindow(This))
230 This->ThreadResult = FALSE;
231 SetEvent(This->hEvent);
235 This->ThreadResult = TRUE;
236 SetEvent(This->hEvent);
238 while ((fGotMessage = GetMessageW(&msg, NULL, 0, 0)) != 0 && fGotMessage != -1)
240 TranslateMessage(&msg);
241 DispatchMessageW(&msg);
244 TRACE("End of message loop\n");
249 static BOOL CreateRenderingSubsystem(VideoRendererImpl* This)
251 This->hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
255 This->hThread = CreateThread(NULL, 0, MessageLoop, This, 0, &This->ThreadID);
258 CloseHandle(This->hEvent);
262 WaitForSingleObject(This->hEvent, INFINITE);
264 if (!This->ThreadResult)
266 CloseHandle(This->hEvent);
267 CloseHandle(This->hThread);
274 static void VideoRenderer_AutoShowWindow(VideoRendererImpl *This) {
275 if (!This->init && (!This->WindowPos.right || !This->WindowPos.top))
277 DWORD style = GetWindowLongW(This->hWnd, GWL_STYLE);
278 DWORD style_ex = GetWindowLongW(This->hWnd, GWL_EXSTYLE);
280 if (!This->WindowPos.right)
282 This->WindowPos.left = This->SourceRect.left;
283 This->WindowPos.right = This->SourceRect.right;
285 if (!This->WindowPos.bottom)
287 This->WindowPos.top = This->SourceRect.top;
288 This->WindowPos.bottom = This->SourceRect.bottom;
291 AdjustWindowRectEx(&This->WindowPos, style, TRUE, style_ex);
293 TRACE("WindowPos: %d %d %d %d\n", This->WindowPos.left, This->WindowPos.top, This->WindowPos.right, This->WindowPos.bottom);
294 SetWindowPos(This->hWnd, NULL,
295 This->WindowPos.left,
297 This->WindowPos.right - This->WindowPos.left,
298 This->WindowPos.bottom - This->WindowPos.top,
299 SWP_NOZORDER|SWP_NOMOVE|SWP_DEFERERASE);
301 GetClientRect(This->hWnd, &This->DestRect);
303 else if (!This->init)
304 This->DestRect = This->WindowPos;
307 ShowWindow(This->hWnd, SW_SHOW);
310 static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data, DWORD size)
316 BITMAPINFOHEADER *bmiHeader;
318 TRACE("(%p)->(%p, %d)\n", This, data, size);
320 sdesc.dwSize = sizeof(sdesc);
321 hr = IPin_ConnectionMediaType((IPin *)This->pInputPin, &amt);
323 ERR("Unable to retrieve media type\n");
327 if (IsEqualIID(&amt.formattype, &FORMAT_VideoInfo))
329 bmiHeader = &((VIDEOINFOHEADER *)amt.pbFormat)->bmiHeader;
331 else if (IsEqualIID(&amt.formattype, &FORMAT_VideoInfo2))
333 bmiHeader = &((VIDEOINFOHEADER2 *)amt.pbFormat)->bmiHeader;
337 FIXME("Unknown type %s\n", debugstr_guid(&amt.subtype));
338 return VFW_E_RUNTIME_ERROR;
341 TRACE("biSize = %d\n", bmiHeader->biSize);
342 TRACE("biWidth = %d\n", bmiHeader->biWidth);
343 TRACE("biHeight = %d\n", bmiHeader->biHeight);
344 TRACE("biPlanes = %d\n", bmiHeader->biPlanes);
345 TRACE("biBitCount = %d\n", bmiHeader->biBitCount);
346 TRACE("biCompression = %s\n", debugstr_an((LPSTR)&(bmiHeader->biCompression), 4));
347 TRACE("biSizeImage = %d\n", bmiHeader->biSizeImage);
349 hDC = GetDC(This->hWnd);
352 ERR("Cannot get DC from window!\n");
356 TRACE("Src Rect: %d %d %d %d\n", This->SourceRect.left, This->SourceRect.top, This->SourceRect.right, This->SourceRect.bottom);
357 TRACE("Dst Rect: %d %d %d %d\n", This->DestRect.left, This->DestRect.top, This->DestRect.right, This->DestRect.bottom);
359 StretchDIBits(hDC, This->DestRect.left, This->DestRect.top, This->DestRect.right -This->DestRect.left,
360 This->DestRect.bottom - This->DestRect.top, This->SourceRect.left, This->SourceRect.top,
361 This->SourceRect.right - This->SourceRect.left, This->SourceRect.bottom - This->SourceRect.top,
362 data, (BITMAPINFO *)bmiHeader, DIB_RGB_COLORS, SRCCOPY);
364 ReleaseDC(This->hWnd, hDC);
369 static HRESULT WINAPI VideoRenderer_Receive(BaseInputPin* pin, IMediaSample * pSample)
371 VideoRendererImpl *This = (VideoRendererImpl *)pin->pin.pinInfo.pFilter;
372 LPBYTE pbSrcStream = NULL;
373 LONG cbSrcStream = 0;
374 REFERENCE_TIME tStart, tStop;
377 TRACE("(%p)->(%p)\n", pin, pSample);
379 EnterCriticalSection(&This->filter.csFilter);
381 if (This->pInputPin->flushing || This->pInputPin->end_of_stream)
383 LeaveCriticalSection(&This->filter.csFilter);
387 if (This->filter.state == State_Stopped)
389 LeaveCriticalSection(&This->filter.csFilter);
390 return VFW_E_WRONG_STATE;
393 if (IMediaSample_GetMediaTime(pSample, &tStart, &tStop) == S_OK)
394 MediaSeekingPassThru_RegisterMediaTime(This->seekthru_unk, tStart);
396 /* Preroll means the sample isn't shown, this is used for key frames and things like that */
397 if (IMediaSample_IsPreroll(pSample) == S_OK) {
398 LeaveCriticalSection(&This->filter.csFilter);
402 hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
405 ERR("Cannot get pointer to sample data (%x)\n", hr);
406 LeaveCriticalSection(&This->filter.csFilter);
410 cbSrcStream = IMediaSample_GetActualDataLength(pSample);
412 TRACE("val %p %d\n", pbSrcStream, cbSrcStream);
414 #if 0 /* For debugging purpose */
417 for(i = 0; i < cbSrcStream; i++)
419 if ((i!=0) && !(i%16))
421 TRACE("%02x ", pbSrcStream[i]);
427 SetEvent(This->hEvent);
428 if (This->filter.state == State_Paused)
430 VideoRenderer_SendSampleData(This, pbSrcStream, cbSrcStream);
431 This->sample_held = pSample;
432 LeaveCriticalSection(&This->filter.csFilter);
433 WaitForSingleObject(This->blocked, INFINITE);
434 EnterCriticalSection(&This->filter.csFilter);
435 This->sample_held = NULL;
436 if (This->filter.state == State_Paused)
439 LeaveCriticalSection(&This->filter.csFilter);
442 if (This->filter.state == State_Stopped)
444 LeaveCriticalSection(&This->filter.csFilter);
445 return VFW_E_WRONG_STATE;
448 hr = QualityControlRender_WaitFor(&This->qcimpl, pSample, This->blocked);
450 QualityControlRender_BeginRender(&This->qcimpl);
451 VideoRenderer_SendSampleData(This, pbSrcStream, cbSrcStream);
452 QualityControlRender_EndRender(&This->qcimpl);
454 QualityControlRender_DoQOS(&This->qcimpl);
456 LeaveCriticalSection(&This->filter.csFilter);
460 static HRESULT WINAPI VideoRenderer_CheckMediaType(BasePin *iface, const AM_MEDIA_TYPE * pmt)
462 BaseInputPin* pin = (BaseInputPin*)iface;
463 VideoRendererImpl *This = (VideoRendererImpl *)pin->pin.pinInfo.pFilter;
465 if (!IsEqualIID(&pmt->majortype, &MEDIATYPE_Video))
468 if (IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB32) ||
469 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB24) ||
470 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB565) ||
471 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB8))
475 if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo))
477 VIDEOINFOHEADER *format = (VIDEOINFOHEADER *)pmt->pbFormat;
478 This->SourceRect.left = 0;
479 This->SourceRect.top = 0;
480 This->SourceRect.right = This->VideoWidth = format->bmiHeader.biWidth;
481 height = format->bmiHeader.biHeight;
483 This->SourceRect.bottom = This->VideoHeight = -height;
485 This->SourceRect.bottom = This->VideoHeight = height;
487 else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2))
489 VIDEOINFOHEADER2 *format2 = (VIDEOINFOHEADER2 *)pmt->pbFormat;
491 This->SourceRect.left = 0;
492 This->SourceRect.top = 0;
493 This->SourceRect.right = This->VideoWidth = format2->bmiHeader.biWidth;
494 height = format2->bmiHeader.biHeight;
496 This->SourceRect.bottom = This->VideoHeight = -height;
498 This->SourceRect.bottom = This->VideoHeight = height;
502 WARN("Format type %s not supported\n", debugstr_guid(&pmt->formattype));
510 static IPin* WINAPI VideoRenderer_GetPin(BaseFilter *iface, int pos)
512 VideoRendererImpl *This = (VideoRendererImpl *)iface;
514 if (pos >= 1 || pos < 0)
517 IPin_AddRef((IPin *)This->pInputPin);
518 return (IPin *)This->pInputPin;
521 static LONG WINAPI VideoRenderer_GetPinCount(BaseFilter *iface)
526 static const BaseFilterFuncTable BaseFuncTable = {
527 VideoRenderer_GetPin,
528 VideoRenderer_GetPinCount
531 static const BasePinFuncTable input_BaseFuncTable = {
532 VideoRenderer_CheckMediaType,
534 BasePinImpl_GetMediaTypeVersion,
535 BasePinImpl_GetMediaType
538 static const BaseInputPinFuncTable input_BaseInputFuncTable = {
539 VideoRenderer_Receive
542 HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
546 VideoRendererImpl * pVideoRenderer;
547 ISeekingPassThru *passthru;
549 TRACE("(%p, %p)\n", pUnkOuter, ppv);
553 pVideoRenderer = CoTaskMemAlloc(sizeof(VideoRendererImpl));
554 pVideoRenderer->pUnkOuter = pUnkOuter;
555 pVideoRenderer->bUnkOuterValid = FALSE;
556 pVideoRenderer->bAggregatable = FALSE;
557 pVideoRenderer->IInner_vtbl = &IInner_VTable;
558 pVideoRenderer->IAMFilterMiscFlags_vtbl = &IAMFilterMiscFlags_Vtbl;
560 BaseFilter_Init(&pVideoRenderer->filter, &VideoRenderer_Vtbl, &CLSID_VideoRenderer, (DWORD_PTR)(__FILE__ ": VideoRendererImpl.csFilter"), &BaseFuncTable);
562 pVideoRenderer->IBasicVideo_vtbl = &IBasicVideo_VTable;
563 pVideoRenderer->IVideoWindow_vtbl = &IVideoWindow_VTable;
565 pVideoRenderer->init = 0;
566 pVideoRenderer->AutoShow = 1;
567 ZeroMemory(&pVideoRenderer->SourceRect, sizeof(RECT));
568 ZeroMemory(&pVideoRenderer->DestRect, sizeof(RECT));
569 ZeroMemory(&pVideoRenderer->WindowPos, sizeof(RECT));
570 pVideoRenderer->hWndMsgDrain = pVideoRenderer->hWndOwner = NULL;
571 pVideoRenderer->WindowStyle = WS_OVERLAPPED;
573 /* construct input pin */
574 piInput.dir = PINDIR_INPUT;
575 piInput.pFilter = (IBaseFilter *)pVideoRenderer;
576 lstrcpynW(piInput.achName, wcsInputPinName, sizeof(piInput.achName) / sizeof(piInput.achName[0]));
578 hr = BaseInputPin_Construct(&VideoRenderer_InputPin_Vtbl, &piInput, &input_BaseFuncTable, &input_BaseInputFuncTable, &pVideoRenderer->filter.csFilter, NULL, (IPin **)&pVideoRenderer->pInputPin);
582 hr = CoCreateInstance(&CLSID_SeekingPassThru, pUnkOuter ? pUnkOuter : (IUnknown*)&pVideoRenderer->IInner_vtbl, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&pVideoRenderer->seekthru_unk);
584 IPin_Release((IPin*)pVideoRenderer->pInputPin);
587 IUnknown_QueryInterface(pVideoRenderer->seekthru_unk, &IID_ISeekingPassThru, (void**)&passthru);
588 ISeekingPassThru_Init(passthru, TRUE, (IPin*)pVideoRenderer->pInputPin);
589 ISeekingPassThru_Release(passthru);
590 pVideoRenderer->sample_held = NULL;
591 *ppv = pVideoRenderer;
596 QualityControlImpl_init(&pVideoRenderer->qcimpl, (IPin*)pVideoRenderer->pInputPin, (IBaseFilter*)pVideoRenderer);
597 pVideoRenderer->qcimpl.lpVtbl = &VideoRenderer_QualityControl_Vtbl;
599 if (!CreateRenderingSubsystem(pVideoRenderer))
602 pVideoRenderer->blocked = CreateEventW(NULL, FALSE, FALSE, NULL);
603 if (!pVideoRenderer->blocked)
605 hr = HRESULT_FROM_WIN32(GetLastError());
606 IUnknown_Release((IUnknown *)pVideoRenderer);
611 BaseFilterImpl_Release((IBaseFilter*)pVideoRenderer);
612 CoTaskMemFree(pVideoRenderer);
616 HRESULT VideoRendererDefault_create(IUnknown * pUnkOuter, LPVOID * ppv)
618 /* TODO: Attempt to use the VMR-7 renderer instead when possible */
619 return VideoRenderer_create(pUnkOuter, ppv);
622 static HRESULT WINAPI VideoRendererInner_QueryInterface(IUnknown * iface, REFIID riid, LPVOID * ppv)
624 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
625 TRACE("(%p/%p)->(%s, %p)\n", This, iface, qzdebugstr_guid(riid), ppv);
627 if (This->bAggregatable)
628 This->bUnkOuterValid = TRUE;
632 if (IsEqualIID(riid, &IID_IUnknown))
633 *ppv = &This->IInner_vtbl;
634 else if (IsEqualIID(riid, &IID_IPersist))
636 else if (IsEqualIID(riid, &IID_IMediaFilter))
638 else if (IsEqualIID(riid, &IID_IBaseFilter))
640 else if (IsEqualIID(riid, &IID_IBasicVideo))
641 *ppv = &This->IBasicVideo_vtbl;
642 else if (IsEqualIID(riid, &IID_IVideoWindow))
643 *ppv = &This->IVideoWindow_vtbl;
644 else if (IsEqualIID(riid, &IID_IMediaSeeking))
645 return IUnknown_QueryInterface(This->seekthru_unk, riid, ppv);
646 else if (IsEqualIID(riid, &IID_IAMFilterMiscFlags))
647 *ppv = &This->IAMFilterMiscFlags_vtbl;
648 else if (IsEqualIID(riid, &IID_IQualityControl))
649 *ppv = &This->qcimpl;
653 IUnknown_AddRef((IUnknown *)(*ppv));
657 if (!IsEqualIID(riid, &IID_IPin))
658 FIXME("No interface for %s!\n", qzdebugstr_guid(riid));
660 return E_NOINTERFACE;
663 static ULONG WINAPI VideoRendererInner_AddRef(IUnknown * iface)
665 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
666 ULONG refCount = InterlockedIncrement(&This->filter.refCount);
668 TRACE("(%p/%p)->() AddRef from %d\n", This, iface, refCount - 1);
673 static ULONG WINAPI VideoRendererInner_Release(IUnknown * iface)
675 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
676 ULONG refCount = InterlockedDecrement(&This->filter.refCount);
678 TRACE("(%p/%p)->() Release from %d\n", This, iface, refCount + 1);
685 SendMessageW(This->hWnd, WM_CLOSE, 0, 0);
686 PostThreadMessageW(This->ThreadID, WM_QUIT, 0, 0);
687 WaitForSingleObject(This->hThread, INFINITE);
688 CloseHandle(This->hThread);
689 CloseHandle(This->hEvent);
691 if (SUCCEEDED(IPin_ConnectedTo((IPin *)This->pInputPin, &pConnectedTo)))
693 IPin_Disconnect(pConnectedTo);
694 IPin_Release(pConnectedTo);
696 IPin_Disconnect((IPin *)This->pInputPin);
698 IPin_Release((IPin *)This->pInputPin);
700 This->filter.lpVtbl = NULL;
701 IUnknown_Release(This->seekthru_unk);
702 This->filter.csFilter.DebugInfo->Spare[0] = 0;
703 DeleteCriticalSection(&This->filter.csFilter);
705 TRACE("Destroying Video Renderer\n");
714 static const IUnknownVtbl IInner_VTable =
716 VideoRendererInner_QueryInterface,
717 VideoRendererInner_AddRef,
718 VideoRendererInner_Release
721 static HRESULT WINAPI VideoRenderer_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv)
723 VideoRendererImpl *This = (VideoRendererImpl *)iface;
725 if (This->bAggregatable)
726 This->bUnkOuterValid = TRUE;
730 if (This->bAggregatable)
731 return IUnknown_QueryInterface(This->pUnkOuter, riid, ppv);
733 if (IsEqualIID(riid, &IID_IUnknown))
737 IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
738 hr = IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
739 IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
740 This->bAggregatable = TRUE;
745 return E_NOINTERFACE;
748 return IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
751 static ULONG WINAPI VideoRenderer_AddRef(IBaseFilter * iface)
753 VideoRendererImpl *This = (VideoRendererImpl *)iface;
755 if (This->pUnkOuter && This->bUnkOuterValid)
756 return IUnknown_AddRef(This->pUnkOuter);
757 return IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
760 static ULONG WINAPI VideoRenderer_Release(IBaseFilter * iface)
762 VideoRendererImpl *This = (VideoRendererImpl *)iface;
764 if (This->pUnkOuter && This->bUnkOuterValid)
765 return IUnknown_Release(This->pUnkOuter);
766 return IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
769 /** IMediaFilter methods **/
771 static HRESULT WINAPI VideoRenderer_Stop(IBaseFilter * iface)
773 VideoRendererImpl *This = (VideoRendererImpl *)iface;
775 TRACE("(%p/%p)->()\n", This, iface);
777 EnterCriticalSection(&This->filter.csFilter);
779 This->filter.state = State_Stopped;
780 SetEvent(This->hEvent);
781 SetEvent(This->blocked);
782 MediaSeekingPassThru_ResetMediaTime(This->seekthru_unk);
785 RedrawWindow(This->hWnd, NULL, NULL, RDW_INVALIDATE|RDW_ERASE);
787 LeaveCriticalSection(&This->filter.csFilter);
792 static HRESULT WINAPI VideoRenderer_Pause(IBaseFilter * iface)
794 VideoRendererImpl *This = (VideoRendererImpl *)iface;
796 TRACE("(%p/%p)->()\n", This, iface);
798 EnterCriticalSection(&This->filter.csFilter);
799 if (This->filter.state != State_Paused)
801 if (This->filter.state == State_Stopped)
803 This->pInputPin->end_of_stream = 0;
804 ResetEvent(This->hEvent);
805 VideoRenderer_AutoShowWindow(This);
808 This->filter.state = State_Paused;
809 ResetEvent(This->blocked);
811 LeaveCriticalSection(&This->filter.csFilter);
816 static HRESULT WINAPI VideoRenderer_SetSyncSource(IBaseFilter *iface, IReferenceClock *clock) {
817 VideoRendererImpl *This = (VideoRendererImpl *)iface;
820 EnterCriticalSection(&This->filter.csFilter);
821 QualityControlRender_SetClock(&This->qcimpl, clock);
822 hr = BaseFilterImpl_SetSyncSource(iface, clock);
823 LeaveCriticalSection(&This->filter.csFilter);
827 static HRESULT WINAPI VideoRenderer_Run(IBaseFilter * iface, REFERENCE_TIME tStart)
830 VideoRendererImpl *This = (VideoRendererImpl *)iface;
832 TRACE("(%p/%p)->(%s)\n", This, iface, wine_dbgstr_longlong(tStart));
834 EnterCriticalSection(&This->filter.csFilter);
835 if (This->filter.state == State_Running)
837 This->filter.rtStreamStart = tStart;
838 QualityControlRender_Start(&This->qcimpl, tStart);
839 if (This->pInputPin->pin.pConnectedTo && (This->filter.state == State_Stopped || !This->pInputPin->end_of_stream))
841 if (This->filter.state == State_Stopped)
843 ResetEvent(This->hEvent);
844 VideoRenderer_AutoShowWindow(This);
845 This->pInputPin->end_of_stream = 0;
847 SetEvent(This->blocked);
848 } else if (This->filter.filterInfo.pGraph) {
849 IMediaEventSink *pEventSink;
850 hr = IFilterGraph_QueryInterface(This->filter.filterInfo.pGraph, &IID_IMediaEventSink, (LPVOID*)&pEventSink);
853 hr = IMediaEventSink_Notify(pEventSink, EC_COMPLETE, S_OK, (LONG_PTR)This);
854 IMediaEventSink_Release(pEventSink);
859 This->filter.state = State_Running;
861 LeaveCriticalSection(&This->filter.csFilter);
866 static HRESULT WINAPI VideoRenderer_GetState(IBaseFilter * iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState)
868 VideoRendererImpl *This = (VideoRendererImpl *)iface;
871 TRACE("(%p/%p)->(%d, %p)\n", This, iface, dwMilliSecsTimeout, pState);
873 if (WaitForSingleObject(This->hEvent, dwMilliSecsTimeout) == WAIT_TIMEOUT)
874 hr = VFW_S_STATE_INTERMEDIATE;
878 BaseFilterImpl_GetState(iface, dwMilliSecsTimeout, pState);
883 /** IBaseFilter implementation **/
885 static HRESULT WINAPI VideoRenderer_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)
887 VideoRendererImpl *This = (VideoRendererImpl *)iface;
889 FIXME("(%p/%p)->(%p,%p): stub !!!\n", This, iface, debugstr_w(Id), ppPin);
891 /* FIXME: critical section */
896 static const IBaseFilterVtbl VideoRenderer_Vtbl =
898 VideoRenderer_QueryInterface,
899 VideoRenderer_AddRef,
900 VideoRenderer_Release,
901 BaseFilterImpl_GetClassID,
905 VideoRenderer_GetState,
906 VideoRenderer_SetSyncSource,
907 BaseFilterImpl_GetSyncSource,
908 BaseFilterImpl_EnumPins,
909 VideoRenderer_FindPin,
910 BaseFilterImpl_QueryFilterInfo,
911 BaseFilterImpl_JoinFilterGraph,
912 BaseFilterImpl_QueryVendorInfo
915 static HRESULT WINAPI VideoRenderer_InputPin_EndOfStream(IPin * iface)
917 BaseInputPin* This = (BaseInputPin*)iface;
918 VideoRendererImpl *pFilter;
919 IMediaEventSink* pEventSink;
922 TRACE("(%p/%p)->()\n", This, iface);
924 EnterCriticalSection(This->pin.pCritSec);
925 pFilter = (VideoRendererImpl*)This->pin.pinInfo.pFilter;
926 if (This->flushing || This->end_of_stream)
928 hr = IFilterGraph_QueryInterface(pFilter->filter.filterInfo.pGraph, &IID_IMediaEventSink, (LPVOID*)&pEventSink);
931 hr = IMediaEventSink_Notify(pEventSink, EC_COMPLETE, S_OK, (LONG_PTR)pFilter);
932 IMediaEventSink_Release(pEventSink);
934 MediaSeekingPassThru_EOS(pFilter->seekthru_unk);
935 This->end_of_stream = 1;
937 LeaveCriticalSection(This->pin.pCritSec);
942 static HRESULT WINAPI VideoRenderer_InputPin_BeginFlush(IPin * iface)
944 BaseInputPin* This = (BaseInputPin*)iface;
945 VideoRendererImpl *pVideoRenderer = (VideoRendererImpl *)This->pin.pinInfo.pFilter;
947 TRACE("(%p/%p)->()\n", This, iface);
949 SetEvent(pVideoRenderer->blocked);
950 return BaseInputPinImpl_BeginFlush(iface);
953 static HRESULT WINAPI VideoRenderer_InputPin_EndFlush(IPin * iface)
955 BaseInputPin* This = (BaseInputPin*)iface;
956 VideoRendererImpl *pVideoRenderer = (VideoRendererImpl *)This->pin.pinInfo.pFilter;
959 TRACE("(%p/%p)->()\n", This, iface);
961 EnterCriticalSection(This->pin.pCritSec);
962 if (pVideoRenderer->filter.state == State_Paused) {
963 ResetEvent(pVideoRenderer->blocked);
964 ResetEvent(pVideoRenderer->hEvent);
967 QualityControlRender_Start(&pVideoRenderer->qcimpl, pVideoRenderer->filter.rtStreamStart);
968 hr = BaseInputPinImpl_EndFlush(iface);
969 LeaveCriticalSection(This->pin.pCritSec);
970 MediaSeekingPassThru_ResetMediaTime(pVideoRenderer->seekthru_unk);
975 static const IPinVtbl VideoRenderer_InputPin_Vtbl =
977 BaseInputPinImpl_QueryInterface,
979 BaseInputPinImpl_Release,
980 BaseInputPinImpl_Connect,
981 BaseInputPinImpl_ReceiveConnection,
982 BasePinImpl_Disconnect,
983 BasePinImpl_ConnectedTo,
984 BasePinImpl_ConnectionMediaType,
985 BasePinImpl_QueryPinInfo,
986 BasePinImpl_QueryDirection,
988 BaseInputPinImpl_QueryAccept,
989 BasePinImpl_EnumMediaTypes,
990 BasePinImpl_QueryInternalConnections,
991 VideoRenderer_InputPin_EndOfStream,
992 VideoRenderer_InputPin_BeginFlush,
993 VideoRenderer_InputPin_EndFlush,
994 BaseInputPinImpl_NewSegment
997 /*** IUnknown methods ***/
998 static HRESULT WINAPI Basicvideo_QueryInterface(IBasicVideo *iface,
1001 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1003 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1005 return VideoRenderer_QueryInterface((IBaseFilter*)This, riid, ppvObj);
1008 static ULONG WINAPI Basicvideo_AddRef(IBasicVideo *iface) {
1009 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1011 TRACE("(%p/%p)->()\n", This, iface);
1013 return VideoRenderer_AddRef((IBaseFilter*)This);
1016 static ULONG WINAPI Basicvideo_Release(IBasicVideo *iface) {
1017 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1019 TRACE("(%p/%p)->()\n", This, iface);
1021 return VideoRenderer_Release((IBaseFilter*)This);
1024 /*** IDispatch methods ***/
1025 static HRESULT WINAPI Basicvideo_GetTypeInfoCount(IBasicVideo *iface,
1027 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1029 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
1034 static HRESULT WINAPI Basicvideo_GetTypeInfo(IBasicVideo *iface,
1037 ITypeInfo**ppTInfo) {
1038 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1040 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
1045 static HRESULT WINAPI Basicvideo_GetIDsOfNames(IBasicVideo *iface,
1051 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1053 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1058 static HRESULT WINAPI Basicvideo_Invoke(IBasicVideo *iface,
1059 DISPID dispIdMember,
1063 DISPPARAMS*pDispParams,
1065 EXCEPINFO*pExepInfo,
1067 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1069 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);
1074 /*** IBasicVideo methods ***/
1075 static HRESULT WINAPI Basicvideo_get_AvgTimePerFrame(IBasicVideo *iface,
1076 REFTIME *pAvgTimePerFrame) {
1078 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1080 if (!This->pInputPin->pin.pConnectedTo)
1081 return VFW_E_NOT_CONNECTED;
1083 TRACE("(%p/%p)->(%p)\n", This, iface, pAvgTimePerFrame);
1085 pmt = &This->pInputPin->pin.mtCurrent;
1086 if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo)) {
1087 VIDEOINFOHEADER *vih = (VIDEOINFOHEADER*)pmt->pbFormat;
1088 *pAvgTimePerFrame = vih->AvgTimePerFrame;
1089 } else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2)) {
1090 VIDEOINFOHEADER2 *vih = (VIDEOINFOHEADER2*)pmt->pbFormat;
1091 *pAvgTimePerFrame = vih->AvgTimePerFrame;
1093 ERR("Unknown format type %s\n", qzdebugstr_guid(&pmt->formattype));
1094 *pAvgTimePerFrame = 0;
1099 static HRESULT WINAPI Basicvideo_get_BitRate(IBasicVideo *iface,
1101 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1103 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBitRate);
1108 static HRESULT WINAPI Basicvideo_get_BitErrorRate(IBasicVideo *iface,
1109 LONG *pBitErrorRate) {
1110 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1112 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBitErrorRate);
1117 static HRESULT WINAPI Basicvideo_get_VideoWidth(IBasicVideo *iface,
1118 LONG *pVideoWidth) {
1119 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1121 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoWidth);
1123 *pVideoWidth = This->VideoWidth;
1128 static HRESULT WINAPI Basicvideo_get_VideoHeight(IBasicVideo *iface,
1129 LONG *pVideoHeight) {
1130 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1132 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoHeight);
1134 *pVideoHeight = This->VideoHeight;
1139 static HRESULT WINAPI Basicvideo_put_SourceLeft(IBasicVideo *iface,
1141 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1143 TRACE("(%p/%p)->(%d)\n", This, iface, SourceLeft);
1145 This->SourceRect.left = SourceLeft;
1150 static HRESULT WINAPI Basicvideo_get_SourceLeft(IBasicVideo *iface,
1151 LONG *pSourceLeft) {
1152 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1154 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceLeft);
1156 *pSourceLeft = This->SourceRect.left;
1161 static HRESULT WINAPI Basicvideo_put_SourceWidth(IBasicVideo *iface,
1163 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1165 TRACE("(%p/%p)->(%d)\n", This, iface, SourceWidth);
1167 This->SourceRect.right = This->SourceRect.left + SourceWidth;
1172 static HRESULT WINAPI Basicvideo_get_SourceWidth(IBasicVideo *iface,
1173 LONG *pSourceWidth) {
1174 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1176 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceWidth);
1178 *pSourceWidth = This->SourceRect.right - This->SourceRect.left;
1183 static HRESULT WINAPI Basicvideo_put_SourceTop(IBasicVideo *iface,
1185 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1187 TRACE("(%p/%p)->(%d)\n", This, iface, SourceTop);
1189 This->SourceRect.top = SourceTop;
1194 static HRESULT WINAPI Basicvideo_get_SourceTop(IBasicVideo *iface,
1196 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1198 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceTop);
1200 *pSourceTop = This->SourceRect.top;
1205 static HRESULT WINAPI Basicvideo_put_SourceHeight(IBasicVideo *iface,
1206 LONG SourceHeight) {
1207 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1209 TRACE("(%p/%p)->(%d)\n", This, iface, SourceHeight);
1211 This->SourceRect.bottom = This->SourceRect.top + SourceHeight;
1216 static HRESULT WINAPI Basicvideo_get_SourceHeight(IBasicVideo *iface,
1217 LONG *pSourceHeight) {
1218 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1220 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceHeight);
1222 *pSourceHeight = This->SourceRect.bottom - This->SourceRect.top;
1227 static HRESULT WINAPI Basicvideo_put_DestinationLeft(IBasicVideo *iface,
1228 LONG DestinationLeft) {
1229 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1231 TRACE("(%p/%p)->(%d)\n", This, iface, DestinationLeft);
1233 This->DestRect.left = DestinationLeft;
1238 static HRESULT WINAPI Basicvideo_get_DestinationLeft(IBasicVideo *iface,
1239 LONG *pDestinationLeft) {
1240 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1242 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationLeft);
1244 *pDestinationLeft = This->DestRect.left;
1249 static HRESULT WINAPI Basicvideo_put_DestinationWidth(IBasicVideo *iface,
1250 LONG DestinationWidth) {
1251 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1253 TRACE("(%p/%p)->(%d)\n", This, iface, DestinationWidth);
1255 This->DestRect.right = This->DestRect.left + DestinationWidth;
1260 static HRESULT WINAPI Basicvideo_get_DestinationWidth(IBasicVideo *iface,
1261 LONG *pDestinationWidth) {
1262 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1264 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationWidth);
1266 *pDestinationWidth = This->DestRect.right - This->DestRect.left;
1271 static HRESULT WINAPI Basicvideo_put_DestinationTop(IBasicVideo *iface,
1272 LONG DestinationTop) {
1273 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1275 TRACE("(%p/%p)->(%d)\n", This, iface, DestinationTop);
1277 This->DestRect.top = DestinationTop;
1282 static HRESULT WINAPI Basicvideo_get_DestinationTop(IBasicVideo *iface,
1283 LONG *pDestinationTop) {
1284 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1286 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationTop);
1288 *pDestinationTop = This->DestRect.top;
1293 static HRESULT WINAPI Basicvideo_put_DestinationHeight(IBasicVideo *iface,
1294 LONG DestinationHeight) {
1295 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1297 TRACE("(%p/%p)->(%d)\n", This, iface, DestinationHeight);
1299 This->DestRect.right = This->DestRect.left + DestinationHeight;
1304 static HRESULT WINAPI Basicvideo_get_DestinationHeight(IBasicVideo *iface,
1305 LONG *pDestinationHeight) {
1306 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1308 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationHeight);
1310 *pDestinationHeight = This->DestRect.right - This->DestRect.left;
1315 static HRESULT WINAPI Basicvideo_SetSourcePosition(IBasicVideo *iface,
1320 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1322 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height);
1324 This->SourceRect.left = Left;
1325 This->SourceRect.top = Top;
1326 This->SourceRect.right = Left + Width;
1327 This->SourceRect.bottom = Top + Height;
1332 static HRESULT WINAPI Basicvideo_GetSourcePosition(IBasicVideo *iface,
1337 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1339 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1341 *pLeft = This->SourceRect.left;
1342 *pTop = This->SourceRect.top;
1343 *pWidth = This->SourceRect.right - This->SourceRect.left;
1344 *pHeight = This->SourceRect.bottom - This->SourceRect.top;
1349 static HRESULT WINAPI Basicvideo_SetDefaultSourcePosition(IBasicVideo *iface) {
1350 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1352 TRACE("(%p/%p)->()\n", This, iface);
1354 This->SourceRect.left = 0;
1355 This->SourceRect.top = 0;
1356 This->SourceRect.right = This->VideoWidth;
1357 This->SourceRect.bottom = This->VideoHeight;
1362 static HRESULT WINAPI Basicvideo_SetDestinationPosition(IBasicVideo *iface,
1367 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1369 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height);
1371 This->DestRect.left = Left;
1372 This->DestRect.top = Top;
1373 This->DestRect.right = Left + Width;
1374 This->DestRect.bottom = Top + Height;
1379 static HRESULT WINAPI Basicvideo_GetDestinationPosition(IBasicVideo *iface,
1384 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1386 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1388 *pLeft = This->DestRect.left;
1389 *pTop = This->DestRect.top;
1390 *pWidth = This->DestRect.right - This->DestRect.left;
1391 *pHeight = This->DestRect.bottom - This->DestRect.top;
1396 static HRESULT WINAPI Basicvideo_SetDefaultDestinationPosition(IBasicVideo *iface) {
1397 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1400 TRACE("(%p/%p)->()\n", This, iface);
1402 if (!GetClientRect(This->hWnd, &rect))
1405 This->SourceRect.left = 0;
1406 This->SourceRect.top = 0;
1407 This->SourceRect.right = rect.right;
1408 This->SourceRect.bottom = rect.bottom;
1413 static HRESULT WINAPI Basicvideo_GetVideoSize(IBasicVideo *iface,
1416 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1418 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
1420 *pWidth = This->VideoWidth;
1421 *pHeight = This->VideoHeight;
1426 static HRESULT WINAPI Basicvideo_GetVideoPaletteEntries(IBasicVideo *iface,
1431 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1433 TRACE("(%p/%p)->(%d, %d, %p, %p)\n", This, iface, StartIndex, Entries, pRetrieved, pPalette);
1437 return VFW_E_NO_PALETTE_AVAILABLE;
1440 static HRESULT WINAPI Basicvideo_GetCurrentImage(IBasicVideo *iface,
1443 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1444 BITMAPINFOHEADER *bmiHeader;
1446 AM_MEDIA_TYPE *amt = &This->pInputPin->pin.mtCurrent;
1449 FIXME("(%p/%p)->(%p, %p): partial stub\n", This, iface, pBufferSize, pDIBImage);
1451 EnterCriticalSection(&This->filter.csFilter);
1453 if (!This->sample_held)
1455 LeaveCriticalSection(&This->filter.csFilter);
1456 return (This->filter.state == State_Paused ? E_UNEXPECTED : VFW_E_NOT_PAUSED);
1459 if (IsEqualIID(&amt->formattype, &FORMAT_VideoInfo))
1461 bmiHeader = &((VIDEOINFOHEADER *)amt->pbFormat)->bmiHeader;
1463 else if (IsEqualIID(&amt->formattype, &FORMAT_VideoInfo2))
1465 bmiHeader = &((VIDEOINFOHEADER2 *)amt->pbFormat)->bmiHeader;
1469 FIXME("Unknown type %s\n", debugstr_guid(&amt->subtype));
1470 LeaveCriticalSection(&This->filter.csFilter);
1471 return VFW_E_RUNTIME_ERROR;
1474 needed_size = bmiHeader->biSize;
1475 needed_size += IMediaSample_GetActualDataLength(This->sample_held);
1479 *pBufferSize = needed_size;
1480 LeaveCriticalSection(&This->filter.csFilter);
1484 if (needed_size < *pBufferSize)
1486 ERR("Buffer too small %u/%u\n", needed_size, *pBufferSize);
1487 LeaveCriticalSection(&This->filter.csFilter);
1490 *pBufferSize = needed_size;
1492 memcpy(pDIBImage, bmiHeader, bmiHeader->biSize);
1493 IMediaSample_GetPointer(This->sample_held, (BYTE **)&ptr);
1494 memcpy((char *)pDIBImage + bmiHeader->biSize, ptr, IMediaSample_GetActualDataLength(This->sample_held));
1496 LeaveCriticalSection(&This->filter.csFilter);
1501 static HRESULT WINAPI Basicvideo_IsUsingDefaultSource(IBasicVideo *iface) {
1502 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1504 FIXME("(%p/%p)->(): stub !!!\n", This, iface);
1509 static HRESULT WINAPI Basicvideo_IsUsingDefaultDestination(IBasicVideo *iface) {
1510 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1512 FIXME("(%p/%p)->(): stub !!!\n", This, iface);
1518 static const IBasicVideoVtbl IBasicVideo_VTable =
1520 Basicvideo_QueryInterface,
1523 Basicvideo_GetTypeInfoCount,
1524 Basicvideo_GetTypeInfo,
1525 Basicvideo_GetIDsOfNames,
1527 Basicvideo_get_AvgTimePerFrame,
1528 Basicvideo_get_BitRate,
1529 Basicvideo_get_BitErrorRate,
1530 Basicvideo_get_VideoWidth,
1531 Basicvideo_get_VideoHeight,
1532 Basicvideo_put_SourceLeft,
1533 Basicvideo_get_SourceLeft,
1534 Basicvideo_put_SourceWidth,
1535 Basicvideo_get_SourceWidth,
1536 Basicvideo_put_SourceTop,
1537 Basicvideo_get_SourceTop,
1538 Basicvideo_put_SourceHeight,
1539 Basicvideo_get_SourceHeight,
1540 Basicvideo_put_DestinationLeft,
1541 Basicvideo_get_DestinationLeft,
1542 Basicvideo_put_DestinationWidth,
1543 Basicvideo_get_DestinationWidth,
1544 Basicvideo_put_DestinationTop,
1545 Basicvideo_get_DestinationTop,
1546 Basicvideo_put_DestinationHeight,
1547 Basicvideo_get_DestinationHeight,
1548 Basicvideo_SetSourcePosition,
1549 Basicvideo_GetSourcePosition,
1550 Basicvideo_SetDefaultSourcePosition,
1551 Basicvideo_SetDestinationPosition,
1552 Basicvideo_GetDestinationPosition,
1553 Basicvideo_SetDefaultDestinationPosition,
1554 Basicvideo_GetVideoSize,
1555 Basicvideo_GetVideoPaletteEntries,
1556 Basicvideo_GetCurrentImage,
1557 Basicvideo_IsUsingDefaultSource,
1558 Basicvideo_IsUsingDefaultDestination
1562 /*** IUnknown methods ***/
1563 static HRESULT WINAPI Videowindow_QueryInterface(IVideoWindow *iface,
1566 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1568 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1570 return VideoRenderer_QueryInterface((IBaseFilter*)This, riid, ppvObj);
1573 static ULONG WINAPI Videowindow_AddRef(IVideoWindow *iface) {
1574 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1576 TRACE("(%p/%p)->()\n", This, iface);
1578 return VideoRenderer_AddRef((IBaseFilter*)This);
1581 static ULONG WINAPI Videowindow_Release(IVideoWindow *iface) {
1582 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1584 TRACE("(%p/%p)->()\n", This, iface);
1586 return VideoRenderer_Release((IBaseFilter*)This);
1589 /*** IDispatch methods ***/
1590 static HRESULT WINAPI Videowindow_GetTypeInfoCount(IVideoWindow *iface,
1592 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1594 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
1599 static HRESULT WINAPI Videowindow_GetTypeInfo(IVideoWindow *iface,
1602 ITypeInfo**ppTInfo) {
1603 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1605 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
1610 static HRESULT WINAPI Videowindow_GetIDsOfNames(IVideoWindow *iface,
1616 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1618 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1623 static HRESULT WINAPI Videowindow_Invoke(IVideoWindow *iface,
1624 DISPID dispIdMember,
1628 DISPPARAMS*pDispParams,
1630 EXCEPINFO*pExepInfo,
1632 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1634 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);
1639 /*** IVideoWindow methods ***/
1640 static HRESULT WINAPI Videowindow_put_Caption(IVideoWindow *iface,
1642 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1644 TRACE("(%p/%p)->(%s (%p))\n", This, iface, debugstr_w(strCaption), strCaption);
1646 if (!SetWindowTextW(This->hWnd, strCaption))
1652 static HRESULT WINAPI Videowindow_get_Caption(IVideoWindow *iface,
1654 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1656 TRACE("(%p/%p)->(%p)\n", This, iface, strCaption);
1658 GetWindowTextW(This->hWnd, (LPWSTR)strCaption, 100);
1663 static HRESULT WINAPI Videowindow_put_WindowStyle(IVideoWindow *iface,
1665 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1668 old = GetWindowLongW(This->hWnd, GWL_STYLE);
1670 TRACE("(%p/%p)->(%x -> %x)\n", This, iface, old, WindowStyle);
1672 if (WindowStyle & (WS_DISABLED|WS_HSCROLL|WS_ICONIC|WS_MAXIMIZE|WS_MINIMIZE|WS_VSCROLL))
1673 return E_INVALIDARG;
1675 SetWindowLongW(This->hWnd, GWL_STYLE, WindowStyle);
1676 SetWindowPos(This->hWnd,0,0,0,0,0,SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOZORDER);
1677 This->WindowStyle = WindowStyle;
1682 static HRESULT WINAPI Videowindow_get_WindowStyle(IVideoWindow *iface,
1683 LONG *WindowStyle) {
1684 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1686 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyle);
1688 *WindowStyle = This->WindowStyle;
1693 static HRESULT WINAPI Videowindow_put_WindowStyleEx(IVideoWindow *iface,
1694 LONG WindowStyleEx) {
1695 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1697 TRACE("(%p/%p)->(%d)\n", This, iface, WindowStyleEx);
1699 if (!SetWindowLongW(This->hWnd, GWL_EXSTYLE, WindowStyleEx))
1705 static HRESULT WINAPI Videowindow_get_WindowStyleEx(IVideoWindow *iface,
1706 LONG *WindowStyleEx) {
1707 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1709 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyleEx);
1711 *WindowStyleEx = GetWindowLongW(This->hWnd, GWL_EXSTYLE);
1716 static HRESULT WINAPI Videowindow_put_AutoShow(IVideoWindow *iface,
1718 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1720 TRACE("(%p/%p)->(%d)\n", This, iface, AutoShow);
1722 This->AutoShow = AutoShow;
1727 static HRESULT WINAPI Videowindow_get_AutoShow(IVideoWindow *iface,
1729 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1731 TRACE("(%p/%p)->(%p)\n", This, iface, AutoShow);
1733 *AutoShow = This->AutoShow;
1738 static HRESULT WINAPI Videowindow_put_WindowState(IVideoWindow *iface,
1740 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1742 TRACE("(%p/%p)->(%d)\n", This, iface, WindowState);
1743 ShowWindow(This->hWnd, WindowState);
1747 static HRESULT WINAPI Videowindow_get_WindowState(IVideoWindow *iface,
1748 LONG *WindowState) {
1749 WINDOWPLACEMENT place;
1750 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1752 place.length = sizeof(place);
1753 GetWindowPlacement(This->hWnd, &place);
1754 TRACE("(%p/%p)->(%p)\n", This, iface, WindowState);
1755 *WindowState = place.showCmd;
1760 static HRESULT WINAPI Videowindow_put_BackgroundPalette(IVideoWindow *iface,
1761 LONG BackgroundPalette) {
1762 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1764 FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, BackgroundPalette);
1769 static HRESULT WINAPI Videowindow_get_BackgroundPalette(IVideoWindow *iface,
1770 LONG *pBackgroundPalette) {
1771 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1773 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBackgroundPalette);
1778 static HRESULT WINAPI Videowindow_put_Visible(IVideoWindow *iface,
1780 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1782 TRACE("(%p/%p)->(%d)\n", This, iface, Visible);
1784 ShowWindow(This->hWnd, Visible ? SW_SHOW : SW_HIDE);
1789 static HRESULT WINAPI Videowindow_get_Visible(IVideoWindow *iface,
1791 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1793 TRACE("(%p/%p)->(%p)\n", This, iface, pVisible);
1795 *pVisible = IsWindowVisible(This->hWnd);
1800 static HRESULT WINAPI Videowindow_put_Left(IVideoWindow *iface,
1802 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1804 TRACE("(%p/%p)->(%d)\n", This, iface, Left);
1806 if (!SetWindowPos(This->hWnd, NULL, Left, This->WindowPos.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE))
1809 This->WindowPos.left = Left;
1814 static HRESULT WINAPI Videowindow_get_Left(IVideoWindow *iface,
1816 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1818 TRACE("(%p/%p)->(%p)\n", This, iface, pLeft);
1820 *pLeft = This->WindowPos.left;
1825 static HRESULT WINAPI Videowindow_put_Width(IVideoWindow *iface,
1827 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1829 TRACE("(%p/%p)->(%d)\n", This, iface, Width);
1831 if (!SetWindowPos(This->hWnd, NULL, 0, 0, Width, This->WindowPos.bottom-This->WindowPos.top, SWP_NOZORDER|SWP_NOMOVE))
1834 This->WindowPos.right = This->WindowPos.left + Width;
1839 static HRESULT WINAPI Videowindow_get_Width(IVideoWindow *iface,
1841 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1843 TRACE("(%p/%p)->(%p)\n", This, iface, pWidth);
1845 *pWidth = This->WindowPos.right - This->WindowPos.left;
1850 static HRESULT WINAPI Videowindow_put_Top(IVideoWindow *iface,
1852 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1854 TRACE("(%p/%p)->(%d)\n", This, iface, Top);
1856 if (!SetWindowPos(This->hWnd, NULL, This->WindowPos.left, Top, 0, 0, SWP_NOZORDER|SWP_NOSIZE))
1859 This->WindowPos.top = Top;
1864 static HRESULT WINAPI Videowindow_get_Top(IVideoWindow *iface,
1866 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1868 TRACE("(%p/%p)->(%p)\n", This, iface, pTop);
1870 *pTop = This->WindowPos.top;
1875 static HRESULT WINAPI Videowindow_put_Height(IVideoWindow *iface,
1877 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1879 TRACE("(%p/%p)->(%d)\n", This, iface, Height);
1881 if (!SetWindowPos(This->hWnd, NULL, 0, 0, This->WindowPos.right-This->WindowPos.left, Height, SWP_NOZORDER|SWP_NOMOVE))
1884 This->WindowPos.bottom = This->WindowPos.top + Height;
1889 static HRESULT WINAPI Videowindow_get_Height(IVideoWindow *iface,
1891 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1893 TRACE("(%p/%p)->(%p)\n", This, iface, pHeight);
1895 *pHeight = This->WindowPos.bottom - This->WindowPos.top;
1900 static HRESULT WINAPI Videowindow_put_Owner(IVideoWindow *iface,
1902 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1904 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Owner);
1906 This->hWndOwner = (HWND)Owner;
1907 SetParent(This->hWnd, This->hWndOwner);
1908 if (This->WindowStyle & WS_CHILD)
1910 LONG old = GetWindowLongW(This->hWnd, GWL_STYLE);
1911 if (old != This->WindowStyle)
1913 SetWindowLongW(This->hWnd, GWL_STYLE, This->WindowStyle);
1914 SetWindowPos(This->hWnd,0,0,0,0,0,SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOZORDER);
1921 static HRESULT WINAPI Videowindow_get_Owner(IVideoWindow *iface,
1923 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1925 TRACE("(%p/%p)->(%p)\n", This, iface, Owner);
1927 *(HWND*)Owner = This->hWndOwner;
1932 static HRESULT WINAPI Videowindow_put_MessageDrain(IVideoWindow *iface,
1934 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1936 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Drain);
1938 This->hWndMsgDrain = (HWND)Drain;
1943 static HRESULT WINAPI Videowindow_get_MessageDrain(IVideoWindow *iface,
1945 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1947 TRACE("(%p/%p)->(%p)\n", This, iface, Drain);
1949 *Drain = (OAHWND)This->hWndMsgDrain;
1954 static HRESULT WINAPI Videowindow_get_BorderColor(IVideoWindow *iface,
1956 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1958 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, Color);
1963 static HRESULT WINAPI Videowindow_put_BorderColor(IVideoWindow *iface,
1965 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1967 FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, Color);
1972 static HRESULT WINAPI Videowindow_get_FullScreenMode(IVideoWindow *iface,
1973 LONG *FullScreenMode) {
1974 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1976 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, FullScreenMode);
1981 static HRESULT WINAPI Videowindow_put_FullScreenMode(IVideoWindow *iface,
1982 LONG FullScreenMode) {
1983 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1985 FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, FullScreenMode);
1987 if (FullScreenMode) {
1988 ShowWindow(This->hWnd, SW_HIDE);
1989 SetParent(This->hWnd, 0);
1990 SetWindowLongW(This->hWnd, GWL_STYLE, WS_POPUP);
1991 SetWindowPos(This->hWnd,HWND_TOP,0,0,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN),SWP_SHOWWINDOW);
1992 GetWindowRect(This->hWnd, &This->DestRect);
1993 This->WindowPos = This->DestRect;
1995 ShowWindow(This->hWnd, SW_HIDE);
1996 SetParent(This->hWnd, This->hWndOwner);
1997 SetWindowLongW(This->hWnd, GWL_STYLE, This->WindowStyle);
1998 GetClientRect(This->hWnd, &This->DestRect);
1999 SetWindowPos(This->hWnd,0,This->DestRect.left,This->DestRect.top,This->DestRect.right,This->DestRect.bottom,SWP_NOZORDER|SWP_SHOWWINDOW);
2000 This->WindowPos = This->DestRect;
2006 static HRESULT WINAPI Videowindow_SetWindowForeground(IVideoWindow *iface,
2008 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2013 TRACE("(%p/%p)->(%d)\n", This, iface, Focus);
2015 if ((Focus != FALSE) && (Focus != TRUE))
2016 return E_INVALIDARG;
2018 hr = IPin_ConnectedTo((IPin *)This->pInputPin, &pPin);
2019 if ((hr != S_OK) || !pPin)
2020 return VFW_E_NOT_CONNECTED;
2023 ret = SetForegroundWindow(This->hWnd);
2025 ret = SetWindowPos(This->hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
2033 static HRESULT WINAPI Videowindow_NotifyOwnerMessage(IVideoWindow *iface,
2038 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2040 TRACE("(%p/%p)->(%08lx, %d, %08lx, %08lx)\n", This, iface, hwnd, uMsg, wParam, lParam);
2042 if (!PostMessageW(This->hWnd, uMsg, wParam, lParam))
2048 static HRESULT WINAPI Videowindow_SetWindowPosition(IVideoWindow *iface,
2053 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2055 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height);
2057 if (!SetWindowPos(This->hWnd, NULL, Left, Top, Width, Height, SWP_NOZORDER))
2060 This->WindowPos.left = Left;
2061 This->WindowPos.top = Top;
2062 This->WindowPos.right = Left + Width;
2063 This->WindowPos.bottom = Top + Height;
2068 static HRESULT WINAPI Videowindow_GetWindowPosition(IVideoWindow *iface,
2073 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2075 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
2077 *pLeft = This->WindowPos.left;
2078 *pTop = This->WindowPos.top;
2079 *pWidth = This->WindowPos.right - This->WindowPos.left;
2080 *pHeight = This->WindowPos.bottom - This->WindowPos.top;
2085 static HRESULT WINAPI Videowindow_GetMinIdealImageSize(IVideoWindow *iface,
2088 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2090 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This, iface, pWidth, pHeight);
2092 *pWidth = This->VideoWidth;
2093 *pHeight = This->VideoHeight;
2098 static HRESULT WINAPI Videowindow_GetMaxIdealImageSize(IVideoWindow *iface,
2101 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2103 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This, iface, pWidth, pHeight);
2105 *pWidth = This->VideoWidth;
2106 *pHeight = This->VideoHeight;
2111 static HRESULT WINAPI Videowindow_GetRestorePosition(IVideoWindow *iface,
2116 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2118 FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This, iface, pLeft, pTop, pWidth, pHeight);
2123 static HRESULT WINAPI Videowindow_HideCursor(IVideoWindow *iface,
2125 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2127 FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, HideCursor);
2132 static HRESULT WINAPI Videowindow_IsCursorHidden(IVideoWindow *iface,
2133 LONG *CursorHidden) {
2134 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2136 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, CursorHidden);
2141 static const IVideoWindowVtbl IVideoWindow_VTable =
2143 Videowindow_QueryInterface,
2145 Videowindow_Release,
2146 Videowindow_GetTypeInfoCount,
2147 Videowindow_GetTypeInfo,
2148 Videowindow_GetIDsOfNames,
2150 Videowindow_put_Caption,
2151 Videowindow_get_Caption,
2152 Videowindow_put_WindowStyle,
2153 Videowindow_get_WindowStyle,
2154 Videowindow_put_WindowStyleEx,
2155 Videowindow_get_WindowStyleEx,
2156 Videowindow_put_AutoShow,
2157 Videowindow_get_AutoShow,
2158 Videowindow_put_WindowState,
2159 Videowindow_get_WindowState,
2160 Videowindow_put_BackgroundPalette,
2161 Videowindow_get_BackgroundPalette,
2162 Videowindow_put_Visible,
2163 Videowindow_get_Visible,
2164 Videowindow_put_Left,
2165 Videowindow_get_Left,
2166 Videowindow_put_Width,
2167 Videowindow_get_Width,
2168 Videowindow_put_Top,
2169 Videowindow_get_Top,
2170 Videowindow_put_Height,
2171 Videowindow_get_Height,
2172 Videowindow_put_Owner,
2173 Videowindow_get_Owner,
2174 Videowindow_put_MessageDrain,
2175 Videowindow_get_MessageDrain,
2176 Videowindow_get_BorderColor,
2177 Videowindow_put_BorderColor,
2178 Videowindow_get_FullScreenMode,
2179 Videowindow_put_FullScreenMode,
2180 Videowindow_SetWindowForeground,
2181 Videowindow_NotifyOwnerMessage,
2182 Videowindow_SetWindowPosition,
2183 Videowindow_GetWindowPosition,
2184 Videowindow_GetMinIdealImageSize,
2185 Videowindow_GetMaxIdealImageSize,
2186 Videowindow_GetRestorePosition,
2187 Videowindow_HideCursor,
2188 Videowindow_IsCursorHidden
2191 static VideoRendererImpl *from_IAMFilterMiscFlags(IAMFilterMiscFlags *iface) {
2192 return (VideoRendererImpl*)((char*)iface - offsetof(VideoRendererImpl, IAMFilterMiscFlags_vtbl));
2195 static HRESULT WINAPI AMFilterMiscFlags_QueryInterface(IAMFilterMiscFlags *iface, const REFIID riid, void **ppv) {
2196 VideoRendererImpl *This = from_IAMFilterMiscFlags(iface);
2197 return IUnknown_QueryInterface((IUnknown*)This, riid, ppv);
2200 static ULONG WINAPI AMFilterMiscFlags_AddRef(IAMFilterMiscFlags *iface) {
2201 VideoRendererImpl *This = from_IAMFilterMiscFlags(iface);
2202 return IUnknown_AddRef((IUnknown*)This);
2205 static ULONG WINAPI AMFilterMiscFlags_Release(IAMFilterMiscFlags *iface) {
2206 VideoRendererImpl *This = from_IAMFilterMiscFlags(iface);
2207 return IUnknown_Release((IUnknown*)This);
2210 static ULONG WINAPI AMFilterMiscFlags_GetMiscFlags(IAMFilterMiscFlags *iface) {
2211 return AM_FILTER_MISC_FLAGS_IS_RENDERER;
2214 static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl = {
2215 AMFilterMiscFlags_QueryInterface,
2216 AMFilterMiscFlags_AddRef,
2217 AMFilterMiscFlags_Release,
2218 AMFilterMiscFlags_GetMiscFlags