2 * Video Renderer (Fullscreen and Windowed using Direct Draw)
4 * Copyright 2004 Christian Costa
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #define NONAMELESSSTRUCT
24 #define NONAMELESSUNION
25 #include "quartz_private.h"
26 #include "control_private.h"
41 #include "wine/unicode.h"
42 #include "wine/debug.h"
44 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
46 static BOOL wnd_class_registered = FALSE;
48 static const WCHAR wcsInputPinName[] = {'i','n','p','u','t',' ','p','i','n',0};
50 static const IBaseFilterVtbl VideoRenderer_Vtbl;
51 static const IUnknownVtbl IInner_VTable;
52 static const IBasicVideoVtbl IBasicVideo_VTable;
53 static const IVideoWindowVtbl IVideoWindow_VTable;
54 static const IPinVtbl VideoRenderer_InputPin_Vtbl;
56 typedef struct VideoRendererImpl
58 const IBaseFilterVtbl * lpVtbl;
59 const IBasicVideoVtbl * IBasicVideo_vtbl;
60 const IVideoWindowVtbl * IVideoWindow_vtbl;
61 const IUnknownVtbl * IInner_vtbl;
64 CRITICAL_SECTION csFilter;
66 REFERENCE_TIME rtStreamStart;
67 IReferenceClock * pClock;
68 FILTER_INFO filterInfo;
88 REFERENCE_TIME rtLastStop;
91 static LRESULT CALLBACK VideoWndProcA(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
93 VideoRendererImpl* pVideoRenderer = (VideoRendererImpl*)GetWindowLongA(hwnd, 0);
94 LPRECT lprect = (LPRECT)lParam;
96 if (pVideoRenderer && pVideoRenderer->hWndMsgDrain)
102 case WM_LBUTTONDBLCLK:
105 case WM_MBUTTONDBLCLK:
108 case WM_MOUSEACTIVATE:
110 case WM_NCLBUTTONDBLCLK:
111 case WM_NCLBUTTONDOWN:
113 case WM_NCMBUTTONDBLCLK:
114 case WM_NCMBUTTONDOWN:
117 case WM_NCRBUTTONDBLCLK:
118 case WM_NCRBUTTONDOWN:
120 case WM_RBUTTONDBLCLK:
123 PostMessageA(pVideoRenderer->hWndMsgDrain, uMsg, wParam, lParam);
133 /* TRACE("WM_SIZING %d %d %d %d\n", lprect->left, lprect->top, lprect->right, lprect->bottom); */
134 SetWindowPos(hwnd, NULL, lprect->left, lprect->top, lprect->right - lprect->left, lprect->bottom - lprect->top, SWP_NOZORDER);
135 GetClientRect(hwnd, &pVideoRenderer->DestRect);
136 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
137 pVideoRenderer->DestRect.left,
138 pVideoRenderer->DestRect.top,
139 pVideoRenderer->DestRect.right - pVideoRenderer->DestRect.left,
140 pVideoRenderer->DestRect.bottom - pVideoRenderer->DestRect.top);
143 TRACE("WM_SIZE %d %d\n", LOWORD(lParam), HIWORD(lParam));
144 GetClientRect(hwnd, &pVideoRenderer->DestRect);
145 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
146 pVideoRenderer->DestRect.left,
147 pVideoRenderer->DestRect.top,
148 pVideoRenderer->DestRect.right - pVideoRenderer->DestRect.left,
149 pVideoRenderer->DestRect.bottom - pVideoRenderer->DestRect.top);
152 return DefWindowProcA(hwnd, uMsg, wParam, lParam);
157 static BOOL CreateRenderingWindow(VideoRendererImpl* This)
161 TRACE("(%p)->()\n", This);
164 winclass.lpfnWndProc = VideoWndProcA;
165 winclass.cbClsExtra = 0;
166 winclass.cbWndExtra = sizeof(VideoRendererImpl*);
167 winclass.hInstance = NULL;
168 winclass.hIcon = NULL;
169 winclass.hCursor = NULL;
170 winclass.hbrBackground = GetStockObject(BLACK_BRUSH);
171 winclass.lpszMenuName = NULL;
172 winclass.lpszClassName = "Wine ActiveMovie Class";
174 if (!wnd_class_registered)
176 if (!RegisterClassA(&winclass))
178 ERR("Unable to register window %u\n", GetLastError());
181 wnd_class_registered = TRUE;
184 This->hWnd = CreateWindowExA(0, "Wine ActiveMovie Class", "Wine ActiveMovie Window", WS_SIZEBOX,
185 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL,
190 ERR("Unable to create window\n");
194 SetWindowLongA(This->hWnd, 0, (LONG)This);
199 static DWORD WINAPI MessageLoop(LPVOID lpParameter)
201 VideoRendererImpl* This = (VideoRendererImpl*) lpParameter;
205 TRACE("Starting message loop\n");
207 if (!CreateRenderingWindow(This))
209 This->ThreadResult = FALSE;
210 SetEvent(This->hEvent);
214 This->ThreadResult = TRUE;
215 SetEvent(This->hEvent);
217 while ((fGotMessage = GetMessageA(&msg, NULL, 0, 0)) != 0 && fGotMessage != -1)
219 TranslateMessage(&msg);
220 DispatchMessageA(&msg);
223 TRACE("End of message loop\n");
228 static BOOL CreateRenderingSubsystem(VideoRendererImpl* This)
230 This->hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
234 This->hThread = CreateThread(NULL, 0, MessageLoop, (LPVOID)This, 0, &This->ThreadID);
237 CloseHandle(This->hEvent);
241 WaitForSingleObject(This->hEvent, INFINITE);
242 CloseHandle(This->hEvent);
244 if (!This->ThreadResult)
246 CloseHandle(This->hThread);
253 static const IMemInputPinVtbl MemInputPin_Vtbl =
255 MemInputPin_QueryInterface,
258 MemInputPin_GetAllocator,
259 MemInputPin_NotifyAllocator,
260 MemInputPin_GetAllocatorRequirements,
262 MemInputPin_ReceiveMultiple,
263 MemInputPin_ReceiveCanBlock
266 static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data, DWORD size)
273 LPBYTE palette = NULL;
275 BITMAPINFOHEADER *bmiHeader;
277 TRACE("%p %p %d\n", This, data, size);
279 sdesc.dwSize = sizeof(sdesc);
280 hr = IPin_ConnectionMediaType((IPin *)This->pInputPin, &amt);
282 ERR("Unable to retrieve media type\n");
286 if (IsEqualIID(&amt.formattype, &FORMAT_VideoInfo))
288 bmiHeader = &((VIDEOINFOHEADER *)amt.pbFormat)->bmiHeader;
290 else if (IsEqualIID(&amt.formattype, &FORMAT_VideoInfo2))
292 bmiHeader = &((VIDEOINFOHEADER2 *)amt.pbFormat)->bmiHeader;
296 FIXME("Unknown type %s\n", debugstr_guid(&amt.subtype));
297 return VFW_E_RUNTIME_ERROR;
301 TRACE("biSize = %d\n", bmiHeader->biSize);
302 TRACE("biWidth = %d\n", bmiHeader->biWidth);
303 TRACE("biHeight = %d\n", bmiHeader->biHeight);
304 TRACE("biPlanes = %d\n", bmiHeader->biPlanes);
305 TRACE("biBitCount = %d\n", bmiHeader->biBitCount);
306 TRACE("biCompression = %s\n", debugstr_an((LPSTR)&(bmiHeader->biCompression), 4));
307 TRACE("biSizeImage = %d\n", bmiHeader->biSizeImage);
309 width = bmiHeader->biWidth;
310 height = bmiHeader->biHeight;
311 palette = ((LPBYTE)bmiHeader) + bmiHeader->biSize;
315 if (!This->WindowPos.right || !This->WindowPos.bottom)
316 This->WindowPos = This->SourceRect;
318 TRACE("WindowPos: %d %d %d %d\n", This->WindowPos.left, This->WindowPos.top, This->WindowPos.right, This->WindowPos.bottom);
319 SetWindowPos(This->hWnd, NULL,
320 This->WindowPos.left,
322 This->WindowPos.right - This->WindowPos.left,
323 This->WindowPos.bottom - This->WindowPos.top,
324 SWP_NOZORDER|SWP_NOMOVE);
326 GetClientRect(This->hWnd, &This->DestRect);
330 hDC = GetDC(This->hWnd);
333 ERR("Cannot get DC from window!\n");
337 TRACE("Src Rect: %d %d %d %d\n", This->SourceRect.left, This->SourceRect.top, This->SourceRect.right, This->SourceRect.bottom);
338 TRACE("Dst Rect: %d %d %d %d\n", This->DestRect.left, This->DestRect.top, This->DestRect.right, This->DestRect.bottom);
340 StretchDIBits(hDC, This->DestRect.left, This->DestRect.top, This->DestRect.right -This->DestRect.left,
341 This->DestRect.bottom - This->DestRect.top, This->SourceRect.left, This->SourceRect.top,
342 This->SourceRect.right - This->SourceRect.left, This->SourceRect.bottom - This->SourceRect.top,
343 data, (BITMAPINFO *)bmiHeader, DIB_RGB_COLORS, SRCCOPY);
345 ReleaseDC(This->hWnd, hDC);
347 ShowWindow(This->hWnd, SW_SHOW);
352 static HRESULT VideoRenderer_Sample(LPVOID iface, IMediaSample * pSample)
354 VideoRendererImpl *This = (VideoRendererImpl *)iface;
355 LPBYTE pbSrcStream = NULL;
356 long cbSrcStream = 0;
357 REFERENCE_TIME tStart, tStop;
360 if (This->state == State_Stopped)
363 TRACE("%p %p\n", iface, pSample);
365 hr = IMediaSample_GetTime(pSample, &tStart, &tStop);
367 ERR("Cannot get sample time (%x)\n", hr);
369 if (This->rtLastStop != tStart)
371 if (IMediaSample_IsDiscontinuity(pSample) == S_FALSE)
372 ERR("Unexpected discontinuity: Last: %u.%03u, tStart: %u.%03u\n",
373 (DWORD)(This->rtLastStop / 10000000),
374 (DWORD)((This->rtLastStop / 10000)%1000),
375 (DWORD)(tStart / 10000000), (DWORD)((tStart / 10000)%1000));
376 This->rtLastStop = tStart;
379 /* Preroll means the sample isn't shown, this is used for key frames and things like that */
380 if (IMediaSample_IsPreroll(pSample) == S_OK)
382 This->rtLastStop = tStop;
386 hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
389 ERR("Cannot get pointer to sample data (%x)\n", hr);
393 cbSrcStream = IMediaSample_GetActualDataLength(pSample);
395 TRACE("val %p %ld\n", pbSrcStream, cbSrcStream);
397 #if 0 /* For debugging purpose */
400 for(i = 0; i < cbSrcStream; i++)
402 if ((i!=0) && !(i%16))
404 TRACE("%02x ", pbSrcStream[i]);
410 if (This->pClock && This->state == State_Running)
412 REFERENCE_TIME time, trefstart, trefstop;
415 /* Perhaps I <SHOULD> use the reference clock AdviseTime function here
416 * I'm not going to! When I tried, it seemed to generate lag and
417 * it caused instability.
419 IReferenceClock_GetTime(This->pClock, &time);
421 trefstart = This->rtStreamStart;
422 trefstop = (REFERENCE_TIME)((double)(tStop - tStart) / This->pInputPin->dRate) + This->rtStreamStart;
423 delta = (LONG)((trefstart-time)/10000);
424 This->rtStreamStart = trefstop;
425 This->rtLastStop = tStop;
429 TRACE("Sleeping for %u ms\n", delta);
432 else if (time > trefstop)
434 TRACE("Dropping sample: Time: %lld ms trefstop: %lld ms!\n", time/10000, trefstop/10000);
435 This->rtLastStop = tStop;
439 This->rtLastStop = tStop;
441 VideoRenderer_SendSampleData(This, pbSrcStream, cbSrcStream);
446 static HRESULT VideoRenderer_QueryAccept(LPVOID iface, const AM_MEDIA_TYPE * pmt)
448 if (!IsEqualIID(&pmt->majortype, &MEDIATYPE_Video))
451 if (IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB32) ||
452 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB24) ||
453 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB565) ||
454 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB8))
456 VideoRendererImpl* This = (VideoRendererImpl*) iface;
458 if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo))
460 VIDEOINFOHEADER *format = (VIDEOINFOHEADER *)pmt->pbFormat;
461 This->SourceRect.left = 0;
462 This->SourceRect.top = 0;
463 This->SourceRect.right = This->VideoWidth = format->bmiHeader.biWidth;
464 This->SourceRect.bottom = This->VideoHeight = format->bmiHeader.biHeight;
466 else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2))
468 VIDEOINFOHEADER2 *format2 = (VIDEOINFOHEADER2 *)pmt->pbFormat;
470 This->SourceRect.left = 0;
471 This->SourceRect.top = 0;
472 This->SourceRect.right = This->VideoWidth = format2->bmiHeader.biWidth;
473 This->SourceRect.bottom = This->VideoHeight = format2->bmiHeader.biHeight;
477 WARN("Format type %s not supported\n", debugstr_guid(&pmt->formattype));
485 HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
489 VideoRendererImpl * pVideoRenderer;
491 TRACE("(%p, %p)\n", pUnkOuter, ppv);
495 pVideoRenderer = CoTaskMemAlloc(sizeof(VideoRendererImpl));
496 pVideoRenderer->pUnkOuter = pUnkOuter;
497 pVideoRenderer->bUnkOuterValid = FALSE;
498 pVideoRenderer->bAggregatable = FALSE;
499 pVideoRenderer->IInner_vtbl = &IInner_VTable;
501 pVideoRenderer->lpVtbl = &VideoRenderer_Vtbl;
502 pVideoRenderer->IBasicVideo_vtbl = &IBasicVideo_VTable;
503 pVideoRenderer->IVideoWindow_vtbl = &IVideoWindow_VTable;
505 pVideoRenderer->refCount = 1;
506 InitializeCriticalSection(&pVideoRenderer->csFilter);
507 pVideoRenderer->csFilter.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": VideoRendererImpl.csFilter");
508 pVideoRenderer->state = State_Stopped;
509 pVideoRenderer->pClock = NULL;
510 pVideoRenderer->init = 0;
511 pVideoRenderer->AutoShow = 1;
512 pVideoRenderer->rtLastStop = -1;
513 ZeroMemory(&pVideoRenderer->filterInfo, sizeof(FILTER_INFO));
515 /* construct input pin */
516 piInput.dir = PINDIR_INPUT;
517 piInput.pFilter = (IBaseFilter *)pVideoRenderer;
518 lstrcpynW(piInput.achName, wcsInputPinName, sizeof(piInput.achName) / sizeof(piInput.achName[0]));
520 hr = InputPin_Construct(&VideoRenderer_InputPin_Vtbl, &piInput, VideoRenderer_Sample, (LPVOID)pVideoRenderer, VideoRenderer_QueryAccept, NULL, &pVideoRenderer->csFilter, (IPin **)&pVideoRenderer->pInputPin);
524 *ppv = (LPVOID)pVideoRenderer;
528 pVideoRenderer->csFilter.DebugInfo->Spare[0] = 0;
529 DeleteCriticalSection(&pVideoRenderer->csFilter);
530 CoTaskMemFree(pVideoRenderer);
533 if (!CreateRenderingSubsystem(pVideoRenderer))
539 HRESULT VideoRendererDefault_create(IUnknown * pUnkOuter, LPVOID * ppv)
541 /* TODO: Attempt to use the VMR-7 renderer instead when possible */
542 return VideoRenderer_create(pUnkOuter, ppv);
545 static HRESULT WINAPI VideoRendererInner_QueryInterface(IUnknown * iface, REFIID riid, LPVOID * ppv)
547 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
548 TRACE("(%p/%p)->(%s, %p)\n", This, iface, qzdebugstr_guid(riid), ppv);
550 if (This->bAggregatable)
551 This->bUnkOuterValid = TRUE;
555 if (IsEqualIID(riid, &IID_IUnknown))
556 *ppv = (LPVOID)&(This->IInner_vtbl);
557 else if (IsEqualIID(riid, &IID_IPersist))
559 else if (IsEqualIID(riid, &IID_IMediaFilter))
561 else if (IsEqualIID(riid, &IID_IBaseFilter))
563 else if (IsEqualIID(riid, &IID_IBasicVideo))
564 *ppv = (LPVOID)&(This->IBasicVideo_vtbl);
565 else if (IsEqualIID(riid, &IID_IVideoWindow))
566 *ppv = (LPVOID)&(This->IVideoWindow_vtbl);
570 IUnknown_AddRef((IUnknown *)(*ppv));
574 if (!IsEqualIID(riid, &IID_IPin))
575 FIXME("No interface for %s!\n", qzdebugstr_guid(riid));
577 return E_NOINTERFACE;
580 static ULONG WINAPI VideoRendererInner_AddRef(IUnknown * iface)
582 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
583 ULONG refCount = InterlockedIncrement(&This->refCount);
585 TRACE("(%p/%p)->() AddRef from %d\n", This, iface, refCount - 1);
590 static ULONG WINAPI VideoRendererInner_Release(IUnknown * iface)
592 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
593 ULONG refCount = InterlockedDecrement(&This->refCount);
595 TRACE("(%p/%p)->() Release from %d\n", This, iface, refCount + 1);
601 DestroyWindow(This->hWnd);
602 PostThreadMessageA(This->ThreadID, WM_QUIT, 0, 0);
603 WaitForSingleObject(This->hThread, INFINITE);
604 CloseHandle(This->hThread);
607 IReferenceClock_Release(This->pClock);
609 if (SUCCEEDED(IPin_ConnectedTo((IPin *)This->pInputPin, &pConnectedTo)))
611 IPin_Disconnect(pConnectedTo);
612 IPin_Release(pConnectedTo);
614 IPin_Disconnect((IPin *)This->pInputPin);
616 IPin_Release((IPin *)This->pInputPin);
620 This->csFilter.DebugInfo->Spare[0] = 0;
621 DeleteCriticalSection(&This->csFilter);
623 TRACE("Destroying Video Renderer\n");
632 static const IUnknownVtbl IInner_VTable =
634 VideoRendererInner_QueryInterface,
635 VideoRendererInner_AddRef,
636 VideoRendererInner_Release
639 static HRESULT WINAPI VideoRenderer_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv)
641 VideoRendererImpl *This = (VideoRendererImpl *)iface;
643 if (This->bAggregatable)
644 This->bUnkOuterValid = TRUE;
648 if (This->bAggregatable)
649 return IUnknown_QueryInterface(This->pUnkOuter, riid, ppv);
651 if (IsEqualIID(riid, &IID_IUnknown))
655 IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
656 hr = IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
657 IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
658 This->bAggregatable = TRUE;
663 return E_NOINTERFACE;
666 return IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
669 static ULONG WINAPI VideoRenderer_AddRef(IBaseFilter * iface)
671 VideoRendererImpl *This = (VideoRendererImpl *)iface;
673 if (This->pUnkOuter && This->bUnkOuterValid)
674 return IUnknown_AddRef(This->pUnkOuter);
675 return IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
678 static ULONG WINAPI VideoRenderer_Release(IBaseFilter * iface)
680 VideoRendererImpl *This = (VideoRendererImpl *)iface;
682 if (This->pUnkOuter && This->bUnkOuterValid)
683 return IUnknown_Release(This->pUnkOuter);
684 return IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
687 /** IPersist methods **/
689 static HRESULT WINAPI VideoRenderer_GetClassID(IBaseFilter * iface, CLSID * pClsid)
691 VideoRendererImpl *This = (VideoRendererImpl *)iface;
693 TRACE("(%p/%p)->(%p)\n", This, iface, pClsid);
695 *pClsid = CLSID_VideoRenderer;
700 /** IMediaFilter methods **/
702 static HRESULT WINAPI VideoRenderer_Stop(IBaseFilter * iface)
704 VideoRendererImpl *This = (VideoRendererImpl *)iface;
706 TRACE("(%p/%p)->()\n", This, iface);
708 EnterCriticalSection(&This->csFilter);
710 This->state = State_Stopped;
712 LeaveCriticalSection(&This->csFilter);
717 static HRESULT WINAPI VideoRenderer_Pause(IBaseFilter * iface)
719 VideoRendererImpl *This = (VideoRendererImpl *)iface;
721 TRACE("(%p/%p)->()\n", This, iface);
723 EnterCriticalSection(&This->csFilter);
725 if (This->state == State_Stopped)
726 This->pInputPin->end_of_stream = 0;
728 This->state = State_Paused;
730 LeaveCriticalSection(&This->csFilter);
735 static HRESULT WINAPI VideoRenderer_Run(IBaseFilter * iface, REFERENCE_TIME tStart)
737 VideoRendererImpl *This = (VideoRendererImpl *)iface;
739 TRACE("(%p/%p)->(%s)\n", This, iface, wine_dbgstr_longlong(tStart));
741 EnterCriticalSection(&This->csFilter);
742 if (This->state != State_Running)
744 if (This->state == State_Stopped)
745 This->pInputPin->end_of_stream = 0;
747 This->rtStreamStart = tStart;
748 This->state = State_Running;
750 LeaveCriticalSection(&This->csFilter);
755 static HRESULT WINAPI VideoRenderer_GetState(IBaseFilter * iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState)
757 VideoRendererImpl *This = (VideoRendererImpl *)iface;
759 TRACE("(%p/%p)->(%d, %p)\n", This, iface, dwMilliSecsTimeout, pState);
761 EnterCriticalSection(&This->csFilter);
763 *pState = This->state;
765 LeaveCriticalSection(&This->csFilter);
770 static HRESULT WINAPI VideoRenderer_SetSyncSource(IBaseFilter * iface, IReferenceClock *pClock)
772 VideoRendererImpl *This = (VideoRendererImpl *)iface;
774 TRACE("(%p/%p)->(%p)\n", This, iface, pClock);
776 EnterCriticalSection(&This->csFilter);
779 IReferenceClock_Release(This->pClock);
780 This->pClock = pClock;
782 IReferenceClock_AddRef(This->pClock);
784 LeaveCriticalSection(&This->csFilter);
789 static HRESULT WINAPI VideoRenderer_GetSyncSource(IBaseFilter * iface, IReferenceClock **ppClock)
791 VideoRendererImpl *This = (VideoRendererImpl *)iface;
793 TRACE("(%p/%p)->(%p)\n", This, iface, ppClock);
795 EnterCriticalSection(&This->csFilter);
797 *ppClock = This->pClock;
799 IReferenceClock_AddRef(This->pClock);
801 LeaveCriticalSection(&This->csFilter);
806 /** IBaseFilter implementation **/
808 static HRESULT VideoRenderer_GetPin(IBaseFilter *iface, ULONG pos, IPin **pin, DWORD *lastsynctick)
810 VideoRendererImpl *This = (VideoRendererImpl *)iface;
812 /* Our pins are static, not changing so setting static tick count is ok */
818 *pin = (IPin *)This->pInputPin;
823 static HRESULT WINAPI VideoRenderer_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum)
825 VideoRendererImpl *This = (VideoRendererImpl *)iface;
827 TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
829 return IEnumPinsImpl_Construct(ppEnum, VideoRenderer_GetPin, iface);
832 static HRESULT WINAPI VideoRenderer_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)
834 VideoRendererImpl *This = (VideoRendererImpl *)iface;
836 TRACE("(%p/%p)->(%p,%p)\n", This, iface, debugstr_w(Id), ppPin);
838 FIXME("VideoRenderer::FindPin(...)\n");
840 /* FIXME: critical section */
845 static HRESULT WINAPI VideoRenderer_QueryFilterInfo(IBaseFilter * iface, FILTER_INFO *pInfo)
847 VideoRendererImpl *This = (VideoRendererImpl *)iface;
849 TRACE("(%p/%p)->(%p)\n", This, iface, pInfo);
851 strcpyW(pInfo->achName, This->filterInfo.achName);
852 pInfo->pGraph = This->filterInfo.pGraph;
855 IFilterGraph_AddRef(pInfo->pGraph);
860 static HRESULT WINAPI VideoRenderer_JoinFilterGraph(IBaseFilter * iface, IFilterGraph *pGraph, LPCWSTR pName)
862 VideoRendererImpl *This = (VideoRendererImpl *)iface;
864 TRACE("(%p/%p)->(%p, %s)\n", This, iface, pGraph, debugstr_w(pName));
866 EnterCriticalSection(&This->csFilter);
869 strcpyW(This->filterInfo.achName, pName);
871 *This->filterInfo.achName = '\0';
872 This->filterInfo.pGraph = pGraph; /* NOTE: do NOT increase ref. count */
874 LeaveCriticalSection(&This->csFilter);
879 static HRESULT WINAPI VideoRenderer_QueryVendorInfo(IBaseFilter * iface, LPWSTR *pVendorInfo)
881 VideoRendererImpl *This = (VideoRendererImpl *)iface;
882 TRACE("(%p/%p)->(%p)\n", This, iface, pVendorInfo);
886 static const IBaseFilterVtbl VideoRenderer_Vtbl =
888 VideoRenderer_QueryInterface,
889 VideoRenderer_AddRef,
890 VideoRenderer_Release,
891 VideoRenderer_GetClassID,
895 VideoRenderer_GetState,
896 VideoRenderer_SetSyncSource,
897 VideoRenderer_GetSyncSource,
898 VideoRenderer_EnumPins,
899 VideoRenderer_FindPin,
900 VideoRenderer_QueryFilterInfo,
901 VideoRenderer_JoinFilterGraph,
902 VideoRenderer_QueryVendorInfo
905 static HRESULT WINAPI VideoRenderer_InputPin_EndOfStream(IPin * iface)
907 InputPin* This = (InputPin*)iface;
908 IMediaEventSink* pEventSink;
911 TRACE("(%p/%p)->()\n", This, iface);
913 hr = IFilterGraph_QueryInterface(((VideoRendererImpl*)This->pin.pinInfo.pFilter)->filterInfo.pGraph, &IID_IMediaEventSink, (LPVOID*)&pEventSink);
916 hr = IMediaEventSink_Notify(pEventSink, EC_COMPLETE, S_OK, 0);
917 IMediaEventSink_Release(pEventSink);
923 static const IPinVtbl VideoRenderer_InputPin_Vtbl =
925 InputPin_QueryInterface,
929 InputPin_ReceiveConnection,
931 IPinImpl_ConnectedTo,
932 IPinImpl_ConnectionMediaType,
933 IPinImpl_QueryPinInfo,
934 IPinImpl_QueryDirection,
936 IPinImpl_QueryAccept,
937 IPinImpl_EnumMediaTypes,
938 IPinImpl_QueryInternalConnections,
939 VideoRenderer_InputPin_EndOfStream,
945 /*** IUnknown methods ***/
946 static HRESULT WINAPI Basicvideo_QueryInterface(IBasicVideo *iface,
949 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
951 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
953 return VideoRenderer_QueryInterface((IBaseFilter*)This, riid, ppvObj);
956 static ULONG WINAPI Basicvideo_AddRef(IBasicVideo *iface) {
957 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
959 TRACE("(%p/%p)->()\n", This, iface);
961 return VideoRenderer_AddRef((IBaseFilter*)This);
964 static ULONG WINAPI Basicvideo_Release(IBasicVideo *iface) {
965 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
967 TRACE("(%p/%p)->()\n", This, iface);
969 return VideoRenderer_Release((IBaseFilter*)This);
972 /*** IDispatch methods ***/
973 static HRESULT WINAPI Basicvideo_GetTypeInfoCount(IBasicVideo *iface,
975 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
977 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
982 static HRESULT WINAPI Basicvideo_GetTypeInfo(IBasicVideo *iface,
985 ITypeInfo**ppTInfo) {
986 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
988 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
993 static HRESULT WINAPI Basicvideo_GetIDsOfNames(IBasicVideo *iface,
999 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1001 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1006 static HRESULT WINAPI Basicvideo_Invoke(IBasicVideo *iface,
1007 DISPID dispIdMember,
1011 DISPPARAMS*pDispParams,
1013 EXCEPINFO*pExepInfo,
1015 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1017 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);
1022 /*** IBasicVideo methods ***/
1023 static HRESULT WINAPI Basicvideo_get_AvgTimePerFrame(IBasicVideo *iface,
1024 REFTIME *pAvgTimePerFrame) {
1025 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1027 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pAvgTimePerFrame);
1032 static HRESULT WINAPI Basicvideo_get_BitRate(IBasicVideo *iface,
1034 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1036 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBitRate);
1041 static HRESULT WINAPI Basicvideo_get_BitErrorRate(IBasicVideo *iface,
1042 long *pBitErrorRate) {
1043 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1045 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBitErrorRate);
1050 static HRESULT WINAPI Basicvideo_get_VideoWidth(IBasicVideo *iface,
1051 long *pVideoWidth) {
1052 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1054 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoWidth);
1056 *pVideoWidth = This->VideoWidth;
1061 static HRESULT WINAPI Basicvideo_get_VideoHeight(IBasicVideo *iface,
1062 long *pVideoHeight) {
1063 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1065 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoHeight);
1067 *pVideoHeight = This->VideoHeight;
1072 static HRESULT WINAPI Basicvideo_put_SourceLeft(IBasicVideo *iface,
1074 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1076 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceLeft);
1078 This->SourceRect.left = SourceLeft;
1083 static HRESULT WINAPI Basicvideo_get_SourceLeft(IBasicVideo *iface,
1084 long *pSourceLeft) {
1085 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1087 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceLeft);
1089 *pSourceLeft = This->SourceRect.left;
1094 static HRESULT WINAPI Basicvideo_put_SourceWidth(IBasicVideo *iface,
1096 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1098 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceWidth);
1100 This->SourceRect.right = This->SourceRect.left + SourceWidth;
1105 static HRESULT WINAPI Basicvideo_get_SourceWidth(IBasicVideo *iface,
1106 long *pSourceWidth) {
1107 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1109 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceWidth);
1111 *pSourceWidth = This->SourceRect.right - This->SourceRect.left;
1116 static HRESULT WINAPI Basicvideo_put_SourceTop(IBasicVideo *iface,
1118 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1120 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceTop);
1122 This->SourceRect.top = SourceTop;
1127 static HRESULT WINAPI Basicvideo_get_SourceTop(IBasicVideo *iface,
1129 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1131 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceTop);
1133 *pSourceTop = This->SourceRect.top;
1138 static HRESULT WINAPI Basicvideo_put_SourceHeight(IBasicVideo *iface,
1139 long SourceHeight) {
1140 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1142 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceHeight);
1144 This->SourceRect.bottom = This->SourceRect.top + SourceHeight;
1149 static HRESULT WINAPI Basicvideo_get_SourceHeight(IBasicVideo *iface,
1150 long *pSourceHeight) {
1151 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1153 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceHeight);
1155 *pSourceHeight = This->SourceRect.bottom - This->SourceRect.top;
1160 static HRESULT WINAPI Basicvideo_put_DestinationLeft(IBasicVideo *iface,
1161 long DestinationLeft) {
1162 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1164 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationLeft);
1166 This->DestRect.left = DestinationLeft;
1171 static HRESULT WINAPI Basicvideo_get_DestinationLeft(IBasicVideo *iface,
1172 long *pDestinationLeft) {
1173 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1175 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationLeft);
1177 *pDestinationLeft = This->DestRect.left;
1182 static HRESULT WINAPI Basicvideo_put_DestinationWidth(IBasicVideo *iface,
1183 long DestinationWidth) {
1184 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1186 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationWidth);
1188 This->DestRect.right = This->DestRect.left + DestinationWidth;
1193 static HRESULT WINAPI Basicvideo_get_DestinationWidth(IBasicVideo *iface,
1194 long *pDestinationWidth) {
1195 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1197 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationWidth);
1199 *pDestinationWidth = This->DestRect.right - This->DestRect.left;
1204 static HRESULT WINAPI Basicvideo_put_DestinationTop(IBasicVideo *iface,
1205 long DestinationTop) {
1206 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1208 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationTop);
1210 This->DestRect.top = DestinationTop;
1215 static HRESULT WINAPI Basicvideo_get_DestinationTop(IBasicVideo *iface,
1216 long *pDestinationTop) {
1217 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1219 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationTop);
1221 *pDestinationTop = This->DestRect.top;
1226 static HRESULT WINAPI Basicvideo_put_DestinationHeight(IBasicVideo *iface,
1227 long DestinationHeight) {
1228 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1230 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationHeight);
1232 This->DestRect.right = This->DestRect.left + DestinationHeight;
1237 static HRESULT WINAPI Basicvideo_get_DestinationHeight(IBasicVideo *iface,
1238 long *pDestinationHeight) {
1239 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1241 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationHeight);
1243 *pDestinationHeight = This->DestRect.right - This->DestRect.left;
1248 static HRESULT WINAPI Basicvideo_SetSourcePosition(IBasicVideo *iface,
1253 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1255 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
1257 This->SourceRect.left = Left;
1258 This->SourceRect.top = Top;
1259 This->SourceRect.right = Left + Width;
1260 This->SourceRect.bottom = Top + Height;
1265 static HRESULT WINAPI Basicvideo_GetSourcePosition(IBasicVideo *iface,
1270 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1272 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1274 *pLeft = This->SourceRect.left;
1275 *pTop = This->SourceRect.top;
1276 *pWidth = This->SourceRect.right - This->SourceRect.left;
1277 *pHeight = This->SourceRect.bottom - This->SourceRect.top;
1282 static HRESULT WINAPI Basicvideo_SetDefaultSourcePosition(IBasicVideo *iface) {
1283 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1285 TRACE("(%p/%p)->()\n", This, iface);
1287 This->SourceRect.left = 0;
1288 This->SourceRect.top = 0;
1289 This->SourceRect.right = This->VideoWidth;
1290 This->SourceRect.bottom = This->VideoHeight;
1295 static HRESULT WINAPI Basicvideo_SetDestinationPosition(IBasicVideo *iface,
1300 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1302 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
1304 This->DestRect.left = Left;
1305 This->DestRect.top = Top;
1306 This->DestRect.right = Left + Width;
1307 This->DestRect.bottom = Top + Height;
1312 static HRESULT WINAPI Basicvideo_GetDestinationPosition(IBasicVideo *iface,
1317 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1319 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1321 *pLeft = This->DestRect.left;
1322 *pTop = This->DestRect.top;
1323 *pWidth = This->DestRect.right - This->DestRect.left;
1324 *pHeight = This->DestRect.bottom - This->DestRect.top;
1329 static HRESULT WINAPI Basicvideo_SetDefaultDestinationPosition(IBasicVideo *iface) {
1330 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1333 TRACE("(%p/%p)->()\n", This, iface);
1335 if (!GetClientRect(This->hWnd, &rect))
1338 This->SourceRect.left = 0;
1339 This->SourceRect.top = 0;
1340 This->SourceRect.right = rect.right;
1341 This->SourceRect.bottom = rect.bottom;
1346 static HRESULT WINAPI Basicvideo_GetVideoSize(IBasicVideo *iface,
1349 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1351 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
1353 *pWidth = This->VideoWidth;
1354 *pHeight = This->VideoHeight;
1359 static HRESULT WINAPI Basicvideo_GetVideoPaletteEntries(IBasicVideo *iface,
1364 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1366 FIXME("(%p/%p)->(%ld, %ld, %p, %p): stub !!!\n", This, iface, StartIndex, Entries, pRetrieved, pPalette);
1371 static HRESULT WINAPI Basicvideo_GetCurrentImage(IBasicVideo *iface,
1374 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1376 FIXME("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pBufferSize, pDIBImage);
1381 static HRESULT WINAPI Basicvideo_IsUsingDefaultSource(IBasicVideo *iface) {
1382 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1384 FIXME("(%p/%p)->(): stub !!!\n", This, iface);
1389 static HRESULT WINAPI Basicvideo_IsUsingDefaultDestination(IBasicVideo *iface) {
1390 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1392 FIXME("(%p/%p)->(): stub !!!\n", This, iface);
1398 static const IBasicVideoVtbl IBasicVideo_VTable =
1400 Basicvideo_QueryInterface,
1403 Basicvideo_GetTypeInfoCount,
1404 Basicvideo_GetTypeInfo,
1405 Basicvideo_GetIDsOfNames,
1407 Basicvideo_get_AvgTimePerFrame,
1408 Basicvideo_get_BitRate,
1409 Basicvideo_get_BitErrorRate,
1410 Basicvideo_get_VideoWidth,
1411 Basicvideo_get_VideoHeight,
1412 Basicvideo_put_SourceLeft,
1413 Basicvideo_get_SourceLeft,
1414 Basicvideo_put_SourceWidth,
1415 Basicvideo_get_SourceWidth,
1416 Basicvideo_put_SourceTop,
1417 Basicvideo_get_SourceTop,
1418 Basicvideo_put_SourceHeight,
1419 Basicvideo_get_SourceHeight,
1420 Basicvideo_put_DestinationLeft,
1421 Basicvideo_get_DestinationLeft,
1422 Basicvideo_put_DestinationWidth,
1423 Basicvideo_get_DestinationWidth,
1424 Basicvideo_put_DestinationTop,
1425 Basicvideo_get_DestinationTop,
1426 Basicvideo_put_DestinationHeight,
1427 Basicvideo_get_DestinationHeight,
1428 Basicvideo_SetSourcePosition,
1429 Basicvideo_GetSourcePosition,
1430 Basicvideo_SetDefaultSourcePosition,
1431 Basicvideo_SetDestinationPosition,
1432 Basicvideo_GetDestinationPosition,
1433 Basicvideo_SetDefaultDestinationPosition,
1434 Basicvideo_GetVideoSize,
1435 Basicvideo_GetVideoPaletteEntries,
1436 Basicvideo_GetCurrentImage,
1437 Basicvideo_IsUsingDefaultSource,
1438 Basicvideo_IsUsingDefaultDestination
1442 /*** IUnknown methods ***/
1443 static HRESULT WINAPI Videowindow_QueryInterface(IVideoWindow *iface,
1446 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1448 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1450 return VideoRenderer_QueryInterface((IBaseFilter*)This, riid, ppvObj);
1453 static ULONG WINAPI Videowindow_AddRef(IVideoWindow *iface) {
1454 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1456 TRACE("(%p/%p)->()\n", This, iface);
1458 return VideoRenderer_AddRef((IBaseFilter*)This);
1461 static ULONG WINAPI Videowindow_Release(IVideoWindow *iface) {
1462 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1464 TRACE("(%p/%p)->()\n", This, iface);
1466 return VideoRenderer_Release((IBaseFilter*)This);
1469 /*** IDispatch methods ***/
1470 static HRESULT WINAPI Videowindow_GetTypeInfoCount(IVideoWindow *iface,
1472 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1474 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
1479 static HRESULT WINAPI Videowindow_GetTypeInfo(IVideoWindow *iface,
1482 ITypeInfo**ppTInfo) {
1483 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1485 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
1490 static HRESULT WINAPI Videowindow_GetIDsOfNames(IVideoWindow *iface,
1496 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1498 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1503 static HRESULT WINAPI Videowindow_Invoke(IVideoWindow *iface,
1504 DISPID dispIdMember,
1508 DISPPARAMS*pDispParams,
1510 EXCEPINFO*pExepInfo,
1512 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1514 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);
1519 /*** IVideoWindow methods ***/
1520 static HRESULT WINAPI Videowindow_put_Caption(IVideoWindow *iface,
1522 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1524 TRACE("(%p/%p)->(%s (%p))\n", This, iface, debugstr_w(strCaption), strCaption);
1526 if (!SetWindowTextW(This->hWnd, strCaption))
1532 static HRESULT WINAPI Videowindow_get_Caption(IVideoWindow *iface,
1534 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1536 TRACE("(%p/%p)->(%p)\n", This, iface, strCaption);
1538 GetWindowTextW(This->hWnd, (LPWSTR)strCaption, 100);
1543 static HRESULT WINAPI Videowindow_put_WindowStyle(IVideoWindow *iface,
1545 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1548 old = GetWindowLongA(This->hWnd, GWL_STYLE);
1550 TRACE("(%p/%p)->(%x -> %lx)\n", This, iface, old, WindowStyle);
1552 if (WindowStyle & (WS_DISABLED|WS_HSCROLL|WS_ICONIC|WS_MAXIMIZE|WS_MINIMIZE|WS_VSCROLL))
1553 return E_INVALIDARG;
1555 SetWindowLongA(This->hWnd, GWL_STYLE, WindowStyle);
1560 static HRESULT WINAPI Videowindow_get_WindowStyle(IVideoWindow *iface,
1561 long *WindowStyle) {
1562 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1564 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyle);
1566 *WindowStyle = GetWindowLongA(This->hWnd, GWL_STYLE);
1571 static HRESULT WINAPI Videowindow_put_WindowStyleEx(IVideoWindow *iface,
1572 long WindowStyleEx) {
1573 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1575 TRACE("(%p/%p)->(%ld)\n", This, iface, WindowStyleEx);
1577 if (WindowStyleEx & (WS_DISABLED|WS_HSCROLL|WS_ICONIC|WS_MAXIMIZE|WS_MINIMIZE|WS_VSCROLL))
1578 return E_INVALIDARG;
1580 if (!SetWindowLongA(This->hWnd, GWL_EXSTYLE, WindowStyleEx))
1586 static HRESULT WINAPI Videowindow_get_WindowStyleEx(IVideoWindow *iface,
1587 long *WindowStyleEx) {
1588 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1590 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyleEx);
1592 *WindowStyleEx = GetWindowLongA(This->hWnd, GWL_EXSTYLE);
1597 static HRESULT WINAPI Videowindow_put_AutoShow(IVideoWindow *iface,
1599 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1601 TRACE("(%p/%p)->(%ld)\n", This, iface, AutoShow);
1603 This->AutoShow = 1; /* FXIME: Should be AutoShow */;
1608 static HRESULT WINAPI Videowindow_get_AutoShow(IVideoWindow *iface,
1610 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1612 TRACE("(%p/%p)->(%p)\n", This, iface, AutoShow);
1614 *AutoShow = This->AutoShow;
1619 static HRESULT WINAPI Videowindow_put_WindowState(IVideoWindow *iface,
1621 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1623 FIXME("(%p/%p)->(%ld): stub !!!\n", This, iface, WindowState);
1628 static HRESULT WINAPI Videowindow_get_WindowState(IVideoWindow *iface,
1629 long *WindowState) {
1630 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1632 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, WindowState);
1637 static HRESULT WINAPI Videowindow_put_BackgroundPalette(IVideoWindow *iface,
1638 long BackgroundPalette) {
1639 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1641 FIXME("(%p/%p)->(%ld): stub !!!\n", This, iface, BackgroundPalette);
1646 static HRESULT WINAPI Videowindow_get_BackgroundPalette(IVideoWindow *iface,
1647 long *pBackgroundPalette) {
1648 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1650 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBackgroundPalette);
1655 static HRESULT WINAPI Videowindow_put_Visible(IVideoWindow *iface,
1657 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1659 TRACE("(%p/%p)->(%ld)\n", This, iface, Visible);
1661 ShowWindow(This->hWnd, Visible ? SW_SHOW : SW_HIDE);
1666 static HRESULT WINAPI Videowindow_get_Visible(IVideoWindow *iface,
1668 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1670 TRACE("(%p/%p)->(%p)\n", This, iface, pVisible);
1672 *pVisible = IsWindowVisible(This->hWnd);
1677 static HRESULT WINAPI Videowindow_put_Left(IVideoWindow *iface,
1679 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1681 TRACE("(%p/%p)->(%ld)\n", This, iface, Left);
1683 if (!SetWindowPos(This->hWnd, NULL, Left, This->WindowPos.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE))
1686 This->WindowPos.left = Left;
1691 static HRESULT WINAPI Videowindow_get_Left(IVideoWindow *iface,
1693 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1695 TRACE("(%p/%p)->(%p)\n", This, iface, pLeft);
1697 *pLeft = This->WindowPos.left;
1702 static HRESULT WINAPI Videowindow_put_Width(IVideoWindow *iface,
1704 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1706 TRACE("(%p/%p)->(%ld)\n", This, iface, Width);
1708 if (!SetWindowPos(This->hWnd, NULL, 0, 0, Width, This->WindowPos.bottom-This->WindowPos.top, SWP_NOZORDER|SWP_NOMOVE))
1711 This->WindowPos.right = This->WindowPos.left + Width;
1716 static HRESULT WINAPI Videowindow_get_Width(IVideoWindow *iface,
1718 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1720 TRACE("(%p/%p)->(%p)\n", This, iface, pWidth);
1722 *pWidth = This->WindowPos.right - This->WindowPos.left;
1727 static HRESULT WINAPI Videowindow_put_Top(IVideoWindow *iface,
1729 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1731 TRACE("(%p/%p)->(%ld)\n", This, iface, Top);
1733 if (!SetWindowPos(This->hWnd, NULL, This->WindowPos.left, Top, 0, 0, SWP_NOZORDER|SWP_NOSIZE))
1736 This->WindowPos.top = Top;
1741 static HRESULT WINAPI Videowindow_get_Top(IVideoWindow *iface,
1743 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1745 TRACE("(%p/%p)->(%p)\n", This, iface, pTop);
1747 *pTop = This->WindowPos.top;
1752 static HRESULT WINAPI Videowindow_put_Height(IVideoWindow *iface,
1754 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1756 TRACE("(%p/%p)->(%ld)\n", This, iface, Height);
1758 if (!SetWindowPos(This->hWnd, NULL, 0, 0, This->WindowPos.right-This->WindowPos.left, Height, SWP_NOZORDER|SWP_NOMOVE))
1761 This->WindowPos.bottom = This->WindowPos.top + Height;
1766 static HRESULT WINAPI Videowindow_get_Height(IVideoWindow *iface,
1768 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1770 TRACE("(%p/%p)->(%p)\n", This, iface, pHeight);
1772 *pHeight = This->WindowPos.bottom - This->WindowPos.top;
1777 static HRESULT WINAPI Videowindow_put_Owner(IVideoWindow *iface,
1779 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1781 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Owner);
1783 SetParent(This->hWnd, (HWND)Owner);
1788 static HRESULT WINAPI Videowindow_get_Owner(IVideoWindow *iface,
1790 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1792 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Owner);
1794 *(HWND*)Owner = GetParent(This->hWnd);
1799 static HRESULT WINAPI Videowindow_put_MessageDrain(IVideoWindow *iface,
1801 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1803 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Drain);
1805 This->hWndMsgDrain = (HWND)Drain;
1810 static HRESULT WINAPI Videowindow_get_MessageDrain(IVideoWindow *iface,
1812 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1814 TRACE("(%p/%p)->(%p)\n", This, iface, Drain);
1816 *Drain = (OAHWND)This->hWndMsgDrain;
1821 static HRESULT WINAPI Videowindow_get_BorderColor(IVideoWindow *iface,
1823 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1825 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, Color);
1830 static HRESULT WINAPI Videowindow_put_BorderColor(IVideoWindow *iface,
1832 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1834 FIXME("(%p/%p)->(%ld): stub !!!\n", This, iface, Color);
1839 static HRESULT WINAPI Videowindow_get_FullScreenMode(IVideoWindow *iface,
1840 long *FullScreenMode) {
1841 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1843 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, FullScreenMode);
1848 static HRESULT WINAPI Videowindow_put_FullScreenMode(IVideoWindow *iface,
1849 long FullScreenMode) {
1850 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1852 FIXME("(%p/%p)->(%ld): stub !!!\n", This, iface, FullScreenMode);
1857 static HRESULT WINAPI Videowindow_SetWindowForeground(IVideoWindow *iface,
1859 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1864 TRACE("(%p/%p)->(%ld)\n", This, iface, Focus);
1866 if ((Focus != FALSE) && (Focus != TRUE))
1867 return E_INVALIDARG;
1869 hr = IPin_ConnectedTo((IPin *)This->pInputPin, &pPin);
1870 if ((hr != S_OK) || !pPin)
1871 return VFW_E_NOT_CONNECTED;
1874 ret = SetForegroundWindow(This->hWnd);
1876 ret = SetWindowPos(This->hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
1884 static HRESULT WINAPI Videowindow_NotifyOwnerMessage(IVideoWindow *iface,
1889 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1891 TRACE("(%p/%p)->(%08x, %ld, %08lx, %08lx)\n", This, iface, (DWORD) hwnd, uMsg, wParam, lParam);
1893 if (!PostMessageA(This->hWnd, uMsg, wParam, lParam))
1899 static HRESULT WINAPI Videowindow_SetWindowPosition(IVideoWindow *iface,
1904 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1906 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
1908 if (!SetWindowPos(This->hWnd, NULL, Left, Top, Width, Height, SWP_NOZORDER))
1911 This->WindowPos.left = Left;
1912 This->WindowPos.top = Top;
1913 This->WindowPos.right = Left + Width;
1914 This->WindowPos.bottom = Top + Height;
1919 static HRESULT WINAPI Videowindow_GetWindowPosition(IVideoWindow *iface,
1924 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1926 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1928 *pLeft = This->WindowPos.left;
1929 *pTop = This->WindowPos.top;
1930 *pWidth = This->WindowPos.right - This->WindowPos.left;
1931 *pHeight = This->WindowPos.bottom - This->WindowPos.top;
1936 static HRESULT WINAPI Videowindow_GetMinIdealImageSize(IVideoWindow *iface,
1939 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1941 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This, iface, pWidth, pHeight);
1943 *pWidth = This->VideoWidth;
1944 *pHeight = This->VideoHeight;
1949 static HRESULT WINAPI Videowindow_GetMaxIdealImageSize(IVideoWindow *iface,
1952 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1954 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This, iface, pWidth, pHeight);
1956 *pWidth = This->VideoWidth;
1957 *pHeight = This->VideoHeight;
1962 static HRESULT WINAPI Videowindow_GetRestorePosition(IVideoWindow *iface,
1967 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1969 FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This, iface, pLeft, pTop, pWidth, pHeight);
1974 static HRESULT WINAPI Videowindow_HideCursor(IVideoWindow *iface,
1976 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1978 FIXME("(%p/%p)->(%ld): stub !!!\n", This, iface, HideCursor);
1983 static HRESULT WINAPI Videowindow_IsCursorHidden(IVideoWindow *iface,
1984 long *CursorHidden) {
1985 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1987 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, CursorHidden);
1992 static const IVideoWindowVtbl IVideoWindow_VTable =
1994 Videowindow_QueryInterface,
1996 Videowindow_Release,
1997 Videowindow_GetTypeInfoCount,
1998 Videowindow_GetTypeInfo,
1999 Videowindow_GetIDsOfNames,
2001 Videowindow_put_Caption,
2002 Videowindow_get_Caption,
2003 Videowindow_put_WindowStyle,
2004 Videowindow_get_WindowStyle,
2005 Videowindow_put_WindowStyleEx,
2006 Videowindow_get_WindowStyleEx,
2007 Videowindow_put_AutoShow,
2008 Videowindow_get_AutoShow,
2009 Videowindow_put_WindowState,
2010 Videowindow_get_WindowState,
2011 Videowindow_put_BackgroundPalette,
2012 Videowindow_get_BackgroundPalette,
2013 Videowindow_put_Visible,
2014 Videowindow_get_Visible,
2015 Videowindow_put_Left,
2016 Videowindow_get_Left,
2017 Videowindow_put_Width,
2018 Videowindow_get_Width,
2019 Videowindow_put_Top,
2020 Videowindow_get_Top,
2021 Videowindow_put_Height,
2022 Videowindow_get_Height,
2023 Videowindow_put_Owner,
2024 Videowindow_get_Owner,
2025 Videowindow_put_MessageDrain,
2026 Videowindow_get_MessageDrain,
2027 Videowindow_get_BorderColor,
2028 Videowindow_put_BorderColor,
2029 Videowindow_get_FullScreenMode,
2030 Videowindow_put_FullScreenMode,
2031 Videowindow_SetWindowForeground,
2032 Videowindow_NotifyOwnerMessage,
2033 Videowindow_SetWindowPosition,
2034 Videowindow_GetWindowPosition,
2035 Videowindow_GetMinIdealImageSize,
2036 Videowindow_GetMaxIdealImageSize,
2037 Videowindow_GetRestorePosition,
2038 Videowindow_HideCursor,
2039 Videowindow_IsCursorHidden