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;
94 REFERENCE_TIME rtLastStop;
97 /* During pause we can hold a single sample, for use in GetCurrentImage */
98 IMediaSample *sample_held;
101 static LRESULT CALLBACK VideoWndProcA(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 PostMessageA(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 DefWindowProcA(hwnd, uMsg, wParam, lParam);
167 static BOOL CreateRenderingWindow(VideoRendererImpl* This)
171 TRACE("(%p)->()\n", This);
174 winclass.lpfnWndProc = VideoWndProcA;
175 winclass.cbClsExtra = 0;
176 winclass.cbWndExtra = sizeof(VideoRendererImpl*);
177 winclass.hInstance = NULL;
178 winclass.hIcon = NULL;
179 winclass.hCursor = NULL;
180 winclass.hbrBackground = GetStockObject(BLACK_BRUSH);
181 winclass.lpszMenuName = NULL;
182 winclass.lpszClassName = "Wine ActiveMovie Class";
184 if (!wnd_class_registered)
186 if (!RegisterClassA(&winclass))
188 ERR("Unable to register window %u\n", GetLastError());
191 wnd_class_registered = TRUE;
194 This->hWnd = CreateWindowExA(0, "Wine ActiveMovie Class", "Wine ActiveMovie Window", WS_SIZEBOX,
195 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL,
200 ERR("Unable to create window\n");
204 SetWindowLongPtrW(This->hWnd, 0, (LONG_PTR)This);
209 static DWORD WINAPI MessageLoop(LPVOID lpParameter)
211 VideoRendererImpl* This = lpParameter;
215 TRACE("Starting message loop\n");
217 if (!CreateRenderingWindow(This))
219 This->ThreadResult = FALSE;
220 SetEvent(This->hEvent);
224 This->ThreadResult = TRUE;
225 SetEvent(This->hEvent);
227 while ((fGotMessage = GetMessageA(&msg, NULL, 0, 0)) != 0 && fGotMessage != -1)
229 TranslateMessage(&msg);
230 DispatchMessageA(&msg);
233 TRACE("End of message loop\n");
238 static BOOL CreateRenderingSubsystem(VideoRendererImpl* This)
240 This->hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
244 This->hThread = CreateThread(NULL, 0, MessageLoop, This, 0, &This->ThreadID);
247 CloseHandle(This->hEvent);
251 WaitForSingleObject(This->hEvent, INFINITE);
253 if (!This->ThreadResult)
255 CloseHandle(This->hEvent);
256 CloseHandle(This->hThread);
263 static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data, DWORD size)
269 BITMAPINFOHEADER *bmiHeader;
271 TRACE("(%p)->(%p, %d)\n", This, data, size);
273 sdesc.dwSize = sizeof(sdesc);
274 hr = IPin_ConnectionMediaType((IPin *)This->pInputPin, &amt);
276 ERR("Unable to retrieve media type\n");
280 if (IsEqualIID(&amt.formattype, &FORMAT_VideoInfo))
282 bmiHeader = &((VIDEOINFOHEADER *)amt.pbFormat)->bmiHeader;
284 else if (IsEqualIID(&amt.formattype, &FORMAT_VideoInfo2))
286 bmiHeader = &((VIDEOINFOHEADER2 *)amt.pbFormat)->bmiHeader;
290 FIXME("Unknown type %s\n", debugstr_guid(&amt.subtype));
291 return VFW_E_RUNTIME_ERROR;
294 TRACE("biSize = %d\n", bmiHeader->biSize);
295 TRACE("biWidth = %d\n", bmiHeader->biWidth);
296 TRACE("biHeight = %d\n", bmiHeader->biHeight);
297 TRACE("biPlanes = %d\n", bmiHeader->biPlanes);
298 TRACE("biBitCount = %d\n", bmiHeader->biBitCount);
299 TRACE("biCompression = %s\n", debugstr_an((LPSTR)&(bmiHeader->biCompression), 4));
300 TRACE("biSizeImage = %d\n", bmiHeader->biSizeImage);
304 if (!This->WindowPos.right || !This->WindowPos.top)
306 DWORD style = GetWindowLongW(This->hWnd, GWL_STYLE);
307 DWORD style_ex = GetWindowLongW(This->hWnd, GWL_EXSTYLE);
309 if (!This->WindowPos.right)
311 This->WindowPos.left = This->SourceRect.left;
312 This->WindowPos.right = This->SourceRect.right;
314 if (!This->WindowPos.bottom)
316 This->WindowPos.top = This->SourceRect.top;
317 This->WindowPos.bottom = This->SourceRect.bottom;
320 AdjustWindowRectEx(&This->WindowPos, style, TRUE, style_ex);
322 TRACE("WindowPos: %d %d %d %d\n", This->WindowPos.left, This->WindowPos.top, This->WindowPos.right, This->WindowPos.bottom);
323 SetWindowPos(This->hWnd, NULL,
324 This->WindowPos.left,
326 This->WindowPos.right - This->WindowPos.left,
327 This->WindowPos.bottom - This->WindowPos.top,
328 SWP_NOZORDER|SWP_NOMOVE|SWP_DEFERERASE);
330 GetClientRect(This->hWnd, &This->DestRect);
333 This->DestRect = This->WindowPos;
337 hDC = GetDC(This->hWnd);
340 ERR("Cannot get DC from window!\n");
344 TRACE("Src Rect: %d %d %d %d\n", This->SourceRect.left, This->SourceRect.top, This->SourceRect.right, This->SourceRect.bottom);
345 TRACE("Dst Rect: %d %d %d %d\n", This->DestRect.left, This->DestRect.top, This->DestRect.right, This->DestRect.bottom);
347 StretchDIBits(hDC, This->DestRect.left, This->DestRect.top, This->DestRect.right -This->DestRect.left,
348 This->DestRect.bottom - This->DestRect.top, This->SourceRect.left, This->SourceRect.top,
349 This->SourceRect.right - This->SourceRect.left, This->SourceRect.bottom - This->SourceRect.top,
350 data, (BITMAPINFO *)bmiHeader, DIB_RGB_COLORS, SRCCOPY);
352 ReleaseDC(This->hWnd, hDC);
354 ShowWindow(This->hWnd, SW_SHOW);
359 static HRESULT WINAPI VideoRenderer_Receive(BaseInputPin* pin, IMediaSample * pSample)
361 VideoRendererImpl *This = (VideoRendererImpl *)pin->pin.pinInfo.pFilter;
362 LPBYTE pbSrcStream = NULL;
363 LONG cbSrcStream = 0;
364 REFERENCE_TIME tStart, tStop;
367 TRACE("(%p)->(%p)\n", pin, pSample);
369 EnterCriticalSection(&This->filter.csFilter);
371 if (This->pInputPin->flushing || This->pInputPin->end_of_stream)
373 LeaveCriticalSection(&This->filter.csFilter);
377 if (This->filter.state == State_Stopped)
379 LeaveCriticalSection(&This->filter.csFilter);
380 return VFW_E_WRONG_STATE;
383 if (IMediaSample_GetMediaTime(pSample, &tStart, &tStop) == S_OK)
384 MediaSeekingPassThru_RegisterMediaTime(This->seekthru_unk, tStart);
386 hr = IMediaSample_GetTime(pSample, &tStart, &tStop);
388 ERR("Cannot get sample time (%x)\n", hr);
390 if (This->rtLastStop != tStart && This->filter.state == State_Running)
393 delta = tStart - This->rtLastStop;
394 if ((delta < -100000 || delta > 100000) &&
395 IMediaSample_IsDiscontinuity(pSample) == S_FALSE)
396 ERR("Unexpected discontinuity: Last: %u.%03u, tStart: %u.%03u\n",
397 (DWORD)(This->rtLastStop / 10000000),
398 (DWORD)((This->rtLastStop / 10000)%1000),
399 (DWORD)(tStart / 10000000), (DWORD)((tStart / 10000)%1000));
400 This->rtLastStop = tStart;
403 /* Preroll means the sample isn't shown, this is used for key frames and things like that */
404 if (IMediaSample_IsPreroll(pSample) == S_OK)
406 This->rtLastStop = tStop;
407 LeaveCriticalSection(&This->filter.csFilter);
411 hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
414 ERR("Cannot get pointer to sample data (%x)\n", hr);
415 LeaveCriticalSection(&This->filter.csFilter);
419 cbSrcStream = IMediaSample_GetActualDataLength(pSample);
421 TRACE("val %p %d\n", pbSrcStream, cbSrcStream);
423 #if 0 /* For debugging purpose */
426 for(i = 0; i < cbSrcStream; i++)
428 if ((i!=0) && !(i%16))
430 TRACE("%02x ", pbSrcStream[i]);
436 SetEvent(This->hEvent);
437 if (This->filter.state == State_Paused)
439 This->sample_held = pSample;
440 LeaveCriticalSection(&This->filter.csFilter);
441 WaitForSingleObject(This->blocked, INFINITE);
442 EnterCriticalSection(&This->filter.csFilter);
443 This->sample_held = NULL;
444 if (This->filter.state == State_Paused)
447 LeaveCriticalSection(&This->filter.csFilter);
450 if (This->filter.state == State_Stopped)
452 LeaveCriticalSection(&This->filter.csFilter);
453 return VFW_E_WRONG_STATE;
457 if (This->filter.pClock && This->filter.state == State_Running)
459 REFERENCE_TIME time, trefstart, trefstop;
462 /* Perhaps I <SHOULD> use the reference clock AdviseTime function here
463 * I'm not going to! When I tried, it seemed to generate lag and
464 * it caused instability.
466 IReferenceClock_GetTime(This->filter.pClock, &time);
468 trefstart = This->filter.rtStreamStart;
469 trefstop = (REFERENCE_TIME)((double)(tStop - tStart) / This->pInputPin->pin.dRate) + This->filter.rtStreamStart;
470 delta = (LONG)((trefstart-time)/10000);
471 This->filter.rtStreamStart = trefstop;
472 This->rtLastStop = tStop;
476 TRACE("Sleeping for %u ms\n", delta);
479 else if (time > trefstop)
481 TRACE("Dropping sample: Time: %u.%03u ms trefstop: %u.%03u ms!\n",
482 (DWORD)(time / 10000000), (DWORD)((time / 10000)%1000),
483 (DWORD)(trefstop / 10000000), (DWORD)((trefstop / 10000)%1000) );
484 This->rtLastStop = tStop;
485 LeaveCriticalSection(&This->filter.csFilter);
489 This->rtLastStop = tStop;
491 VideoRenderer_SendSampleData(This, pbSrcStream, cbSrcStream);
493 LeaveCriticalSection(&This->filter.csFilter);
497 static HRESULT WINAPI VideoRenderer_CheckMediaType(BasePin *iface, const AM_MEDIA_TYPE * pmt)
499 BaseInputPin* pin = (BaseInputPin*)iface;
500 VideoRendererImpl *This = (VideoRendererImpl *)pin->pin.pinInfo.pFilter;
502 if (!IsEqualIID(&pmt->majortype, &MEDIATYPE_Video))
505 if (IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB32) ||
506 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB24) ||
507 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB565) ||
508 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB8))
512 if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo))
514 VIDEOINFOHEADER *format = (VIDEOINFOHEADER *)pmt->pbFormat;
515 This->SourceRect.left = 0;
516 This->SourceRect.top = 0;
517 This->SourceRect.right = This->VideoWidth = format->bmiHeader.biWidth;
518 height = format->bmiHeader.biHeight;
520 This->SourceRect.bottom = This->VideoHeight = -height;
522 This->SourceRect.bottom = This->VideoHeight = height;
524 else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2))
526 VIDEOINFOHEADER2 *format2 = (VIDEOINFOHEADER2 *)pmt->pbFormat;
528 This->SourceRect.left = 0;
529 This->SourceRect.top = 0;
530 This->SourceRect.right = This->VideoWidth = format2->bmiHeader.biWidth;
531 height = format2->bmiHeader.biHeight;
533 This->SourceRect.bottom = This->VideoHeight = -height;
535 This->SourceRect.bottom = This->VideoHeight = height;
539 WARN("Format type %s not supported\n", debugstr_guid(&pmt->formattype));
547 static IPin* WINAPI VideoRenderer_GetPin(BaseFilter *iface, int pos)
549 VideoRendererImpl *This = (VideoRendererImpl *)iface;
551 if (pos >= 1 || pos < 0)
554 IPin_AddRef((IPin *)This->pInputPin);
555 return (IPin *)This->pInputPin;
558 static LONG WINAPI VideoRenderer_GetPinCount(BaseFilter *iface)
563 static const BaseFilterFuncTable BaseFuncTable = {
564 VideoRenderer_GetPin,
565 VideoRenderer_GetPinCount
568 static const BasePinFuncTable input_BaseFuncTable = {
569 VideoRenderer_CheckMediaType,
571 BasePinImpl_GetMediaTypeVersion,
572 BasePinImpl_GetMediaType
575 static const BaseInputPinFuncTable input_BaseInputFuncTable = {
576 VideoRenderer_Receive
579 HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
583 VideoRendererImpl * pVideoRenderer;
584 ISeekingPassThru *passthru;
586 TRACE("(%p, %p)\n", pUnkOuter, ppv);
590 pVideoRenderer = CoTaskMemAlloc(sizeof(VideoRendererImpl));
591 pVideoRenderer->pUnkOuter = pUnkOuter;
592 pVideoRenderer->bUnkOuterValid = FALSE;
593 pVideoRenderer->bAggregatable = FALSE;
594 pVideoRenderer->IInner_vtbl = &IInner_VTable;
595 pVideoRenderer->IAMFilterMiscFlags_vtbl = &IAMFilterMiscFlags_Vtbl;
597 BaseFilter_Init(&pVideoRenderer->filter, &VideoRenderer_Vtbl, &CLSID_VideoRenderer, (DWORD_PTR)(__FILE__ ": VideoRendererImpl.csFilter"), &BaseFuncTable);
599 pVideoRenderer->IBasicVideo_vtbl = &IBasicVideo_VTable;
600 pVideoRenderer->IVideoWindow_vtbl = &IVideoWindow_VTable;
602 pVideoRenderer->init = 0;
603 pVideoRenderer->AutoShow = 1;
604 pVideoRenderer->rtLastStop = -1;
605 ZeroMemory(&pVideoRenderer->SourceRect, sizeof(RECT));
606 ZeroMemory(&pVideoRenderer->DestRect, sizeof(RECT));
607 ZeroMemory(&pVideoRenderer->WindowPos, sizeof(RECT));
608 pVideoRenderer->hWndMsgDrain = NULL;
609 pVideoRenderer->WindowStyle = WS_OVERLAPPED;
611 /* construct input pin */
612 piInput.dir = PINDIR_INPUT;
613 piInput.pFilter = (IBaseFilter *)pVideoRenderer;
614 lstrcpynW(piInput.achName, wcsInputPinName, sizeof(piInput.achName) / sizeof(piInput.achName[0]));
616 hr = BaseInputPin_Construct(&VideoRenderer_InputPin_Vtbl, &piInput, &input_BaseFuncTable, &input_BaseInputFuncTable, &pVideoRenderer->filter.csFilter, NULL, (IPin **)&pVideoRenderer->pInputPin);
620 hr = CoCreateInstance(&CLSID_SeekingPassThru, pUnkOuter ? pUnkOuter : (IUnknown*)&pVideoRenderer->IInner_vtbl, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&pVideoRenderer->seekthru_unk);
622 IPin_Release((IPin*)pVideoRenderer->pInputPin);
625 IUnknown_QueryInterface(pVideoRenderer->seekthru_unk, &IID_ISeekingPassThru, (void**)&passthru);
626 ISeekingPassThru_Init(passthru, TRUE, (IPin*)pVideoRenderer->pInputPin);
627 ISeekingPassThru_Release(passthru);
628 pVideoRenderer->sample_held = NULL;
629 *ppv = pVideoRenderer;
634 QualityControlImpl_init(&pVideoRenderer->qcimpl, (IPin*)pVideoRenderer->pInputPin, (IBaseFilter*)pVideoRenderer);
635 pVideoRenderer->qcimpl.lpVtbl = &VideoRenderer_QualityControl_Vtbl;
637 if (!CreateRenderingSubsystem(pVideoRenderer))
640 pVideoRenderer->blocked = CreateEventW(NULL, FALSE, FALSE, NULL);
641 if (!pVideoRenderer->blocked)
643 hr = HRESULT_FROM_WIN32(GetLastError());
644 IUnknown_Release((IUnknown *)pVideoRenderer);
649 BaseFilterImpl_Release((IBaseFilter*)pVideoRenderer);
650 CoTaskMemFree(pVideoRenderer);
654 HRESULT VideoRendererDefault_create(IUnknown * pUnkOuter, LPVOID * ppv)
656 /* TODO: Attempt to use the VMR-7 renderer instead when possible */
657 return VideoRenderer_create(pUnkOuter, ppv);
660 static HRESULT WINAPI VideoRendererInner_QueryInterface(IUnknown * iface, REFIID riid, LPVOID * ppv)
662 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
663 TRACE("(%p/%p)->(%s, %p)\n", This, iface, qzdebugstr_guid(riid), ppv);
665 if (This->bAggregatable)
666 This->bUnkOuterValid = TRUE;
670 if (IsEqualIID(riid, &IID_IUnknown))
671 *ppv = &This->IInner_vtbl;
672 else if (IsEqualIID(riid, &IID_IPersist))
674 else if (IsEqualIID(riid, &IID_IMediaFilter))
676 else if (IsEqualIID(riid, &IID_IBaseFilter))
678 else if (IsEqualIID(riid, &IID_IBasicVideo))
679 *ppv = &This->IBasicVideo_vtbl;
680 else if (IsEqualIID(riid, &IID_IVideoWindow))
681 *ppv = &This->IVideoWindow_vtbl;
682 else if (IsEqualIID(riid, &IID_IMediaSeeking))
683 return IUnknown_QueryInterface(This->seekthru_unk, riid, ppv);
684 else if (IsEqualIID(riid, &IID_IAMFilterMiscFlags))
685 *ppv = &This->IAMFilterMiscFlags_vtbl;
686 else if (IsEqualIID(riid, &IID_IQualityControl))
687 *ppv = &This->qcimpl;
691 IUnknown_AddRef((IUnknown *)(*ppv));
695 if (!IsEqualIID(riid, &IID_IPin))
696 FIXME("No interface for %s!\n", qzdebugstr_guid(riid));
698 return E_NOINTERFACE;
701 static ULONG WINAPI VideoRendererInner_AddRef(IUnknown * iface)
703 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
704 ULONG refCount = InterlockedIncrement(&This->filter.refCount);
706 TRACE("(%p/%p)->() AddRef from %d\n", This, iface, refCount - 1);
711 static ULONG WINAPI VideoRendererInner_Release(IUnknown * iface)
713 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
714 ULONG refCount = InterlockedDecrement(&This->filter.refCount);
716 TRACE("(%p/%p)->() Release from %d\n", This, iface, refCount + 1);
722 DestroyWindow(This->hWnd);
723 PostThreadMessageA(This->ThreadID, WM_QUIT, 0, 0);
724 WaitForSingleObject(This->hThread, INFINITE);
725 CloseHandle(This->hThread);
726 CloseHandle(This->hEvent);
728 if (SUCCEEDED(IPin_ConnectedTo((IPin *)This->pInputPin, &pConnectedTo)))
730 IPin_Disconnect(pConnectedTo);
731 IPin_Release(pConnectedTo);
733 IPin_Disconnect((IPin *)This->pInputPin);
735 IPin_Release((IPin *)This->pInputPin);
737 This->filter.lpVtbl = NULL;
738 IUnknown_Release(This->seekthru_unk);
739 This->filter.csFilter.DebugInfo->Spare[0] = 0;
740 DeleteCriticalSection(&This->filter.csFilter);
742 TRACE("Destroying Video Renderer\n");
751 static const IUnknownVtbl IInner_VTable =
753 VideoRendererInner_QueryInterface,
754 VideoRendererInner_AddRef,
755 VideoRendererInner_Release
758 static HRESULT WINAPI VideoRenderer_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv)
760 VideoRendererImpl *This = (VideoRendererImpl *)iface;
762 if (This->bAggregatable)
763 This->bUnkOuterValid = TRUE;
767 if (This->bAggregatable)
768 return IUnknown_QueryInterface(This->pUnkOuter, riid, ppv);
770 if (IsEqualIID(riid, &IID_IUnknown))
774 IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
775 hr = IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
776 IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
777 This->bAggregatable = TRUE;
782 return E_NOINTERFACE;
785 return IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
788 static ULONG WINAPI VideoRenderer_AddRef(IBaseFilter * iface)
790 VideoRendererImpl *This = (VideoRendererImpl *)iface;
792 if (This->pUnkOuter && This->bUnkOuterValid)
793 return IUnknown_AddRef(This->pUnkOuter);
794 return IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
797 static ULONG WINAPI VideoRenderer_Release(IBaseFilter * iface)
799 VideoRendererImpl *This = (VideoRendererImpl *)iface;
801 if (This->pUnkOuter && This->bUnkOuterValid)
802 return IUnknown_Release(This->pUnkOuter);
803 return IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
806 /** IMediaFilter methods **/
808 static HRESULT WINAPI VideoRenderer_Stop(IBaseFilter * iface)
810 VideoRendererImpl *This = (VideoRendererImpl *)iface;
812 TRACE("(%p/%p)->()\n", This, iface);
814 EnterCriticalSection(&This->filter.csFilter);
816 This->filter.state = State_Stopped;
817 SetEvent(This->hEvent);
818 SetEvent(This->blocked);
819 MediaSeekingPassThru_ResetMediaTime(This->seekthru_unk);
821 LeaveCriticalSection(&This->filter.csFilter);
826 static HRESULT WINAPI VideoRenderer_Pause(IBaseFilter * iface)
828 VideoRendererImpl *This = (VideoRendererImpl *)iface;
830 TRACE("(%p/%p)->()\n", This, iface);
832 EnterCriticalSection(&This->filter.csFilter);
833 if (This->filter.state != State_Paused)
835 if (This->filter.state == State_Stopped)
837 This->pInputPin->end_of_stream = 0;
838 ResetEvent(This->hEvent);
841 This->filter.state = State_Paused;
842 ResetEvent(This->blocked);
844 LeaveCriticalSection(&This->filter.csFilter);
849 static HRESULT WINAPI VideoRenderer_Run(IBaseFilter * iface, REFERENCE_TIME tStart)
852 VideoRendererImpl *This = (VideoRendererImpl *)iface;
854 TRACE("(%p/%p)->(%s)\n", This, iface, wine_dbgstr_longlong(tStart));
856 EnterCriticalSection(&This->filter.csFilter);
857 if (This->filter.state == State_Running)
859 if (This->pInputPin->pin.pConnectedTo)
861 if (This->filter.state == State_Stopped)
863 This->pInputPin->end_of_stream = 0;
864 ResetEvent(This->hEvent);
866 SetEvent(This->blocked);
868 This->filter.rtStreamStart = tStart;
869 This->filter.state = State_Running;
870 } else if (This->filter.filterInfo.pGraph) {
871 IMediaEventSink *pEventSink;
872 hr = IFilterGraph_QueryInterface(This->filter.filterInfo.pGraph, &IID_IMediaEventSink, (LPVOID*)&pEventSink);
875 hr = IMediaEventSink_Notify(pEventSink, EC_COMPLETE, S_OK, (LONG_PTR)This);
876 IMediaEventSink_Release(pEventSink);
881 This->filter.state = State_Running;
883 LeaveCriticalSection(&This->filter.csFilter);
888 static HRESULT WINAPI VideoRenderer_GetState(IBaseFilter * iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState)
890 VideoRendererImpl *This = (VideoRendererImpl *)iface;
893 TRACE("(%p/%p)->(%d, %p)\n", This, iface, dwMilliSecsTimeout, pState);
895 if (WaitForSingleObject(This->hEvent, dwMilliSecsTimeout) == WAIT_TIMEOUT)
896 hr = VFW_S_STATE_INTERMEDIATE;
900 BaseFilterImpl_GetState(iface, dwMilliSecsTimeout, pState);
905 /** IBaseFilter implementation **/
907 static HRESULT WINAPI VideoRenderer_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)
909 VideoRendererImpl *This = (VideoRendererImpl *)iface;
911 FIXME("(%p/%p)->(%p,%p): stub !!!\n", This, iface, debugstr_w(Id), ppPin);
913 /* FIXME: critical section */
918 static const IBaseFilterVtbl VideoRenderer_Vtbl =
920 VideoRenderer_QueryInterface,
921 VideoRenderer_AddRef,
922 VideoRenderer_Release,
923 BaseFilterImpl_GetClassID,
927 VideoRenderer_GetState,
928 BaseFilterImpl_SetSyncSource,
929 BaseFilterImpl_GetSyncSource,
930 BaseFilterImpl_EnumPins,
931 VideoRenderer_FindPin,
932 BaseFilterImpl_QueryFilterInfo,
933 BaseFilterImpl_JoinFilterGraph,
934 BaseFilterImpl_QueryVendorInfo
937 static HRESULT WINAPI VideoRenderer_InputPin_EndOfStream(IPin * iface)
939 BaseInputPin* This = (BaseInputPin*)iface;
940 VideoRendererImpl *pFilter;
941 IMediaEventSink* pEventSink;
944 TRACE("(%p/%p)->()\n", This, iface);
946 pFilter = (VideoRendererImpl*)This->pin.pinInfo.pFilter;
947 hr = IFilterGraph_QueryInterface(pFilter->filter.filterInfo.pGraph, &IID_IMediaEventSink, (LPVOID*)&pEventSink);
950 hr = IMediaEventSink_Notify(pEventSink, EC_COMPLETE, S_OK, (LONG_PTR)pFilter);
951 IMediaEventSink_Release(pEventSink);
953 MediaSeekingPassThru_EOS(pFilter->seekthru_unk);
958 static HRESULT WINAPI VideoRenderer_InputPin_BeginFlush(IPin * iface)
960 BaseInputPin* This = (BaseInputPin*)iface;
961 VideoRendererImpl *pVideoRenderer = (VideoRendererImpl *)This->pin.pinInfo.pFilter;
963 TRACE("(%p/%p)->()\n", This, iface);
965 SetEvent(pVideoRenderer->blocked);
966 return BaseInputPinImpl_BeginFlush(iface);
969 static HRESULT WINAPI VideoRenderer_InputPin_EndFlush(IPin * iface)
971 BaseInputPin* This = (BaseInputPin*)iface;
972 VideoRendererImpl *pVideoRenderer = (VideoRendererImpl *)This->pin.pinInfo.pFilter;
975 TRACE("(%p/%p)->()\n", This, iface);
977 EnterCriticalSection(This->pin.pCritSec);
978 if (pVideoRenderer->filter.state == State_Paused)
979 ResetEvent(pVideoRenderer->blocked);
981 hr = BaseInputPinImpl_EndFlush(iface);
982 LeaveCriticalSection(This->pin.pCritSec);
983 MediaSeekingPassThru_ResetMediaTime(pVideoRenderer->seekthru_unk);
988 static const IPinVtbl VideoRenderer_InputPin_Vtbl =
990 BaseInputPinImpl_QueryInterface,
992 BaseInputPinImpl_Release,
993 BaseInputPinImpl_Connect,
994 BaseInputPinImpl_ReceiveConnection,
995 BasePinImpl_Disconnect,
996 BasePinImpl_ConnectedTo,
997 BasePinImpl_ConnectionMediaType,
998 BasePinImpl_QueryPinInfo,
999 BasePinImpl_QueryDirection,
1000 BasePinImpl_QueryId,
1001 BaseInputPinImpl_QueryAccept,
1002 BasePinImpl_EnumMediaTypes,
1003 BasePinImpl_QueryInternalConnections,
1004 VideoRenderer_InputPin_EndOfStream,
1005 VideoRenderer_InputPin_BeginFlush,
1006 VideoRenderer_InputPin_EndFlush,
1007 BaseInputPinImpl_NewSegment
1010 /*** IUnknown methods ***/
1011 static HRESULT WINAPI Basicvideo_QueryInterface(IBasicVideo *iface,
1014 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1016 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1018 return VideoRenderer_QueryInterface((IBaseFilter*)This, riid, ppvObj);
1021 static ULONG WINAPI Basicvideo_AddRef(IBasicVideo *iface) {
1022 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1024 TRACE("(%p/%p)->()\n", This, iface);
1026 return VideoRenderer_AddRef((IBaseFilter*)This);
1029 static ULONG WINAPI Basicvideo_Release(IBasicVideo *iface) {
1030 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1032 TRACE("(%p/%p)->()\n", This, iface);
1034 return VideoRenderer_Release((IBaseFilter*)This);
1037 /*** IDispatch methods ***/
1038 static HRESULT WINAPI Basicvideo_GetTypeInfoCount(IBasicVideo *iface,
1040 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1042 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
1047 static HRESULT WINAPI Basicvideo_GetTypeInfo(IBasicVideo *iface,
1050 ITypeInfo**ppTInfo) {
1051 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1053 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
1058 static HRESULT WINAPI Basicvideo_GetIDsOfNames(IBasicVideo *iface,
1064 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1066 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1071 static HRESULT WINAPI Basicvideo_Invoke(IBasicVideo *iface,
1072 DISPID dispIdMember,
1076 DISPPARAMS*pDispParams,
1078 EXCEPINFO*pExepInfo,
1080 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1082 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);
1087 /*** IBasicVideo methods ***/
1088 static HRESULT WINAPI Basicvideo_get_AvgTimePerFrame(IBasicVideo *iface,
1089 REFTIME *pAvgTimePerFrame) {
1091 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1093 if (!This->pInputPin->pin.pConnectedTo)
1094 return VFW_E_NOT_CONNECTED;
1096 TRACE("(%p/%p)->(%p)\n", This, iface, pAvgTimePerFrame);
1098 pmt = &This->pInputPin->pin.mtCurrent;
1099 if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo)) {
1100 VIDEOINFOHEADER *vih = (VIDEOINFOHEADER*)pmt->pbFormat;
1101 *pAvgTimePerFrame = vih->AvgTimePerFrame;
1102 } else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2)) {
1103 VIDEOINFOHEADER2 *vih = (VIDEOINFOHEADER2*)pmt->pbFormat;
1104 *pAvgTimePerFrame = vih->AvgTimePerFrame;
1106 ERR("Unknown format type %s\n", qzdebugstr_guid(&pmt->formattype));
1107 *pAvgTimePerFrame = 0;
1112 static HRESULT WINAPI Basicvideo_get_BitRate(IBasicVideo *iface,
1114 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1116 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBitRate);
1121 static HRESULT WINAPI Basicvideo_get_BitErrorRate(IBasicVideo *iface,
1122 LONG *pBitErrorRate) {
1123 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1125 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBitErrorRate);
1130 static HRESULT WINAPI Basicvideo_get_VideoWidth(IBasicVideo *iface,
1131 LONG *pVideoWidth) {
1132 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1134 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoWidth);
1136 *pVideoWidth = This->VideoWidth;
1141 static HRESULT WINAPI Basicvideo_get_VideoHeight(IBasicVideo *iface,
1142 LONG *pVideoHeight) {
1143 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1145 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoHeight);
1147 *pVideoHeight = This->VideoHeight;
1152 static HRESULT WINAPI Basicvideo_put_SourceLeft(IBasicVideo *iface,
1154 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1156 TRACE("(%p/%p)->(%d)\n", This, iface, SourceLeft);
1158 This->SourceRect.left = SourceLeft;
1163 static HRESULT WINAPI Basicvideo_get_SourceLeft(IBasicVideo *iface,
1164 LONG *pSourceLeft) {
1165 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1167 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceLeft);
1169 *pSourceLeft = This->SourceRect.left;
1174 static HRESULT WINAPI Basicvideo_put_SourceWidth(IBasicVideo *iface,
1176 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1178 TRACE("(%p/%p)->(%d)\n", This, iface, SourceWidth);
1180 This->SourceRect.right = This->SourceRect.left + SourceWidth;
1185 static HRESULT WINAPI Basicvideo_get_SourceWidth(IBasicVideo *iface,
1186 LONG *pSourceWidth) {
1187 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1189 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceWidth);
1191 *pSourceWidth = This->SourceRect.right - This->SourceRect.left;
1196 static HRESULT WINAPI Basicvideo_put_SourceTop(IBasicVideo *iface,
1198 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1200 TRACE("(%p/%p)->(%d)\n", This, iface, SourceTop);
1202 This->SourceRect.top = SourceTop;
1207 static HRESULT WINAPI Basicvideo_get_SourceTop(IBasicVideo *iface,
1209 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1211 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceTop);
1213 *pSourceTop = This->SourceRect.top;
1218 static HRESULT WINAPI Basicvideo_put_SourceHeight(IBasicVideo *iface,
1219 LONG SourceHeight) {
1220 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1222 TRACE("(%p/%p)->(%d)\n", This, iface, SourceHeight);
1224 This->SourceRect.bottom = This->SourceRect.top + SourceHeight;
1229 static HRESULT WINAPI Basicvideo_get_SourceHeight(IBasicVideo *iface,
1230 LONG *pSourceHeight) {
1231 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1233 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceHeight);
1235 *pSourceHeight = This->SourceRect.bottom - This->SourceRect.top;
1240 static HRESULT WINAPI Basicvideo_put_DestinationLeft(IBasicVideo *iface,
1241 LONG DestinationLeft) {
1242 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1244 TRACE("(%p/%p)->(%d)\n", This, iface, DestinationLeft);
1246 This->DestRect.left = DestinationLeft;
1251 static HRESULT WINAPI Basicvideo_get_DestinationLeft(IBasicVideo *iface,
1252 LONG *pDestinationLeft) {
1253 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1255 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationLeft);
1257 *pDestinationLeft = This->DestRect.left;
1262 static HRESULT WINAPI Basicvideo_put_DestinationWidth(IBasicVideo *iface,
1263 LONG DestinationWidth) {
1264 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1266 TRACE("(%p/%p)->(%d)\n", This, iface, DestinationWidth);
1268 This->DestRect.right = This->DestRect.left + DestinationWidth;
1273 static HRESULT WINAPI Basicvideo_get_DestinationWidth(IBasicVideo *iface,
1274 LONG *pDestinationWidth) {
1275 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1277 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationWidth);
1279 *pDestinationWidth = This->DestRect.right - This->DestRect.left;
1284 static HRESULT WINAPI Basicvideo_put_DestinationTop(IBasicVideo *iface,
1285 LONG DestinationTop) {
1286 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1288 TRACE("(%p/%p)->(%d)\n", This, iface, DestinationTop);
1290 This->DestRect.top = DestinationTop;
1295 static HRESULT WINAPI Basicvideo_get_DestinationTop(IBasicVideo *iface,
1296 LONG *pDestinationTop) {
1297 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1299 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationTop);
1301 *pDestinationTop = This->DestRect.top;
1306 static HRESULT WINAPI Basicvideo_put_DestinationHeight(IBasicVideo *iface,
1307 LONG DestinationHeight) {
1308 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1310 TRACE("(%p/%p)->(%d)\n", This, iface, DestinationHeight);
1312 This->DestRect.right = This->DestRect.left + DestinationHeight;
1317 static HRESULT WINAPI Basicvideo_get_DestinationHeight(IBasicVideo *iface,
1318 LONG *pDestinationHeight) {
1319 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1321 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationHeight);
1323 *pDestinationHeight = This->DestRect.right - This->DestRect.left;
1328 static HRESULT WINAPI Basicvideo_SetSourcePosition(IBasicVideo *iface,
1333 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1335 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height);
1337 This->SourceRect.left = Left;
1338 This->SourceRect.top = Top;
1339 This->SourceRect.right = Left + Width;
1340 This->SourceRect.bottom = Top + Height;
1345 static HRESULT WINAPI Basicvideo_GetSourcePosition(IBasicVideo *iface,
1350 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1352 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1354 *pLeft = This->SourceRect.left;
1355 *pTop = This->SourceRect.top;
1356 *pWidth = This->SourceRect.right - This->SourceRect.left;
1357 *pHeight = This->SourceRect.bottom - This->SourceRect.top;
1362 static HRESULT WINAPI Basicvideo_SetDefaultSourcePosition(IBasicVideo *iface) {
1363 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1365 TRACE("(%p/%p)->()\n", This, iface);
1367 This->SourceRect.left = 0;
1368 This->SourceRect.top = 0;
1369 This->SourceRect.right = This->VideoWidth;
1370 This->SourceRect.bottom = This->VideoHeight;
1375 static HRESULT WINAPI Basicvideo_SetDestinationPosition(IBasicVideo *iface,
1380 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1382 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height);
1384 This->DestRect.left = Left;
1385 This->DestRect.top = Top;
1386 This->DestRect.right = Left + Width;
1387 This->DestRect.bottom = Top + Height;
1392 static HRESULT WINAPI Basicvideo_GetDestinationPosition(IBasicVideo *iface,
1397 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1399 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1401 *pLeft = This->DestRect.left;
1402 *pTop = This->DestRect.top;
1403 *pWidth = This->DestRect.right - This->DestRect.left;
1404 *pHeight = This->DestRect.bottom - This->DestRect.top;
1409 static HRESULT WINAPI Basicvideo_SetDefaultDestinationPosition(IBasicVideo *iface) {
1410 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1413 TRACE("(%p/%p)->()\n", This, iface);
1415 if (!GetClientRect(This->hWnd, &rect))
1418 This->SourceRect.left = 0;
1419 This->SourceRect.top = 0;
1420 This->SourceRect.right = rect.right;
1421 This->SourceRect.bottom = rect.bottom;
1426 static HRESULT WINAPI Basicvideo_GetVideoSize(IBasicVideo *iface,
1429 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1431 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
1433 *pWidth = This->VideoWidth;
1434 *pHeight = This->VideoHeight;
1439 static HRESULT WINAPI Basicvideo_GetVideoPaletteEntries(IBasicVideo *iface,
1444 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1446 FIXME("(%p/%p)->(%d, %d, %p, %p): stub !!!\n", This, iface, StartIndex, Entries, pRetrieved, pPalette);
1451 static HRESULT WINAPI Basicvideo_GetCurrentImage(IBasicVideo *iface,
1454 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1455 BITMAPINFOHEADER *bmiHeader;
1457 AM_MEDIA_TYPE *amt = &This->pInputPin->pin.mtCurrent;
1460 FIXME("(%p/%p)->(%p, %p): partial stub\n", This, iface, pBufferSize, pDIBImage);
1462 EnterCriticalSection(&This->filter.csFilter);
1464 if (!This->sample_held)
1466 LeaveCriticalSection(&This->filter.csFilter);
1467 return (This->filter.state == State_Paused ? E_UNEXPECTED : VFW_E_NOT_PAUSED);
1470 if (IsEqualIID(&amt->formattype, &FORMAT_VideoInfo))
1472 bmiHeader = &((VIDEOINFOHEADER *)amt->pbFormat)->bmiHeader;
1474 else if (IsEqualIID(&amt->formattype, &FORMAT_VideoInfo2))
1476 bmiHeader = &((VIDEOINFOHEADER2 *)amt->pbFormat)->bmiHeader;
1480 FIXME("Unknown type %s\n", debugstr_guid(&amt->subtype));
1481 LeaveCriticalSection(&This->filter.csFilter);
1482 return VFW_E_RUNTIME_ERROR;
1485 needed_size = bmiHeader->biSize;
1486 needed_size += IMediaSample_GetActualDataLength(This->sample_held);
1490 *pBufferSize = needed_size;
1491 LeaveCriticalSection(&This->filter.csFilter);
1495 if (needed_size < *pBufferSize)
1497 ERR("Buffer too small %u/%u\n", needed_size, *pBufferSize);
1498 LeaveCriticalSection(&This->filter.csFilter);
1501 *pBufferSize = needed_size;
1503 memcpy(pDIBImage, bmiHeader, bmiHeader->biSize);
1504 IMediaSample_GetPointer(This->sample_held, (BYTE **)&ptr);
1505 memcpy((char *)pDIBImage + bmiHeader->biSize, ptr, IMediaSample_GetActualDataLength(This->sample_held));
1507 LeaveCriticalSection(&This->filter.csFilter);
1512 static HRESULT WINAPI Basicvideo_IsUsingDefaultSource(IBasicVideo *iface) {
1513 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1515 FIXME("(%p/%p)->(): stub !!!\n", This, iface);
1520 static HRESULT WINAPI Basicvideo_IsUsingDefaultDestination(IBasicVideo *iface) {
1521 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1523 FIXME("(%p/%p)->(): stub !!!\n", This, iface);
1529 static const IBasicVideoVtbl IBasicVideo_VTable =
1531 Basicvideo_QueryInterface,
1534 Basicvideo_GetTypeInfoCount,
1535 Basicvideo_GetTypeInfo,
1536 Basicvideo_GetIDsOfNames,
1538 Basicvideo_get_AvgTimePerFrame,
1539 Basicvideo_get_BitRate,
1540 Basicvideo_get_BitErrorRate,
1541 Basicvideo_get_VideoWidth,
1542 Basicvideo_get_VideoHeight,
1543 Basicvideo_put_SourceLeft,
1544 Basicvideo_get_SourceLeft,
1545 Basicvideo_put_SourceWidth,
1546 Basicvideo_get_SourceWidth,
1547 Basicvideo_put_SourceTop,
1548 Basicvideo_get_SourceTop,
1549 Basicvideo_put_SourceHeight,
1550 Basicvideo_get_SourceHeight,
1551 Basicvideo_put_DestinationLeft,
1552 Basicvideo_get_DestinationLeft,
1553 Basicvideo_put_DestinationWidth,
1554 Basicvideo_get_DestinationWidth,
1555 Basicvideo_put_DestinationTop,
1556 Basicvideo_get_DestinationTop,
1557 Basicvideo_put_DestinationHeight,
1558 Basicvideo_get_DestinationHeight,
1559 Basicvideo_SetSourcePosition,
1560 Basicvideo_GetSourcePosition,
1561 Basicvideo_SetDefaultSourcePosition,
1562 Basicvideo_SetDestinationPosition,
1563 Basicvideo_GetDestinationPosition,
1564 Basicvideo_SetDefaultDestinationPosition,
1565 Basicvideo_GetVideoSize,
1566 Basicvideo_GetVideoPaletteEntries,
1567 Basicvideo_GetCurrentImage,
1568 Basicvideo_IsUsingDefaultSource,
1569 Basicvideo_IsUsingDefaultDestination
1573 /*** IUnknown methods ***/
1574 static HRESULT WINAPI Videowindow_QueryInterface(IVideoWindow *iface,
1577 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1579 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1581 return VideoRenderer_QueryInterface((IBaseFilter*)This, riid, ppvObj);
1584 static ULONG WINAPI Videowindow_AddRef(IVideoWindow *iface) {
1585 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1587 TRACE("(%p/%p)->()\n", This, iface);
1589 return VideoRenderer_AddRef((IBaseFilter*)This);
1592 static ULONG WINAPI Videowindow_Release(IVideoWindow *iface) {
1593 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1595 TRACE("(%p/%p)->()\n", This, iface);
1597 return VideoRenderer_Release((IBaseFilter*)This);
1600 /*** IDispatch methods ***/
1601 static HRESULT WINAPI Videowindow_GetTypeInfoCount(IVideoWindow *iface,
1603 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1605 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
1610 static HRESULT WINAPI Videowindow_GetTypeInfo(IVideoWindow *iface,
1613 ITypeInfo**ppTInfo) {
1614 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1616 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
1621 static HRESULT WINAPI Videowindow_GetIDsOfNames(IVideoWindow *iface,
1627 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1629 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1634 static HRESULT WINAPI Videowindow_Invoke(IVideoWindow *iface,
1635 DISPID dispIdMember,
1639 DISPPARAMS*pDispParams,
1641 EXCEPINFO*pExepInfo,
1643 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1645 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);
1650 /*** IVideoWindow methods ***/
1651 static HRESULT WINAPI Videowindow_put_Caption(IVideoWindow *iface,
1653 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1655 TRACE("(%p/%p)->(%s (%p))\n", This, iface, debugstr_w(strCaption), strCaption);
1657 if (!SetWindowTextW(This->hWnd, strCaption))
1663 static HRESULT WINAPI Videowindow_get_Caption(IVideoWindow *iface,
1665 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1667 TRACE("(%p/%p)->(%p)\n", This, iface, strCaption);
1669 GetWindowTextW(This->hWnd, (LPWSTR)strCaption, 100);
1674 static HRESULT WINAPI Videowindow_put_WindowStyle(IVideoWindow *iface,
1676 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1679 old = GetWindowLongA(This->hWnd, GWL_STYLE);
1681 TRACE("(%p/%p)->(%x -> %x)\n", This, iface, old, WindowStyle);
1683 if (WindowStyle & (WS_DISABLED|WS_HSCROLL|WS_ICONIC|WS_MAXIMIZE|WS_MINIMIZE|WS_VSCROLL))
1684 return E_INVALIDARG;
1686 SetWindowLongA(This->hWnd, GWL_STYLE, WindowStyle);
1687 SetWindowPos(This->hWnd,0,0,0,0,0,SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOZORDER);
1688 This->WindowStyle = WindowStyle;
1693 static HRESULT WINAPI Videowindow_get_WindowStyle(IVideoWindow *iface,
1694 LONG *WindowStyle) {
1695 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1697 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyle);
1699 *WindowStyle = This->WindowStyle;
1704 static HRESULT WINAPI Videowindow_put_WindowStyleEx(IVideoWindow *iface,
1705 LONG WindowStyleEx) {
1706 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1708 TRACE("(%p/%p)->(%d)\n", This, iface, WindowStyleEx);
1710 if (!SetWindowLongA(This->hWnd, GWL_EXSTYLE, WindowStyleEx))
1716 static HRESULT WINAPI Videowindow_get_WindowStyleEx(IVideoWindow *iface,
1717 LONG *WindowStyleEx) {
1718 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1720 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyleEx);
1722 *WindowStyleEx = GetWindowLongA(This->hWnd, GWL_EXSTYLE);
1727 static HRESULT WINAPI Videowindow_put_AutoShow(IVideoWindow *iface,
1729 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1731 TRACE("(%p/%p)->(%d)\n", This, iface, AutoShow);
1733 This->AutoShow = AutoShow;
1738 static HRESULT WINAPI Videowindow_get_AutoShow(IVideoWindow *iface,
1740 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1742 TRACE("(%p/%p)->(%p)\n", This, iface, AutoShow);
1744 *AutoShow = This->AutoShow;
1749 static HRESULT WINAPI Videowindow_put_WindowState(IVideoWindow *iface,
1751 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1753 TRACE("(%p/%p)->(%d)\n", This, iface, WindowState);
1754 ShowWindow(This->hWnd, WindowState);
1758 static HRESULT WINAPI Videowindow_get_WindowState(IVideoWindow *iface,
1759 LONG *WindowState) {
1760 WINDOWPLACEMENT place;
1761 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1763 place.length = sizeof(place);
1764 GetWindowPlacement(This->hWnd, &place);
1765 TRACE("(%p/%p)->(%p)\n", This, iface, WindowState);
1766 *WindowState = place.showCmd;
1771 static HRESULT WINAPI Videowindow_put_BackgroundPalette(IVideoWindow *iface,
1772 LONG BackgroundPalette) {
1773 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1775 FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, BackgroundPalette);
1780 static HRESULT WINAPI Videowindow_get_BackgroundPalette(IVideoWindow *iface,
1781 LONG *pBackgroundPalette) {
1782 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1784 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBackgroundPalette);
1789 static HRESULT WINAPI Videowindow_put_Visible(IVideoWindow *iface,
1791 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1793 TRACE("(%p/%p)->(%d)\n", This, iface, Visible);
1795 ShowWindow(This->hWnd, Visible ? SW_SHOW : SW_HIDE);
1800 static HRESULT WINAPI Videowindow_get_Visible(IVideoWindow *iface,
1802 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1804 TRACE("(%p/%p)->(%p)\n", This, iface, pVisible);
1806 *pVisible = IsWindowVisible(This->hWnd);
1811 static HRESULT WINAPI Videowindow_put_Left(IVideoWindow *iface,
1813 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1815 TRACE("(%p/%p)->(%d)\n", This, iface, Left);
1817 if (!SetWindowPos(This->hWnd, NULL, Left, This->WindowPos.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE))
1820 This->WindowPos.left = Left;
1825 static HRESULT WINAPI Videowindow_get_Left(IVideoWindow *iface,
1827 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1829 TRACE("(%p/%p)->(%p)\n", This, iface, pLeft);
1831 *pLeft = This->WindowPos.left;
1836 static HRESULT WINAPI Videowindow_put_Width(IVideoWindow *iface,
1838 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1840 TRACE("(%p/%p)->(%d)\n", This, iface, Width);
1842 if (!SetWindowPos(This->hWnd, NULL, 0, 0, Width, This->WindowPos.bottom-This->WindowPos.top, SWP_NOZORDER|SWP_NOMOVE))
1845 This->WindowPos.right = This->WindowPos.left + Width;
1850 static HRESULT WINAPI Videowindow_get_Width(IVideoWindow *iface,
1852 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1854 TRACE("(%p/%p)->(%p)\n", This, iface, pWidth);
1856 *pWidth = This->WindowPos.right - This->WindowPos.left;
1861 static HRESULT WINAPI Videowindow_put_Top(IVideoWindow *iface,
1863 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1865 TRACE("(%p/%p)->(%d)\n", This, iface, Top);
1867 if (!SetWindowPos(This->hWnd, NULL, This->WindowPos.left, Top, 0, 0, SWP_NOZORDER|SWP_NOSIZE))
1870 This->WindowPos.top = Top;
1875 static HRESULT WINAPI Videowindow_get_Top(IVideoWindow *iface,
1877 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1879 TRACE("(%p/%p)->(%p)\n", This, iface, pTop);
1881 *pTop = This->WindowPos.top;
1886 static HRESULT WINAPI Videowindow_put_Height(IVideoWindow *iface,
1888 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1890 TRACE("(%p/%p)->(%d)\n", This, iface, Height);
1892 if (!SetWindowPos(This->hWnd, NULL, 0, 0, This->WindowPos.right-This->WindowPos.left, Height, SWP_NOZORDER|SWP_NOMOVE))
1895 This->WindowPos.bottom = This->WindowPos.top + Height;
1900 static HRESULT WINAPI Videowindow_get_Height(IVideoWindow *iface,
1902 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1904 TRACE("(%p/%p)->(%p)\n", This, iface, pHeight);
1906 *pHeight = This->WindowPos.bottom - This->WindowPos.top;
1911 static HRESULT WINAPI Videowindow_put_Owner(IVideoWindow *iface,
1913 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1915 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Owner);
1917 SetParent(This->hWnd, (HWND)Owner);
1918 if (This->WindowStyle & WS_CHILD)
1920 LONG old = GetWindowLongA(This->hWnd, GWL_STYLE);
1921 if (old != This->WindowStyle)
1923 SetWindowLongA(This->hWnd, GWL_STYLE, This->WindowStyle);
1924 SetWindowPos(This->hWnd,0,0,0,0,0,SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOZORDER);
1931 static HRESULT WINAPI Videowindow_get_Owner(IVideoWindow *iface,
1933 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1935 TRACE("(%p/%p)->(%p)\n", This, iface, Owner);
1937 *(HWND*)Owner = GetParent(This->hWnd);
1942 static HRESULT WINAPI Videowindow_put_MessageDrain(IVideoWindow *iface,
1944 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1946 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Drain);
1948 This->hWndMsgDrain = (HWND)Drain;
1953 static HRESULT WINAPI Videowindow_get_MessageDrain(IVideoWindow *iface,
1955 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1957 TRACE("(%p/%p)->(%p)\n", This, iface, Drain);
1959 *Drain = (OAHWND)This->hWndMsgDrain;
1964 static HRESULT WINAPI Videowindow_get_BorderColor(IVideoWindow *iface,
1966 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1968 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, Color);
1973 static HRESULT WINAPI Videowindow_put_BorderColor(IVideoWindow *iface,
1975 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1977 FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, Color);
1982 static HRESULT WINAPI Videowindow_get_FullScreenMode(IVideoWindow *iface,
1983 LONG *FullScreenMode) {
1984 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1986 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, FullScreenMode);
1991 static HRESULT WINAPI Videowindow_put_FullScreenMode(IVideoWindow *iface,
1992 LONG FullScreenMode) {
1993 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1995 FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, FullScreenMode);
2000 static HRESULT WINAPI Videowindow_SetWindowForeground(IVideoWindow *iface,
2002 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2007 TRACE("(%p/%p)->(%d)\n", This, iface, Focus);
2009 if ((Focus != FALSE) && (Focus != TRUE))
2010 return E_INVALIDARG;
2012 hr = IPin_ConnectedTo((IPin *)This->pInputPin, &pPin);
2013 if ((hr != S_OK) || !pPin)
2014 return VFW_E_NOT_CONNECTED;
2017 ret = SetForegroundWindow(This->hWnd);
2019 ret = SetWindowPos(This->hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
2027 static HRESULT WINAPI Videowindow_NotifyOwnerMessage(IVideoWindow *iface,
2032 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2034 TRACE("(%p/%p)->(%08lx, %d, %08lx, %08lx)\n", This, iface, hwnd, uMsg, wParam, lParam);
2036 if (!PostMessageA(This->hWnd, uMsg, wParam, lParam))
2042 static HRESULT WINAPI Videowindow_SetWindowPosition(IVideoWindow *iface,
2047 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2049 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height);
2051 if (!SetWindowPos(This->hWnd, NULL, Left, Top, Width, Height, SWP_NOZORDER))
2054 This->WindowPos.left = Left;
2055 This->WindowPos.top = Top;
2056 This->WindowPos.right = Left + Width;
2057 This->WindowPos.bottom = Top + Height;
2062 static HRESULT WINAPI Videowindow_GetWindowPosition(IVideoWindow *iface,
2067 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2069 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
2071 *pLeft = This->WindowPos.left;
2072 *pTop = This->WindowPos.top;
2073 *pWidth = This->WindowPos.right - This->WindowPos.left;
2074 *pHeight = This->WindowPos.bottom - This->WindowPos.top;
2079 static HRESULT WINAPI Videowindow_GetMinIdealImageSize(IVideoWindow *iface,
2082 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2084 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This, iface, pWidth, pHeight);
2086 *pWidth = This->VideoWidth;
2087 *pHeight = This->VideoHeight;
2092 static HRESULT WINAPI Videowindow_GetMaxIdealImageSize(IVideoWindow *iface,
2095 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2097 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This, iface, pWidth, pHeight);
2099 *pWidth = This->VideoWidth;
2100 *pHeight = This->VideoHeight;
2105 static HRESULT WINAPI Videowindow_GetRestorePosition(IVideoWindow *iface,
2110 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2112 FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This, iface, pLeft, pTop, pWidth, pHeight);
2117 static HRESULT WINAPI Videowindow_HideCursor(IVideoWindow *iface,
2119 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2121 FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, HideCursor);
2126 static HRESULT WINAPI Videowindow_IsCursorHidden(IVideoWindow *iface,
2127 LONG *CursorHidden) {
2128 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2130 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, CursorHidden);
2135 static const IVideoWindowVtbl IVideoWindow_VTable =
2137 Videowindow_QueryInterface,
2139 Videowindow_Release,
2140 Videowindow_GetTypeInfoCount,
2141 Videowindow_GetTypeInfo,
2142 Videowindow_GetIDsOfNames,
2144 Videowindow_put_Caption,
2145 Videowindow_get_Caption,
2146 Videowindow_put_WindowStyle,
2147 Videowindow_get_WindowStyle,
2148 Videowindow_put_WindowStyleEx,
2149 Videowindow_get_WindowStyleEx,
2150 Videowindow_put_AutoShow,
2151 Videowindow_get_AutoShow,
2152 Videowindow_put_WindowState,
2153 Videowindow_get_WindowState,
2154 Videowindow_put_BackgroundPalette,
2155 Videowindow_get_BackgroundPalette,
2156 Videowindow_put_Visible,
2157 Videowindow_get_Visible,
2158 Videowindow_put_Left,
2159 Videowindow_get_Left,
2160 Videowindow_put_Width,
2161 Videowindow_get_Width,
2162 Videowindow_put_Top,
2163 Videowindow_get_Top,
2164 Videowindow_put_Height,
2165 Videowindow_get_Height,
2166 Videowindow_put_Owner,
2167 Videowindow_get_Owner,
2168 Videowindow_put_MessageDrain,
2169 Videowindow_get_MessageDrain,
2170 Videowindow_get_BorderColor,
2171 Videowindow_put_BorderColor,
2172 Videowindow_get_FullScreenMode,
2173 Videowindow_put_FullScreenMode,
2174 Videowindow_SetWindowForeground,
2175 Videowindow_NotifyOwnerMessage,
2176 Videowindow_SetWindowPosition,
2177 Videowindow_GetWindowPosition,
2178 Videowindow_GetMinIdealImageSize,
2179 Videowindow_GetMaxIdealImageSize,
2180 Videowindow_GetRestorePosition,
2181 Videowindow_HideCursor,
2182 Videowindow_IsCursorHidden
2185 static VideoRendererImpl *from_IAMFilterMiscFlags(IAMFilterMiscFlags *iface) {
2186 return (VideoRendererImpl*)((char*)iface - offsetof(VideoRendererImpl, IAMFilterMiscFlags_vtbl));
2189 static HRESULT WINAPI AMFilterMiscFlags_QueryInterface(IAMFilterMiscFlags *iface, const REFIID riid, void **ppv) {
2190 VideoRendererImpl *This = from_IAMFilterMiscFlags(iface);
2191 return IUnknown_QueryInterface((IUnknown*)This, riid, ppv);
2194 static ULONG WINAPI AMFilterMiscFlags_AddRef(IAMFilterMiscFlags *iface) {
2195 VideoRendererImpl *This = from_IAMFilterMiscFlags(iface);
2196 return IUnknown_AddRef((IUnknown*)This);
2199 static ULONG WINAPI AMFilterMiscFlags_Release(IAMFilterMiscFlags *iface) {
2200 VideoRendererImpl *This = from_IAMFilterMiscFlags(iface);
2201 return IUnknown_Release((IUnknown*)This);
2204 static ULONG WINAPI AMFilterMiscFlags_GetMiscFlags(IAMFilterMiscFlags *iface) {
2205 return AM_FILTER_MISC_FLAGS_IS_RENDERER;
2208 static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl = {
2209 AMFilterMiscFlags_QueryInterface,
2210 AMFilterMiscFlags_AddRef,
2211 AMFilterMiscFlags_Release,
2212 AMFilterMiscFlags_GetMiscFlags