2 * Video Renderer (Fullscreen and Windowed using Direct Draw)
4 * Copyright 2004 Christian Costa
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #define NONAMELESSSTRUCT
24 #define NONAMELESSUNION
25 #include "quartz_private.h"
26 #include "control_private.h"
41 #include "wine/unicode.h"
42 #include "wine/debug.h"
44 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
46 static BOOL wnd_class_registered = FALSE;
48 static const WCHAR wcsInputPinName[] = {'i','n','p','u','t',' ','p','i','n',0};
50 static const IBaseFilterVtbl VideoRenderer_Vtbl;
51 static const IUnknownVtbl IInner_VTable;
52 static const IBasicVideoVtbl IBasicVideo_VTable;
53 static const IVideoWindowVtbl IVideoWindow_VTable;
54 static const IPinVtbl VideoRenderer_InputPin_Vtbl;
55 static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl;
56 static const IQualityControlVtbl VideoRenderer_QualityControl_Vtbl = {
57 QualityControlImpl_QueryInterface,
58 QualityControlImpl_AddRef,
59 QualityControlImpl_Release,
60 QualityControlImpl_Notify,
61 QualityControlImpl_SetSink
64 typedef struct VideoRendererImpl
67 const IBasicVideoVtbl * IBasicVideo_vtbl;
68 const IVideoWindowVtbl * IVideoWindow_vtbl;
69 const IUnknownVtbl * IInner_vtbl;
70 const IAMFilterMiscFlagsVtbl *IAMFilterMiscFlags_vtbl;
71 IUnknown *seekthru_unk;
72 QualityControlImpl qcimpl;
74 BaseInputPin *pInputPin;
97 /* During pause we can hold a single sample, for use in GetCurrentImage */
98 IMediaSample *sample_held;
101 static LRESULT CALLBACK 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 video_register_windowclass(void) {
169 if (wnd_class_registered)
173 winclass.lpfnWndProc = VideoWndProcA;
174 winclass.cbClsExtra = 0;
175 winclass.cbWndExtra = sizeof(VideoRendererImpl*);
176 winclass.hInstance = NULL;
177 winclass.hIcon = NULL;
178 winclass.hCursor = NULL;
179 winclass.hbrBackground = GetStockObject(BLACK_BRUSH);
180 winclass.lpszMenuName = NULL;
181 winclass.lpszClassName = "Wine ActiveMovie Class";
182 if (!RegisterClassA(&winclass))
184 ERR("Unable to register window class: %u\n", GetLastError());
187 wnd_class_registered = 1;
191 void video_unregister_windowclass(void) {
192 if (!wnd_class_registered)
194 UnregisterClassA("Wine ActiveMovie Class", NULL);
197 static BOOL CreateRenderingWindow(VideoRendererImpl* This)
199 TRACE("(%p)->()\n", This);
200 if (!video_register_windowclass())
202 This->hWnd = CreateWindowExA(0, "Wine ActiveMovie Class", "Wine ActiveMovie Window", WS_SIZEBOX,
203 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL,
208 ERR("Unable to create window\n");
212 SetWindowLongPtrW(This->hWnd, 0, (LONG_PTR)This);
217 static DWORD WINAPI MessageLoop(LPVOID lpParameter)
219 VideoRendererImpl* This = lpParameter;
223 TRACE("Starting message loop\n");
225 if (!CreateRenderingWindow(This))
227 This->ThreadResult = FALSE;
228 SetEvent(This->hEvent);
232 This->ThreadResult = TRUE;
233 SetEvent(This->hEvent);
235 while ((fGotMessage = GetMessageA(&msg, NULL, 0, 0)) != 0 && fGotMessage != -1)
237 TranslateMessage(&msg);
238 DispatchMessageA(&msg);
241 TRACE("End of message loop\n");
246 static BOOL CreateRenderingSubsystem(VideoRendererImpl* This)
248 This->hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
252 This->hThread = CreateThread(NULL, 0, MessageLoop, This, 0, &This->ThreadID);
255 CloseHandle(This->hEvent);
259 WaitForSingleObject(This->hEvent, INFINITE);
261 if (!This->ThreadResult)
263 CloseHandle(This->hEvent);
264 CloseHandle(This->hThread);
271 static void VideoRenderer_AutoShowWindow(VideoRendererImpl *This) {
272 if (!This->init && (!This->WindowPos.right || !This->WindowPos.top))
274 DWORD style = GetWindowLongW(This->hWnd, GWL_STYLE);
275 DWORD style_ex = GetWindowLongW(This->hWnd, GWL_EXSTYLE);
277 if (!This->WindowPos.right)
279 This->WindowPos.left = This->SourceRect.left;
280 This->WindowPos.right = This->SourceRect.right;
282 if (!This->WindowPos.bottom)
284 This->WindowPos.top = This->SourceRect.top;
285 This->WindowPos.bottom = This->SourceRect.bottom;
288 AdjustWindowRectEx(&This->WindowPos, style, TRUE, style_ex);
290 TRACE("WindowPos: %d %d %d %d\n", This->WindowPos.left, This->WindowPos.top, This->WindowPos.right, This->WindowPos.bottom);
291 SetWindowPos(This->hWnd, NULL,
292 This->WindowPos.left,
294 This->WindowPos.right - This->WindowPos.left,
295 This->WindowPos.bottom - This->WindowPos.top,
296 SWP_NOZORDER|SWP_NOMOVE|SWP_DEFERERASE);
298 GetClientRect(This->hWnd, &This->DestRect);
300 else if (!This->init)
301 This->DestRect = This->WindowPos;
304 ShowWindow(This->hWnd, SW_SHOW);
307 static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data, DWORD size)
313 BITMAPINFOHEADER *bmiHeader;
315 TRACE("(%p)->(%p, %d)\n", This, data, size);
317 sdesc.dwSize = sizeof(sdesc);
318 hr = IPin_ConnectionMediaType((IPin *)This->pInputPin, &amt);
320 ERR("Unable to retrieve media type\n");
324 if (IsEqualIID(&amt.formattype, &FORMAT_VideoInfo))
326 bmiHeader = &((VIDEOINFOHEADER *)amt.pbFormat)->bmiHeader;
328 else if (IsEqualIID(&amt.formattype, &FORMAT_VideoInfo2))
330 bmiHeader = &((VIDEOINFOHEADER2 *)amt.pbFormat)->bmiHeader;
334 FIXME("Unknown type %s\n", debugstr_guid(&amt.subtype));
335 return VFW_E_RUNTIME_ERROR;
338 TRACE("biSize = %d\n", bmiHeader->biSize);
339 TRACE("biWidth = %d\n", bmiHeader->biWidth);
340 TRACE("biHeight = %d\n", bmiHeader->biHeight);
341 TRACE("biPlanes = %d\n", bmiHeader->biPlanes);
342 TRACE("biBitCount = %d\n", bmiHeader->biBitCount);
343 TRACE("biCompression = %s\n", debugstr_an((LPSTR)&(bmiHeader->biCompression), 4));
344 TRACE("biSizeImage = %d\n", bmiHeader->biSizeImage);
346 hDC = GetDC(This->hWnd);
349 ERR("Cannot get DC from window!\n");
353 TRACE("Src Rect: %d %d %d %d\n", This->SourceRect.left, This->SourceRect.top, This->SourceRect.right, This->SourceRect.bottom);
354 TRACE("Dst Rect: %d %d %d %d\n", This->DestRect.left, This->DestRect.top, This->DestRect.right, This->DestRect.bottom);
356 StretchDIBits(hDC, This->DestRect.left, This->DestRect.top, This->DestRect.right -This->DestRect.left,
357 This->DestRect.bottom - This->DestRect.top, This->SourceRect.left, This->SourceRect.top,
358 This->SourceRect.right - This->SourceRect.left, This->SourceRect.bottom - This->SourceRect.top,
359 data, (BITMAPINFO *)bmiHeader, DIB_RGB_COLORS, SRCCOPY);
361 ReleaseDC(This->hWnd, hDC);
366 static HRESULT WINAPI VideoRenderer_Receive(BaseInputPin* pin, IMediaSample * pSample)
368 VideoRendererImpl *This = (VideoRendererImpl *)pin->pin.pinInfo.pFilter;
369 LPBYTE pbSrcStream = NULL;
370 LONG cbSrcStream = 0;
371 REFERENCE_TIME tStart, tStop;
374 TRACE("(%p)->(%p)\n", pin, pSample);
376 EnterCriticalSection(&This->filter.csFilter);
378 if (This->pInputPin->flushing || This->pInputPin->end_of_stream)
380 LeaveCriticalSection(&This->filter.csFilter);
384 if (This->filter.state == State_Stopped)
386 LeaveCriticalSection(&This->filter.csFilter);
387 return VFW_E_WRONG_STATE;
390 if (IMediaSample_GetMediaTime(pSample, &tStart, &tStop) == S_OK)
391 MediaSeekingPassThru_RegisterMediaTime(This->seekthru_unk, tStart);
393 /* Preroll means the sample isn't shown, this is used for key frames and things like that */
394 if (IMediaSample_IsPreroll(pSample) == S_OK) {
395 LeaveCriticalSection(&This->filter.csFilter);
399 hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
402 ERR("Cannot get pointer to sample data (%x)\n", hr);
403 LeaveCriticalSection(&This->filter.csFilter);
407 cbSrcStream = IMediaSample_GetActualDataLength(pSample);
409 TRACE("val %p %d\n", pbSrcStream, cbSrcStream);
411 #if 0 /* For debugging purpose */
414 for(i = 0; i < cbSrcStream; i++)
416 if ((i!=0) && !(i%16))
418 TRACE("%02x ", pbSrcStream[i]);
424 SetEvent(This->hEvent);
425 if (This->filter.state == State_Paused)
427 VideoRenderer_SendSampleData(This, pbSrcStream, cbSrcStream);
428 This->sample_held = pSample;
429 LeaveCriticalSection(&This->filter.csFilter);
430 WaitForSingleObject(This->blocked, INFINITE);
431 EnterCriticalSection(&This->filter.csFilter);
432 This->sample_held = NULL;
433 if (This->filter.state == State_Paused)
436 LeaveCriticalSection(&This->filter.csFilter);
439 if (This->filter.state == State_Stopped)
441 LeaveCriticalSection(&This->filter.csFilter);
442 return VFW_E_WRONG_STATE;
445 hr = QualityControlRender_WaitFor(&This->qcimpl, pSample, This->blocked);
447 QualityControlRender_BeginRender(&This->qcimpl);
448 VideoRenderer_SendSampleData(This, pbSrcStream, cbSrcStream);
449 QualityControlRender_EndRender(&This->qcimpl);
451 QualityControlRender_DoQOS(&This->qcimpl);
453 LeaveCriticalSection(&This->filter.csFilter);
457 static HRESULT WINAPI VideoRenderer_CheckMediaType(BasePin *iface, const AM_MEDIA_TYPE * pmt)
459 BaseInputPin* pin = (BaseInputPin*)iface;
460 VideoRendererImpl *This = (VideoRendererImpl *)pin->pin.pinInfo.pFilter;
462 if (!IsEqualIID(&pmt->majortype, &MEDIATYPE_Video))
465 if (IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB32) ||
466 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB24) ||
467 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB565) ||
468 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB8))
472 if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo))
474 VIDEOINFOHEADER *format = (VIDEOINFOHEADER *)pmt->pbFormat;
475 This->SourceRect.left = 0;
476 This->SourceRect.top = 0;
477 This->SourceRect.right = This->VideoWidth = format->bmiHeader.biWidth;
478 height = format->bmiHeader.biHeight;
480 This->SourceRect.bottom = This->VideoHeight = -height;
482 This->SourceRect.bottom = This->VideoHeight = height;
484 else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2))
486 VIDEOINFOHEADER2 *format2 = (VIDEOINFOHEADER2 *)pmt->pbFormat;
488 This->SourceRect.left = 0;
489 This->SourceRect.top = 0;
490 This->SourceRect.right = This->VideoWidth = format2->bmiHeader.biWidth;
491 height = format2->bmiHeader.biHeight;
493 This->SourceRect.bottom = This->VideoHeight = -height;
495 This->SourceRect.bottom = This->VideoHeight = height;
499 WARN("Format type %s not supported\n", debugstr_guid(&pmt->formattype));
507 static IPin* WINAPI VideoRenderer_GetPin(BaseFilter *iface, int pos)
509 VideoRendererImpl *This = (VideoRendererImpl *)iface;
511 if (pos >= 1 || pos < 0)
514 IPin_AddRef((IPin *)This->pInputPin);
515 return (IPin *)This->pInputPin;
518 static LONG WINAPI VideoRenderer_GetPinCount(BaseFilter *iface)
523 static const BaseFilterFuncTable BaseFuncTable = {
524 VideoRenderer_GetPin,
525 VideoRenderer_GetPinCount
528 static const BasePinFuncTable input_BaseFuncTable = {
529 VideoRenderer_CheckMediaType,
531 BasePinImpl_GetMediaTypeVersion,
532 BasePinImpl_GetMediaType
535 static const BaseInputPinFuncTable input_BaseInputFuncTable = {
536 VideoRenderer_Receive
539 HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
543 VideoRendererImpl * pVideoRenderer;
544 ISeekingPassThru *passthru;
546 TRACE("(%p, %p)\n", pUnkOuter, ppv);
550 pVideoRenderer = CoTaskMemAlloc(sizeof(VideoRendererImpl));
551 pVideoRenderer->pUnkOuter = pUnkOuter;
552 pVideoRenderer->bUnkOuterValid = FALSE;
553 pVideoRenderer->bAggregatable = FALSE;
554 pVideoRenderer->IInner_vtbl = &IInner_VTable;
555 pVideoRenderer->IAMFilterMiscFlags_vtbl = &IAMFilterMiscFlags_Vtbl;
557 BaseFilter_Init(&pVideoRenderer->filter, &VideoRenderer_Vtbl, &CLSID_VideoRenderer, (DWORD_PTR)(__FILE__ ": VideoRendererImpl.csFilter"), &BaseFuncTable);
559 pVideoRenderer->IBasicVideo_vtbl = &IBasicVideo_VTable;
560 pVideoRenderer->IVideoWindow_vtbl = &IVideoWindow_VTable;
562 pVideoRenderer->init = 0;
563 pVideoRenderer->AutoShow = 1;
564 ZeroMemory(&pVideoRenderer->SourceRect, sizeof(RECT));
565 ZeroMemory(&pVideoRenderer->DestRect, sizeof(RECT));
566 ZeroMemory(&pVideoRenderer->WindowPos, sizeof(RECT));
567 pVideoRenderer->hWndMsgDrain = pVideoRenderer->hWndOwner = NULL;
568 pVideoRenderer->WindowStyle = WS_OVERLAPPED;
570 /* construct input pin */
571 piInput.dir = PINDIR_INPUT;
572 piInput.pFilter = (IBaseFilter *)pVideoRenderer;
573 lstrcpynW(piInput.achName, wcsInputPinName, sizeof(piInput.achName) / sizeof(piInput.achName[0]));
575 hr = BaseInputPin_Construct(&VideoRenderer_InputPin_Vtbl, &piInput, &input_BaseFuncTable, &input_BaseInputFuncTable, &pVideoRenderer->filter.csFilter, NULL, (IPin **)&pVideoRenderer->pInputPin);
579 hr = CoCreateInstance(&CLSID_SeekingPassThru, pUnkOuter ? pUnkOuter : (IUnknown*)&pVideoRenderer->IInner_vtbl, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&pVideoRenderer->seekthru_unk);
581 IPin_Release((IPin*)pVideoRenderer->pInputPin);
584 IUnknown_QueryInterface(pVideoRenderer->seekthru_unk, &IID_ISeekingPassThru, (void**)&passthru);
585 ISeekingPassThru_Init(passthru, TRUE, (IPin*)pVideoRenderer->pInputPin);
586 ISeekingPassThru_Release(passthru);
587 pVideoRenderer->sample_held = NULL;
588 *ppv = pVideoRenderer;
593 QualityControlImpl_init(&pVideoRenderer->qcimpl, (IPin*)pVideoRenderer->pInputPin, (IBaseFilter*)pVideoRenderer);
594 pVideoRenderer->qcimpl.lpVtbl = &VideoRenderer_QualityControl_Vtbl;
596 if (!CreateRenderingSubsystem(pVideoRenderer))
599 pVideoRenderer->blocked = CreateEventW(NULL, FALSE, FALSE, NULL);
600 if (!pVideoRenderer->blocked)
602 hr = HRESULT_FROM_WIN32(GetLastError());
603 IUnknown_Release((IUnknown *)pVideoRenderer);
608 BaseFilterImpl_Release((IBaseFilter*)pVideoRenderer);
609 CoTaskMemFree(pVideoRenderer);
613 HRESULT VideoRendererDefault_create(IUnknown * pUnkOuter, LPVOID * ppv)
615 /* TODO: Attempt to use the VMR-7 renderer instead when possible */
616 return VideoRenderer_create(pUnkOuter, ppv);
619 static HRESULT WINAPI VideoRendererInner_QueryInterface(IUnknown * iface, REFIID riid, LPVOID * ppv)
621 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
622 TRACE("(%p/%p)->(%s, %p)\n", This, iface, qzdebugstr_guid(riid), ppv);
624 if (This->bAggregatable)
625 This->bUnkOuterValid = TRUE;
629 if (IsEqualIID(riid, &IID_IUnknown))
630 *ppv = &This->IInner_vtbl;
631 else if (IsEqualIID(riid, &IID_IPersist))
633 else if (IsEqualIID(riid, &IID_IMediaFilter))
635 else if (IsEqualIID(riid, &IID_IBaseFilter))
637 else if (IsEqualIID(riid, &IID_IBasicVideo))
638 *ppv = &This->IBasicVideo_vtbl;
639 else if (IsEqualIID(riid, &IID_IVideoWindow))
640 *ppv = &This->IVideoWindow_vtbl;
641 else if (IsEqualIID(riid, &IID_IMediaSeeking))
642 return IUnknown_QueryInterface(This->seekthru_unk, riid, ppv);
643 else if (IsEqualIID(riid, &IID_IAMFilterMiscFlags))
644 *ppv = &This->IAMFilterMiscFlags_vtbl;
645 else if (IsEqualIID(riid, &IID_IQualityControl))
646 *ppv = &This->qcimpl;
650 IUnknown_AddRef((IUnknown *)(*ppv));
654 if (!IsEqualIID(riid, &IID_IPin))
655 FIXME("No interface for %s!\n", qzdebugstr_guid(riid));
657 return E_NOINTERFACE;
660 static ULONG WINAPI VideoRendererInner_AddRef(IUnknown * iface)
662 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
663 ULONG refCount = InterlockedIncrement(&This->filter.refCount);
665 TRACE("(%p/%p)->() AddRef from %d\n", This, iface, refCount - 1);
670 static ULONG WINAPI VideoRendererInner_Release(IUnknown * iface)
672 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
673 ULONG refCount = InterlockedDecrement(&This->filter.refCount);
675 TRACE("(%p/%p)->() Release from %d\n", This, iface, refCount + 1);
681 DestroyWindow(This->hWnd);
682 PostThreadMessageA(This->ThreadID, WM_QUIT, 0, 0);
683 WaitForSingleObject(This->hThread, INFINITE);
684 CloseHandle(This->hThread);
685 CloseHandle(This->hEvent);
687 if (SUCCEEDED(IPin_ConnectedTo((IPin *)This->pInputPin, &pConnectedTo)))
689 IPin_Disconnect(pConnectedTo);
690 IPin_Release(pConnectedTo);
692 IPin_Disconnect((IPin *)This->pInputPin);
694 IPin_Release((IPin *)This->pInputPin);
696 This->filter.lpVtbl = NULL;
697 IUnknown_Release(This->seekthru_unk);
698 This->filter.csFilter.DebugInfo->Spare[0] = 0;
699 DeleteCriticalSection(&This->filter.csFilter);
701 TRACE("Destroying Video Renderer\n");
710 static const IUnknownVtbl IInner_VTable =
712 VideoRendererInner_QueryInterface,
713 VideoRendererInner_AddRef,
714 VideoRendererInner_Release
717 static HRESULT WINAPI VideoRenderer_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv)
719 VideoRendererImpl *This = (VideoRendererImpl *)iface;
721 if (This->bAggregatable)
722 This->bUnkOuterValid = TRUE;
726 if (This->bAggregatable)
727 return IUnknown_QueryInterface(This->pUnkOuter, riid, ppv);
729 if (IsEqualIID(riid, &IID_IUnknown))
733 IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
734 hr = IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
735 IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
736 This->bAggregatable = TRUE;
741 return E_NOINTERFACE;
744 return IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
747 static ULONG WINAPI VideoRenderer_AddRef(IBaseFilter * iface)
749 VideoRendererImpl *This = (VideoRendererImpl *)iface;
751 if (This->pUnkOuter && This->bUnkOuterValid)
752 return IUnknown_AddRef(This->pUnkOuter);
753 return IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
756 static ULONG WINAPI VideoRenderer_Release(IBaseFilter * iface)
758 VideoRendererImpl *This = (VideoRendererImpl *)iface;
760 if (This->pUnkOuter && This->bUnkOuterValid)
761 return IUnknown_Release(This->pUnkOuter);
762 return IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
765 /** IMediaFilter methods **/
767 static HRESULT WINAPI VideoRenderer_Stop(IBaseFilter * iface)
769 VideoRendererImpl *This = (VideoRendererImpl *)iface;
771 TRACE("(%p/%p)->()\n", This, iface);
773 EnterCriticalSection(&This->filter.csFilter);
775 This->filter.state = State_Stopped;
776 SetEvent(This->hEvent);
777 SetEvent(This->blocked);
778 MediaSeekingPassThru_ResetMediaTime(This->seekthru_unk);
781 RedrawWindow(This->hWnd, NULL, NULL, RDW_INVALIDATE|RDW_ERASE);
783 LeaveCriticalSection(&This->filter.csFilter);
788 static HRESULT WINAPI VideoRenderer_Pause(IBaseFilter * iface)
790 VideoRendererImpl *This = (VideoRendererImpl *)iface;
792 TRACE("(%p/%p)->()\n", This, iface);
794 EnterCriticalSection(&This->filter.csFilter);
795 if (This->filter.state != State_Paused)
797 if (This->filter.state == State_Stopped)
799 This->pInputPin->end_of_stream = 0;
800 ResetEvent(This->hEvent);
801 VideoRenderer_AutoShowWindow(This);
804 This->filter.state = State_Paused;
805 ResetEvent(This->blocked);
807 LeaveCriticalSection(&This->filter.csFilter);
812 static HRESULT WINAPI VideoRenderer_SetSyncSource(IBaseFilter *iface, IReferenceClock *clock) {
813 VideoRendererImpl *This = (VideoRendererImpl *)iface;
816 EnterCriticalSection(&This->filter.csFilter);
817 QualityControlRender_SetClock(&This->qcimpl, clock);
818 hr = BaseFilterImpl_SetSyncSource(iface, clock);
819 LeaveCriticalSection(&This->filter.csFilter);
823 static HRESULT WINAPI VideoRenderer_Run(IBaseFilter * iface, REFERENCE_TIME tStart)
826 VideoRendererImpl *This = (VideoRendererImpl *)iface;
828 TRACE("(%p/%p)->(%s)\n", This, iface, wine_dbgstr_longlong(tStart));
830 EnterCriticalSection(&This->filter.csFilter);
831 if (This->filter.state == State_Running)
833 This->filter.rtStreamStart = tStart;
834 QualityControlRender_Start(&This->qcimpl, tStart);
835 if (This->pInputPin->pin.pConnectedTo && (This->filter.state == State_Stopped || !This->pInputPin->end_of_stream))
837 if (This->filter.state == State_Stopped)
839 ResetEvent(This->hEvent);
840 VideoRenderer_AutoShowWindow(This);
841 This->pInputPin->end_of_stream = 0;
843 SetEvent(This->blocked);
844 } else if (This->filter.filterInfo.pGraph) {
845 IMediaEventSink *pEventSink;
846 hr = IFilterGraph_QueryInterface(This->filter.filterInfo.pGraph, &IID_IMediaEventSink, (LPVOID*)&pEventSink);
849 hr = IMediaEventSink_Notify(pEventSink, EC_COMPLETE, S_OK, (LONG_PTR)This);
850 IMediaEventSink_Release(pEventSink);
855 This->filter.state = State_Running;
857 LeaveCriticalSection(&This->filter.csFilter);
862 static HRESULT WINAPI VideoRenderer_GetState(IBaseFilter * iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState)
864 VideoRendererImpl *This = (VideoRendererImpl *)iface;
867 TRACE("(%p/%p)->(%d, %p)\n", This, iface, dwMilliSecsTimeout, pState);
869 if (WaitForSingleObject(This->hEvent, dwMilliSecsTimeout) == WAIT_TIMEOUT)
870 hr = VFW_S_STATE_INTERMEDIATE;
874 BaseFilterImpl_GetState(iface, dwMilliSecsTimeout, pState);
879 /** IBaseFilter implementation **/
881 static HRESULT WINAPI VideoRenderer_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)
883 VideoRendererImpl *This = (VideoRendererImpl *)iface;
885 FIXME("(%p/%p)->(%p,%p): stub !!!\n", This, iface, debugstr_w(Id), ppPin);
887 /* FIXME: critical section */
892 static const IBaseFilterVtbl VideoRenderer_Vtbl =
894 VideoRenderer_QueryInterface,
895 VideoRenderer_AddRef,
896 VideoRenderer_Release,
897 BaseFilterImpl_GetClassID,
901 VideoRenderer_GetState,
902 VideoRenderer_SetSyncSource,
903 BaseFilterImpl_GetSyncSource,
904 BaseFilterImpl_EnumPins,
905 VideoRenderer_FindPin,
906 BaseFilterImpl_QueryFilterInfo,
907 BaseFilterImpl_JoinFilterGraph,
908 BaseFilterImpl_QueryVendorInfo
911 static HRESULT WINAPI VideoRenderer_InputPin_EndOfStream(IPin * iface)
913 BaseInputPin* This = (BaseInputPin*)iface;
914 VideoRendererImpl *pFilter;
915 IMediaEventSink* pEventSink;
918 TRACE("(%p/%p)->()\n", This, iface);
920 EnterCriticalSection(This->pin.pCritSec);
921 pFilter = (VideoRendererImpl*)This->pin.pinInfo.pFilter;
922 if (This->flushing || This->end_of_stream)
924 hr = IFilterGraph_QueryInterface(pFilter->filter.filterInfo.pGraph, &IID_IMediaEventSink, (LPVOID*)&pEventSink);
927 hr = IMediaEventSink_Notify(pEventSink, EC_COMPLETE, S_OK, (LONG_PTR)pFilter);
928 IMediaEventSink_Release(pEventSink);
930 MediaSeekingPassThru_EOS(pFilter->seekthru_unk);
931 This->end_of_stream = 1;
933 LeaveCriticalSection(This->pin.pCritSec);
938 static HRESULT WINAPI VideoRenderer_InputPin_BeginFlush(IPin * iface)
940 BaseInputPin* This = (BaseInputPin*)iface;
941 VideoRendererImpl *pVideoRenderer = (VideoRendererImpl *)This->pin.pinInfo.pFilter;
943 TRACE("(%p/%p)->()\n", This, iface);
945 SetEvent(pVideoRenderer->blocked);
946 return BaseInputPinImpl_BeginFlush(iface);
949 static HRESULT WINAPI VideoRenderer_InputPin_EndFlush(IPin * iface)
951 BaseInputPin* This = (BaseInputPin*)iface;
952 VideoRendererImpl *pVideoRenderer = (VideoRendererImpl *)This->pin.pinInfo.pFilter;
955 TRACE("(%p/%p)->()\n", This, iface);
957 EnterCriticalSection(This->pin.pCritSec);
958 if (pVideoRenderer->filter.state == State_Paused) {
959 ResetEvent(pVideoRenderer->blocked);
960 ResetEvent(pVideoRenderer->hEvent);
963 QualityControlRender_Start(&pVideoRenderer->qcimpl, pVideoRenderer->filter.rtStreamStart);
964 hr = BaseInputPinImpl_EndFlush(iface);
965 LeaveCriticalSection(This->pin.pCritSec);
966 MediaSeekingPassThru_ResetMediaTime(pVideoRenderer->seekthru_unk);
971 static const IPinVtbl VideoRenderer_InputPin_Vtbl =
973 BaseInputPinImpl_QueryInterface,
975 BaseInputPinImpl_Release,
976 BaseInputPinImpl_Connect,
977 BaseInputPinImpl_ReceiveConnection,
978 BasePinImpl_Disconnect,
979 BasePinImpl_ConnectedTo,
980 BasePinImpl_ConnectionMediaType,
981 BasePinImpl_QueryPinInfo,
982 BasePinImpl_QueryDirection,
984 BaseInputPinImpl_QueryAccept,
985 BasePinImpl_EnumMediaTypes,
986 BasePinImpl_QueryInternalConnections,
987 VideoRenderer_InputPin_EndOfStream,
988 VideoRenderer_InputPin_BeginFlush,
989 VideoRenderer_InputPin_EndFlush,
990 BaseInputPinImpl_NewSegment
993 /*** IUnknown methods ***/
994 static HRESULT WINAPI Basicvideo_QueryInterface(IBasicVideo *iface,
997 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
999 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1001 return VideoRenderer_QueryInterface((IBaseFilter*)This, riid, ppvObj);
1004 static ULONG WINAPI Basicvideo_AddRef(IBasicVideo *iface) {
1005 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1007 TRACE("(%p/%p)->()\n", This, iface);
1009 return VideoRenderer_AddRef((IBaseFilter*)This);
1012 static ULONG WINAPI Basicvideo_Release(IBasicVideo *iface) {
1013 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1015 TRACE("(%p/%p)->()\n", This, iface);
1017 return VideoRenderer_Release((IBaseFilter*)This);
1020 /*** IDispatch methods ***/
1021 static HRESULT WINAPI Basicvideo_GetTypeInfoCount(IBasicVideo *iface,
1023 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1025 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
1030 static HRESULT WINAPI Basicvideo_GetTypeInfo(IBasicVideo *iface,
1033 ITypeInfo**ppTInfo) {
1034 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1036 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
1041 static HRESULT WINAPI Basicvideo_GetIDsOfNames(IBasicVideo *iface,
1047 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1049 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1054 static HRESULT WINAPI Basicvideo_Invoke(IBasicVideo *iface,
1055 DISPID dispIdMember,
1059 DISPPARAMS*pDispParams,
1061 EXCEPINFO*pExepInfo,
1063 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1065 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);
1070 /*** IBasicVideo methods ***/
1071 static HRESULT WINAPI Basicvideo_get_AvgTimePerFrame(IBasicVideo *iface,
1072 REFTIME *pAvgTimePerFrame) {
1074 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1076 if (!This->pInputPin->pin.pConnectedTo)
1077 return VFW_E_NOT_CONNECTED;
1079 TRACE("(%p/%p)->(%p)\n", This, iface, pAvgTimePerFrame);
1081 pmt = &This->pInputPin->pin.mtCurrent;
1082 if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo)) {
1083 VIDEOINFOHEADER *vih = (VIDEOINFOHEADER*)pmt->pbFormat;
1084 *pAvgTimePerFrame = vih->AvgTimePerFrame;
1085 } else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2)) {
1086 VIDEOINFOHEADER2 *vih = (VIDEOINFOHEADER2*)pmt->pbFormat;
1087 *pAvgTimePerFrame = vih->AvgTimePerFrame;
1089 ERR("Unknown format type %s\n", qzdebugstr_guid(&pmt->formattype));
1090 *pAvgTimePerFrame = 0;
1095 static HRESULT WINAPI Basicvideo_get_BitRate(IBasicVideo *iface,
1097 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1099 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBitRate);
1104 static HRESULT WINAPI Basicvideo_get_BitErrorRate(IBasicVideo *iface,
1105 LONG *pBitErrorRate) {
1106 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1108 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBitErrorRate);
1113 static HRESULT WINAPI Basicvideo_get_VideoWidth(IBasicVideo *iface,
1114 LONG *pVideoWidth) {
1115 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1117 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoWidth);
1119 *pVideoWidth = This->VideoWidth;
1124 static HRESULT WINAPI Basicvideo_get_VideoHeight(IBasicVideo *iface,
1125 LONG *pVideoHeight) {
1126 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1128 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoHeight);
1130 *pVideoHeight = This->VideoHeight;
1135 static HRESULT WINAPI Basicvideo_put_SourceLeft(IBasicVideo *iface,
1137 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1139 TRACE("(%p/%p)->(%d)\n", This, iface, SourceLeft);
1141 This->SourceRect.left = SourceLeft;
1146 static HRESULT WINAPI Basicvideo_get_SourceLeft(IBasicVideo *iface,
1147 LONG *pSourceLeft) {
1148 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1150 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceLeft);
1152 *pSourceLeft = This->SourceRect.left;
1157 static HRESULT WINAPI Basicvideo_put_SourceWidth(IBasicVideo *iface,
1159 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1161 TRACE("(%p/%p)->(%d)\n", This, iface, SourceWidth);
1163 This->SourceRect.right = This->SourceRect.left + SourceWidth;
1168 static HRESULT WINAPI Basicvideo_get_SourceWidth(IBasicVideo *iface,
1169 LONG *pSourceWidth) {
1170 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1172 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceWidth);
1174 *pSourceWidth = This->SourceRect.right - This->SourceRect.left;
1179 static HRESULT WINAPI Basicvideo_put_SourceTop(IBasicVideo *iface,
1181 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1183 TRACE("(%p/%p)->(%d)\n", This, iface, SourceTop);
1185 This->SourceRect.top = SourceTop;
1190 static HRESULT WINAPI Basicvideo_get_SourceTop(IBasicVideo *iface,
1192 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1194 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceTop);
1196 *pSourceTop = This->SourceRect.top;
1201 static HRESULT WINAPI Basicvideo_put_SourceHeight(IBasicVideo *iface,
1202 LONG SourceHeight) {
1203 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1205 TRACE("(%p/%p)->(%d)\n", This, iface, SourceHeight);
1207 This->SourceRect.bottom = This->SourceRect.top + SourceHeight;
1212 static HRESULT WINAPI Basicvideo_get_SourceHeight(IBasicVideo *iface,
1213 LONG *pSourceHeight) {
1214 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1216 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceHeight);
1218 *pSourceHeight = This->SourceRect.bottom - This->SourceRect.top;
1223 static HRESULT WINAPI Basicvideo_put_DestinationLeft(IBasicVideo *iface,
1224 LONG DestinationLeft) {
1225 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1227 TRACE("(%p/%p)->(%d)\n", This, iface, DestinationLeft);
1229 This->DestRect.left = DestinationLeft;
1234 static HRESULT WINAPI Basicvideo_get_DestinationLeft(IBasicVideo *iface,
1235 LONG *pDestinationLeft) {
1236 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1238 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationLeft);
1240 *pDestinationLeft = This->DestRect.left;
1245 static HRESULT WINAPI Basicvideo_put_DestinationWidth(IBasicVideo *iface,
1246 LONG DestinationWidth) {
1247 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1249 TRACE("(%p/%p)->(%d)\n", This, iface, DestinationWidth);
1251 This->DestRect.right = This->DestRect.left + DestinationWidth;
1256 static HRESULT WINAPI Basicvideo_get_DestinationWidth(IBasicVideo *iface,
1257 LONG *pDestinationWidth) {
1258 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1260 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationWidth);
1262 *pDestinationWidth = This->DestRect.right - This->DestRect.left;
1267 static HRESULT WINAPI Basicvideo_put_DestinationTop(IBasicVideo *iface,
1268 LONG DestinationTop) {
1269 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1271 TRACE("(%p/%p)->(%d)\n", This, iface, DestinationTop);
1273 This->DestRect.top = DestinationTop;
1278 static HRESULT WINAPI Basicvideo_get_DestinationTop(IBasicVideo *iface,
1279 LONG *pDestinationTop) {
1280 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1282 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationTop);
1284 *pDestinationTop = This->DestRect.top;
1289 static HRESULT WINAPI Basicvideo_put_DestinationHeight(IBasicVideo *iface,
1290 LONG DestinationHeight) {
1291 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1293 TRACE("(%p/%p)->(%d)\n", This, iface, DestinationHeight);
1295 This->DestRect.right = This->DestRect.left + DestinationHeight;
1300 static HRESULT WINAPI Basicvideo_get_DestinationHeight(IBasicVideo *iface,
1301 LONG *pDestinationHeight) {
1302 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1304 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationHeight);
1306 *pDestinationHeight = This->DestRect.right - This->DestRect.left;
1311 static HRESULT WINAPI Basicvideo_SetSourcePosition(IBasicVideo *iface,
1316 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1318 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height);
1320 This->SourceRect.left = Left;
1321 This->SourceRect.top = Top;
1322 This->SourceRect.right = Left + Width;
1323 This->SourceRect.bottom = Top + Height;
1328 static HRESULT WINAPI Basicvideo_GetSourcePosition(IBasicVideo *iface,
1333 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1335 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1337 *pLeft = This->SourceRect.left;
1338 *pTop = This->SourceRect.top;
1339 *pWidth = This->SourceRect.right - This->SourceRect.left;
1340 *pHeight = This->SourceRect.bottom - This->SourceRect.top;
1345 static HRESULT WINAPI Basicvideo_SetDefaultSourcePosition(IBasicVideo *iface) {
1346 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1348 TRACE("(%p/%p)->()\n", This, iface);
1350 This->SourceRect.left = 0;
1351 This->SourceRect.top = 0;
1352 This->SourceRect.right = This->VideoWidth;
1353 This->SourceRect.bottom = This->VideoHeight;
1358 static HRESULT WINAPI Basicvideo_SetDestinationPosition(IBasicVideo *iface,
1363 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1365 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height);
1367 This->DestRect.left = Left;
1368 This->DestRect.top = Top;
1369 This->DestRect.right = Left + Width;
1370 This->DestRect.bottom = Top + Height;
1375 static HRESULT WINAPI Basicvideo_GetDestinationPosition(IBasicVideo *iface,
1380 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1382 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1384 *pLeft = This->DestRect.left;
1385 *pTop = This->DestRect.top;
1386 *pWidth = This->DestRect.right - This->DestRect.left;
1387 *pHeight = This->DestRect.bottom - This->DestRect.top;
1392 static HRESULT WINAPI Basicvideo_SetDefaultDestinationPosition(IBasicVideo *iface) {
1393 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1396 TRACE("(%p/%p)->()\n", This, iface);
1398 if (!GetClientRect(This->hWnd, &rect))
1401 This->SourceRect.left = 0;
1402 This->SourceRect.top = 0;
1403 This->SourceRect.right = rect.right;
1404 This->SourceRect.bottom = rect.bottom;
1409 static HRESULT WINAPI Basicvideo_GetVideoSize(IBasicVideo *iface,
1412 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1414 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
1416 *pWidth = This->VideoWidth;
1417 *pHeight = This->VideoHeight;
1422 static HRESULT WINAPI Basicvideo_GetVideoPaletteEntries(IBasicVideo *iface,
1427 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1429 TRACE("(%p/%p)->(%d, %d, %p, %p)\n", This, iface, StartIndex, Entries, pRetrieved, pPalette);
1433 return VFW_E_NO_PALETTE_AVAILABLE;
1436 static HRESULT WINAPI Basicvideo_GetCurrentImage(IBasicVideo *iface,
1439 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1440 BITMAPINFOHEADER *bmiHeader;
1442 AM_MEDIA_TYPE *amt = &This->pInputPin->pin.mtCurrent;
1445 FIXME("(%p/%p)->(%p, %p): partial stub\n", This, iface, pBufferSize, pDIBImage);
1447 EnterCriticalSection(&This->filter.csFilter);
1449 if (!This->sample_held)
1451 LeaveCriticalSection(&This->filter.csFilter);
1452 return (This->filter.state == State_Paused ? E_UNEXPECTED : VFW_E_NOT_PAUSED);
1455 if (IsEqualIID(&amt->formattype, &FORMAT_VideoInfo))
1457 bmiHeader = &((VIDEOINFOHEADER *)amt->pbFormat)->bmiHeader;
1459 else if (IsEqualIID(&amt->formattype, &FORMAT_VideoInfo2))
1461 bmiHeader = &((VIDEOINFOHEADER2 *)amt->pbFormat)->bmiHeader;
1465 FIXME("Unknown type %s\n", debugstr_guid(&amt->subtype));
1466 LeaveCriticalSection(&This->filter.csFilter);
1467 return VFW_E_RUNTIME_ERROR;
1470 needed_size = bmiHeader->biSize;
1471 needed_size += IMediaSample_GetActualDataLength(This->sample_held);
1475 *pBufferSize = needed_size;
1476 LeaveCriticalSection(&This->filter.csFilter);
1480 if (needed_size < *pBufferSize)
1482 ERR("Buffer too small %u/%u\n", needed_size, *pBufferSize);
1483 LeaveCriticalSection(&This->filter.csFilter);
1486 *pBufferSize = needed_size;
1488 memcpy(pDIBImage, bmiHeader, bmiHeader->biSize);
1489 IMediaSample_GetPointer(This->sample_held, (BYTE **)&ptr);
1490 memcpy((char *)pDIBImage + bmiHeader->biSize, ptr, IMediaSample_GetActualDataLength(This->sample_held));
1492 LeaveCriticalSection(&This->filter.csFilter);
1497 static HRESULT WINAPI Basicvideo_IsUsingDefaultSource(IBasicVideo *iface) {
1498 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1500 FIXME("(%p/%p)->(): stub !!!\n", This, iface);
1505 static HRESULT WINAPI Basicvideo_IsUsingDefaultDestination(IBasicVideo *iface) {
1506 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1508 FIXME("(%p/%p)->(): stub !!!\n", This, iface);
1514 static const IBasicVideoVtbl IBasicVideo_VTable =
1516 Basicvideo_QueryInterface,
1519 Basicvideo_GetTypeInfoCount,
1520 Basicvideo_GetTypeInfo,
1521 Basicvideo_GetIDsOfNames,
1523 Basicvideo_get_AvgTimePerFrame,
1524 Basicvideo_get_BitRate,
1525 Basicvideo_get_BitErrorRate,
1526 Basicvideo_get_VideoWidth,
1527 Basicvideo_get_VideoHeight,
1528 Basicvideo_put_SourceLeft,
1529 Basicvideo_get_SourceLeft,
1530 Basicvideo_put_SourceWidth,
1531 Basicvideo_get_SourceWidth,
1532 Basicvideo_put_SourceTop,
1533 Basicvideo_get_SourceTop,
1534 Basicvideo_put_SourceHeight,
1535 Basicvideo_get_SourceHeight,
1536 Basicvideo_put_DestinationLeft,
1537 Basicvideo_get_DestinationLeft,
1538 Basicvideo_put_DestinationWidth,
1539 Basicvideo_get_DestinationWidth,
1540 Basicvideo_put_DestinationTop,
1541 Basicvideo_get_DestinationTop,
1542 Basicvideo_put_DestinationHeight,
1543 Basicvideo_get_DestinationHeight,
1544 Basicvideo_SetSourcePosition,
1545 Basicvideo_GetSourcePosition,
1546 Basicvideo_SetDefaultSourcePosition,
1547 Basicvideo_SetDestinationPosition,
1548 Basicvideo_GetDestinationPosition,
1549 Basicvideo_SetDefaultDestinationPosition,
1550 Basicvideo_GetVideoSize,
1551 Basicvideo_GetVideoPaletteEntries,
1552 Basicvideo_GetCurrentImage,
1553 Basicvideo_IsUsingDefaultSource,
1554 Basicvideo_IsUsingDefaultDestination
1558 /*** IUnknown methods ***/
1559 static HRESULT WINAPI Videowindow_QueryInterface(IVideoWindow *iface,
1562 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1564 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1566 return VideoRenderer_QueryInterface((IBaseFilter*)This, riid, ppvObj);
1569 static ULONG WINAPI Videowindow_AddRef(IVideoWindow *iface) {
1570 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1572 TRACE("(%p/%p)->()\n", This, iface);
1574 return VideoRenderer_AddRef((IBaseFilter*)This);
1577 static ULONG WINAPI Videowindow_Release(IVideoWindow *iface) {
1578 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1580 TRACE("(%p/%p)->()\n", This, iface);
1582 return VideoRenderer_Release((IBaseFilter*)This);
1585 /*** IDispatch methods ***/
1586 static HRESULT WINAPI Videowindow_GetTypeInfoCount(IVideoWindow *iface,
1588 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1590 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
1595 static HRESULT WINAPI Videowindow_GetTypeInfo(IVideoWindow *iface,
1598 ITypeInfo**ppTInfo) {
1599 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1601 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
1606 static HRESULT WINAPI Videowindow_GetIDsOfNames(IVideoWindow *iface,
1612 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1614 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1619 static HRESULT WINAPI Videowindow_Invoke(IVideoWindow *iface,
1620 DISPID dispIdMember,
1624 DISPPARAMS*pDispParams,
1626 EXCEPINFO*pExepInfo,
1628 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1630 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);
1635 /*** IVideoWindow methods ***/
1636 static HRESULT WINAPI Videowindow_put_Caption(IVideoWindow *iface,
1638 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1640 TRACE("(%p/%p)->(%s (%p))\n", This, iface, debugstr_w(strCaption), strCaption);
1642 if (!SetWindowTextW(This->hWnd, strCaption))
1648 static HRESULT WINAPI Videowindow_get_Caption(IVideoWindow *iface,
1650 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1652 TRACE("(%p/%p)->(%p)\n", This, iface, strCaption);
1654 GetWindowTextW(This->hWnd, (LPWSTR)strCaption, 100);
1659 static HRESULT WINAPI Videowindow_put_WindowStyle(IVideoWindow *iface,
1661 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1664 old = GetWindowLongA(This->hWnd, GWL_STYLE);
1666 TRACE("(%p/%p)->(%x -> %x)\n", This, iface, old, WindowStyle);
1668 if (WindowStyle & (WS_DISABLED|WS_HSCROLL|WS_ICONIC|WS_MAXIMIZE|WS_MINIMIZE|WS_VSCROLL))
1669 return E_INVALIDARG;
1671 SetWindowLongA(This->hWnd, GWL_STYLE, WindowStyle);
1672 SetWindowPos(This->hWnd,0,0,0,0,0,SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOZORDER);
1673 This->WindowStyle = WindowStyle;
1678 static HRESULT WINAPI Videowindow_get_WindowStyle(IVideoWindow *iface,
1679 LONG *WindowStyle) {
1680 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1682 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyle);
1684 *WindowStyle = This->WindowStyle;
1689 static HRESULT WINAPI Videowindow_put_WindowStyleEx(IVideoWindow *iface,
1690 LONG WindowStyleEx) {
1691 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1693 TRACE("(%p/%p)->(%d)\n", This, iface, WindowStyleEx);
1695 if (!SetWindowLongA(This->hWnd, GWL_EXSTYLE, WindowStyleEx))
1701 static HRESULT WINAPI Videowindow_get_WindowStyleEx(IVideoWindow *iface,
1702 LONG *WindowStyleEx) {
1703 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1705 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyleEx);
1707 *WindowStyleEx = GetWindowLongA(This->hWnd, GWL_EXSTYLE);
1712 static HRESULT WINAPI Videowindow_put_AutoShow(IVideoWindow *iface,
1714 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1716 TRACE("(%p/%p)->(%d)\n", This, iface, AutoShow);
1718 This->AutoShow = AutoShow;
1723 static HRESULT WINAPI Videowindow_get_AutoShow(IVideoWindow *iface,
1725 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1727 TRACE("(%p/%p)->(%p)\n", This, iface, AutoShow);
1729 *AutoShow = This->AutoShow;
1734 static HRESULT WINAPI Videowindow_put_WindowState(IVideoWindow *iface,
1736 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1738 TRACE("(%p/%p)->(%d)\n", This, iface, WindowState);
1739 ShowWindow(This->hWnd, WindowState);
1743 static HRESULT WINAPI Videowindow_get_WindowState(IVideoWindow *iface,
1744 LONG *WindowState) {
1745 WINDOWPLACEMENT place;
1746 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1748 place.length = sizeof(place);
1749 GetWindowPlacement(This->hWnd, &place);
1750 TRACE("(%p/%p)->(%p)\n", This, iface, WindowState);
1751 *WindowState = place.showCmd;
1756 static HRESULT WINAPI Videowindow_put_BackgroundPalette(IVideoWindow *iface,
1757 LONG BackgroundPalette) {
1758 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1760 FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, BackgroundPalette);
1765 static HRESULT WINAPI Videowindow_get_BackgroundPalette(IVideoWindow *iface,
1766 LONG *pBackgroundPalette) {
1767 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1769 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBackgroundPalette);
1774 static HRESULT WINAPI Videowindow_put_Visible(IVideoWindow *iface,
1776 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1778 TRACE("(%p/%p)->(%d)\n", This, iface, Visible);
1780 ShowWindow(This->hWnd, Visible ? SW_SHOW : SW_HIDE);
1785 static HRESULT WINAPI Videowindow_get_Visible(IVideoWindow *iface,
1787 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1789 TRACE("(%p/%p)->(%p)\n", This, iface, pVisible);
1791 *pVisible = IsWindowVisible(This->hWnd);
1796 static HRESULT WINAPI Videowindow_put_Left(IVideoWindow *iface,
1798 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1800 TRACE("(%p/%p)->(%d)\n", This, iface, Left);
1802 if (!SetWindowPos(This->hWnd, NULL, Left, This->WindowPos.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE))
1805 This->WindowPos.left = Left;
1810 static HRESULT WINAPI Videowindow_get_Left(IVideoWindow *iface,
1812 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1814 TRACE("(%p/%p)->(%p)\n", This, iface, pLeft);
1816 *pLeft = This->WindowPos.left;
1821 static HRESULT WINAPI Videowindow_put_Width(IVideoWindow *iface,
1823 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1825 TRACE("(%p/%p)->(%d)\n", This, iface, Width);
1827 if (!SetWindowPos(This->hWnd, NULL, 0, 0, Width, This->WindowPos.bottom-This->WindowPos.top, SWP_NOZORDER|SWP_NOMOVE))
1830 This->WindowPos.right = This->WindowPos.left + Width;
1835 static HRESULT WINAPI Videowindow_get_Width(IVideoWindow *iface,
1837 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1839 TRACE("(%p/%p)->(%p)\n", This, iface, pWidth);
1841 *pWidth = This->WindowPos.right - This->WindowPos.left;
1846 static HRESULT WINAPI Videowindow_put_Top(IVideoWindow *iface,
1848 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1850 TRACE("(%p/%p)->(%d)\n", This, iface, Top);
1852 if (!SetWindowPos(This->hWnd, NULL, This->WindowPos.left, Top, 0, 0, SWP_NOZORDER|SWP_NOSIZE))
1855 This->WindowPos.top = Top;
1860 static HRESULT WINAPI Videowindow_get_Top(IVideoWindow *iface,
1862 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1864 TRACE("(%p/%p)->(%p)\n", This, iface, pTop);
1866 *pTop = This->WindowPos.top;
1871 static HRESULT WINAPI Videowindow_put_Height(IVideoWindow *iface,
1873 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1875 TRACE("(%p/%p)->(%d)\n", This, iface, Height);
1877 if (!SetWindowPos(This->hWnd, NULL, 0, 0, This->WindowPos.right-This->WindowPos.left, Height, SWP_NOZORDER|SWP_NOMOVE))
1880 This->WindowPos.bottom = This->WindowPos.top + Height;
1885 static HRESULT WINAPI Videowindow_get_Height(IVideoWindow *iface,
1887 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1889 TRACE("(%p/%p)->(%p)\n", This, iface, pHeight);
1891 *pHeight = This->WindowPos.bottom - This->WindowPos.top;
1896 static HRESULT WINAPI Videowindow_put_Owner(IVideoWindow *iface,
1898 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1900 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Owner);
1902 This->hWndOwner = (HWND)Owner;
1903 SetParent(This->hWnd, This->hWndOwner);
1904 if (This->WindowStyle & WS_CHILD)
1906 LONG old = GetWindowLongA(This->hWnd, GWL_STYLE);
1907 if (old != This->WindowStyle)
1909 SetWindowLongA(This->hWnd, GWL_STYLE, This->WindowStyle);
1910 SetWindowPos(This->hWnd,0,0,0,0,0,SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOZORDER);
1917 static HRESULT WINAPI Videowindow_get_Owner(IVideoWindow *iface,
1919 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1921 TRACE("(%p/%p)->(%p)\n", This, iface, Owner);
1923 *(HWND*)Owner = This->hWndOwner;
1928 static HRESULT WINAPI Videowindow_put_MessageDrain(IVideoWindow *iface,
1930 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1932 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Drain);
1934 This->hWndMsgDrain = (HWND)Drain;
1939 static HRESULT WINAPI Videowindow_get_MessageDrain(IVideoWindow *iface,
1941 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1943 TRACE("(%p/%p)->(%p)\n", This, iface, Drain);
1945 *Drain = (OAHWND)This->hWndMsgDrain;
1950 static HRESULT WINAPI Videowindow_get_BorderColor(IVideoWindow *iface,
1952 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1954 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, Color);
1959 static HRESULT WINAPI Videowindow_put_BorderColor(IVideoWindow *iface,
1961 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1963 FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, Color);
1968 static HRESULT WINAPI Videowindow_get_FullScreenMode(IVideoWindow *iface,
1969 LONG *FullScreenMode) {
1970 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1972 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, FullScreenMode);
1977 static HRESULT WINAPI Videowindow_put_FullScreenMode(IVideoWindow *iface,
1978 LONG FullScreenMode) {
1979 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1981 FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, FullScreenMode);
1983 if (FullScreenMode) {
1984 ShowWindow(This->hWnd, SW_HIDE);
1985 SetParent(This->hWnd, 0);
1986 SetWindowLongA(This->hWnd, GWL_STYLE, WS_POPUP);
1987 SetWindowPos(This->hWnd,HWND_TOP,0,0,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN),SWP_SHOWWINDOW);
1988 GetWindowRect(This->hWnd, &This->DestRect);
1989 This->WindowPos = This->DestRect;
1991 ShowWindow(This->hWnd, SW_HIDE);
1992 SetParent(This->hWnd, This->hWndOwner);
1993 SetWindowLongA(This->hWnd, GWL_STYLE, This->WindowStyle);
1994 GetClientRect(This->hWnd, &This->DestRect);
1995 SetWindowPos(This->hWnd,0,This->DestRect.left,This->DestRect.top,This->DestRect.right,This->DestRect.bottom,SWP_NOZORDER|SWP_SHOWWINDOW);
1996 This->WindowPos = This->DestRect;
2002 static HRESULT WINAPI Videowindow_SetWindowForeground(IVideoWindow *iface,
2004 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2009 TRACE("(%p/%p)->(%d)\n", This, iface, Focus);
2011 if ((Focus != FALSE) && (Focus != TRUE))
2012 return E_INVALIDARG;
2014 hr = IPin_ConnectedTo((IPin *)This->pInputPin, &pPin);
2015 if ((hr != S_OK) || !pPin)
2016 return VFW_E_NOT_CONNECTED;
2019 ret = SetForegroundWindow(This->hWnd);
2021 ret = SetWindowPos(This->hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
2029 static HRESULT WINAPI Videowindow_NotifyOwnerMessage(IVideoWindow *iface,
2034 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2036 TRACE("(%p/%p)->(%08lx, %d, %08lx, %08lx)\n", This, iface, hwnd, uMsg, wParam, lParam);
2038 if (!PostMessageA(This->hWnd, uMsg, wParam, lParam))
2044 static HRESULT WINAPI Videowindow_SetWindowPosition(IVideoWindow *iface,
2049 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2051 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height);
2053 if (!SetWindowPos(This->hWnd, NULL, Left, Top, Width, Height, SWP_NOZORDER))
2056 This->WindowPos.left = Left;
2057 This->WindowPos.top = Top;
2058 This->WindowPos.right = Left + Width;
2059 This->WindowPos.bottom = Top + Height;
2064 static HRESULT WINAPI Videowindow_GetWindowPosition(IVideoWindow *iface,
2069 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2071 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
2073 *pLeft = This->WindowPos.left;
2074 *pTop = This->WindowPos.top;
2075 *pWidth = This->WindowPos.right - This->WindowPos.left;
2076 *pHeight = This->WindowPos.bottom - This->WindowPos.top;
2081 static HRESULT WINAPI Videowindow_GetMinIdealImageSize(IVideoWindow *iface,
2084 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2086 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This, iface, pWidth, pHeight);
2088 *pWidth = This->VideoWidth;
2089 *pHeight = This->VideoHeight;
2094 static HRESULT WINAPI Videowindow_GetMaxIdealImageSize(IVideoWindow *iface,
2097 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2099 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This, iface, pWidth, pHeight);
2101 *pWidth = This->VideoWidth;
2102 *pHeight = This->VideoHeight;
2107 static HRESULT WINAPI Videowindow_GetRestorePosition(IVideoWindow *iface,
2112 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2114 FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This, iface, pLeft, pTop, pWidth, pHeight);
2119 static HRESULT WINAPI Videowindow_HideCursor(IVideoWindow *iface,
2121 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2123 FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, HideCursor);
2128 static HRESULT WINAPI Videowindow_IsCursorHidden(IVideoWindow *iface,
2129 LONG *CursorHidden) {
2130 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
2132 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, CursorHidden);
2137 static const IVideoWindowVtbl IVideoWindow_VTable =
2139 Videowindow_QueryInterface,
2141 Videowindow_Release,
2142 Videowindow_GetTypeInfoCount,
2143 Videowindow_GetTypeInfo,
2144 Videowindow_GetIDsOfNames,
2146 Videowindow_put_Caption,
2147 Videowindow_get_Caption,
2148 Videowindow_put_WindowStyle,
2149 Videowindow_get_WindowStyle,
2150 Videowindow_put_WindowStyleEx,
2151 Videowindow_get_WindowStyleEx,
2152 Videowindow_put_AutoShow,
2153 Videowindow_get_AutoShow,
2154 Videowindow_put_WindowState,
2155 Videowindow_get_WindowState,
2156 Videowindow_put_BackgroundPalette,
2157 Videowindow_get_BackgroundPalette,
2158 Videowindow_put_Visible,
2159 Videowindow_get_Visible,
2160 Videowindow_put_Left,
2161 Videowindow_get_Left,
2162 Videowindow_put_Width,
2163 Videowindow_get_Width,
2164 Videowindow_put_Top,
2165 Videowindow_get_Top,
2166 Videowindow_put_Height,
2167 Videowindow_get_Height,
2168 Videowindow_put_Owner,
2169 Videowindow_get_Owner,
2170 Videowindow_put_MessageDrain,
2171 Videowindow_get_MessageDrain,
2172 Videowindow_get_BorderColor,
2173 Videowindow_put_BorderColor,
2174 Videowindow_get_FullScreenMode,
2175 Videowindow_put_FullScreenMode,
2176 Videowindow_SetWindowForeground,
2177 Videowindow_NotifyOwnerMessage,
2178 Videowindow_SetWindowPosition,
2179 Videowindow_GetWindowPosition,
2180 Videowindow_GetMinIdealImageSize,
2181 Videowindow_GetMaxIdealImageSize,
2182 Videowindow_GetRestorePosition,
2183 Videowindow_HideCursor,
2184 Videowindow_IsCursorHidden
2187 static VideoRendererImpl *from_IAMFilterMiscFlags(IAMFilterMiscFlags *iface) {
2188 return (VideoRendererImpl*)((char*)iface - offsetof(VideoRendererImpl, IAMFilterMiscFlags_vtbl));
2191 static HRESULT WINAPI AMFilterMiscFlags_QueryInterface(IAMFilterMiscFlags *iface, const REFIID riid, void **ppv) {
2192 VideoRendererImpl *This = from_IAMFilterMiscFlags(iface);
2193 return IUnknown_QueryInterface((IUnknown*)This, riid, ppv);
2196 static ULONG WINAPI AMFilterMiscFlags_AddRef(IAMFilterMiscFlags *iface) {
2197 VideoRendererImpl *This = from_IAMFilterMiscFlags(iface);
2198 return IUnknown_AddRef((IUnknown*)This);
2201 static ULONG WINAPI AMFilterMiscFlags_Release(IAMFilterMiscFlags *iface) {
2202 VideoRendererImpl *This = from_IAMFilterMiscFlags(iface);
2203 return IUnknown_Release((IUnknown*)This);
2206 static ULONG WINAPI AMFilterMiscFlags_GetMiscFlags(IAMFilterMiscFlags *iface) {
2207 return AM_FILTER_MISC_FLAGS_IS_RENDERER;
2210 static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl = {
2211 AMFilterMiscFlags_QueryInterface,
2212 AMFilterMiscFlags_AddRef,
2213 AMFilterMiscFlags_Release,
2214 AMFilterMiscFlags_GetMiscFlags