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"
40 #include "wine/unicode.h"
41 #include "wine/debug.h"
43 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
45 static const WCHAR wcsInputPinName[] = {'i','n','p','u','t',' ','p','i','n',0};
47 static const IBaseFilterVtbl VideoRenderer_Vtbl;
48 static const IUnknownVtbl IInner_VTable;
49 static const IBasicVideoVtbl IBasicVideo_VTable;
50 static const IVideoWindowVtbl IVideoWindow_VTable;
51 static const IPinVtbl VideoRenderer_InputPin_Vtbl;
52 static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl;
53 static const IQualityControlVtbl VideoRenderer_QualityControl_Vtbl = {
54 QualityControlImpl_QueryInterface,
55 QualityControlImpl_AddRef,
56 QualityControlImpl_Release,
57 QualityControlImpl_Notify,
58 QualityControlImpl_SetSink
61 typedef struct VideoRendererImpl
64 const IBasicVideoVtbl * IBasicVideo_vtbl;
65 const IVideoWindowVtbl * IVideoWindow_vtbl;
66 const IUnknownVtbl * IInner_vtbl;
67 const IAMFilterMiscFlagsVtbl *IAMFilterMiscFlags_vtbl;
68 IUnknown *seekthru_unk;
69 QualityControlImpl qcimpl;
71 BaseInputPin *pInputPin;
77 BaseWindow baseWindow;
95 /* During pause we can hold a single sample, for use in GetCurrentImage */
96 IMediaSample *sample_held;
99 static inline VideoRendererImpl *impl_from_BaseWindow(BaseWindow *iface)
101 return CONTAINING_RECORD(iface, VideoRendererImpl, baseWindow);
104 static DWORD WINAPI MessageLoop(LPVOID lpParameter)
106 VideoRendererImpl* This = lpParameter;
110 TRACE("Starting message loop\n");
112 if (FAILED(BaseWindowImpl_PrepareWindow(&This->baseWindow)))
114 This->ThreadResult = FALSE;
115 SetEvent(This->hEvent);
119 This->ThreadResult = TRUE;
120 SetEvent(This->hEvent);
122 while ((fGotMessage = GetMessageW(&msg, NULL, 0, 0)) != 0 && fGotMessage != -1)
124 TranslateMessage(&msg);
125 DispatchMessageW(&msg);
128 TRACE("End of message loop\n");
133 static BOOL CreateRenderingSubsystem(VideoRendererImpl* This)
135 This->hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
139 This->hThread = CreateThread(NULL, 0, MessageLoop, This, 0, &This->ThreadID);
142 CloseHandle(This->hEvent);
146 WaitForSingleObject(This->hEvent, INFINITE);
148 if (!This->ThreadResult)
150 CloseHandle(This->hEvent);
151 CloseHandle(This->hThread);
158 static void VideoRenderer_AutoShowWindow(VideoRendererImpl *This) {
159 if (!This->init && (!This->WindowPos.right || !This->WindowPos.top))
161 DWORD style = GetWindowLongW(This->baseWindow.hWnd, GWL_STYLE);
162 DWORD style_ex = GetWindowLongW(This->baseWindow.hWnd, GWL_EXSTYLE);
164 if (!This->WindowPos.right)
166 This->WindowPos.left = This->SourceRect.left;
167 This->WindowPos.right = This->SourceRect.right;
169 if (!This->WindowPos.bottom)
171 This->WindowPos.top = This->SourceRect.top;
172 This->WindowPos.bottom = This->SourceRect.bottom;
175 AdjustWindowRectEx(&This->WindowPos, style, TRUE, style_ex);
177 TRACE("WindowPos: %d %d %d %d\n", This->WindowPos.left, This->WindowPos.top, This->WindowPos.right, This->WindowPos.bottom);
178 SetWindowPos(This->baseWindow.hWnd, NULL,
179 This->WindowPos.left,
181 This->WindowPos.right - This->WindowPos.left,
182 This->WindowPos.bottom - This->WindowPos.top,
183 SWP_NOZORDER|SWP_NOMOVE|SWP_DEFERERASE);
185 GetClientRect(This->baseWindow.hWnd, &This->DestRect);
187 else if (!This->init)
188 This->DestRect = This->WindowPos;
191 ShowWindow(This->baseWindow.hWnd, SW_SHOW);
194 static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data, DWORD size)
199 BITMAPINFOHEADER *bmiHeader;
201 TRACE("(%p)->(%p, %d)\n", This, data, size);
203 sdesc.dwSize = sizeof(sdesc);
204 hr = IPin_ConnectionMediaType((IPin *)This->pInputPin, &amt);
206 ERR("Unable to retrieve media type\n");
210 if (IsEqualIID(&amt.formattype, &FORMAT_VideoInfo))
212 bmiHeader = &((VIDEOINFOHEADER *)amt.pbFormat)->bmiHeader;
214 else if (IsEqualIID(&amt.formattype, &FORMAT_VideoInfo2))
216 bmiHeader = &((VIDEOINFOHEADER2 *)amt.pbFormat)->bmiHeader;
220 FIXME("Unknown type %s\n", debugstr_guid(&amt.subtype));
221 return VFW_E_RUNTIME_ERROR;
224 TRACE("biSize = %d\n", bmiHeader->biSize);
225 TRACE("biWidth = %d\n", bmiHeader->biWidth);
226 TRACE("biHeight = %d\n", bmiHeader->biHeight);
227 TRACE("biPlanes = %d\n", bmiHeader->biPlanes);
228 TRACE("biBitCount = %d\n", bmiHeader->biBitCount);
229 TRACE("biCompression = %s\n", debugstr_an((LPSTR)&(bmiHeader->biCompression), 4));
230 TRACE("biSizeImage = %d\n", bmiHeader->biSizeImage);
232 if (!This->baseWindow.hDC) {
233 ERR("Cannot get DC from window!\n");
237 TRACE("Src Rect: %d %d %d %d\n", This->SourceRect.left, This->SourceRect.top, This->SourceRect.right, This->SourceRect.bottom);
238 TRACE("Dst Rect: %d %d %d %d\n", This->DestRect.left, This->DestRect.top, This->DestRect.right, This->DestRect.bottom);
240 StretchDIBits(This->baseWindow.hDC, This->DestRect.left, This->DestRect.top, This->DestRect.right -This->DestRect.left,
241 This->DestRect.bottom - This->DestRect.top, This->SourceRect.left, This->SourceRect.top,
242 This->SourceRect.right - This->SourceRect.left, This->SourceRect.bottom - This->SourceRect.top,
243 data, (BITMAPINFO *)bmiHeader, DIB_RGB_COLORS, SRCCOPY);
248 static HRESULT WINAPI VideoRenderer_Receive(BaseInputPin* pin, IMediaSample * pSample)
250 VideoRendererImpl *This = (VideoRendererImpl *)pin->pin.pinInfo.pFilter;
251 LPBYTE pbSrcStream = NULL;
252 LONG cbSrcStream = 0;
253 REFERENCE_TIME tStart, tStop;
256 TRACE("(%p)->(%p)\n", pin, pSample);
258 EnterCriticalSection(&This->filter.csFilter);
260 if (This->pInputPin->flushing || This->pInputPin->end_of_stream)
262 LeaveCriticalSection(&This->filter.csFilter);
266 if (This->filter.state == State_Stopped)
268 LeaveCriticalSection(&This->filter.csFilter);
269 return VFW_E_WRONG_STATE;
272 if (IMediaSample_GetMediaTime(pSample, &tStart, &tStop) == S_OK)
273 RendererPosPassThru_RegisterMediaTime(This->seekthru_unk, tStart);
275 /* Preroll means the sample isn't shown, this is used for key frames and things like that */
276 if (IMediaSample_IsPreroll(pSample) == S_OK) {
277 LeaveCriticalSection(&This->filter.csFilter);
281 hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
284 ERR("Cannot get pointer to sample data (%x)\n", hr);
285 LeaveCriticalSection(&This->filter.csFilter);
289 cbSrcStream = IMediaSample_GetActualDataLength(pSample);
291 TRACE("val %p %d\n", pbSrcStream, cbSrcStream);
293 #if 0 /* For debugging purpose */
296 for(i = 0; i < cbSrcStream; i++)
298 if ((i!=0) && !(i%16))
300 TRACE("%02x ", pbSrcStream[i]);
306 SetEvent(This->hEvent);
307 if (This->filter.state == State_Paused)
309 VideoRenderer_SendSampleData(This, pbSrcStream, cbSrcStream);
310 This->sample_held = pSample;
311 LeaveCriticalSection(&This->filter.csFilter);
312 WaitForSingleObject(This->blocked, INFINITE);
313 EnterCriticalSection(&This->filter.csFilter);
314 SetEvent(This->hEvent);
315 This->sample_held = NULL;
316 if (This->filter.state == State_Paused)
319 LeaveCriticalSection(&This->filter.csFilter);
322 if (This->filter.state == State_Stopped)
324 LeaveCriticalSection(&This->filter.csFilter);
325 return VFW_E_WRONG_STATE;
328 hr = QualityControlRender_WaitFor(&This->qcimpl, pSample, This->blocked);
330 QualityControlRender_BeginRender(&This->qcimpl);
331 VideoRenderer_SendSampleData(This, pbSrcStream, cbSrcStream);
332 QualityControlRender_EndRender(&This->qcimpl);
334 QualityControlRender_DoQOS(&This->qcimpl);
336 LeaveCriticalSection(&This->filter.csFilter);
340 static HRESULT WINAPI VideoRenderer_CheckMediaType(BasePin *iface, const AM_MEDIA_TYPE * pmt)
342 BaseInputPin* pin = (BaseInputPin*)iface;
343 VideoRendererImpl *This = (VideoRendererImpl *)pin->pin.pinInfo.pFilter;
345 if (!IsEqualIID(&pmt->majortype, &MEDIATYPE_Video))
348 if (IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB32) ||
349 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB24) ||
350 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB565) ||
351 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB8))
355 if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo))
357 VIDEOINFOHEADER *format = (VIDEOINFOHEADER *)pmt->pbFormat;
358 This->SourceRect.left = 0;
359 This->SourceRect.top = 0;
360 This->SourceRect.right = This->VideoWidth = format->bmiHeader.biWidth;
361 height = format->bmiHeader.biHeight;
363 This->SourceRect.bottom = This->VideoHeight = -height;
365 This->SourceRect.bottom = This->VideoHeight = height;
367 else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2))
369 VIDEOINFOHEADER2 *format2 = (VIDEOINFOHEADER2 *)pmt->pbFormat;
371 This->SourceRect.left = 0;
372 This->SourceRect.top = 0;
373 This->SourceRect.right = This->VideoWidth = format2->bmiHeader.biWidth;
374 height = format2->bmiHeader.biHeight;
376 This->SourceRect.bottom = This->VideoHeight = -height;
378 This->SourceRect.bottom = This->VideoHeight = height;
382 WARN("Format type %s not supported\n", debugstr_guid(&pmt->formattype));
390 static IPin* WINAPI VideoRenderer_GetPin(BaseFilter *iface, int pos)
392 VideoRendererImpl *This = (VideoRendererImpl *)iface;
394 if (pos >= 1 || pos < 0)
397 IPin_AddRef((IPin *)This->pInputPin);
398 return (IPin *)This->pInputPin;
401 static LONG WINAPI VideoRenderer_GetPinCount(BaseFilter *iface)
406 static LPWSTR WINAPI VideoRenderer_GetClassWindowStyles(BaseWindow *This, DWORD *pClassStyles, DWORD *pWindowStyles, DWORD *pWindowStylesEx)
408 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 };
411 *pWindowStyles = WS_SIZEBOX;
412 *pWindowStylesEx = 0;
414 return (LPWSTR)classnameW;
417 static BOOL WINAPI VideoRenderer_PossiblyEatMessage(BaseWindow *iface, UINT uMsg, WPARAM wParam, LPARAM lParam)
419 VideoRendererImpl *This = impl_from_BaseWindow(iface);
421 if (This->hWndMsgDrain)
427 case WM_LBUTTONDBLCLK:
430 case WM_MBUTTONDBLCLK:
433 case WM_MOUSEACTIVATE:
435 case WM_NCLBUTTONDBLCLK:
436 case WM_NCLBUTTONDOWN:
438 case WM_NCMBUTTONDBLCLK:
439 case WM_NCMBUTTONDOWN:
442 case WM_NCRBUTTONDBLCLK:
443 case WM_NCRBUTTONDOWN:
445 case WM_RBUTTONDBLCLK:
448 PostMessageW(This->hWndMsgDrain, uMsg, wParam, lParam);
458 static BOOL WINAPI VideoRenderer_OnSize(BaseWindow *iface, LONG Width, LONG Height)
460 VideoRendererImpl *This = impl_from_BaseWindow(iface);
462 TRACE("WM_SIZE %d %d\n", Width, Height);
463 GetClientRect(iface->hWnd, &This->DestRect);
464 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
467 This->DestRect.right - This->DestRect.left,
468 This->DestRect.bottom - This->DestRect.top);
472 static const BaseFilterFuncTable BaseFuncTable = {
473 VideoRenderer_GetPin,
474 VideoRenderer_GetPinCount
477 static const BasePinFuncTable input_BaseFuncTable = {
478 VideoRenderer_CheckMediaType,
480 BasePinImpl_GetMediaTypeVersion,
481 BasePinImpl_GetMediaType
484 static const BaseInputPinFuncTable input_BaseInputFuncTable = {
485 VideoRenderer_Receive
488 static const BaseWindowFuncTable renderer_BaseWindowFuncTable = {
489 VideoRenderer_GetClassWindowStyles,
492 VideoRenderer_PossiblyEatMessage,
496 HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
500 VideoRendererImpl * pVideoRenderer;
502 TRACE("(%p, %p)\n", pUnkOuter, ppv);
506 pVideoRenderer = CoTaskMemAlloc(sizeof(VideoRendererImpl));
507 pVideoRenderer->pUnkOuter = pUnkOuter;
508 pVideoRenderer->bUnkOuterValid = FALSE;
509 pVideoRenderer->bAggregatable = FALSE;
510 pVideoRenderer->IInner_vtbl = &IInner_VTable;
511 pVideoRenderer->IAMFilterMiscFlags_vtbl = &IAMFilterMiscFlags_Vtbl;
513 BaseFilter_Init(&pVideoRenderer->filter, &VideoRenderer_Vtbl, &CLSID_VideoRenderer, (DWORD_PTR)(__FILE__ ": VideoRendererImpl.csFilter"), &BaseFuncTable);
515 pVideoRenderer->IBasicVideo_vtbl = &IBasicVideo_VTable;
516 pVideoRenderer->IVideoWindow_vtbl = &IVideoWindow_VTable;
518 pVideoRenderer->init = 0;
519 pVideoRenderer->AutoShow = 1;
520 ZeroMemory(&pVideoRenderer->SourceRect, sizeof(RECT));
521 ZeroMemory(&pVideoRenderer->DestRect, sizeof(RECT));
522 ZeroMemory(&pVideoRenderer->WindowPos, sizeof(RECT));
523 pVideoRenderer->hWndMsgDrain = pVideoRenderer->hWndOwner = NULL;
524 pVideoRenderer->WindowStyle = WS_OVERLAPPED;
526 /* construct input pin */
527 piInput.dir = PINDIR_INPUT;
528 piInput.pFilter = (IBaseFilter *)pVideoRenderer;
529 lstrcpynW(piInput.achName, wcsInputPinName, sizeof(piInput.achName) / sizeof(piInput.achName[0]));
531 hr = BaseInputPin_Construct(&VideoRenderer_InputPin_Vtbl, &piInput, &input_BaseFuncTable, &input_BaseInputFuncTable, &pVideoRenderer->filter.csFilter, NULL, (IPin **)&pVideoRenderer->pInputPin);
535 hr = CreatePosPassThru(pUnkOuter ? pUnkOuter : (IUnknown*)&pVideoRenderer->IInner_vtbl, TRUE, (IPin*)pVideoRenderer->pInputPin, &pVideoRenderer->seekthru_unk);
538 IPin_Release((IPin*)pVideoRenderer->pInputPin);
541 pVideoRenderer->sample_held = NULL;
542 *ppv = pVideoRenderer;
547 hr = BaseWindow_Init(&pVideoRenderer->baseWindow, &renderer_BaseWindowFuncTable);
551 QualityControlImpl_init(&pVideoRenderer->qcimpl, (IPin*)pVideoRenderer->pInputPin, (IBaseFilter*)pVideoRenderer);
552 pVideoRenderer->qcimpl.lpVtbl = &VideoRenderer_QualityControl_Vtbl;
554 if (!CreateRenderingSubsystem(pVideoRenderer))
557 pVideoRenderer->blocked = CreateEventW(NULL, FALSE, FALSE, NULL);
558 if (!pVideoRenderer->blocked)
560 hr = HRESULT_FROM_WIN32(GetLastError());
561 IUnknown_Release((IUnknown *)pVideoRenderer);
566 BaseFilterImpl_Release((IBaseFilter*)pVideoRenderer);
567 CoTaskMemFree(pVideoRenderer);
571 HRESULT VideoRendererDefault_create(IUnknown * pUnkOuter, LPVOID * ppv)
573 /* TODO: Attempt to use the VMR-7 renderer instead when possible */
574 return VideoRenderer_create(pUnkOuter, ppv);
577 static HRESULT WINAPI VideoRendererInner_QueryInterface(IUnknown * iface, REFIID riid, LPVOID * ppv)
579 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
580 TRACE("(%p/%p)->(%s, %p)\n", This, iface, qzdebugstr_guid(riid), ppv);
582 if (This->bAggregatable)
583 This->bUnkOuterValid = TRUE;
587 if (IsEqualIID(riid, &IID_IUnknown))
588 *ppv = &This->IInner_vtbl;
589 else if (IsEqualIID(riid, &IID_IPersist))
591 else if (IsEqualIID(riid, &IID_IMediaFilter))
593 else if (IsEqualIID(riid, &IID_IBaseFilter))
595 else if (IsEqualIID(riid, &IID_IBasicVideo))
596 *ppv = &This->IBasicVideo_vtbl;
597 else if (IsEqualIID(riid, &IID_IVideoWindow))
598 *ppv = &This->IVideoWindow_vtbl;
599 else if (IsEqualIID(riid, &IID_IMediaSeeking))
600 return IUnknown_QueryInterface(This->seekthru_unk, riid, ppv);
601 else if (IsEqualIID(riid, &IID_IAMFilterMiscFlags))
602 *ppv = &This->IAMFilterMiscFlags_vtbl;
603 else if (IsEqualIID(riid, &IID_IQualityControl))
604 *ppv = &This->qcimpl;
608 IUnknown_AddRef((IUnknown *)(*ppv));
612 if (!IsEqualIID(riid, &IID_IPin))
613 FIXME("No interface for %s!\n", qzdebugstr_guid(riid));
615 return E_NOINTERFACE;
618 static ULONG WINAPI VideoRendererInner_AddRef(IUnknown * iface)
620 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
621 ULONG refCount = InterlockedIncrement(&This->filter.refCount);
623 TRACE("(%p/%p)->() AddRef from %d\n", This, iface, refCount - 1);
628 static ULONG WINAPI VideoRendererInner_Release(IUnknown * iface)
630 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
631 ULONG refCount = InterlockedDecrement(&This->filter.refCount);
633 TRACE("(%p/%p)->() Release from %d\n", This, iface, refCount + 1);
639 BaseWindowImpl_DoneWithWindow(&This->baseWindow);
640 PostThreadMessageW(This->ThreadID, WM_QUIT, 0, 0);
641 WaitForSingleObject(This->hThread, INFINITE);
642 CloseHandle(This->hThread);
643 CloseHandle(This->hEvent);
645 if (SUCCEEDED(IPin_ConnectedTo((IPin *)This->pInputPin, &pConnectedTo)))
647 IPin_Disconnect(pConnectedTo);
648 IPin_Release(pConnectedTo);
650 IPin_Disconnect((IPin *)This->pInputPin);
652 IPin_Release((IPin *)This->pInputPin);
654 IUnknown_Release(This->seekthru_unk);
655 This->filter.csFilter.DebugInfo->Spare[0] = 0;
656 DeleteCriticalSection(&This->filter.csFilter);
658 TRACE("Destroying Video Renderer\n");
667 static const IUnknownVtbl IInner_VTable =
669 VideoRendererInner_QueryInterface,
670 VideoRendererInner_AddRef,
671 VideoRendererInner_Release
674 static HRESULT WINAPI VideoRenderer_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv)
676 VideoRendererImpl *This = (VideoRendererImpl *)iface;
678 if (This->bAggregatable)
679 This->bUnkOuterValid = TRUE;
683 if (This->bAggregatable)
684 return IUnknown_QueryInterface(This->pUnkOuter, riid, ppv);
686 if (IsEqualIID(riid, &IID_IUnknown))
690 IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
691 hr = IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
692 IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
693 This->bAggregatable = TRUE;
698 return E_NOINTERFACE;
701 return IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
704 static ULONG WINAPI VideoRenderer_AddRef(IBaseFilter * iface)
706 VideoRendererImpl *This = (VideoRendererImpl *)iface;
708 if (This->pUnkOuter && This->bUnkOuterValid)
709 return IUnknown_AddRef(This->pUnkOuter);
710 return IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
713 static ULONG WINAPI VideoRenderer_Release(IBaseFilter * iface)
715 VideoRendererImpl *This = (VideoRendererImpl *)iface;
717 if (This->pUnkOuter && This->bUnkOuterValid)
718 return IUnknown_Release(This->pUnkOuter);
719 return IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
722 /** IMediaFilter methods **/
724 static HRESULT WINAPI VideoRenderer_Stop(IBaseFilter * iface)
726 VideoRendererImpl *This = (VideoRendererImpl *)iface;
728 TRACE("(%p/%p)->()\n", This, iface);
730 EnterCriticalSection(&This->filter.csFilter);
732 This->filter.state = State_Stopped;
733 SetEvent(This->hEvent);
734 SetEvent(This->blocked);
735 RendererPosPassThru_ResetMediaTime(This->seekthru_unk);
738 RedrawWindow(This->baseWindow.hWnd, NULL, NULL, RDW_INVALIDATE|RDW_ERASE);
740 LeaveCriticalSection(&This->filter.csFilter);
745 static HRESULT WINAPI VideoRenderer_Pause(IBaseFilter * iface)
747 VideoRendererImpl *This = (VideoRendererImpl *)iface;
749 TRACE("(%p/%p)->()\n", This, iface);
751 EnterCriticalSection(&This->filter.csFilter);
752 if (This->filter.state != State_Paused)
754 if (This->filter.state == State_Stopped)
756 This->pInputPin->end_of_stream = 0;
757 ResetEvent(This->hEvent);
758 VideoRenderer_AutoShowWindow(This);
761 This->filter.state = State_Paused;
762 ResetEvent(This->blocked);
764 LeaveCriticalSection(&This->filter.csFilter);
769 static HRESULT WINAPI VideoRenderer_SetSyncSource(IBaseFilter *iface, IReferenceClock *clock) {
770 VideoRendererImpl *This = (VideoRendererImpl *)iface;
773 EnterCriticalSection(&This->filter.csFilter);
774 QualityControlRender_SetClock(&This->qcimpl, clock);
775 hr = BaseFilterImpl_SetSyncSource(iface, clock);
776 LeaveCriticalSection(&This->filter.csFilter);
780 static HRESULT WINAPI VideoRenderer_Run(IBaseFilter * iface, REFERENCE_TIME tStart)
783 VideoRendererImpl *This = (VideoRendererImpl *)iface;
785 TRACE("(%p/%p)->(%s)\n", This, iface, wine_dbgstr_longlong(tStart));
787 EnterCriticalSection(&This->filter.csFilter);
788 This->filter.rtStreamStart = tStart;
789 if (This->filter.state == State_Running)
791 QualityControlRender_Start(&This->qcimpl, tStart);
792 if (This->pInputPin->pin.pConnectedTo && (This->filter.state == State_Stopped || !This->pInputPin->end_of_stream))
794 if (This->filter.state == State_Stopped)
796 ResetEvent(This->hEvent);
797 VideoRenderer_AutoShowWindow(This);
798 This->pInputPin->end_of_stream = 0;
800 SetEvent(This->blocked);
801 } else if (This->filter.filterInfo.pGraph) {
802 IMediaEventSink *pEventSink;
803 hr = IFilterGraph_QueryInterface(This->filter.filterInfo.pGraph, &IID_IMediaEventSink, (LPVOID*)&pEventSink);
806 hr = IMediaEventSink_Notify(pEventSink, EC_COMPLETE, S_OK, (LONG_PTR)This);
807 IMediaEventSink_Release(pEventSink);
812 This->filter.state = State_Running;
814 LeaveCriticalSection(&This->filter.csFilter);
819 static HRESULT WINAPI VideoRenderer_GetState(IBaseFilter * iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState)
821 VideoRendererImpl *This = (VideoRendererImpl *)iface;
824 TRACE("(%p/%p)->(%d, %p)\n", This, iface, dwMilliSecsTimeout, pState);
826 if (WaitForSingleObject(This->hEvent, dwMilliSecsTimeout) == WAIT_TIMEOUT)
827 hr = VFW_S_STATE_INTERMEDIATE;
831 BaseFilterImpl_GetState(iface, dwMilliSecsTimeout, pState);
836 /** IBaseFilter implementation **/
838 static HRESULT WINAPI VideoRenderer_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)
840 VideoRendererImpl *This = (VideoRendererImpl *)iface;
842 FIXME("(%p/%p)->(%s,%p): stub !!!\n", This, iface, debugstr_w(Id), ppPin);
844 /* FIXME: critical section */
849 static const IBaseFilterVtbl VideoRenderer_Vtbl =
851 VideoRenderer_QueryInterface,
852 VideoRenderer_AddRef,
853 VideoRenderer_Release,
854 BaseFilterImpl_GetClassID,
858 VideoRenderer_GetState,
859 VideoRenderer_SetSyncSource,
860 BaseFilterImpl_GetSyncSource,
861 BaseFilterImpl_EnumPins,
862 VideoRenderer_FindPin,
863 BaseFilterImpl_QueryFilterInfo,
864 BaseFilterImpl_JoinFilterGraph,
865 BaseFilterImpl_QueryVendorInfo
868 static HRESULT WINAPI VideoRenderer_InputPin_EndOfStream(IPin * iface)
870 BaseInputPin* This = (BaseInputPin*)iface;
871 VideoRendererImpl *pFilter;
872 IMediaEventSink* pEventSink;
875 TRACE("(%p/%p)->()\n", This, iface);
877 EnterCriticalSection(This->pin.pCritSec);
878 pFilter = (VideoRendererImpl*)This->pin.pinInfo.pFilter;
879 if (This->flushing || This->end_of_stream)
881 hr = IFilterGraph_QueryInterface(pFilter->filter.filterInfo.pGraph, &IID_IMediaEventSink, (LPVOID*)&pEventSink);
884 hr = IMediaEventSink_Notify(pEventSink, EC_COMPLETE, S_OK, (LONG_PTR)pFilter);
885 IMediaEventSink_Release(pEventSink);
887 RendererPosPassThru_EOS(pFilter->seekthru_unk);
888 This->end_of_stream = 1;
890 LeaveCriticalSection(This->pin.pCritSec);
895 static HRESULT WINAPI VideoRenderer_InputPin_BeginFlush(IPin * iface)
897 BaseInputPin* This = (BaseInputPin*)iface;
898 VideoRendererImpl *pVideoRenderer = (VideoRendererImpl *)This->pin.pinInfo.pFilter;
900 TRACE("(%p/%p)->()\n", This, iface);
902 SetEvent(pVideoRenderer->blocked);
903 return BaseInputPinImpl_BeginFlush(iface);
906 static HRESULT WINAPI VideoRenderer_InputPin_EndFlush(IPin * iface)
908 BaseInputPin* This = (BaseInputPin*)iface;
909 VideoRendererImpl *pVideoRenderer = (VideoRendererImpl *)This->pin.pinInfo.pFilter;
912 TRACE("(%p/%p)->()\n", This, iface);
914 EnterCriticalSection(This->pin.pCritSec);
916 if (pVideoRenderer->sample_held) {
917 SetEvent(pVideoRenderer->blocked);
918 ResetEvent(pVideoRenderer->hEvent);
919 LeaveCriticalSection(This->pin.pCritSec);
920 WaitForSingleObject(pVideoRenderer->hEvent, INFINITE);
921 EnterCriticalSection(This->pin.pCritSec);
922 ResetEvent(pVideoRenderer->blocked);
924 if (pVideoRenderer->filter.state == State_Paused) {
925 ResetEvent(pVideoRenderer->blocked);
926 ResetEvent(pVideoRenderer->hEvent);
929 QualityControlRender_Start(&pVideoRenderer->qcimpl, pVideoRenderer->filter.rtStreamStart);
930 hr = BaseInputPinImpl_EndFlush(iface);
931 LeaveCriticalSection(This->pin.pCritSec);
932 RendererPosPassThru_ResetMediaTime(pVideoRenderer->seekthru_unk);
937 static const IPinVtbl VideoRenderer_InputPin_Vtbl =
939 BaseInputPinImpl_QueryInterface,
941 BaseInputPinImpl_Release,
942 BaseInputPinImpl_Connect,
943 BaseInputPinImpl_ReceiveConnection,
944 BasePinImpl_Disconnect,
945 BasePinImpl_ConnectedTo,
946 BasePinImpl_ConnectionMediaType,
947 BasePinImpl_QueryPinInfo,
948 BasePinImpl_QueryDirection,
950 BaseInputPinImpl_QueryAccept,
951 BasePinImpl_EnumMediaTypes,
952 BasePinImpl_QueryInternalConnections,
953 VideoRenderer_InputPin_EndOfStream,
954 VideoRenderer_InputPin_BeginFlush,
955 VideoRenderer_InputPin_EndFlush,
956 BaseInputPinImpl_NewSegment
959 /*** IUnknown methods ***/
960 static HRESULT WINAPI Basicvideo_QueryInterface(IBasicVideo *iface,
963 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
965 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
967 return VideoRenderer_QueryInterface((IBaseFilter*)This, riid, ppvObj);
970 static ULONG WINAPI Basicvideo_AddRef(IBasicVideo *iface) {
971 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
973 TRACE("(%p/%p)->()\n", This, iface);
975 return VideoRenderer_AddRef((IBaseFilter*)This);
978 static ULONG WINAPI Basicvideo_Release(IBasicVideo *iface) {
979 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
981 TRACE("(%p/%p)->()\n", This, iface);
983 return VideoRenderer_Release((IBaseFilter*)This);
986 /*** IDispatch methods ***/
987 static HRESULT WINAPI Basicvideo_GetTypeInfoCount(IBasicVideo *iface,
989 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
991 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
996 static HRESULT WINAPI Basicvideo_GetTypeInfo(IBasicVideo *iface,
999 ITypeInfo**ppTInfo) {
1000 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1002 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
1007 static HRESULT WINAPI Basicvideo_GetIDsOfNames(IBasicVideo *iface,
1013 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1015 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1020 static HRESULT WINAPI Basicvideo_Invoke(IBasicVideo *iface,
1021 DISPID dispIdMember,
1025 DISPPARAMS*pDispParams,
1027 EXCEPINFO*pExepInfo,
1029 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1031 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);
1036 /*** IBasicVideo methods ***/
1037 static HRESULT WINAPI Basicvideo_get_AvgTimePerFrame(IBasicVideo *iface,
1038 REFTIME *pAvgTimePerFrame) {
1040 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1042 if (!This->pInputPin->pin.pConnectedTo)
1043 return VFW_E_NOT_CONNECTED;
1045 TRACE("(%p/%p)->(%p)\n", This, iface, pAvgTimePerFrame);
1047 pmt = &This->pInputPin->pin.mtCurrent;
1048 if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo)) {
1049 VIDEOINFOHEADER *vih = (VIDEOINFOHEADER*)pmt->pbFormat;
1050 *pAvgTimePerFrame = vih->AvgTimePerFrame;
1051 } else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2)) {
1052 VIDEOINFOHEADER2 *vih = (VIDEOINFOHEADER2*)pmt->pbFormat;
1053 *pAvgTimePerFrame = vih->AvgTimePerFrame;
1055 ERR("Unknown format type %s\n", qzdebugstr_guid(&pmt->formattype));
1056 *pAvgTimePerFrame = 0;
1061 static HRESULT WINAPI Basicvideo_get_BitRate(IBasicVideo *iface,
1063 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1065 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBitRate);
1070 static HRESULT WINAPI Basicvideo_get_BitErrorRate(IBasicVideo *iface,
1071 LONG *pBitErrorRate) {
1072 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1074 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBitErrorRate);
1079 static HRESULT WINAPI Basicvideo_get_VideoWidth(IBasicVideo *iface,
1080 LONG *pVideoWidth) {
1081 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1083 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoWidth);
1085 *pVideoWidth = This->VideoWidth;
1090 static HRESULT WINAPI Basicvideo_get_VideoHeight(IBasicVideo *iface,
1091 LONG *pVideoHeight) {
1092 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1094 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoHeight);
1096 *pVideoHeight = This->VideoHeight;
1101 static HRESULT WINAPI Basicvideo_put_SourceLeft(IBasicVideo *iface,
1103 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1105 TRACE("(%p/%p)->(%d)\n", This, iface, SourceLeft);
1107 This->SourceRect.left = SourceLeft;
1112 static HRESULT WINAPI Basicvideo_get_SourceLeft(IBasicVideo *iface,
1113 LONG *pSourceLeft) {
1114 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1116 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceLeft);
1118 *pSourceLeft = This->SourceRect.left;
1123 static HRESULT WINAPI Basicvideo_put_SourceWidth(IBasicVideo *iface,
1125 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1127 TRACE("(%p/%p)->(%d)\n", This, iface, SourceWidth);
1129 This->SourceRect.right = This->SourceRect.left + SourceWidth;
1134 static HRESULT WINAPI Basicvideo_get_SourceWidth(IBasicVideo *iface,
1135 LONG *pSourceWidth) {
1136 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1138 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceWidth);
1140 *pSourceWidth = This->SourceRect.right - This->SourceRect.left;
1145 static HRESULT WINAPI Basicvideo_put_SourceTop(IBasicVideo *iface,
1147 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1149 TRACE("(%p/%p)->(%d)\n", This, iface, SourceTop);
1151 This->SourceRect.top = SourceTop;
1156 static HRESULT WINAPI Basicvideo_get_SourceTop(IBasicVideo *iface,
1158 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1160 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceTop);
1162 *pSourceTop = This->SourceRect.top;
1167 static HRESULT WINAPI Basicvideo_put_SourceHeight(IBasicVideo *iface,
1168 LONG SourceHeight) {
1169 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1171 TRACE("(%p/%p)->(%d)\n", This, iface, SourceHeight);
1173 This->SourceRect.bottom = This->SourceRect.top + SourceHeight;
1178 static HRESULT WINAPI Basicvideo_get_SourceHeight(IBasicVideo *iface,
1179 LONG *pSourceHeight) {
1180 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1182 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceHeight);
1184 *pSourceHeight = This->SourceRect.bottom - This->SourceRect.top;
1189 static HRESULT WINAPI Basicvideo_put_DestinationLeft(IBasicVideo *iface,
1190 LONG DestinationLeft) {
1191 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1193 TRACE("(%p/%p)->(%d)\n", This, iface, DestinationLeft);
1195 This->DestRect.left = DestinationLeft;
1200 static HRESULT WINAPI Basicvideo_get_DestinationLeft(IBasicVideo *iface,
1201 LONG *pDestinationLeft) {
1202 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1204 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationLeft);
1206 *pDestinationLeft = This->DestRect.left;
1211 static HRESULT WINAPI Basicvideo_put_DestinationWidth(IBasicVideo *iface,
1212 LONG DestinationWidth) {
1213 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1215 TRACE("(%p/%p)->(%d)\n", This, iface, DestinationWidth);
1217 This->DestRect.right = This->DestRect.left + DestinationWidth;
1222 static HRESULT WINAPI Basicvideo_get_DestinationWidth(IBasicVideo *iface,
1223 LONG *pDestinationWidth) {
1224 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1226 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationWidth);
1228 *pDestinationWidth = This->DestRect.right - This->DestRect.left;
1233 static HRESULT WINAPI Basicvideo_put_DestinationTop(IBasicVideo *iface,
1234 LONG DestinationTop) {
1235 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1237 TRACE("(%p/%p)->(%d)\n", This, iface, DestinationTop);
1239 This->DestRect.top = DestinationTop;
1244 static HRESULT WINAPI Basicvideo_get_DestinationTop(IBasicVideo *iface,
1245 LONG *pDestinationTop) {
1246 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1248 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationTop);
1250 *pDestinationTop = This->DestRect.top;
1255 static HRESULT WINAPI Basicvideo_put_DestinationHeight(IBasicVideo *iface,
1256 LONG DestinationHeight) {
1257 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1259 TRACE("(%p/%p)->(%d)\n", This, iface, DestinationHeight);
1261 This->DestRect.right = This->DestRect.left + DestinationHeight;
1266 static HRESULT WINAPI Basicvideo_get_DestinationHeight(IBasicVideo *iface,
1267 LONG *pDestinationHeight) {
1268 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1270 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationHeight);
1272 *pDestinationHeight = This->DestRect.right - This->DestRect.left;
1277 static HRESULT WINAPI Basicvideo_SetSourcePosition(IBasicVideo *iface,
1282 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1284 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height);
1286 This->SourceRect.left = Left;
1287 This->SourceRect.top = Top;
1288 This->SourceRect.right = Left + Width;
1289 This->SourceRect.bottom = Top + Height;
1294 static HRESULT WINAPI Basicvideo_GetSourcePosition(IBasicVideo *iface,
1299 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1301 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1303 *pLeft = This->SourceRect.left;
1304 *pTop = This->SourceRect.top;
1305 *pWidth = This->SourceRect.right - This->SourceRect.left;
1306 *pHeight = This->SourceRect.bottom - This->SourceRect.top;
1311 static HRESULT WINAPI Basicvideo_SetDefaultSourcePosition(IBasicVideo *iface) {
1312 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1314 TRACE("(%p/%p)->()\n", This, iface);
1316 This->SourceRect.left = 0;
1317 This->SourceRect.top = 0;
1318 This->SourceRect.right = This->VideoWidth;
1319 This->SourceRect.bottom = This->VideoHeight;
1324 static HRESULT WINAPI Basicvideo_SetDestinationPosition(IBasicVideo *iface,
1329 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1331 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height);
1333 This->DestRect.left = Left;
1334 This->DestRect.top = Top;
1335 This->DestRect.right = Left + Width;
1336 This->DestRect.bottom = Top + Height;
1341 static HRESULT WINAPI Basicvideo_GetDestinationPosition(IBasicVideo *iface,
1346 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1348 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1350 *pLeft = This->DestRect.left;
1351 *pTop = This->DestRect.top;
1352 *pWidth = This->DestRect.right - This->DestRect.left;
1353 *pHeight = This->DestRect.bottom - This->DestRect.top;
1358 static HRESULT WINAPI Basicvideo_SetDefaultDestinationPosition(IBasicVideo *iface) {
1359 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1362 TRACE("(%p/%p)->()\n", This, iface);
1364 if (!GetClientRect(This->baseWindow.hWnd, &rect))
1367 This->SourceRect.left = 0;
1368 This->SourceRect.top = 0;
1369 This->SourceRect.right = rect.right;
1370 This->SourceRect.bottom = rect.bottom;
1375 static HRESULT WINAPI Basicvideo_GetVideoSize(IBasicVideo *iface,
1378 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1380 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
1382 *pWidth = This->VideoWidth;
1383 *pHeight = This->VideoHeight;
1388 static HRESULT WINAPI Basicvideo_GetVideoPaletteEntries(IBasicVideo *iface,
1393 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1395 TRACE("(%p/%p)->(%d, %d, %p, %p)\n", This, iface, StartIndex, Entries, pRetrieved, pPalette);
1399 return VFW_E_NO_PALETTE_AVAILABLE;
1402 static HRESULT WINAPI Basicvideo_GetCurrentImage(IBasicVideo *iface,
1405 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1406 BITMAPINFOHEADER *bmiHeader;
1408 AM_MEDIA_TYPE *amt = &This->pInputPin->pin.mtCurrent;
1411 FIXME("(%p/%p)->(%p, %p): partial stub\n", This, iface, pBufferSize, pDIBImage);
1413 EnterCriticalSection(&This->filter.csFilter);
1415 if (!This->sample_held)
1417 LeaveCriticalSection(&This->filter.csFilter);
1418 return (This->filter.state == State_Paused ? E_UNEXPECTED : VFW_E_NOT_PAUSED);
1421 if (IsEqualIID(&amt->formattype, &FORMAT_VideoInfo))
1423 bmiHeader = &((VIDEOINFOHEADER *)amt->pbFormat)->bmiHeader;
1425 else if (IsEqualIID(&amt->formattype, &FORMAT_VideoInfo2))
1427 bmiHeader = &((VIDEOINFOHEADER2 *)amt->pbFormat)->bmiHeader;
1431 FIXME("Unknown type %s\n", debugstr_guid(&amt->subtype));
1432 LeaveCriticalSection(&This->filter.csFilter);
1433 return VFW_E_RUNTIME_ERROR;
1436 needed_size = bmiHeader->biSize;
1437 needed_size += IMediaSample_GetActualDataLength(This->sample_held);
1441 *pBufferSize = needed_size;
1442 LeaveCriticalSection(&This->filter.csFilter);
1446 if (needed_size < *pBufferSize)
1448 ERR("Buffer too small %u/%u\n", needed_size, *pBufferSize);
1449 LeaveCriticalSection(&This->filter.csFilter);
1452 *pBufferSize = needed_size;
1454 memcpy(pDIBImage, bmiHeader, bmiHeader->biSize);
1455 IMediaSample_GetPointer(This->sample_held, (BYTE **)&ptr);
1456 memcpy((char *)pDIBImage + bmiHeader->biSize, ptr, IMediaSample_GetActualDataLength(This->sample_held));
1458 LeaveCriticalSection(&This->filter.csFilter);
1463 static HRESULT WINAPI Basicvideo_IsUsingDefaultSource(IBasicVideo *iface) {
1464 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1466 FIXME("(%p/%p)->(): stub !!!\n", This, iface);
1471 static HRESULT WINAPI Basicvideo_IsUsingDefaultDestination(IBasicVideo *iface) {
1472 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1474 FIXME("(%p/%p)->(): stub !!!\n", This, iface);
1480 static const IBasicVideoVtbl IBasicVideo_VTable =
1482 Basicvideo_QueryInterface,
1485 Basicvideo_GetTypeInfoCount,
1486 Basicvideo_GetTypeInfo,
1487 Basicvideo_GetIDsOfNames,
1489 Basicvideo_get_AvgTimePerFrame,
1490 Basicvideo_get_BitRate,
1491 Basicvideo_get_BitErrorRate,
1492 Basicvideo_get_VideoWidth,
1493 Basicvideo_get_VideoHeight,
1494 Basicvideo_put_SourceLeft,
1495 Basicvideo_get_SourceLeft,
1496 Basicvideo_put_SourceWidth,
1497 Basicvideo_get_SourceWidth,
1498 Basicvideo_put_SourceTop,
1499 Basicvideo_get_SourceTop,
1500 Basicvideo_put_SourceHeight,
1501 Basicvideo_get_SourceHeight,
1502 Basicvideo_put_DestinationLeft,
1503 Basicvideo_get_DestinationLeft,
1504 Basicvideo_put_DestinationWidth,
1505 Basicvideo_get_DestinationWidth,
1506 Basicvideo_put_DestinationTop,
1507 Basicvideo_get_DestinationTop,
1508 Basicvideo_put_DestinationHeight,
1509 Basicvideo_get_DestinationHeight,
1510 Basicvideo_SetSourcePosition,
1511 Basicvideo_GetSourcePosition,
1512 Basicvideo_SetDefaultSourcePosition,
1513 Basicvideo_SetDestinationPosition,
1514 Basicvideo_GetDestinationPosition,
1515 Basicvideo_SetDefaultDestinationPosition,
1516 Basicvideo_GetVideoSize,
1517 Basicvideo_GetVideoPaletteEntries,
1518 Basicvideo_GetCurrentImage,
1519 Basicvideo_IsUsingDefaultSource,
1520 Basicvideo_IsUsingDefaultDestination
1524 /*** IUnknown methods ***/
1525 static HRESULT WINAPI Videowindow_QueryInterface(IVideoWindow *iface,
1528 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1530 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1532 return VideoRenderer_QueryInterface((IBaseFilter*)This, riid, ppvObj);
1535 static ULONG WINAPI Videowindow_AddRef(IVideoWindow *iface) {
1536 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1538 TRACE("(%p/%p)->()\n", This, iface);
1540 return VideoRenderer_AddRef((IBaseFilter*)This);
1543 static ULONG WINAPI Videowindow_Release(IVideoWindow *iface) {
1544 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1546 TRACE("(%p/%p)->()\n", This, iface);
1548 return VideoRenderer_Release((IBaseFilter*)This);
1551 /*** IDispatch methods ***/
1552 static HRESULT WINAPI Videowindow_GetTypeInfoCount(IVideoWindow *iface,
1554 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1556 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
1561 static HRESULT WINAPI Videowindow_GetTypeInfo(IVideoWindow *iface,
1564 ITypeInfo**ppTInfo) {
1565 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1567 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
1572 static HRESULT WINAPI Videowindow_GetIDsOfNames(IVideoWindow *iface,
1578 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1580 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1585 static HRESULT WINAPI Videowindow_Invoke(IVideoWindow *iface,
1586 DISPID dispIdMember,
1590 DISPPARAMS*pDispParams,
1592 EXCEPINFO*pExepInfo,
1594 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1596 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);
1601 /*** IVideoWindow methods ***/
1602 static HRESULT WINAPI Videowindow_put_Caption(IVideoWindow *iface,
1604 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1606 TRACE("(%p/%p)->(%s (%p))\n", This, iface, debugstr_w(strCaption), strCaption);
1608 if (!SetWindowTextW(This->baseWindow.hWnd, strCaption))
1614 static HRESULT WINAPI Videowindow_get_Caption(IVideoWindow *iface,
1616 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1618 TRACE("(%p/%p)->(%p)\n", This, iface, strCaption);
1620 GetWindowTextW(This->baseWindow.hWnd, (LPWSTR)strCaption, 100);
1625 static HRESULT WINAPI Videowindow_put_WindowStyle(IVideoWindow *iface,
1627 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1630 old = GetWindowLongW(This->baseWindow.hWnd, GWL_STYLE);
1632 TRACE("(%p/%p)->(%x -> %x)\n", This, iface, old, WindowStyle);
1634 if (WindowStyle & (WS_DISABLED|WS_HSCROLL|WS_ICONIC|WS_MAXIMIZE|WS_MINIMIZE|WS_VSCROLL))
1635 return E_INVALIDARG;
1637 SetWindowLongW(This->baseWindow.hWnd, GWL_STYLE, WindowStyle);
1638 SetWindowPos(This->baseWindow.hWnd,0,0,0,0,0,SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOZORDER);
1639 This->WindowStyle = WindowStyle;
1644 static HRESULT WINAPI Videowindow_get_WindowStyle(IVideoWindow *iface,
1645 LONG *WindowStyle) {
1646 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1648 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyle);
1650 *WindowStyle = This->WindowStyle;
1655 static HRESULT WINAPI Videowindow_put_WindowStyleEx(IVideoWindow *iface,
1656 LONG WindowStyleEx) {
1657 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1659 TRACE("(%p/%p)->(%d)\n", This, iface, WindowStyleEx);
1661 if (!SetWindowLongW(This->baseWindow.hWnd, GWL_EXSTYLE, WindowStyleEx))
1667 static HRESULT WINAPI Videowindow_get_WindowStyleEx(IVideoWindow *iface,
1668 LONG *WindowStyleEx) {
1669 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1671 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyleEx);
1673 *WindowStyleEx = GetWindowLongW(This->baseWindow.hWnd, GWL_EXSTYLE);
1678 static HRESULT WINAPI Videowindow_put_AutoShow(IVideoWindow *iface,
1680 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1682 TRACE("(%p/%p)->(%d)\n", This, iface, AutoShow);
1684 This->AutoShow = AutoShow;
1689 static HRESULT WINAPI Videowindow_get_AutoShow(IVideoWindow *iface,
1691 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1693 TRACE("(%p/%p)->(%p)\n", This, iface, AutoShow);
1695 *AutoShow = This->AutoShow;
1700 static HRESULT WINAPI Videowindow_put_WindowState(IVideoWindow *iface,
1702 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1704 TRACE("(%p/%p)->(%d)\n", This, iface, WindowState);
1705 ShowWindow(This->baseWindow.hWnd, WindowState);
1709 static HRESULT WINAPI Videowindow_get_WindowState(IVideoWindow *iface,
1710 LONG *WindowState) {
1711 WINDOWPLACEMENT place;
1712 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1714 place.length = sizeof(place);
1715 GetWindowPlacement(This->baseWindow.hWnd, &place);
1716 TRACE("(%p/%p)->(%p)\n", This, iface, WindowState);
1717 *WindowState = place.showCmd;
1722 static HRESULT WINAPI Videowindow_put_BackgroundPalette(IVideoWindow *iface,
1723 LONG BackgroundPalette) {
1724 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1726 FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, BackgroundPalette);
1731 static HRESULT WINAPI Videowindow_get_BackgroundPalette(IVideoWindow *iface,
1732 LONG *pBackgroundPalette) {
1733 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1735 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBackgroundPalette);
1740 static HRESULT WINAPI Videowindow_put_Visible(IVideoWindow *iface,
1742 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1744 TRACE("(%p/%p)->(%d)\n", This, iface, Visible);
1746 ShowWindow(This->baseWindow.hWnd, Visible ? SW_SHOW : SW_HIDE);
1751 static HRESULT WINAPI Videowindow_get_Visible(IVideoWindow *iface,
1753 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1755 TRACE("(%p/%p)->(%p)\n", This, iface, pVisible);
1757 *pVisible = IsWindowVisible(This->baseWindow.hWnd);
1762 static HRESULT WINAPI Videowindow_put_Left(IVideoWindow *iface,
1764 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1766 TRACE("(%p/%p)->(%d)\n", This, iface, Left);
1768 if (!SetWindowPos(This->baseWindow.hWnd, NULL, Left, This->WindowPos.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE))
1771 This->WindowPos.left = Left;
1776 static HRESULT WINAPI Videowindow_get_Left(IVideoWindow *iface,
1778 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1780 TRACE("(%p/%p)->(%p)\n", This, iface, pLeft);
1782 *pLeft = This->WindowPos.left;
1787 static HRESULT WINAPI Videowindow_put_Width(IVideoWindow *iface,
1789 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1791 TRACE("(%p/%p)->(%d)\n", This, iface, Width);
1793 if (!SetWindowPos(This->baseWindow.hWnd, NULL, 0, 0, Width, This->WindowPos.bottom-This->WindowPos.top, SWP_NOZORDER|SWP_NOMOVE))
1796 This->WindowPos.right = This->WindowPos.left + Width;
1801 static HRESULT WINAPI Videowindow_get_Width(IVideoWindow *iface,
1803 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1805 TRACE("(%p/%p)->(%p)\n", This, iface, pWidth);
1807 *pWidth = This->WindowPos.right - This->WindowPos.left;
1812 static HRESULT WINAPI Videowindow_put_Top(IVideoWindow *iface,
1814 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1816 TRACE("(%p/%p)->(%d)\n", This, iface, Top);
1818 if (!SetWindowPos(This->baseWindow.hWnd, NULL, This->WindowPos.left, Top, 0, 0, SWP_NOZORDER|SWP_NOSIZE))
1821 This->WindowPos.top = Top;
1826 static HRESULT WINAPI Videowindow_get_Top(IVideoWindow *iface,
1828 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1830 TRACE("(%p/%p)->(%p)\n", This, iface, pTop);
1832 *pTop = This->WindowPos.top;
1837 static HRESULT WINAPI Videowindow_put_Height(IVideoWindow *iface,
1839 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1841 TRACE("(%p/%p)->(%d)\n", This, iface, Height);
1843 if (!SetWindowPos(This->baseWindow.hWnd, NULL, 0, 0, This->WindowPos.right-This->WindowPos.left, Height, SWP_NOZORDER|SWP_NOMOVE))
1846 This->WindowPos.bottom = This->WindowPos.top + Height;
1851 static HRESULT WINAPI Videowindow_get_Height(IVideoWindow *iface,
1853 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1855 TRACE("(%p/%p)->(%p)\n", This, iface, pHeight);
1857 *pHeight = This->WindowPos.bottom - This->WindowPos.top;
1862 static HRESULT WINAPI Videowindow_put_Owner(IVideoWindow *iface,
1864 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1866 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Owner);
1868 This->hWndOwner = (HWND)Owner;
1869 SetParent(This->baseWindow.hWnd, This->hWndOwner);
1870 if (This->WindowStyle & WS_CHILD)
1872 LONG old = GetWindowLongW(This->baseWindow.hWnd, GWL_STYLE);
1873 if (old != This->WindowStyle)
1875 SetWindowLongW(This->baseWindow.hWnd, GWL_STYLE, This->WindowStyle);
1876 SetWindowPos(This->baseWindow.hWnd,0,0,0,0,0,SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOZORDER);
1883 static HRESULT WINAPI Videowindow_get_Owner(IVideoWindow *iface,
1885 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1887 TRACE("(%p/%p)->(%p)\n", This, iface, Owner);
1889 *(HWND*)Owner = This->hWndOwner;
1894 static HRESULT WINAPI Videowindow_put_MessageDrain(IVideoWindow *iface,
1896 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1898 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Drain);
1900 This->hWndMsgDrain = (HWND)Drain;
1905 static HRESULT WINAPI Videowindow_get_MessageDrain(IVideoWindow *iface,
1907 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1909 TRACE("(%p/%p)->(%p)\n", This, iface, Drain);
1911 *Drain = (OAHWND)This->hWndMsgDrain;
1916 static HRESULT WINAPI Videowindow_get_BorderColor(IVideoWindow *iface,
1918 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1920 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, Color);
1925 static HRESULT WINAPI Videowindow_put_BorderColor(IVideoWindow *iface,
1927 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1929 FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, Color);
1934 static HRESULT WINAPI Videowindow_get_FullScreenMode(IVideoWindow *iface,
1935 LONG *FullScreenMode) {
1936 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1938 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, FullScreenMode);
1943 static HRESULT WINAPI Videowindow_put_FullScreenMode(IVideoWindow *iface,
1944 LONG FullScreenMode) {
1945 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1947 FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, FullScreenMode);
1949 if (FullScreenMode) {
1950 ShowWindow(This->baseWindow.hWnd, SW_HIDE);
1951 SetParent(This->baseWindow.hWnd, 0);
1952 SetWindowLongW(This->baseWindow.hWnd, GWL_STYLE, WS_POPUP);
1953 SetWindowPos(This->baseWindow.hWnd,HWND_TOP,0,0,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN),SWP_SHOWWINDOW);
1954 GetWindowRect(This->baseWindow.hWnd, &This->DestRect);
1955 This->WindowPos = This->DestRect;
1957 ShowWindow(This->baseWindow.hWnd, SW_HIDE);
1958 SetParent(This->baseWindow.hWnd, This->hWndOwner);
1959 SetWindowLongW(This->baseWindow.hWnd, GWL_STYLE, This->WindowStyle);
1960 GetClientRect(This->baseWindow.hWnd, &This->DestRect);
1961 SetWindowPos(This->baseWindow.hWnd,0,This->DestRect.left,This->DestRect.top,This->DestRect.right,This->DestRect.bottom,SWP_NOZORDER|SWP_SHOWWINDOW);
1962 This->WindowPos = This->DestRect;
1968 static HRESULT WINAPI Videowindow_SetWindowForeground(IVideoWindow *iface,
1970 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1975 TRACE("(%p/%p)->(%d)\n", This, iface, Focus);
1977 if ((Focus != FALSE) && (Focus != TRUE))
1978 return E_INVALIDARG;
1980 hr = IPin_ConnectedTo((IPin *)This->pInputPin, &pPin);
1981 if ((hr != S_OK) || !pPin)
1982 return VFW_E_NOT_CONNECTED;
1985 ret = SetForegroundWindow(This->baseWindow.hWnd);
1987 ret = SetWindowPos(This->baseWindow.hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
1995 static HRESULT WINAPI Videowindow_NotifyOwnerMessage(IVideoWindow *iface,
2000 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2002 TRACE("(%p/%p)->(%08lx, %d, %08lx, %08lx)\n", This, iface, hwnd, uMsg, wParam, lParam);
2004 if (!PostMessageW(This->baseWindow.hWnd, uMsg, wParam, lParam))
2010 static HRESULT WINAPI Videowindow_SetWindowPosition(IVideoWindow *iface,
2015 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2017 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height);
2019 if (!SetWindowPos(This->baseWindow.hWnd, NULL, Left, Top, Width, Height, SWP_NOZORDER))
2022 This->WindowPos.left = Left;
2023 This->WindowPos.top = Top;
2024 This->WindowPos.right = Left + Width;
2025 This->WindowPos.bottom = Top + Height;
2030 static HRESULT WINAPI Videowindow_GetWindowPosition(IVideoWindow *iface,
2035 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2037 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
2039 *pLeft = This->WindowPos.left;
2040 *pTop = This->WindowPos.top;
2041 *pWidth = This->WindowPos.right - This->WindowPos.left;
2042 *pHeight = This->WindowPos.bottom - This->WindowPos.top;
2047 static HRESULT WINAPI Videowindow_GetMinIdealImageSize(IVideoWindow *iface,
2050 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2052 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This, iface, pWidth, pHeight);
2054 *pWidth = This->VideoWidth;
2055 *pHeight = This->VideoHeight;
2060 static HRESULT WINAPI Videowindow_GetMaxIdealImageSize(IVideoWindow *iface,
2063 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2065 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This, iface, pWidth, pHeight);
2067 *pWidth = This->VideoWidth;
2068 *pHeight = This->VideoHeight;
2073 static HRESULT WINAPI Videowindow_GetRestorePosition(IVideoWindow *iface,
2078 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2080 FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This, iface, pLeft, pTop, pWidth, pHeight);
2085 static HRESULT WINAPI Videowindow_HideCursor(IVideoWindow *iface,
2087 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2089 FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, HideCursor);
2094 static HRESULT WINAPI Videowindow_IsCursorHidden(IVideoWindow *iface,
2095 LONG *CursorHidden) {
2096 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2098 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, CursorHidden);
2103 static const IVideoWindowVtbl IVideoWindow_VTable =
2105 Videowindow_QueryInterface,
2107 Videowindow_Release,
2108 Videowindow_GetTypeInfoCount,
2109 Videowindow_GetTypeInfo,
2110 Videowindow_GetIDsOfNames,
2112 Videowindow_put_Caption,
2113 Videowindow_get_Caption,
2114 Videowindow_put_WindowStyle,
2115 Videowindow_get_WindowStyle,
2116 Videowindow_put_WindowStyleEx,
2117 Videowindow_get_WindowStyleEx,
2118 Videowindow_put_AutoShow,
2119 Videowindow_get_AutoShow,
2120 Videowindow_put_WindowState,
2121 Videowindow_get_WindowState,
2122 Videowindow_put_BackgroundPalette,
2123 Videowindow_get_BackgroundPalette,
2124 Videowindow_put_Visible,
2125 Videowindow_get_Visible,
2126 Videowindow_put_Left,
2127 Videowindow_get_Left,
2128 Videowindow_put_Width,
2129 Videowindow_get_Width,
2130 Videowindow_put_Top,
2131 Videowindow_get_Top,
2132 Videowindow_put_Height,
2133 Videowindow_get_Height,
2134 Videowindow_put_Owner,
2135 Videowindow_get_Owner,
2136 Videowindow_put_MessageDrain,
2137 Videowindow_get_MessageDrain,
2138 Videowindow_get_BorderColor,
2139 Videowindow_put_BorderColor,
2140 Videowindow_get_FullScreenMode,
2141 Videowindow_put_FullScreenMode,
2142 Videowindow_SetWindowForeground,
2143 Videowindow_NotifyOwnerMessage,
2144 Videowindow_SetWindowPosition,
2145 Videowindow_GetWindowPosition,
2146 Videowindow_GetMinIdealImageSize,
2147 Videowindow_GetMaxIdealImageSize,
2148 Videowindow_GetRestorePosition,
2149 Videowindow_HideCursor,
2150 Videowindow_IsCursorHidden
2153 static VideoRendererImpl *from_IAMFilterMiscFlags(IAMFilterMiscFlags *iface) {
2154 return (VideoRendererImpl*)((char*)iface - offsetof(VideoRendererImpl, IAMFilterMiscFlags_vtbl));
2157 static HRESULT WINAPI AMFilterMiscFlags_QueryInterface(IAMFilterMiscFlags *iface, REFIID riid, void **ppv) {
2158 VideoRendererImpl *This = from_IAMFilterMiscFlags(iface);
2159 return IUnknown_QueryInterface((IUnknown*)This, riid, ppv);
2162 static ULONG WINAPI AMFilterMiscFlags_AddRef(IAMFilterMiscFlags *iface) {
2163 VideoRendererImpl *This = from_IAMFilterMiscFlags(iface);
2164 return IUnknown_AddRef((IUnknown*)This);
2167 static ULONG WINAPI AMFilterMiscFlags_Release(IAMFilterMiscFlags *iface) {
2168 VideoRendererImpl *This = from_IAMFilterMiscFlags(iface);
2169 return IUnknown_Release((IUnknown*)This);
2172 static ULONG WINAPI AMFilterMiscFlags_GetMiscFlags(IAMFilterMiscFlags *iface) {
2173 return AM_FILTER_MISC_FLAGS_IS_RENDERER;
2176 static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl = {
2177 AMFilterMiscFlags_QueryInterface,
2178 AMFilterMiscFlags_AddRef,
2179 AMFilterMiscFlags_Release,
2180 AMFilterMiscFlags_GetMiscFlags