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"
39 #include "wine/unicode.h"
40 #include "wine/debug.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
44 static BOOL wnd_class_registered = FALSE;
46 static const WCHAR wcsInputPinName[] = {'i','n','p','u','t',' ','p','i','n',0};
48 static const IBaseFilterVtbl VideoRenderer_Vtbl;
49 static const IUnknownVtbl IInner_VTable;
50 static const IBasicVideoVtbl IBasicVideo_VTable;
51 static const IVideoWindowVtbl IVideoWindow_VTable;
52 static const IPinVtbl VideoRenderer_InputPin_Vtbl;
54 typedef struct VideoRendererImpl
56 const IBaseFilterVtbl * lpVtbl;
57 const IBasicVideoVtbl * IBasicVideo_vtbl;
58 const IVideoWindowVtbl * IVideoWindow_vtbl;
59 const IUnknownVtbl * IInner_vtbl;
62 CRITICAL_SECTION csFilter;
64 REFERENCE_TIME rtStreamStart;
65 IReferenceClock * pClock;
66 FILTER_INFO filterInfo;
89 static LRESULT CALLBACK VideoWndProcA(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
91 VideoRendererImpl* pVideoRenderer = (VideoRendererImpl*)GetWindowLongA(hwnd, 0);
92 LPRECT lprect = (LPRECT)lParam;
94 if (pVideoRenderer && pVideoRenderer->hWndMsgDrain)
100 case WM_LBUTTONDBLCLK:
103 case WM_MBUTTONDBLCLK:
106 case WM_MOUSEACTIVATE:
108 case WM_NCLBUTTONDBLCLK:
109 case WM_NCLBUTTONDOWN:
111 case WM_NCMBUTTONDBLCLK:
112 case WM_NCMBUTTONDOWN:
115 case WM_NCRBUTTONDBLCLK:
116 case WM_NCRBUTTONDOWN:
118 case WM_RBUTTONDBLCLK:
121 PostMessageA(pVideoRenderer->hWndMsgDrain, uMsg, wParam, lParam);
131 /* TRACE("WM_SIZING %d %d %d %d\n", lprect->left, lprect->top, lprect->right, lprect->bottom); */
132 SetWindowPos(hwnd, NULL, lprect->left, lprect->top, lprect->right - lprect->left, lprect->bottom - lprect->top, SWP_NOZORDER);
133 GetClientRect(hwnd, &pVideoRenderer->DestRect);
134 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
135 pVideoRenderer->DestRect.left,
136 pVideoRenderer->DestRect.top,
137 pVideoRenderer->DestRect.right - pVideoRenderer->DestRect.left,
138 pVideoRenderer->DestRect.bottom - pVideoRenderer->DestRect.top);
141 TRACE("WM_SIZE %d %d\n", LOWORD(lParam), HIWORD(lParam));
142 GetClientRect(hwnd, &pVideoRenderer->DestRect);
143 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
144 pVideoRenderer->DestRect.left,
145 pVideoRenderer->DestRect.top,
146 pVideoRenderer->DestRect.right - pVideoRenderer->DestRect.left,
147 pVideoRenderer->DestRect.bottom - pVideoRenderer->DestRect.top);
150 return DefWindowProcA(hwnd, uMsg, wParam, lParam);
155 static BOOL CreateRenderingWindow(VideoRendererImpl* This)
159 TRACE("(%p)->()\n", This);
162 winclass.lpfnWndProc = VideoWndProcA;
163 winclass.cbClsExtra = 0;
164 winclass.cbWndExtra = sizeof(VideoRendererImpl*);
165 winclass.hInstance = NULL;
166 winclass.hIcon = NULL;
167 winclass.hCursor = NULL;
168 winclass.hbrBackground = GetStockObject(BLACK_BRUSH);
169 winclass.lpszMenuName = NULL;
170 winclass.lpszClassName = "Wine ActiveMovie Class";
172 if (!wnd_class_registered)
174 if (!RegisterClassA(&winclass))
176 ERR("Unable to register window %u\n", GetLastError());
179 wnd_class_registered = TRUE;
182 This->hWnd = CreateWindowExA(0, "Wine ActiveMovie Class", "Wine ActiveMovie Window", WS_SIZEBOX,
183 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL,
188 ERR("Unable to create window\n");
192 SetWindowLongA(This->hWnd, 0, (LONG)This);
197 static DWORD WINAPI MessageLoop(LPVOID lpParameter)
199 VideoRendererImpl* This = (VideoRendererImpl*) lpParameter;
203 TRACE("Starting message loop\n");
205 if (!CreateRenderingWindow(This))
207 This->ThreadResult = FALSE;
208 SetEvent(This->hEvent);
212 This->ThreadResult = TRUE;
213 SetEvent(This->hEvent);
215 while ((fGotMessage = GetMessageA(&msg, NULL, 0, 0)) != 0 && fGotMessage != -1)
217 TranslateMessage(&msg);
218 DispatchMessageA(&msg);
221 TRACE("End of message loop\n");
226 static BOOL CreateRenderingSubsystem(VideoRendererImpl* This)
228 This->hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
232 This->hThread = CreateThread(NULL, 0, MessageLoop, (LPVOID)This, 0, &This->ThreadID);
235 CloseHandle(This->hEvent);
239 WaitForSingleObject(This->hEvent, INFINITE);
240 CloseHandle(This->hEvent);
242 if (!This->ThreadResult)
244 CloseHandle(This->hThread);
251 static const IMemInputPinVtbl MemInputPin_Vtbl =
253 MemInputPin_QueryInterface,
256 MemInputPin_GetAllocator,
257 MemInputPin_NotifyAllocator,
258 MemInputPin_GetAllocatorRequirements,
260 MemInputPin_ReceiveMultiple,
261 MemInputPin_ReceiveCanBlock
264 static HRESULT VideoRenderer_InputPin_Construct(const PIN_INFO * pPinInfo, SAMPLEPROC pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, IPin ** ppPin)
270 if (pPinInfo->dir != PINDIR_INPUT)
272 ERR("Pin direction(%x) != PINDIR_INPUT\n", pPinInfo->dir);
276 pPinImpl = CoTaskMemAlloc(sizeof(*pPinImpl));
279 return E_OUTOFMEMORY;
281 if (SUCCEEDED(InputPin_Init(pPinInfo, pSampleProc, pUserData, pQueryAccept, pCritSec, pPinImpl)))
283 pPinImpl->pin.lpVtbl = &VideoRenderer_InputPin_Vtbl;
284 pPinImpl->lpVtblMemInput = &MemInputPin_Vtbl;
286 *ppPin = (IPin *)(&pPinImpl->pin.lpVtbl);
290 CoTaskMemFree(pPinImpl);
294 static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data, DWORD size)
296 VIDEOINFOHEADER* format;
302 LPBYTE palette = NULL;
305 TRACE("%p %p %d\n", This, data, size);
307 sdesc.dwSize = sizeof(sdesc);
308 hr = IPin_ConnectionMediaType(This->ppPins[0], &amt);
310 ERR("Unable to retrieve media type\n");
313 format = (VIDEOINFOHEADER*)amt.pbFormat;
315 TRACE("biSize = %d\n", format->bmiHeader.biSize);
316 TRACE("biWidth = %d\n", format->bmiHeader.biWidth);
317 TRACE("biHeight = %d\n", format->bmiHeader.biHeight);
318 TRACE("biPlanes = %d\n", format->bmiHeader.biPlanes);
319 TRACE("biBitCount = %d\n", format->bmiHeader.biBitCount);
320 TRACE("biCompression = %s\n", debugstr_an((LPSTR)&(format->bmiHeader.biCompression), 4));
321 TRACE("biSizeImage = %d\n", format->bmiHeader.biSizeImage);
323 width = format->bmiHeader.biWidth;
324 height = format->bmiHeader.biHeight;
325 palette = ((LPBYTE)&format->bmiHeader) + format->bmiHeader.biSize;
329 /* Honor previously set WindowPos */
330 TRACE("WindowPos: %d %d %d %d\n", This->WindowPos.left, This->WindowPos.top, This->WindowPos.right, This->WindowPos.bottom);
331 SetWindowPos(This->hWnd, NULL,
332 This->WindowPos.left,
334 This->WindowPos.right - This->WindowPos.left,
335 This->WindowPos.bottom - This->WindowPos.top,
336 SWP_NOZORDER|SWP_NOMOVE);
337 GetClientRect(This->hWnd, &This->DestRect);
341 hDC = GetDC(This->hWnd);
344 ERR("Cannot get DC from window!\n");
348 TRACE("Src Rect: %d %d %d %d\n", This->SourceRect.left, This->SourceRect.top, This->SourceRect.right, This->SourceRect.bottom);
349 TRACE("Dst Rect: %d %d %d %d\n", This->DestRect.left, This->DestRect.top, This->DestRect.right, This->DestRect.bottom);
351 StretchDIBits(hDC, This->DestRect.left, This->DestRect.top, This->DestRect.right -This->DestRect.left,
352 This->DestRect.bottom - This->DestRect.top, This->SourceRect.left, This->SourceRect.top,
353 This->SourceRect.right - This->SourceRect.left, This->SourceRect.bottom - This->SourceRect.top,
354 data, (BITMAPINFO*)&format->bmiHeader, DIB_RGB_COLORS, SRCCOPY);
356 ReleaseDC(This->hWnd, hDC);
359 ShowWindow(This->hWnd, SW_SHOW);
364 static HRESULT VideoRenderer_Sample(LPVOID iface, IMediaSample * pSample)
366 VideoRendererImpl *This = (VideoRendererImpl *)iface;
367 LPBYTE pbSrcStream = NULL;
368 long cbSrcStream = 0;
369 REFERENCE_TIME tStart, tStop;
372 TRACE("%p %p\n", iface, pSample);
374 hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
377 ERR("Cannot get pointer to sample data (%x)\n", hr);
381 hr = IMediaSample_GetTime(pSample, &tStart, &tStop);
383 ERR("Cannot get sample time (%x)\n", hr);
385 cbSrcStream = IMediaSample_GetActualDataLength(pSample);
387 TRACE("val %p %ld\n", pbSrcStream, cbSrcStream);
389 #if 0 /* For debugging purpose */
392 for(i = 0; i < cbSrcStream; i++)
394 if ((i!=0) && !(i%16))
396 TRACE("%02x ", pbSrcStream[i]);
402 VideoRenderer_SendSampleData(This, pbSrcStream, cbSrcStream);
407 static HRESULT VideoRenderer_QueryAccept(LPVOID iface, const AM_MEDIA_TYPE * pmt)
409 if (!IsEqualIID(&pmt->majortype, &MEDIATYPE_Video))
412 if (IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB32) ||
413 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB24) ||
414 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB565) ||
415 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB8))
417 VideoRendererImpl* This = (VideoRendererImpl*) iface;
418 VIDEOINFOHEADER* format = (VIDEOINFOHEADER*)pmt->pbFormat;
420 if (!IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo))
422 WARN("Format type %s not supported\n", debugstr_guid(&pmt->formattype));
425 This->SourceRect.left = 0;
426 This->SourceRect.top = 0;
427 This->SourceRect.right = This->VideoWidth = format->bmiHeader.biWidth;
428 This->SourceRect.bottom = This->VideoHeight = format->bmiHeader.biHeight;
434 HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
438 VideoRendererImpl * pVideoRenderer;
440 TRACE("(%p, %p)\n", pUnkOuter, ppv);
444 pVideoRenderer = CoTaskMemAlloc(sizeof(VideoRendererImpl));
445 pVideoRenderer->pUnkOuter = pUnkOuter;
446 pVideoRenderer->bUnkOuterValid = FALSE;
447 pVideoRenderer->bAggregatable = FALSE;
448 pVideoRenderer->IInner_vtbl = &IInner_VTable;
450 pVideoRenderer->lpVtbl = &VideoRenderer_Vtbl;
451 pVideoRenderer->IBasicVideo_vtbl = &IBasicVideo_VTable;
452 pVideoRenderer->IVideoWindow_vtbl = &IVideoWindow_VTable;
454 pVideoRenderer->refCount = 1;
455 InitializeCriticalSection(&pVideoRenderer->csFilter);
456 pVideoRenderer->csFilter.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": VideoRendererImpl.csFilter");
457 pVideoRenderer->state = State_Stopped;
458 pVideoRenderer->pClock = NULL;
459 pVideoRenderer->init = 0;
460 pVideoRenderer->AutoShow = 1;
461 ZeroMemory(&pVideoRenderer->filterInfo, sizeof(FILTER_INFO));
463 pVideoRenderer->ppPins = CoTaskMemAlloc(1 * sizeof(IPin *));
465 /* construct input pin */
466 piInput.dir = PINDIR_INPUT;
467 piInput.pFilter = (IBaseFilter *)pVideoRenderer;
468 lstrcpynW(piInput.achName, wcsInputPinName, sizeof(piInput.achName) / sizeof(piInput.achName[0]));
470 hr = VideoRenderer_InputPin_Construct(&piInput, VideoRenderer_Sample, (LPVOID)pVideoRenderer, VideoRenderer_QueryAccept, &pVideoRenderer->csFilter, (IPin **)&pVideoRenderer->pInputPin);
474 pVideoRenderer->ppPins[0] = (IPin *)pVideoRenderer->pInputPin;
475 *ppv = (LPVOID)pVideoRenderer;
479 CoTaskMemFree(pVideoRenderer->ppPins);
480 pVideoRenderer->csFilter.DebugInfo->Spare[0] = 0;
481 DeleteCriticalSection(&pVideoRenderer->csFilter);
482 CoTaskMemFree(pVideoRenderer);
485 if (!CreateRenderingSubsystem(pVideoRenderer))
491 static HRESULT WINAPI VideoRendererInner_QueryInterface(IUnknown * iface, REFIID riid, LPVOID * ppv)
493 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
494 TRACE("(%p/%p)->(%s, %p)\n", This, iface, qzdebugstr_guid(riid), ppv);
496 if (This->bAggregatable)
497 This->bUnkOuterValid = TRUE;
501 if (IsEqualIID(riid, &IID_IUnknown))
502 *ppv = (LPVOID)&(This->IInner_vtbl);
503 else if (IsEqualIID(riid, &IID_IPersist))
505 else if (IsEqualIID(riid, &IID_IMediaFilter))
507 else if (IsEqualIID(riid, &IID_IBaseFilter))
509 else if (IsEqualIID(riid, &IID_IBasicVideo))
510 *ppv = (LPVOID)&(This->IBasicVideo_vtbl);
511 else if (IsEqualIID(riid, &IID_IVideoWindow))
512 *ppv = (LPVOID)&(This->IVideoWindow_vtbl);
516 IUnknown_AddRef((IUnknown *)(*ppv));
520 FIXME("No interface for %s!\n", qzdebugstr_guid(riid));
522 return E_NOINTERFACE;
525 static ULONG WINAPI VideoRendererInner_AddRef(IUnknown * iface)
527 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
528 ULONG refCount = InterlockedIncrement(&This->refCount);
530 TRACE("(%p/%p)->() AddRef from %d\n", This, iface, refCount - 1);
535 static ULONG WINAPI VideoRendererInner_Release(IUnknown * iface)
537 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
538 ULONG refCount = InterlockedDecrement(&This->refCount);
540 TRACE("(%p/%p)->() Release from %d\n", This, iface, refCount + 1);
546 DestroyWindow(This->hWnd);
547 PostThreadMessageA(This->ThreadID, WM_QUIT, 0, 0);
548 WaitForSingleObject(This->hThread, INFINITE);
549 CloseHandle(This->hThread);
552 IReferenceClock_Release(This->pClock);
554 if (SUCCEEDED(IPin_ConnectedTo(This->ppPins[0], &pConnectedTo)))
556 IPin_Disconnect(pConnectedTo);
557 IPin_Release(pConnectedTo);
559 IPin_Disconnect(This->ppPins[0]);
561 IPin_Release(This->ppPins[0]);
563 CoTaskMemFree(This->ppPins);
566 This->csFilter.DebugInfo->Spare[0] = 0;
567 DeleteCriticalSection(&This->csFilter);
569 TRACE("Destroying Video Renderer\n");
578 static const IUnknownVtbl IInner_VTable =
580 VideoRendererInner_QueryInterface,
581 VideoRendererInner_AddRef,
582 VideoRendererInner_Release
585 static HRESULT WINAPI VideoRenderer_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv)
587 VideoRendererImpl *This = (VideoRendererImpl *)iface;
589 if (This->bAggregatable)
590 This->bUnkOuterValid = TRUE;
594 if (This->bAggregatable)
595 return IUnknown_QueryInterface(This->pUnkOuter, riid, ppv);
597 if (IsEqualIID(riid, &IID_IUnknown))
601 IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
602 hr = IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
603 IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
604 This->bAggregatable = TRUE;
609 return E_NOINTERFACE;
612 return IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
615 static ULONG WINAPI VideoRenderer_AddRef(IBaseFilter * iface)
617 VideoRendererImpl *This = (VideoRendererImpl *)iface;
619 if (This->pUnkOuter && This->bUnkOuterValid)
620 return IUnknown_AddRef(This->pUnkOuter);
621 return IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
624 static ULONG WINAPI VideoRenderer_Release(IBaseFilter * iface)
626 VideoRendererImpl *This = (VideoRendererImpl *)iface;
628 if (This->pUnkOuter && This->bUnkOuterValid)
629 return IUnknown_Release(This->pUnkOuter);
630 return IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
633 /** IPersist methods **/
635 static HRESULT WINAPI VideoRenderer_GetClassID(IBaseFilter * iface, CLSID * pClsid)
637 VideoRendererImpl *This = (VideoRendererImpl *)iface;
639 TRACE("(%p/%p)->(%p)\n", This, iface, pClsid);
641 *pClsid = CLSID_VideoRenderer;
646 /** IMediaFilter methods **/
648 static HRESULT WINAPI VideoRenderer_Stop(IBaseFilter * iface)
650 VideoRendererImpl *This = (VideoRendererImpl *)iface;
652 TRACE("(%p/%p)->()\n", This, iface);
654 EnterCriticalSection(&This->csFilter);
656 This->state = State_Stopped;
658 LeaveCriticalSection(&This->csFilter);
663 static HRESULT WINAPI VideoRenderer_Pause(IBaseFilter * iface)
665 VideoRendererImpl *This = (VideoRendererImpl *)iface;
667 TRACE("(%p/%p)->()\n", This, iface);
669 EnterCriticalSection(&This->csFilter);
671 This->state = State_Paused;
673 LeaveCriticalSection(&This->csFilter);
678 static HRESULT WINAPI VideoRenderer_Run(IBaseFilter * iface, REFERENCE_TIME tStart)
680 VideoRendererImpl *This = (VideoRendererImpl *)iface;
682 TRACE("(%p/%p)->(%s)\n", This, iface, wine_dbgstr_longlong(tStart));
684 EnterCriticalSection(&This->csFilter);
686 This->rtStreamStart = tStart;
687 This->state = State_Running;
689 LeaveCriticalSection(&This->csFilter);
694 static HRESULT WINAPI VideoRenderer_GetState(IBaseFilter * iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState)
696 VideoRendererImpl *This = (VideoRendererImpl *)iface;
698 TRACE("(%p/%p)->(%d, %p)\n", This, iface, dwMilliSecsTimeout, pState);
700 EnterCriticalSection(&This->csFilter);
702 *pState = This->state;
704 LeaveCriticalSection(&This->csFilter);
709 static HRESULT WINAPI VideoRenderer_SetSyncSource(IBaseFilter * iface, IReferenceClock *pClock)
711 VideoRendererImpl *This = (VideoRendererImpl *)iface;
713 TRACE("(%p/%p)->(%p)\n", This, iface, pClock);
715 EnterCriticalSection(&This->csFilter);
718 IReferenceClock_Release(This->pClock);
719 This->pClock = pClock;
721 IReferenceClock_AddRef(This->pClock);
723 LeaveCriticalSection(&This->csFilter);
728 static HRESULT WINAPI VideoRenderer_GetSyncSource(IBaseFilter * iface, IReferenceClock **ppClock)
730 VideoRendererImpl *This = (VideoRendererImpl *)iface;
732 TRACE("(%p/%p)->(%p)\n", This, iface, ppClock);
734 EnterCriticalSection(&This->csFilter);
736 *ppClock = This->pClock;
737 IReferenceClock_AddRef(This->pClock);
739 LeaveCriticalSection(&This->csFilter);
744 /** IBaseFilter implementation **/
746 static HRESULT WINAPI VideoRenderer_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum)
749 VideoRendererImpl *This = (VideoRendererImpl *)iface;
751 TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
753 epd.cPins = 1; /* input pin */
754 epd.ppPins = This->ppPins;
755 return IEnumPinsImpl_Construct(&epd, ppEnum);
758 static HRESULT WINAPI VideoRenderer_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)
760 VideoRendererImpl *This = (VideoRendererImpl *)iface;
762 TRACE("(%p/%p)->(%p,%p)\n", This, iface, debugstr_w(Id), ppPin);
764 FIXME("VideoRenderer::FindPin(...)\n");
766 /* FIXME: critical section */
771 static HRESULT WINAPI VideoRenderer_QueryFilterInfo(IBaseFilter * iface, FILTER_INFO *pInfo)
773 VideoRendererImpl *This = (VideoRendererImpl *)iface;
775 TRACE("(%p/%p)->(%p)\n", This, iface, pInfo);
777 strcpyW(pInfo->achName, This->filterInfo.achName);
778 pInfo->pGraph = This->filterInfo.pGraph;
781 IFilterGraph_AddRef(pInfo->pGraph);
786 static HRESULT WINAPI VideoRenderer_JoinFilterGraph(IBaseFilter * iface, IFilterGraph *pGraph, LPCWSTR pName)
788 VideoRendererImpl *This = (VideoRendererImpl *)iface;
790 TRACE("(%p/%p)->(%p, %s)\n", This, iface, pGraph, debugstr_w(pName));
792 EnterCriticalSection(&This->csFilter);
795 strcpyW(This->filterInfo.achName, pName);
797 *This->filterInfo.achName = '\0';
798 This->filterInfo.pGraph = pGraph; /* NOTE: do NOT increase ref. count */
800 LeaveCriticalSection(&This->csFilter);
805 static HRESULT WINAPI VideoRenderer_QueryVendorInfo(IBaseFilter * iface, LPWSTR *pVendorInfo)
807 VideoRendererImpl *This = (VideoRendererImpl *)iface;
808 TRACE("(%p/%p)->(%p)\n", This, iface, pVendorInfo);
812 static const IBaseFilterVtbl VideoRenderer_Vtbl =
814 VideoRenderer_QueryInterface,
815 VideoRenderer_AddRef,
816 VideoRenderer_Release,
817 VideoRenderer_GetClassID,
821 VideoRenderer_GetState,
822 VideoRenderer_SetSyncSource,
823 VideoRenderer_GetSyncSource,
824 VideoRenderer_EnumPins,
825 VideoRenderer_FindPin,
826 VideoRenderer_QueryFilterInfo,
827 VideoRenderer_JoinFilterGraph,
828 VideoRenderer_QueryVendorInfo
831 static HRESULT WINAPI VideoRenderer_InputPin_EndOfStream(IPin * iface)
833 InputPin* This = (InputPin*)iface;
834 IMediaEventSink* pEventSink;
837 TRACE("(%p/%p)->()\n", This, iface);
839 hr = IFilterGraph_QueryInterface(((VideoRendererImpl*)This->pin.pinInfo.pFilter)->filterInfo.pGraph, &IID_IMediaEventSink, (LPVOID*)&pEventSink);
842 hr = IMediaEventSink_Notify(pEventSink, EC_COMPLETE, S_OK, 0);
843 IMediaEventSink_Release(pEventSink);
849 static const IPinVtbl VideoRenderer_InputPin_Vtbl =
851 InputPin_QueryInterface,
855 InputPin_ReceiveConnection,
857 IPinImpl_ConnectedTo,
858 IPinImpl_ConnectionMediaType,
859 IPinImpl_QueryPinInfo,
860 IPinImpl_QueryDirection,
862 IPinImpl_QueryAccept,
863 IPinImpl_EnumMediaTypes,
864 IPinImpl_QueryInternalConnections,
865 VideoRenderer_InputPin_EndOfStream,
871 /*** IUnknown methods ***/
872 static HRESULT WINAPI Basicvideo_QueryInterface(IBasicVideo *iface,
875 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
877 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
879 return VideoRenderer_QueryInterface((IBaseFilter*)This, riid, ppvObj);
882 static ULONG WINAPI Basicvideo_AddRef(IBasicVideo *iface) {
883 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
885 TRACE("(%p/%p)->()\n", This, iface);
887 return VideoRenderer_AddRef((IBaseFilter*)This);
890 static ULONG WINAPI Basicvideo_Release(IBasicVideo *iface) {
891 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
893 TRACE("(%p/%p)->()\n", This, iface);
895 return VideoRenderer_Release((IBaseFilter*)This);
898 /*** IDispatch methods ***/
899 static HRESULT WINAPI Basicvideo_GetTypeInfoCount(IBasicVideo *iface,
901 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
903 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
908 static HRESULT WINAPI Basicvideo_GetTypeInfo(IBasicVideo *iface,
911 ITypeInfo**ppTInfo) {
912 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
914 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
919 static HRESULT WINAPI Basicvideo_GetIDsOfNames(IBasicVideo *iface,
925 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
927 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
932 static HRESULT WINAPI Basicvideo_Invoke(IBasicVideo *iface,
937 DISPPARAMS*pDispParams,
941 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
943 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);
948 /*** IBasicVideo methods ***/
949 static HRESULT WINAPI Basicvideo_get_AvgTimePerFrame(IBasicVideo *iface,
950 REFTIME *pAvgTimePerFrame) {
951 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
953 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pAvgTimePerFrame);
958 static HRESULT WINAPI Basicvideo_get_BitRate(IBasicVideo *iface,
960 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
962 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBitRate);
967 static HRESULT WINAPI Basicvideo_get_BitErrorRate(IBasicVideo *iface,
968 long *pBitErrorRate) {
969 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
971 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBitErrorRate);
976 static HRESULT WINAPI Basicvideo_get_VideoWidth(IBasicVideo *iface,
978 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
980 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoWidth);
982 *pVideoWidth = This->VideoWidth;
987 static HRESULT WINAPI Basicvideo_get_VideoHeight(IBasicVideo *iface,
988 long *pVideoHeight) {
989 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
991 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoHeight);
993 *pVideoHeight = This->VideoHeight;
998 static HRESULT WINAPI Basicvideo_put_SourceLeft(IBasicVideo *iface,
1000 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1002 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceLeft);
1004 This->SourceRect.left = SourceLeft;
1009 static HRESULT WINAPI Basicvideo_get_SourceLeft(IBasicVideo *iface,
1010 long *pSourceLeft) {
1011 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1013 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceLeft);
1015 *pSourceLeft = This->SourceRect.left;
1020 static HRESULT WINAPI Basicvideo_put_SourceWidth(IBasicVideo *iface,
1022 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1024 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceWidth);
1026 This->SourceRect.right = This->SourceRect.left + SourceWidth;
1031 static HRESULT WINAPI Basicvideo_get_SourceWidth(IBasicVideo *iface,
1032 long *pSourceWidth) {
1033 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1035 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceWidth);
1037 *pSourceWidth = This->SourceRect.right - This->SourceRect.left;
1042 static HRESULT WINAPI Basicvideo_put_SourceTop(IBasicVideo *iface,
1044 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1046 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceTop);
1048 This->SourceRect.top = SourceTop;
1053 static HRESULT WINAPI Basicvideo_get_SourceTop(IBasicVideo *iface,
1055 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1057 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceTop);
1059 *pSourceTop = This->SourceRect.top;
1064 static HRESULT WINAPI Basicvideo_put_SourceHeight(IBasicVideo *iface,
1065 long SourceHeight) {
1066 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1068 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceHeight);
1070 This->SourceRect.bottom = This->SourceRect.top + SourceHeight;
1075 static HRESULT WINAPI Basicvideo_get_SourceHeight(IBasicVideo *iface,
1076 long *pSourceHeight) {
1077 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1079 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceHeight);
1081 *pSourceHeight = This->SourceRect.bottom - This->SourceRect.top;
1086 static HRESULT WINAPI Basicvideo_put_DestinationLeft(IBasicVideo *iface,
1087 long DestinationLeft) {
1088 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1090 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationLeft);
1092 This->DestRect.left = DestinationLeft;
1097 static HRESULT WINAPI Basicvideo_get_DestinationLeft(IBasicVideo *iface,
1098 long *pDestinationLeft) {
1099 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1101 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationLeft);
1103 *pDestinationLeft = This->DestRect.left;
1108 static HRESULT WINAPI Basicvideo_put_DestinationWidth(IBasicVideo *iface,
1109 long DestinationWidth) {
1110 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1112 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationWidth);
1114 This->DestRect.right = This->DestRect.left + DestinationWidth;
1119 static HRESULT WINAPI Basicvideo_get_DestinationWidth(IBasicVideo *iface,
1120 long *pDestinationWidth) {
1121 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1123 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationWidth);
1125 *pDestinationWidth = This->DestRect.right - This->DestRect.left;
1130 static HRESULT WINAPI Basicvideo_put_DestinationTop(IBasicVideo *iface,
1131 long DestinationTop) {
1132 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1134 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationTop);
1136 This->DestRect.top = DestinationTop;
1141 static HRESULT WINAPI Basicvideo_get_DestinationTop(IBasicVideo *iface,
1142 long *pDestinationTop) {
1143 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1145 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationTop);
1147 *pDestinationTop = This->DestRect.top;
1152 static HRESULT WINAPI Basicvideo_put_DestinationHeight(IBasicVideo *iface,
1153 long DestinationHeight) {
1154 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1156 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationHeight);
1158 This->DestRect.right = This->DestRect.left + DestinationHeight;
1163 static HRESULT WINAPI Basicvideo_get_DestinationHeight(IBasicVideo *iface,
1164 long *pDestinationHeight) {
1165 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1167 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationHeight);
1169 *pDestinationHeight = This->DestRect.right - This->DestRect.left;
1174 static HRESULT WINAPI Basicvideo_SetSourcePosition(IBasicVideo *iface,
1179 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1181 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
1183 This->SourceRect.left = Left;
1184 This->SourceRect.top = Top;
1185 This->SourceRect.right = Left + Width;
1186 This->SourceRect.bottom = Top + Height;
1191 static HRESULT WINAPI Basicvideo_GetSourcePosition(IBasicVideo *iface,
1196 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1198 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1200 *pLeft = This->SourceRect.left;
1201 *pTop = This->SourceRect.top;
1202 *pWidth = This->SourceRect.right - This->SourceRect.left;
1203 *pHeight = This->SourceRect.bottom - This->SourceRect.top;
1208 static HRESULT WINAPI Basicvideo_SetDefaultSourcePosition(IBasicVideo *iface) {
1209 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1211 TRACE("(%p/%p)->()\n", This, iface);
1213 This->SourceRect.left = 0;
1214 This->SourceRect.top = 0;
1215 This->SourceRect.right = This->VideoWidth;
1216 This->SourceRect.bottom = This->VideoHeight;
1221 static HRESULT WINAPI Basicvideo_SetDestinationPosition(IBasicVideo *iface,
1226 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1228 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
1230 This->DestRect.left = Left;
1231 This->DestRect.top = Top;
1232 This->DestRect.right = Left + Width;
1233 This->DestRect.bottom = Top + Height;
1238 static HRESULT WINAPI Basicvideo_GetDestinationPosition(IBasicVideo *iface,
1243 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1245 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1247 *pLeft = This->DestRect.left;
1248 *pTop = This->DestRect.top;
1249 *pWidth = This->DestRect.right - This->DestRect.left;
1250 *pHeight = This->DestRect.bottom - This->DestRect.top;
1255 static HRESULT WINAPI Basicvideo_SetDefaultDestinationPosition(IBasicVideo *iface) {
1256 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1259 TRACE("(%p/%p)->()\n", This, iface);
1261 if (!GetClientRect(This->hWnd, &rect))
1264 This->SourceRect.left = 0;
1265 This->SourceRect.top = 0;
1266 This->SourceRect.right = rect.right;
1267 This->SourceRect.bottom = rect.bottom;
1272 static HRESULT WINAPI Basicvideo_GetVideoSize(IBasicVideo *iface,
1275 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1277 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
1279 *pWidth = This->VideoWidth;
1280 *pHeight = This->VideoHeight;
1285 static HRESULT WINAPI Basicvideo_GetVideoPaletteEntries(IBasicVideo *iface,
1290 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1292 FIXME("(%p/%p)->(%ld, %ld, %p, %p): stub !!!\n", This, iface, StartIndex, Entries, pRetrieved, pPalette);
1297 static HRESULT WINAPI Basicvideo_GetCurrentImage(IBasicVideo *iface,
1300 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1302 FIXME("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pBufferSize, pDIBImage);
1307 static HRESULT WINAPI Basicvideo_IsUsingDefaultSource(IBasicVideo *iface) {
1308 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1310 FIXME("(%p/%p)->(): stub !!!\n", This, iface);
1315 static HRESULT WINAPI Basicvideo_IsUsingDefaultDestination(IBasicVideo *iface) {
1316 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1318 FIXME("(%p/%p)->(): stub !!!\n", This, iface);
1324 static const IBasicVideoVtbl IBasicVideo_VTable =
1326 Basicvideo_QueryInterface,
1329 Basicvideo_GetTypeInfoCount,
1330 Basicvideo_GetTypeInfo,
1331 Basicvideo_GetIDsOfNames,
1333 Basicvideo_get_AvgTimePerFrame,
1334 Basicvideo_get_BitRate,
1335 Basicvideo_get_BitErrorRate,
1336 Basicvideo_get_VideoWidth,
1337 Basicvideo_get_VideoHeight,
1338 Basicvideo_put_SourceLeft,
1339 Basicvideo_get_SourceLeft,
1340 Basicvideo_put_SourceWidth,
1341 Basicvideo_get_SourceWidth,
1342 Basicvideo_put_SourceTop,
1343 Basicvideo_get_SourceTop,
1344 Basicvideo_put_SourceHeight,
1345 Basicvideo_get_SourceHeight,
1346 Basicvideo_put_DestinationLeft,
1347 Basicvideo_get_DestinationLeft,
1348 Basicvideo_put_DestinationWidth,
1349 Basicvideo_get_DestinationWidth,
1350 Basicvideo_put_DestinationTop,
1351 Basicvideo_get_DestinationTop,
1352 Basicvideo_put_DestinationHeight,
1353 Basicvideo_get_DestinationHeight,
1354 Basicvideo_SetSourcePosition,
1355 Basicvideo_GetSourcePosition,
1356 Basicvideo_SetDefaultSourcePosition,
1357 Basicvideo_SetDestinationPosition,
1358 Basicvideo_GetDestinationPosition,
1359 Basicvideo_SetDefaultDestinationPosition,
1360 Basicvideo_GetVideoSize,
1361 Basicvideo_GetVideoPaletteEntries,
1362 Basicvideo_GetCurrentImage,
1363 Basicvideo_IsUsingDefaultSource,
1364 Basicvideo_IsUsingDefaultDestination
1368 /*** IUnknown methods ***/
1369 static HRESULT WINAPI Videowindow_QueryInterface(IVideoWindow *iface,
1372 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1374 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1376 return VideoRenderer_QueryInterface((IBaseFilter*)This, riid, ppvObj);
1379 static ULONG WINAPI Videowindow_AddRef(IVideoWindow *iface) {
1380 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1382 TRACE("(%p/%p)->()\n", This, iface);
1384 return VideoRenderer_AddRef((IBaseFilter*)This);
1387 static ULONG WINAPI Videowindow_Release(IVideoWindow *iface) {
1388 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1390 TRACE("(%p/%p)->()\n", This, iface);
1392 return VideoRenderer_Release((IBaseFilter*)This);
1395 /*** IDispatch methods ***/
1396 static HRESULT WINAPI Videowindow_GetTypeInfoCount(IVideoWindow *iface,
1398 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1400 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
1405 static HRESULT WINAPI Videowindow_GetTypeInfo(IVideoWindow *iface,
1408 ITypeInfo**ppTInfo) {
1409 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1411 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
1416 static HRESULT WINAPI Videowindow_GetIDsOfNames(IVideoWindow *iface,
1422 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1424 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1429 static HRESULT WINAPI Videowindow_Invoke(IVideoWindow *iface,
1430 DISPID dispIdMember,
1434 DISPPARAMS*pDispParams,
1436 EXCEPINFO*pExepInfo,
1438 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1440 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);
1445 /*** IVideoWindow methods ***/
1446 static HRESULT WINAPI Videowindow_put_Caption(IVideoWindow *iface,
1448 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1450 TRACE("(%p/%p)->(%s (%p))\n", This, iface, debugstr_w(strCaption), strCaption);
1452 if (!SetWindowTextW(This->hWnd, strCaption))
1458 static HRESULT WINAPI Videowindow_get_Caption(IVideoWindow *iface,
1460 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1462 TRACE("(%p/%p)->(%p)\n", This, iface, strCaption);
1464 GetWindowTextW(This->hWnd, (LPWSTR)strCaption, 100);
1469 static HRESULT WINAPI Videowindow_put_WindowStyle(IVideoWindow *iface,
1471 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1474 old = GetWindowLongA(This->hWnd, GWL_STYLE);
1476 TRACE("(%p/%p)->(%x -> %lx)\n", This, iface, old, WindowStyle);
1478 if (WindowStyle & (WS_DISABLED|WS_HSCROLL|WS_ICONIC|WS_MAXIMIZE|WS_MINIMIZE|WS_VSCROLL))
1479 return E_INVALIDARG;
1481 SetWindowLongA(This->hWnd, GWL_STYLE, WindowStyle);
1486 static HRESULT WINAPI Videowindow_get_WindowStyle(IVideoWindow *iface,
1487 long *WindowStyle) {
1488 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1490 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyle);
1492 *WindowStyle = GetWindowLongA(This->hWnd, GWL_STYLE);
1497 static HRESULT WINAPI Videowindow_put_WindowStyleEx(IVideoWindow *iface,
1498 long WindowStyleEx) {
1499 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1501 TRACE("(%p/%p)->(%ld)\n", This, iface, WindowStyleEx);
1503 if (WindowStyleEx & (WS_DISABLED|WS_HSCROLL|WS_ICONIC|WS_MAXIMIZE|WS_MINIMIZE|WS_VSCROLL))
1504 return E_INVALIDARG;
1506 if (!SetWindowLongA(This->hWnd, GWL_EXSTYLE, WindowStyleEx))
1512 static HRESULT WINAPI Videowindow_get_WindowStyleEx(IVideoWindow *iface,
1513 long *WindowStyleEx) {
1514 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1516 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyleEx);
1518 *WindowStyleEx = GetWindowLongA(This->hWnd, GWL_EXSTYLE);
1523 static HRESULT WINAPI Videowindow_put_AutoShow(IVideoWindow *iface,
1525 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1527 TRACE("(%p/%p)->(%ld)\n", This, iface, AutoShow);
1529 This->AutoShow = 1; /* FXIME: Should be AutoShow */;
1534 static HRESULT WINAPI Videowindow_get_AutoShow(IVideoWindow *iface,
1536 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1538 TRACE("(%p/%p)->(%p)\n", This, iface, AutoShow);
1540 *AutoShow = This->AutoShow;
1545 static HRESULT WINAPI Videowindow_put_WindowState(IVideoWindow *iface,
1547 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1549 FIXME("(%p/%p)->(%ld): stub !!!\n", This, iface, WindowState);
1554 static HRESULT WINAPI Videowindow_get_WindowState(IVideoWindow *iface,
1555 long *WindowState) {
1556 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1558 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, WindowState);
1563 static HRESULT WINAPI Videowindow_put_BackgroundPalette(IVideoWindow *iface,
1564 long BackgroundPalette) {
1565 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1567 FIXME("(%p/%p)->(%ld): stub !!!\n", This, iface, BackgroundPalette);
1572 static HRESULT WINAPI Videowindow_get_BackgroundPalette(IVideoWindow *iface,
1573 long *pBackgroundPalette) {
1574 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1576 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBackgroundPalette);
1581 static HRESULT WINAPI Videowindow_put_Visible(IVideoWindow *iface,
1583 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1585 TRACE("(%p/%p)->(%ld)\n", This, iface, Visible);
1587 ShowWindow(This->hWnd, Visible ? SW_SHOW : SW_HIDE);
1592 static HRESULT WINAPI Videowindow_get_Visible(IVideoWindow *iface,
1594 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1596 TRACE("(%p/%p)->(%p)\n", This, iface, pVisible);
1598 *pVisible = IsWindowVisible(This->hWnd);
1603 static HRESULT WINAPI Videowindow_put_Left(IVideoWindow *iface,
1605 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1607 TRACE("(%p/%p)->(%ld)\n", This, iface, Left);
1609 if (!SetWindowPos(This->hWnd, NULL, Left, This->WindowPos.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE))
1612 This->WindowPos.left = Left;
1617 static HRESULT WINAPI Videowindow_get_Left(IVideoWindow *iface,
1619 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1621 TRACE("(%p/%p)->(%p)\n", This, iface, pLeft);
1623 *pLeft = This->WindowPos.left;
1628 static HRESULT WINAPI Videowindow_put_Width(IVideoWindow *iface,
1630 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1632 TRACE("(%p/%p)->(%ld)\n", This, iface, Width);
1634 if (!SetWindowPos(This->hWnd, NULL, 0, 0, Width, This->WindowPos.bottom-This->WindowPos.top, SWP_NOZORDER|SWP_NOMOVE))
1637 This->WindowPos.right = This->WindowPos.left + Width;
1642 static HRESULT WINAPI Videowindow_get_Width(IVideoWindow *iface,
1644 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1646 TRACE("(%p/%p)->(%p)\n", This, iface, pWidth);
1648 *pWidth = This->WindowPos.right - This->WindowPos.left;
1653 static HRESULT WINAPI Videowindow_put_Top(IVideoWindow *iface,
1655 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1657 TRACE("(%p/%p)->(%ld)\n", This, iface, Top);
1659 if (!SetWindowPos(This->hWnd, NULL, This->WindowPos.left, Top, 0, 0, SWP_NOZORDER|SWP_NOSIZE))
1662 This->WindowPos.top = Top;
1667 static HRESULT WINAPI Videowindow_get_Top(IVideoWindow *iface,
1669 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1671 TRACE("(%p/%p)->(%p)\n", This, iface, pTop);
1673 *pTop = This->WindowPos.top;
1678 static HRESULT WINAPI Videowindow_put_Height(IVideoWindow *iface,
1680 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1682 TRACE("(%p/%p)->(%ld)\n", This, iface, Height);
1684 if (!SetWindowPos(This->hWnd, NULL, 0, 0, This->WindowPos.right-This->WindowPos.left, Height, SWP_NOZORDER|SWP_NOMOVE))
1687 This->WindowPos.bottom = This->WindowPos.top + Height;
1692 static HRESULT WINAPI Videowindow_get_Height(IVideoWindow *iface,
1694 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1696 TRACE("(%p/%p)->(%p)\n", This, iface, pHeight);
1698 *pHeight = This->WindowPos.bottom - This->WindowPos.top;
1703 static HRESULT WINAPI Videowindow_put_Owner(IVideoWindow *iface,
1705 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1707 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Owner);
1709 SetParent(This->hWnd, (HWND)Owner);
1714 static HRESULT WINAPI Videowindow_get_Owner(IVideoWindow *iface,
1716 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1718 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Owner);
1720 *(HWND*)Owner = GetParent(This->hWnd);
1725 static HRESULT WINAPI Videowindow_put_MessageDrain(IVideoWindow *iface,
1727 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1729 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Drain);
1731 This->hWndMsgDrain = (HWND)Drain;
1736 static HRESULT WINAPI Videowindow_get_MessageDrain(IVideoWindow *iface,
1738 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1740 TRACE("(%p/%p)->(%p)\n", This, iface, Drain);
1742 *Drain = (OAHWND)This->hWndMsgDrain;
1747 static HRESULT WINAPI Videowindow_get_BorderColor(IVideoWindow *iface,
1749 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1751 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, Color);
1756 static HRESULT WINAPI Videowindow_put_BorderColor(IVideoWindow *iface,
1758 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1760 FIXME("(%p/%p)->(%ld): stub !!!\n", This, iface, Color);
1765 static HRESULT WINAPI Videowindow_get_FullScreenMode(IVideoWindow *iface,
1766 long *FullScreenMode) {
1767 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1769 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, FullScreenMode);
1774 static HRESULT WINAPI Videowindow_put_FullScreenMode(IVideoWindow *iface,
1775 long FullScreenMode) {
1776 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1778 FIXME("(%p/%p)->(%ld): stub !!!\n", This, iface, FullScreenMode);
1783 static HRESULT WINAPI Videowindow_SetWindowForeground(IVideoWindow *iface,
1785 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1790 TRACE("(%p/%p)->(%ld)\n", This, iface, Focus);
1792 if ((Focus != FALSE) && (Focus != TRUE))
1793 return E_INVALIDARG;
1795 hr = IPin_ConnectedTo(This->ppPins[0], &pPin);
1796 if ((hr != S_OK) || !pPin)
1797 return VFW_E_NOT_CONNECTED;
1800 ret = SetForegroundWindow(This->hWnd);
1802 ret = SetWindowPos(This->hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
1810 static HRESULT WINAPI Videowindow_NotifyOwnerMessage(IVideoWindow *iface,
1815 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1817 TRACE("(%p/%p)->(%08x, %ld, %08lx, %08lx)\n", This, iface, (DWORD) hwnd, uMsg, wParam, lParam);
1819 if (!PostMessageA(This->hWnd, uMsg, wParam, lParam))
1825 static HRESULT WINAPI Videowindow_SetWindowPosition(IVideoWindow *iface,
1830 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1832 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
1834 if (!SetWindowPos(This->hWnd, NULL, Left, Top, Width, Height, SWP_NOZORDER))
1837 This->WindowPos.left = Left;
1838 This->WindowPos.top = Top;
1839 This->WindowPos.right = Left + Width;
1840 This->WindowPos.bottom = Top + Height;
1845 static HRESULT WINAPI Videowindow_GetWindowPosition(IVideoWindow *iface,
1850 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1852 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1854 *pLeft = This->WindowPos.left;
1855 *pTop = This->WindowPos.top;
1856 *pWidth = This->WindowPos.right - This->WindowPos.left;
1857 *pHeight = This->WindowPos.bottom - This->WindowPos.top;
1862 static HRESULT WINAPI Videowindow_GetMinIdealImageSize(IVideoWindow *iface,
1865 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1867 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This, iface, pWidth, pHeight);
1869 *pWidth = This->VideoWidth;
1870 *pHeight = This->VideoHeight;
1875 static HRESULT WINAPI Videowindow_GetMaxIdealImageSize(IVideoWindow *iface,
1878 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1880 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This, iface, pWidth, pHeight);
1882 *pWidth = This->VideoWidth;
1883 *pHeight = This->VideoHeight;
1888 static HRESULT WINAPI Videowindow_GetRestorePosition(IVideoWindow *iface,
1893 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1895 FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This, iface, pLeft, pTop, pWidth, pHeight);
1900 static HRESULT WINAPI Videowindow_HideCursor(IVideoWindow *iface,
1902 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1904 FIXME("(%p/%p)->(%ld): stub !!!\n", This, iface, HideCursor);
1909 static HRESULT WINAPI Videowindow_IsCursorHidden(IVideoWindow *iface,
1910 long *CursorHidden) {
1911 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1913 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, CursorHidden);
1918 static const IVideoWindowVtbl IVideoWindow_VTable =
1920 Videowindow_QueryInterface,
1922 Videowindow_Release,
1923 Videowindow_GetTypeInfoCount,
1924 Videowindow_GetTypeInfo,
1925 Videowindow_GetIDsOfNames,
1927 Videowindow_put_Caption,
1928 Videowindow_get_Caption,
1929 Videowindow_put_WindowStyle,
1930 Videowindow_get_WindowStyle,
1931 Videowindow_put_WindowStyleEx,
1932 Videowindow_get_WindowStyleEx,
1933 Videowindow_put_AutoShow,
1934 Videowindow_get_AutoShow,
1935 Videowindow_put_WindowState,
1936 Videowindow_get_WindowState,
1937 Videowindow_put_BackgroundPalette,
1938 Videowindow_get_BackgroundPalette,
1939 Videowindow_put_Visible,
1940 Videowindow_get_Visible,
1941 Videowindow_put_Left,
1942 Videowindow_get_Left,
1943 Videowindow_put_Width,
1944 Videowindow_get_Width,
1945 Videowindow_put_Top,
1946 Videowindow_get_Top,
1947 Videowindow_put_Height,
1948 Videowindow_get_Height,
1949 Videowindow_put_Owner,
1950 Videowindow_get_Owner,
1951 Videowindow_put_MessageDrain,
1952 Videowindow_get_MessageDrain,
1953 Videowindow_get_BorderColor,
1954 Videowindow_put_BorderColor,
1955 Videowindow_get_FullScreenMode,
1956 Videowindow_put_FullScreenMode,
1957 Videowindow_SetWindowForeground,
1958 Videowindow_NotifyOwnerMessage,
1959 Videowindow_SetWindowPosition,
1960 Videowindow_GetWindowPosition,
1961 Videowindow_GetMinIdealImageSize,
1962 Videowindow_GetMaxIdealImageSize,
1963 Videowindow_GetRestorePosition,
1964 Videowindow_HideCursor,
1965 Videowindow_IsCursorHidden