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));
514 ZeroMemory(&pVideoRenderer->SourceRect, sizeof(RECT));
515 ZeroMemory(&pVideoRenderer->DestRect, sizeof(RECT));
516 ZeroMemory(&pVideoRenderer->WindowPos, sizeof(RECT));
517 pVideoRenderer->hWndMsgDrain = NULL;
519 /* construct input pin */
520 piInput.dir = PINDIR_INPUT;
521 piInput.pFilter = (IBaseFilter *)pVideoRenderer;
522 lstrcpynW(piInput.achName, wcsInputPinName, sizeof(piInput.achName) / sizeof(piInput.achName[0]));
524 hr = InputPin_Construct(&VideoRenderer_InputPin_Vtbl, &piInput, VideoRenderer_Sample, (LPVOID)pVideoRenderer, VideoRenderer_QueryAccept, NULL, &pVideoRenderer->csFilter, (IPin **)&pVideoRenderer->pInputPin);
528 *ppv = (LPVOID)pVideoRenderer;
532 pVideoRenderer->csFilter.DebugInfo->Spare[0] = 0;
533 DeleteCriticalSection(&pVideoRenderer->csFilter);
534 CoTaskMemFree(pVideoRenderer);
537 if (!CreateRenderingSubsystem(pVideoRenderer))
543 HRESULT VideoRendererDefault_create(IUnknown * pUnkOuter, LPVOID * ppv)
545 /* TODO: Attempt to use the VMR-7 renderer instead when possible */
546 return VideoRenderer_create(pUnkOuter, ppv);
549 static HRESULT WINAPI VideoRendererInner_QueryInterface(IUnknown * iface, REFIID riid, LPVOID * ppv)
551 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
552 TRACE("(%p/%p)->(%s, %p)\n", This, iface, qzdebugstr_guid(riid), ppv);
554 if (This->bAggregatable)
555 This->bUnkOuterValid = TRUE;
559 if (IsEqualIID(riid, &IID_IUnknown))
560 *ppv = (LPVOID)&(This->IInner_vtbl);
561 else if (IsEqualIID(riid, &IID_IPersist))
563 else if (IsEqualIID(riid, &IID_IMediaFilter))
565 else if (IsEqualIID(riid, &IID_IBaseFilter))
567 else if (IsEqualIID(riid, &IID_IBasicVideo))
568 *ppv = (LPVOID)&(This->IBasicVideo_vtbl);
569 else if (IsEqualIID(riid, &IID_IVideoWindow))
570 *ppv = (LPVOID)&(This->IVideoWindow_vtbl);
574 IUnknown_AddRef((IUnknown *)(*ppv));
578 if (!IsEqualIID(riid, &IID_IPin))
579 FIXME("No interface for %s!\n", qzdebugstr_guid(riid));
581 return E_NOINTERFACE;
584 static ULONG WINAPI VideoRendererInner_AddRef(IUnknown * iface)
586 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
587 ULONG refCount = InterlockedIncrement(&This->refCount);
589 TRACE("(%p/%p)->() AddRef from %d\n", This, iface, refCount - 1);
594 static ULONG WINAPI VideoRendererInner_Release(IUnknown * iface)
596 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
597 ULONG refCount = InterlockedDecrement(&This->refCount);
599 TRACE("(%p/%p)->() Release from %d\n", This, iface, refCount + 1);
605 DestroyWindow(This->hWnd);
606 PostThreadMessageA(This->ThreadID, WM_QUIT, 0, 0);
607 WaitForSingleObject(This->hThread, INFINITE);
608 CloseHandle(This->hThread);
611 IReferenceClock_Release(This->pClock);
613 if (SUCCEEDED(IPin_ConnectedTo((IPin *)This->pInputPin, &pConnectedTo)))
615 IPin_Disconnect(pConnectedTo);
616 IPin_Release(pConnectedTo);
618 IPin_Disconnect((IPin *)This->pInputPin);
620 IPin_Release((IPin *)This->pInputPin);
624 This->csFilter.DebugInfo->Spare[0] = 0;
625 DeleteCriticalSection(&This->csFilter);
627 TRACE("Destroying Video Renderer\n");
636 static const IUnknownVtbl IInner_VTable =
638 VideoRendererInner_QueryInterface,
639 VideoRendererInner_AddRef,
640 VideoRendererInner_Release
643 static HRESULT WINAPI VideoRenderer_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv)
645 VideoRendererImpl *This = (VideoRendererImpl *)iface;
647 if (This->bAggregatable)
648 This->bUnkOuterValid = TRUE;
652 if (This->bAggregatable)
653 return IUnknown_QueryInterface(This->pUnkOuter, riid, ppv);
655 if (IsEqualIID(riid, &IID_IUnknown))
659 IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
660 hr = IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
661 IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
662 This->bAggregatable = TRUE;
667 return E_NOINTERFACE;
670 return IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
673 static ULONG WINAPI VideoRenderer_AddRef(IBaseFilter * iface)
675 VideoRendererImpl *This = (VideoRendererImpl *)iface;
677 if (This->pUnkOuter && This->bUnkOuterValid)
678 return IUnknown_AddRef(This->pUnkOuter);
679 return IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
682 static ULONG WINAPI VideoRenderer_Release(IBaseFilter * iface)
684 VideoRendererImpl *This = (VideoRendererImpl *)iface;
686 if (This->pUnkOuter && This->bUnkOuterValid)
687 return IUnknown_Release(This->pUnkOuter);
688 return IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
691 /** IPersist methods **/
693 static HRESULT WINAPI VideoRenderer_GetClassID(IBaseFilter * iface, CLSID * pClsid)
695 VideoRendererImpl *This = (VideoRendererImpl *)iface;
697 TRACE("(%p/%p)->(%p)\n", This, iface, pClsid);
699 *pClsid = CLSID_VideoRenderer;
704 /** IMediaFilter methods **/
706 static HRESULT WINAPI VideoRenderer_Stop(IBaseFilter * iface)
708 VideoRendererImpl *This = (VideoRendererImpl *)iface;
710 TRACE("(%p/%p)->()\n", This, iface);
712 EnterCriticalSection(&This->csFilter);
714 This->state = State_Stopped;
716 LeaveCriticalSection(&This->csFilter);
721 static HRESULT WINAPI VideoRenderer_Pause(IBaseFilter * iface)
723 VideoRendererImpl *This = (VideoRendererImpl *)iface;
725 TRACE("(%p/%p)->()\n", This, iface);
727 EnterCriticalSection(&This->csFilter);
729 if (This->state == State_Stopped)
730 This->pInputPin->end_of_stream = 0;
732 This->state = State_Paused;
734 LeaveCriticalSection(&This->csFilter);
739 static HRESULT WINAPI VideoRenderer_Run(IBaseFilter * iface, REFERENCE_TIME tStart)
741 VideoRendererImpl *This = (VideoRendererImpl *)iface;
743 TRACE("(%p/%p)->(%s)\n", This, iface, wine_dbgstr_longlong(tStart));
745 EnterCriticalSection(&This->csFilter);
746 if (This->state != State_Running)
748 if (This->state == State_Stopped)
749 This->pInputPin->end_of_stream = 0;
751 This->rtStreamStart = tStart;
752 This->state = State_Running;
754 LeaveCriticalSection(&This->csFilter);
759 static HRESULT WINAPI VideoRenderer_GetState(IBaseFilter * iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState)
761 VideoRendererImpl *This = (VideoRendererImpl *)iface;
763 TRACE("(%p/%p)->(%d, %p)\n", This, iface, dwMilliSecsTimeout, pState);
765 EnterCriticalSection(&This->csFilter);
767 *pState = This->state;
769 LeaveCriticalSection(&This->csFilter);
774 static HRESULT WINAPI VideoRenderer_SetSyncSource(IBaseFilter * iface, IReferenceClock *pClock)
776 VideoRendererImpl *This = (VideoRendererImpl *)iface;
778 TRACE("(%p/%p)->(%p)\n", This, iface, pClock);
780 EnterCriticalSection(&This->csFilter);
783 IReferenceClock_Release(This->pClock);
784 This->pClock = pClock;
786 IReferenceClock_AddRef(This->pClock);
788 LeaveCriticalSection(&This->csFilter);
793 static HRESULT WINAPI VideoRenderer_GetSyncSource(IBaseFilter * iface, IReferenceClock **ppClock)
795 VideoRendererImpl *This = (VideoRendererImpl *)iface;
797 TRACE("(%p/%p)->(%p)\n", This, iface, ppClock);
799 EnterCriticalSection(&This->csFilter);
801 *ppClock = This->pClock;
803 IReferenceClock_AddRef(This->pClock);
805 LeaveCriticalSection(&This->csFilter);
810 /** IBaseFilter implementation **/
812 static HRESULT VideoRenderer_GetPin(IBaseFilter *iface, ULONG pos, IPin **pin, DWORD *lastsynctick)
814 VideoRendererImpl *This = (VideoRendererImpl *)iface;
816 /* Our pins are static, not changing so setting static tick count is ok */
822 *pin = (IPin *)This->pInputPin;
827 static HRESULT WINAPI VideoRenderer_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum)
829 VideoRendererImpl *This = (VideoRendererImpl *)iface;
831 TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
833 return IEnumPinsImpl_Construct(ppEnum, VideoRenderer_GetPin, iface);
836 static HRESULT WINAPI VideoRenderer_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)
838 VideoRendererImpl *This = (VideoRendererImpl *)iface;
840 TRACE("(%p/%p)->(%p,%p)\n", This, iface, debugstr_w(Id), ppPin);
842 FIXME("VideoRenderer::FindPin(...)\n");
844 /* FIXME: critical section */
849 static HRESULT WINAPI VideoRenderer_QueryFilterInfo(IBaseFilter * iface, FILTER_INFO *pInfo)
851 VideoRendererImpl *This = (VideoRendererImpl *)iface;
853 TRACE("(%p/%p)->(%p)\n", This, iface, pInfo);
855 strcpyW(pInfo->achName, This->filterInfo.achName);
856 pInfo->pGraph = This->filterInfo.pGraph;
859 IFilterGraph_AddRef(pInfo->pGraph);
864 static HRESULT WINAPI VideoRenderer_JoinFilterGraph(IBaseFilter * iface, IFilterGraph *pGraph, LPCWSTR pName)
866 VideoRendererImpl *This = (VideoRendererImpl *)iface;
868 TRACE("(%p/%p)->(%p, %s)\n", This, iface, pGraph, debugstr_w(pName));
870 EnterCriticalSection(&This->csFilter);
873 strcpyW(This->filterInfo.achName, pName);
875 *This->filterInfo.achName = '\0';
876 This->filterInfo.pGraph = pGraph; /* NOTE: do NOT increase ref. count */
878 LeaveCriticalSection(&This->csFilter);
883 static HRESULT WINAPI VideoRenderer_QueryVendorInfo(IBaseFilter * iface, LPWSTR *pVendorInfo)
885 VideoRendererImpl *This = (VideoRendererImpl *)iface;
886 TRACE("(%p/%p)->(%p)\n", This, iface, pVendorInfo);
890 static const IBaseFilterVtbl VideoRenderer_Vtbl =
892 VideoRenderer_QueryInterface,
893 VideoRenderer_AddRef,
894 VideoRenderer_Release,
895 VideoRenderer_GetClassID,
899 VideoRenderer_GetState,
900 VideoRenderer_SetSyncSource,
901 VideoRenderer_GetSyncSource,
902 VideoRenderer_EnumPins,
903 VideoRenderer_FindPin,
904 VideoRenderer_QueryFilterInfo,
905 VideoRenderer_JoinFilterGraph,
906 VideoRenderer_QueryVendorInfo
909 static HRESULT WINAPI VideoRenderer_InputPin_EndOfStream(IPin * iface)
911 InputPin* This = (InputPin*)iface;
912 IMediaEventSink* pEventSink;
915 TRACE("(%p/%p)->()\n", This, iface);
917 hr = IFilterGraph_QueryInterface(((VideoRendererImpl*)This->pin.pinInfo.pFilter)->filterInfo.pGraph, &IID_IMediaEventSink, (LPVOID*)&pEventSink);
920 hr = IMediaEventSink_Notify(pEventSink, EC_COMPLETE, S_OK, 0);
921 IMediaEventSink_Release(pEventSink);
927 static const IPinVtbl VideoRenderer_InputPin_Vtbl =
929 InputPin_QueryInterface,
933 InputPin_ReceiveConnection,
935 IPinImpl_ConnectedTo,
936 IPinImpl_ConnectionMediaType,
937 IPinImpl_QueryPinInfo,
938 IPinImpl_QueryDirection,
940 IPinImpl_QueryAccept,
941 IPinImpl_EnumMediaTypes,
942 IPinImpl_QueryInternalConnections,
943 VideoRenderer_InputPin_EndOfStream,
949 /*** IUnknown methods ***/
950 static HRESULT WINAPI Basicvideo_QueryInterface(IBasicVideo *iface,
953 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
955 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
957 return VideoRenderer_QueryInterface((IBaseFilter*)This, riid, ppvObj);
960 static ULONG WINAPI Basicvideo_AddRef(IBasicVideo *iface) {
961 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
963 TRACE("(%p/%p)->()\n", This, iface);
965 return VideoRenderer_AddRef((IBaseFilter*)This);
968 static ULONG WINAPI Basicvideo_Release(IBasicVideo *iface) {
969 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
971 TRACE("(%p/%p)->()\n", This, iface);
973 return VideoRenderer_Release((IBaseFilter*)This);
976 /*** IDispatch methods ***/
977 static HRESULT WINAPI Basicvideo_GetTypeInfoCount(IBasicVideo *iface,
979 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
981 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
986 static HRESULT WINAPI Basicvideo_GetTypeInfo(IBasicVideo *iface,
989 ITypeInfo**ppTInfo) {
990 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
992 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
997 static HRESULT WINAPI Basicvideo_GetIDsOfNames(IBasicVideo *iface,
1003 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1005 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1010 static HRESULT WINAPI Basicvideo_Invoke(IBasicVideo *iface,
1011 DISPID dispIdMember,
1015 DISPPARAMS*pDispParams,
1017 EXCEPINFO*pExepInfo,
1019 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1021 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);
1026 /*** IBasicVideo methods ***/
1027 static HRESULT WINAPI Basicvideo_get_AvgTimePerFrame(IBasicVideo *iface,
1028 REFTIME *pAvgTimePerFrame) {
1029 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1031 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pAvgTimePerFrame);
1036 static HRESULT WINAPI Basicvideo_get_BitRate(IBasicVideo *iface,
1038 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1040 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBitRate);
1045 static HRESULT WINAPI Basicvideo_get_BitErrorRate(IBasicVideo *iface,
1046 long *pBitErrorRate) {
1047 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1049 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBitErrorRate);
1054 static HRESULT WINAPI Basicvideo_get_VideoWidth(IBasicVideo *iface,
1055 long *pVideoWidth) {
1056 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1058 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoWidth);
1060 *pVideoWidth = This->VideoWidth;
1065 static HRESULT WINAPI Basicvideo_get_VideoHeight(IBasicVideo *iface,
1066 long *pVideoHeight) {
1067 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1069 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoHeight);
1071 *pVideoHeight = This->VideoHeight;
1076 static HRESULT WINAPI Basicvideo_put_SourceLeft(IBasicVideo *iface,
1078 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1080 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceLeft);
1082 This->SourceRect.left = SourceLeft;
1087 static HRESULT WINAPI Basicvideo_get_SourceLeft(IBasicVideo *iface,
1088 long *pSourceLeft) {
1089 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1091 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceLeft);
1093 *pSourceLeft = This->SourceRect.left;
1098 static HRESULT WINAPI Basicvideo_put_SourceWidth(IBasicVideo *iface,
1100 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1102 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceWidth);
1104 This->SourceRect.right = This->SourceRect.left + SourceWidth;
1109 static HRESULT WINAPI Basicvideo_get_SourceWidth(IBasicVideo *iface,
1110 long *pSourceWidth) {
1111 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1113 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceWidth);
1115 *pSourceWidth = This->SourceRect.right - This->SourceRect.left;
1120 static HRESULT WINAPI Basicvideo_put_SourceTop(IBasicVideo *iface,
1122 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1124 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceTop);
1126 This->SourceRect.top = SourceTop;
1131 static HRESULT WINAPI Basicvideo_get_SourceTop(IBasicVideo *iface,
1133 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1135 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceTop);
1137 *pSourceTop = This->SourceRect.top;
1142 static HRESULT WINAPI Basicvideo_put_SourceHeight(IBasicVideo *iface,
1143 long SourceHeight) {
1144 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1146 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceHeight);
1148 This->SourceRect.bottom = This->SourceRect.top + SourceHeight;
1153 static HRESULT WINAPI Basicvideo_get_SourceHeight(IBasicVideo *iface,
1154 long *pSourceHeight) {
1155 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1157 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceHeight);
1159 *pSourceHeight = This->SourceRect.bottom - This->SourceRect.top;
1164 static HRESULT WINAPI Basicvideo_put_DestinationLeft(IBasicVideo *iface,
1165 long DestinationLeft) {
1166 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1168 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationLeft);
1170 This->DestRect.left = DestinationLeft;
1175 static HRESULT WINAPI Basicvideo_get_DestinationLeft(IBasicVideo *iface,
1176 long *pDestinationLeft) {
1177 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1179 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationLeft);
1181 *pDestinationLeft = This->DestRect.left;
1186 static HRESULT WINAPI Basicvideo_put_DestinationWidth(IBasicVideo *iface,
1187 long DestinationWidth) {
1188 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1190 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationWidth);
1192 This->DestRect.right = This->DestRect.left + DestinationWidth;
1197 static HRESULT WINAPI Basicvideo_get_DestinationWidth(IBasicVideo *iface,
1198 long *pDestinationWidth) {
1199 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1201 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationWidth);
1203 *pDestinationWidth = This->DestRect.right - This->DestRect.left;
1208 static HRESULT WINAPI Basicvideo_put_DestinationTop(IBasicVideo *iface,
1209 long DestinationTop) {
1210 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1212 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationTop);
1214 This->DestRect.top = DestinationTop;
1219 static HRESULT WINAPI Basicvideo_get_DestinationTop(IBasicVideo *iface,
1220 long *pDestinationTop) {
1221 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1223 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationTop);
1225 *pDestinationTop = This->DestRect.top;
1230 static HRESULT WINAPI Basicvideo_put_DestinationHeight(IBasicVideo *iface,
1231 long DestinationHeight) {
1232 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1234 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationHeight);
1236 This->DestRect.right = This->DestRect.left + DestinationHeight;
1241 static HRESULT WINAPI Basicvideo_get_DestinationHeight(IBasicVideo *iface,
1242 long *pDestinationHeight) {
1243 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1245 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationHeight);
1247 *pDestinationHeight = This->DestRect.right - This->DestRect.left;
1252 static HRESULT WINAPI Basicvideo_SetSourcePosition(IBasicVideo *iface,
1257 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1259 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
1261 This->SourceRect.left = Left;
1262 This->SourceRect.top = Top;
1263 This->SourceRect.right = Left + Width;
1264 This->SourceRect.bottom = Top + Height;
1269 static HRESULT WINAPI Basicvideo_GetSourcePosition(IBasicVideo *iface,
1274 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1276 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1278 *pLeft = This->SourceRect.left;
1279 *pTop = This->SourceRect.top;
1280 *pWidth = This->SourceRect.right - This->SourceRect.left;
1281 *pHeight = This->SourceRect.bottom - This->SourceRect.top;
1286 static HRESULT WINAPI Basicvideo_SetDefaultSourcePosition(IBasicVideo *iface) {
1287 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1289 TRACE("(%p/%p)->()\n", This, iface);
1291 This->SourceRect.left = 0;
1292 This->SourceRect.top = 0;
1293 This->SourceRect.right = This->VideoWidth;
1294 This->SourceRect.bottom = This->VideoHeight;
1299 static HRESULT WINAPI Basicvideo_SetDestinationPosition(IBasicVideo *iface,
1304 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1306 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
1308 This->DestRect.left = Left;
1309 This->DestRect.top = Top;
1310 This->DestRect.right = Left + Width;
1311 This->DestRect.bottom = Top + Height;
1316 static HRESULT WINAPI Basicvideo_GetDestinationPosition(IBasicVideo *iface,
1321 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1323 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1325 *pLeft = This->DestRect.left;
1326 *pTop = This->DestRect.top;
1327 *pWidth = This->DestRect.right - This->DestRect.left;
1328 *pHeight = This->DestRect.bottom - This->DestRect.top;
1333 static HRESULT WINAPI Basicvideo_SetDefaultDestinationPosition(IBasicVideo *iface) {
1334 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1337 TRACE("(%p/%p)->()\n", This, iface);
1339 if (!GetClientRect(This->hWnd, &rect))
1342 This->SourceRect.left = 0;
1343 This->SourceRect.top = 0;
1344 This->SourceRect.right = rect.right;
1345 This->SourceRect.bottom = rect.bottom;
1350 static HRESULT WINAPI Basicvideo_GetVideoSize(IBasicVideo *iface,
1353 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1355 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
1357 *pWidth = This->VideoWidth;
1358 *pHeight = This->VideoHeight;
1363 static HRESULT WINAPI Basicvideo_GetVideoPaletteEntries(IBasicVideo *iface,
1368 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1370 FIXME("(%p/%p)->(%ld, %ld, %p, %p): stub !!!\n", This, iface, StartIndex, Entries, pRetrieved, pPalette);
1375 static HRESULT WINAPI Basicvideo_GetCurrentImage(IBasicVideo *iface,
1378 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1380 FIXME("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pBufferSize, pDIBImage);
1385 static HRESULT WINAPI Basicvideo_IsUsingDefaultSource(IBasicVideo *iface) {
1386 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1388 FIXME("(%p/%p)->(): stub !!!\n", This, iface);
1393 static HRESULT WINAPI Basicvideo_IsUsingDefaultDestination(IBasicVideo *iface) {
1394 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1396 FIXME("(%p/%p)->(): stub !!!\n", This, iface);
1402 static const IBasicVideoVtbl IBasicVideo_VTable =
1404 Basicvideo_QueryInterface,
1407 Basicvideo_GetTypeInfoCount,
1408 Basicvideo_GetTypeInfo,
1409 Basicvideo_GetIDsOfNames,
1411 Basicvideo_get_AvgTimePerFrame,
1412 Basicvideo_get_BitRate,
1413 Basicvideo_get_BitErrorRate,
1414 Basicvideo_get_VideoWidth,
1415 Basicvideo_get_VideoHeight,
1416 Basicvideo_put_SourceLeft,
1417 Basicvideo_get_SourceLeft,
1418 Basicvideo_put_SourceWidth,
1419 Basicvideo_get_SourceWidth,
1420 Basicvideo_put_SourceTop,
1421 Basicvideo_get_SourceTop,
1422 Basicvideo_put_SourceHeight,
1423 Basicvideo_get_SourceHeight,
1424 Basicvideo_put_DestinationLeft,
1425 Basicvideo_get_DestinationLeft,
1426 Basicvideo_put_DestinationWidth,
1427 Basicvideo_get_DestinationWidth,
1428 Basicvideo_put_DestinationTop,
1429 Basicvideo_get_DestinationTop,
1430 Basicvideo_put_DestinationHeight,
1431 Basicvideo_get_DestinationHeight,
1432 Basicvideo_SetSourcePosition,
1433 Basicvideo_GetSourcePosition,
1434 Basicvideo_SetDefaultSourcePosition,
1435 Basicvideo_SetDestinationPosition,
1436 Basicvideo_GetDestinationPosition,
1437 Basicvideo_SetDefaultDestinationPosition,
1438 Basicvideo_GetVideoSize,
1439 Basicvideo_GetVideoPaletteEntries,
1440 Basicvideo_GetCurrentImage,
1441 Basicvideo_IsUsingDefaultSource,
1442 Basicvideo_IsUsingDefaultDestination
1446 /*** IUnknown methods ***/
1447 static HRESULT WINAPI Videowindow_QueryInterface(IVideoWindow *iface,
1450 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1452 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1454 return VideoRenderer_QueryInterface((IBaseFilter*)This, riid, ppvObj);
1457 static ULONG WINAPI Videowindow_AddRef(IVideoWindow *iface) {
1458 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1460 TRACE("(%p/%p)->()\n", This, iface);
1462 return VideoRenderer_AddRef((IBaseFilter*)This);
1465 static ULONG WINAPI Videowindow_Release(IVideoWindow *iface) {
1466 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1468 TRACE("(%p/%p)->()\n", This, iface);
1470 return VideoRenderer_Release((IBaseFilter*)This);
1473 /*** IDispatch methods ***/
1474 static HRESULT WINAPI Videowindow_GetTypeInfoCount(IVideoWindow *iface,
1476 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1478 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
1483 static HRESULT WINAPI Videowindow_GetTypeInfo(IVideoWindow *iface,
1486 ITypeInfo**ppTInfo) {
1487 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1489 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
1494 static HRESULT WINAPI Videowindow_GetIDsOfNames(IVideoWindow *iface,
1500 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1502 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1507 static HRESULT WINAPI Videowindow_Invoke(IVideoWindow *iface,
1508 DISPID dispIdMember,
1512 DISPPARAMS*pDispParams,
1514 EXCEPINFO*pExepInfo,
1516 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1518 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);
1523 /*** IVideoWindow methods ***/
1524 static HRESULT WINAPI Videowindow_put_Caption(IVideoWindow *iface,
1526 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1528 TRACE("(%p/%p)->(%s (%p))\n", This, iface, debugstr_w(strCaption), strCaption);
1530 if (!SetWindowTextW(This->hWnd, strCaption))
1536 static HRESULT WINAPI Videowindow_get_Caption(IVideoWindow *iface,
1538 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1540 TRACE("(%p/%p)->(%p)\n", This, iface, strCaption);
1542 GetWindowTextW(This->hWnd, (LPWSTR)strCaption, 100);
1547 static HRESULT WINAPI Videowindow_put_WindowStyle(IVideoWindow *iface,
1549 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1552 old = GetWindowLongA(This->hWnd, GWL_STYLE);
1554 TRACE("(%p/%p)->(%x -> %lx)\n", This, iface, old, WindowStyle);
1556 if (WindowStyle & (WS_DISABLED|WS_HSCROLL|WS_ICONIC|WS_MAXIMIZE|WS_MINIMIZE|WS_VSCROLL))
1557 return E_INVALIDARG;
1559 SetWindowLongA(This->hWnd, GWL_STYLE, WindowStyle);
1564 static HRESULT WINAPI Videowindow_get_WindowStyle(IVideoWindow *iface,
1565 long *WindowStyle) {
1566 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1568 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyle);
1570 *WindowStyle = GetWindowLongA(This->hWnd, GWL_STYLE);
1575 static HRESULT WINAPI Videowindow_put_WindowStyleEx(IVideoWindow *iface,
1576 long WindowStyleEx) {
1577 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1579 TRACE("(%p/%p)->(%ld)\n", This, iface, WindowStyleEx);
1581 if (WindowStyleEx & (WS_DISABLED|WS_HSCROLL|WS_ICONIC|WS_MAXIMIZE|WS_MINIMIZE|WS_VSCROLL))
1582 return E_INVALIDARG;
1584 if (!SetWindowLongA(This->hWnd, GWL_EXSTYLE, WindowStyleEx))
1590 static HRESULT WINAPI Videowindow_get_WindowStyleEx(IVideoWindow *iface,
1591 long *WindowStyleEx) {
1592 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1594 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyleEx);
1596 *WindowStyleEx = GetWindowLongA(This->hWnd, GWL_EXSTYLE);
1601 static HRESULT WINAPI Videowindow_put_AutoShow(IVideoWindow *iface,
1603 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1605 TRACE("(%p/%p)->(%ld)\n", This, iface, AutoShow);
1607 This->AutoShow = 1; /* FXIME: Should be AutoShow */;
1612 static HRESULT WINAPI Videowindow_get_AutoShow(IVideoWindow *iface,
1614 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1616 TRACE("(%p/%p)->(%p)\n", This, iface, AutoShow);
1618 *AutoShow = This->AutoShow;
1623 static HRESULT WINAPI Videowindow_put_WindowState(IVideoWindow *iface,
1625 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1627 FIXME("(%p/%p)->(%ld): stub !!!\n", This, iface, WindowState);
1632 static HRESULT WINAPI Videowindow_get_WindowState(IVideoWindow *iface,
1633 long *WindowState) {
1634 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1636 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, WindowState);
1641 static HRESULT WINAPI Videowindow_put_BackgroundPalette(IVideoWindow *iface,
1642 long BackgroundPalette) {
1643 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1645 FIXME("(%p/%p)->(%ld): stub !!!\n", This, iface, BackgroundPalette);
1650 static HRESULT WINAPI Videowindow_get_BackgroundPalette(IVideoWindow *iface,
1651 long *pBackgroundPalette) {
1652 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1654 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBackgroundPalette);
1659 static HRESULT WINAPI Videowindow_put_Visible(IVideoWindow *iface,
1661 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1663 TRACE("(%p/%p)->(%ld)\n", This, iface, Visible);
1665 ShowWindow(This->hWnd, Visible ? SW_SHOW : SW_HIDE);
1670 static HRESULT WINAPI Videowindow_get_Visible(IVideoWindow *iface,
1672 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1674 TRACE("(%p/%p)->(%p)\n", This, iface, pVisible);
1676 *pVisible = IsWindowVisible(This->hWnd);
1681 static HRESULT WINAPI Videowindow_put_Left(IVideoWindow *iface,
1683 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1685 TRACE("(%p/%p)->(%ld)\n", This, iface, Left);
1687 if (!SetWindowPos(This->hWnd, NULL, Left, This->WindowPos.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE))
1690 This->WindowPos.left = Left;
1695 static HRESULT WINAPI Videowindow_get_Left(IVideoWindow *iface,
1697 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1699 TRACE("(%p/%p)->(%p)\n", This, iface, pLeft);
1701 *pLeft = This->WindowPos.left;
1706 static HRESULT WINAPI Videowindow_put_Width(IVideoWindow *iface,
1708 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1710 TRACE("(%p/%p)->(%ld)\n", This, iface, Width);
1712 if (!SetWindowPos(This->hWnd, NULL, 0, 0, Width, This->WindowPos.bottom-This->WindowPos.top, SWP_NOZORDER|SWP_NOMOVE))
1715 This->WindowPos.right = This->WindowPos.left + Width;
1720 static HRESULT WINAPI Videowindow_get_Width(IVideoWindow *iface,
1722 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1724 TRACE("(%p/%p)->(%p)\n", This, iface, pWidth);
1726 *pWidth = This->WindowPos.right - This->WindowPos.left;
1731 static HRESULT WINAPI Videowindow_put_Top(IVideoWindow *iface,
1733 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1735 TRACE("(%p/%p)->(%ld)\n", This, iface, Top);
1737 if (!SetWindowPos(This->hWnd, NULL, This->WindowPos.left, Top, 0, 0, SWP_NOZORDER|SWP_NOSIZE))
1740 This->WindowPos.top = Top;
1745 static HRESULT WINAPI Videowindow_get_Top(IVideoWindow *iface,
1747 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1749 TRACE("(%p/%p)->(%p)\n", This, iface, pTop);
1751 *pTop = This->WindowPos.top;
1756 static HRESULT WINAPI Videowindow_put_Height(IVideoWindow *iface,
1758 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1760 TRACE("(%p/%p)->(%ld)\n", This, iface, Height);
1762 if (!SetWindowPos(This->hWnd, NULL, 0, 0, This->WindowPos.right-This->WindowPos.left, Height, SWP_NOZORDER|SWP_NOMOVE))
1765 This->WindowPos.bottom = This->WindowPos.top + Height;
1770 static HRESULT WINAPI Videowindow_get_Height(IVideoWindow *iface,
1772 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1774 TRACE("(%p/%p)->(%p)\n", This, iface, pHeight);
1776 *pHeight = This->WindowPos.bottom - This->WindowPos.top;
1781 static HRESULT WINAPI Videowindow_put_Owner(IVideoWindow *iface,
1783 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1785 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Owner);
1787 SetParent(This->hWnd, (HWND)Owner);
1792 static HRESULT WINAPI Videowindow_get_Owner(IVideoWindow *iface,
1794 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1796 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Owner);
1798 *(HWND*)Owner = GetParent(This->hWnd);
1803 static HRESULT WINAPI Videowindow_put_MessageDrain(IVideoWindow *iface,
1805 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1807 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Drain);
1809 This->hWndMsgDrain = (HWND)Drain;
1814 static HRESULT WINAPI Videowindow_get_MessageDrain(IVideoWindow *iface,
1816 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1818 TRACE("(%p/%p)->(%p)\n", This, iface, Drain);
1820 *Drain = (OAHWND)This->hWndMsgDrain;
1825 static HRESULT WINAPI Videowindow_get_BorderColor(IVideoWindow *iface,
1827 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1829 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, Color);
1834 static HRESULT WINAPI Videowindow_put_BorderColor(IVideoWindow *iface,
1836 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1838 FIXME("(%p/%p)->(%ld): stub !!!\n", This, iface, Color);
1843 static HRESULT WINAPI Videowindow_get_FullScreenMode(IVideoWindow *iface,
1844 long *FullScreenMode) {
1845 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1847 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, FullScreenMode);
1852 static HRESULT WINAPI Videowindow_put_FullScreenMode(IVideoWindow *iface,
1853 long FullScreenMode) {
1854 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1856 FIXME("(%p/%p)->(%ld): stub !!!\n", This, iface, FullScreenMode);
1861 static HRESULT WINAPI Videowindow_SetWindowForeground(IVideoWindow *iface,
1863 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1868 TRACE("(%p/%p)->(%ld)\n", This, iface, Focus);
1870 if ((Focus != FALSE) && (Focus != TRUE))
1871 return E_INVALIDARG;
1873 hr = IPin_ConnectedTo((IPin *)This->pInputPin, &pPin);
1874 if ((hr != S_OK) || !pPin)
1875 return VFW_E_NOT_CONNECTED;
1878 ret = SetForegroundWindow(This->hWnd);
1880 ret = SetWindowPos(This->hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
1888 static HRESULT WINAPI Videowindow_NotifyOwnerMessage(IVideoWindow *iface,
1893 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1895 TRACE("(%p/%p)->(%08x, %ld, %08lx, %08lx)\n", This, iface, (DWORD) hwnd, uMsg, wParam, lParam);
1897 if (!PostMessageA(This->hWnd, uMsg, wParam, lParam))
1903 static HRESULT WINAPI Videowindow_SetWindowPosition(IVideoWindow *iface,
1908 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1910 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
1912 if (!SetWindowPos(This->hWnd, NULL, Left, Top, Width, Height, SWP_NOZORDER))
1915 This->WindowPos.left = Left;
1916 This->WindowPos.top = Top;
1917 This->WindowPos.right = Left + Width;
1918 This->WindowPos.bottom = Top + Height;
1923 static HRESULT WINAPI Videowindow_GetWindowPosition(IVideoWindow *iface,
1928 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1930 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1932 *pLeft = This->WindowPos.left;
1933 *pTop = This->WindowPos.top;
1934 *pWidth = This->WindowPos.right - This->WindowPos.left;
1935 *pHeight = This->WindowPos.bottom - This->WindowPos.top;
1940 static HRESULT WINAPI Videowindow_GetMinIdealImageSize(IVideoWindow *iface,
1943 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1945 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This, iface, pWidth, pHeight);
1947 *pWidth = This->VideoWidth;
1948 *pHeight = This->VideoHeight;
1953 static HRESULT WINAPI Videowindow_GetMaxIdealImageSize(IVideoWindow *iface,
1956 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1958 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This, iface, pWidth, pHeight);
1960 *pWidth = This->VideoWidth;
1961 *pHeight = This->VideoHeight;
1966 static HRESULT WINAPI Videowindow_GetRestorePosition(IVideoWindow *iface,
1971 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1973 FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This, iface, pLeft, pTop, pWidth, pHeight);
1978 static HRESULT WINAPI Videowindow_HideCursor(IVideoWindow *iface,
1980 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1982 FIXME("(%p/%p)->(%ld): stub !!!\n", This, iface, HideCursor);
1987 static HRESULT WINAPI Videowindow_IsCursorHidden(IVideoWindow *iface,
1988 long *CursorHidden) {
1989 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1991 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, CursorHidden);
1996 static const IVideoWindowVtbl IVideoWindow_VTable =
1998 Videowindow_QueryInterface,
2000 Videowindow_Release,
2001 Videowindow_GetTypeInfoCount,
2002 Videowindow_GetTypeInfo,
2003 Videowindow_GetIDsOfNames,
2005 Videowindow_put_Caption,
2006 Videowindow_get_Caption,
2007 Videowindow_put_WindowStyle,
2008 Videowindow_get_WindowStyle,
2009 Videowindow_put_WindowStyleEx,
2010 Videowindow_get_WindowStyleEx,
2011 Videowindow_put_AutoShow,
2012 Videowindow_get_AutoShow,
2013 Videowindow_put_WindowState,
2014 Videowindow_get_WindowState,
2015 Videowindow_put_BackgroundPalette,
2016 Videowindow_get_BackgroundPalette,
2017 Videowindow_put_Visible,
2018 Videowindow_get_Visible,
2019 Videowindow_put_Left,
2020 Videowindow_get_Left,
2021 Videowindow_put_Width,
2022 Videowindow_get_Width,
2023 Videowindow_put_Top,
2024 Videowindow_get_Top,
2025 Videowindow_put_Height,
2026 Videowindow_get_Height,
2027 Videowindow_put_Owner,
2028 Videowindow_get_Owner,
2029 Videowindow_put_MessageDrain,
2030 Videowindow_get_MessageDrain,
2031 Videowindow_get_BorderColor,
2032 Videowindow_put_BorderColor,
2033 Videowindow_get_FullScreenMode,
2034 Videowindow_put_FullScreenMode,
2035 Videowindow_SetWindowForeground,
2036 Videowindow_NotifyOwnerMessage,
2037 Videowindow_SetWindowPosition,
2038 Videowindow_GetWindowPosition,
2039 Videowindow_GetMinIdealImageSize,
2040 Videowindow_GetMaxIdealImageSize,
2041 Videowindow_GetRestorePosition,
2042 Videowindow_HideCursor,
2043 Videowindow_IsCursorHidden