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;
90 static LRESULT CALLBACK VideoWndProcA(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
92 VideoRendererImpl* pVideoRenderer = (VideoRendererImpl*)GetWindowLongA(hwnd, 0);
93 LPRECT lprect = (LPRECT)lParam;
95 if (pVideoRenderer && pVideoRenderer->hWndMsgDrain)
101 case WM_LBUTTONDBLCLK:
104 case WM_MBUTTONDBLCLK:
107 case WM_MOUSEACTIVATE:
109 case WM_NCLBUTTONDBLCLK:
110 case WM_NCLBUTTONDOWN:
112 case WM_NCMBUTTONDBLCLK:
113 case WM_NCMBUTTONDOWN:
116 case WM_NCRBUTTONDBLCLK:
117 case WM_NCRBUTTONDOWN:
119 case WM_RBUTTONDBLCLK:
122 PostMessageA(pVideoRenderer->hWndMsgDrain, uMsg, wParam, lParam);
132 /* TRACE("WM_SIZING %d %d %d %d\n", lprect->left, lprect->top, lprect->right, lprect->bottom); */
133 SetWindowPos(hwnd, NULL, lprect->left, lprect->top, lprect->right - lprect->left, lprect->bottom - lprect->top, SWP_NOZORDER);
134 GetClientRect(hwnd, &pVideoRenderer->DestRect);
135 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
136 pVideoRenderer->DestRect.left,
137 pVideoRenderer->DestRect.top,
138 pVideoRenderer->DestRect.right - pVideoRenderer->DestRect.left,
139 pVideoRenderer->DestRect.bottom - pVideoRenderer->DestRect.top);
142 TRACE("WM_SIZE %d %d\n", LOWORD(lParam), HIWORD(lParam));
143 GetClientRect(hwnd, &pVideoRenderer->DestRect);
144 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
145 pVideoRenderer->DestRect.left,
146 pVideoRenderer->DestRect.top,
147 pVideoRenderer->DestRect.right - pVideoRenderer->DestRect.left,
148 pVideoRenderer->DestRect.bottom - pVideoRenderer->DestRect.top);
151 return DefWindowProcA(hwnd, uMsg, wParam, lParam);
156 static BOOL CreateRenderingWindow(VideoRendererImpl* This)
160 TRACE("(%p)->()\n", This);
163 winclass.lpfnWndProc = VideoWndProcA;
164 winclass.cbClsExtra = 0;
165 winclass.cbWndExtra = sizeof(VideoRendererImpl*);
166 winclass.hInstance = NULL;
167 winclass.hIcon = NULL;
168 winclass.hCursor = NULL;
169 winclass.hbrBackground = GetStockObject(BLACK_BRUSH);
170 winclass.lpszMenuName = NULL;
171 winclass.lpszClassName = "Wine ActiveMovie Class";
173 if (!wnd_class_registered)
175 if (!RegisterClassA(&winclass))
177 ERR("Unable to register window %u\n", GetLastError());
180 wnd_class_registered = TRUE;
183 This->hWnd = CreateWindowExA(0, "Wine ActiveMovie Class", "Wine ActiveMovie Window", WS_SIZEBOX,
184 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL,
189 ERR("Unable to create window\n");
193 SetWindowLongA(This->hWnd, 0, (LONG)This);
198 static DWORD WINAPI MessageLoop(LPVOID lpParameter)
200 VideoRendererImpl* This = (VideoRendererImpl*) lpParameter;
204 TRACE("Starting message loop\n");
206 if (!CreateRenderingWindow(This))
208 This->ThreadResult = FALSE;
209 SetEvent(This->hEvent);
213 This->ThreadResult = TRUE;
214 SetEvent(This->hEvent);
216 while ((fGotMessage = GetMessageA(&msg, NULL, 0, 0)) != 0 && fGotMessage != -1)
218 TranslateMessage(&msg);
219 DispatchMessageA(&msg);
222 TRACE("End of message loop\n");
227 static BOOL CreateRenderingSubsystem(VideoRendererImpl* This)
229 This->hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
233 This->hThread = CreateThread(NULL, 0, MessageLoop, (LPVOID)This, 0, &This->ThreadID);
236 CloseHandle(This->hEvent);
240 WaitForSingleObject(This->hEvent, INFINITE);
241 CloseHandle(This->hEvent);
243 if (!This->ThreadResult)
245 CloseHandle(This->hThread);
252 static const IMemInputPinVtbl MemInputPin_Vtbl =
254 MemInputPin_QueryInterface,
257 MemInputPin_GetAllocator,
258 MemInputPin_NotifyAllocator,
259 MemInputPin_GetAllocatorRequirements,
261 MemInputPin_ReceiveMultiple,
262 MemInputPin_ReceiveCanBlock
265 static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data, DWORD size)
272 LPBYTE palette = NULL;
274 BITMAPINFOHEADER *bmiHeader;
276 TRACE("%p %p %d\n", This, data, size);
278 sdesc.dwSize = sizeof(sdesc);
279 hr = IPin_ConnectionMediaType((IPin *)This->pInputPin, &amt);
281 ERR("Unable to retrieve media type\n");
285 if (IsEqualIID(&amt.formattype, &FORMAT_VideoInfo))
287 bmiHeader = &((VIDEOINFOHEADER *)amt.pbFormat)->bmiHeader;
289 else if (IsEqualIID(&amt.formattype, &FORMAT_VideoInfo2))
291 bmiHeader = &((VIDEOINFOHEADER2 *)amt.pbFormat)->bmiHeader;
295 FIXME("Unknown type %s\n", debugstr_guid(&amt.subtype));
296 return VFW_E_RUNTIME_ERROR;
300 TRACE("biSize = %d\n", bmiHeader->biSize);
301 TRACE("biWidth = %d\n", bmiHeader->biWidth);
302 TRACE("biHeight = %d\n", bmiHeader->biHeight);
303 TRACE("biPlanes = %d\n", bmiHeader->biPlanes);
304 TRACE("biBitCount = %d\n", bmiHeader->biBitCount);
305 TRACE("biCompression = %s\n", debugstr_an((LPSTR)&(bmiHeader->biCompression), 4));
306 TRACE("biSizeImage = %d\n", bmiHeader->biSizeImage);
308 width = bmiHeader->biWidth;
309 height = bmiHeader->biHeight;
310 palette = ((LPBYTE)bmiHeader) + bmiHeader->biSize;
314 if (!This->WindowPos.right || !This->WindowPos.bottom)
315 This->WindowPos = This->SourceRect;
317 TRACE("WindowPos: %d %d %d %d\n", This->WindowPos.left, This->WindowPos.top, This->WindowPos.right, This->WindowPos.bottom);
318 SetWindowPos(This->hWnd, NULL,
319 This->WindowPos.left,
321 This->WindowPos.right - This->WindowPos.left,
322 This->WindowPos.bottom - This->WindowPos.top,
323 SWP_NOZORDER|SWP_NOMOVE);
325 GetClientRect(This->hWnd, &This->DestRect);
329 hDC = GetDC(This->hWnd);
332 ERR("Cannot get DC from window!\n");
336 TRACE("Src Rect: %d %d %d %d\n", This->SourceRect.left, This->SourceRect.top, This->SourceRect.right, This->SourceRect.bottom);
337 TRACE("Dst Rect: %d %d %d %d\n", This->DestRect.left, This->DestRect.top, This->DestRect.right, This->DestRect.bottom);
339 StretchDIBits(hDC, This->DestRect.left, This->DestRect.top, This->DestRect.right -This->DestRect.left,
340 This->DestRect.bottom - This->DestRect.top, This->SourceRect.left, This->SourceRect.top,
341 This->SourceRect.right - This->SourceRect.left, This->SourceRect.bottom - This->SourceRect.top,
342 data, (BITMAPINFO *)bmiHeader, DIB_RGB_COLORS, SRCCOPY);
344 ReleaseDC(This->hWnd, hDC);
346 ShowWindow(This->hWnd, SW_SHOW);
351 static HRESULT VideoRenderer_Sample(LPVOID iface, IMediaSample * pSample)
353 VideoRendererImpl *This = (VideoRendererImpl *)iface;
354 LPBYTE pbSrcStream = NULL;
355 long cbSrcStream = 0;
356 REFERENCE_TIME tStart, tStop;
359 if (This->state == State_Stopped)
362 TRACE("%p %p\n", iface, pSample);
364 /* Preroll means the sample isn't shown, this is used for key frames and things like that */
365 if (IMediaSample_IsPreroll(pSample) == S_OK)
368 hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
371 ERR("Cannot get pointer to sample data (%x)\n", hr);
375 hr = IMediaSample_GetTime(pSample, &tStart, &tStop);
377 ERR("Cannot get sample time (%x)\n", hr);
379 cbSrcStream = IMediaSample_GetActualDataLength(pSample);
381 TRACE("val %p %ld\n", pbSrcStream, cbSrcStream);
383 #if 0 /* For debugging purpose */
386 for(i = 0; i < cbSrcStream; i++)
388 if ((i!=0) && !(i%16))
390 TRACE("%02x ", pbSrcStream[i]);
396 VideoRenderer_SendSampleData(This, pbSrcStream, cbSrcStream);
401 static HRESULT VideoRenderer_QueryAccept(LPVOID iface, const AM_MEDIA_TYPE * pmt)
403 if (!IsEqualIID(&pmt->majortype, &MEDIATYPE_Video))
406 if (IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB32) ||
407 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB24) ||
408 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB565) ||
409 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB8))
411 VideoRendererImpl* This = (VideoRendererImpl*) iface;
413 if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo))
415 VIDEOINFOHEADER *format = (VIDEOINFOHEADER *)pmt->pbFormat;
416 This->SourceRect.left = 0;
417 This->SourceRect.top = 0;
418 This->SourceRect.right = This->VideoWidth = format->bmiHeader.biWidth;
419 This->SourceRect.bottom = This->VideoHeight = format->bmiHeader.biHeight;
421 else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2))
423 VIDEOINFOHEADER2 *format2 = (VIDEOINFOHEADER2 *)pmt->pbFormat;
425 This->SourceRect.left = 0;
426 This->SourceRect.top = 0;
427 This->SourceRect.right = This->VideoWidth = format2->bmiHeader.biWidth;
428 This->SourceRect.bottom = This->VideoHeight = format2->bmiHeader.biHeight;
432 WARN("Format type %s not supported\n", debugstr_guid(&pmt->formattype));
440 HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
444 VideoRendererImpl * pVideoRenderer;
446 TRACE("(%p, %p)\n", pUnkOuter, ppv);
450 pVideoRenderer = CoTaskMemAlloc(sizeof(VideoRendererImpl));
451 pVideoRenderer->pUnkOuter = pUnkOuter;
452 pVideoRenderer->bUnkOuterValid = FALSE;
453 pVideoRenderer->bAggregatable = FALSE;
454 pVideoRenderer->IInner_vtbl = &IInner_VTable;
456 pVideoRenderer->lpVtbl = &VideoRenderer_Vtbl;
457 pVideoRenderer->IBasicVideo_vtbl = &IBasicVideo_VTable;
458 pVideoRenderer->IVideoWindow_vtbl = &IVideoWindow_VTable;
460 pVideoRenderer->refCount = 1;
461 InitializeCriticalSection(&pVideoRenderer->csFilter);
462 pVideoRenderer->csFilter.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": VideoRendererImpl.csFilter");
463 pVideoRenderer->state = State_Stopped;
464 pVideoRenderer->pClock = NULL;
465 pVideoRenderer->init = 0;
466 pVideoRenderer->AutoShow = 1;
467 ZeroMemory(&pVideoRenderer->filterInfo, sizeof(FILTER_INFO));
469 /* construct input pin */
470 piInput.dir = PINDIR_INPUT;
471 piInput.pFilter = (IBaseFilter *)pVideoRenderer;
472 lstrcpynW(piInput.achName, wcsInputPinName, sizeof(piInput.achName) / sizeof(piInput.achName[0]));
474 hr = InputPin_Construct(&VideoRenderer_InputPin_Vtbl, &piInput, VideoRenderer_Sample, (LPVOID)pVideoRenderer, VideoRenderer_QueryAccept, NULL, &pVideoRenderer->csFilter, (IPin **)&pVideoRenderer->pInputPin);
478 *ppv = (LPVOID)pVideoRenderer;
482 pVideoRenderer->csFilter.DebugInfo->Spare[0] = 0;
483 DeleteCriticalSection(&pVideoRenderer->csFilter);
484 CoTaskMemFree(pVideoRenderer);
487 if (!CreateRenderingSubsystem(pVideoRenderer))
493 HRESULT VideoRendererDefault_create(IUnknown * pUnkOuter, LPVOID * ppv)
495 /* TODO: Attempt to use the VMR-7 renderer instead when possible */
496 return VideoRenderer_create(pUnkOuter, ppv);
499 static HRESULT WINAPI VideoRendererInner_QueryInterface(IUnknown * iface, REFIID riid, LPVOID * ppv)
501 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
502 TRACE("(%p/%p)->(%s, %p)\n", This, iface, qzdebugstr_guid(riid), ppv);
504 if (This->bAggregatable)
505 This->bUnkOuterValid = TRUE;
509 if (IsEqualIID(riid, &IID_IUnknown))
510 *ppv = (LPVOID)&(This->IInner_vtbl);
511 else if (IsEqualIID(riid, &IID_IPersist))
513 else if (IsEqualIID(riid, &IID_IMediaFilter))
515 else if (IsEqualIID(riid, &IID_IBaseFilter))
517 else if (IsEqualIID(riid, &IID_IBasicVideo))
518 *ppv = (LPVOID)&(This->IBasicVideo_vtbl);
519 else if (IsEqualIID(riid, &IID_IVideoWindow))
520 *ppv = (LPVOID)&(This->IVideoWindow_vtbl);
524 IUnknown_AddRef((IUnknown *)(*ppv));
528 if (!IsEqualIID(riid, &IID_IPin))
529 FIXME("No interface for %s!\n", qzdebugstr_guid(riid));
531 return E_NOINTERFACE;
534 static ULONG WINAPI VideoRendererInner_AddRef(IUnknown * iface)
536 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
537 ULONG refCount = InterlockedIncrement(&This->refCount);
539 TRACE("(%p/%p)->() AddRef from %d\n", This, iface, refCount - 1);
544 static ULONG WINAPI VideoRendererInner_Release(IUnknown * iface)
546 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
547 ULONG refCount = InterlockedDecrement(&This->refCount);
549 TRACE("(%p/%p)->() Release from %d\n", This, iface, refCount + 1);
555 DestroyWindow(This->hWnd);
556 PostThreadMessageA(This->ThreadID, WM_QUIT, 0, 0);
557 WaitForSingleObject(This->hThread, INFINITE);
558 CloseHandle(This->hThread);
561 IReferenceClock_Release(This->pClock);
563 if (SUCCEEDED(IPin_ConnectedTo((IPin *)This->pInputPin, &pConnectedTo)))
565 IPin_Disconnect(pConnectedTo);
566 IPin_Release(pConnectedTo);
568 IPin_Disconnect((IPin *)This->pInputPin);
570 IPin_Release((IPin *)This->pInputPin);
574 This->csFilter.DebugInfo->Spare[0] = 0;
575 DeleteCriticalSection(&This->csFilter);
577 TRACE("Destroying Video Renderer\n");
586 static const IUnknownVtbl IInner_VTable =
588 VideoRendererInner_QueryInterface,
589 VideoRendererInner_AddRef,
590 VideoRendererInner_Release
593 static HRESULT WINAPI VideoRenderer_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv)
595 VideoRendererImpl *This = (VideoRendererImpl *)iface;
597 if (This->bAggregatable)
598 This->bUnkOuterValid = TRUE;
602 if (This->bAggregatable)
603 return IUnknown_QueryInterface(This->pUnkOuter, riid, ppv);
605 if (IsEqualIID(riid, &IID_IUnknown))
609 IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
610 hr = IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
611 IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
612 This->bAggregatable = TRUE;
617 return E_NOINTERFACE;
620 return IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
623 static ULONG WINAPI VideoRenderer_AddRef(IBaseFilter * iface)
625 VideoRendererImpl *This = (VideoRendererImpl *)iface;
627 if (This->pUnkOuter && This->bUnkOuterValid)
628 return IUnknown_AddRef(This->pUnkOuter);
629 return IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
632 static ULONG WINAPI VideoRenderer_Release(IBaseFilter * iface)
634 VideoRendererImpl *This = (VideoRendererImpl *)iface;
636 if (This->pUnkOuter && This->bUnkOuterValid)
637 return IUnknown_Release(This->pUnkOuter);
638 return IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
641 /** IPersist methods **/
643 static HRESULT WINAPI VideoRenderer_GetClassID(IBaseFilter * iface, CLSID * pClsid)
645 VideoRendererImpl *This = (VideoRendererImpl *)iface;
647 TRACE("(%p/%p)->(%p)\n", This, iface, pClsid);
649 *pClsid = CLSID_VideoRenderer;
654 /** IMediaFilter methods **/
656 static HRESULT WINAPI VideoRenderer_Stop(IBaseFilter * iface)
658 VideoRendererImpl *This = (VideoRendererImpl *)iface;
660 TRACE("(%p/%p)->()\n", This, iface);
662 EnterCriticalSection(&This->csFilter);
664 This->state = State_Stopped;
666 LeaveCriticalSection(&This->csFilter);
671 static HRESULT WINAPI VideoRenderer_Pause(IBaseFilter * iface)
673 VideoRendererImpl *This = (VideoRendererImpl *)iface;
675 TRACE("(%p/%p)->()\n", This, iface);
677 EnterCriticalSection(&This->csFilter);
679 if (This->state == State_Stopped)
680 This->pInputPin->end_of_stream = 0;
682 This->state = State_Paused;
684 LeaveCriticalSection(&This->csFilter);
689 static HRESULT WINAPI VideoRenderer_Run(IBaseFilter * iface, REFERENCE_TIME tStart)
691 VideoRendererImpl *This = (VideoRendererImpl *)iface;
693 TRACE("(%p/%p)->(%s)\n", This, iface, wine_dbgstr_longlong(tStart));
695 EnterCriticalSection(&This->csFilter);
696 if (This->state != State_Running)
698 if (This->state == State_Stopped)
699 This->pInputPin->end_of_stream = 0;
701 This->rtStreamStart = tStart;
702 This->state = State_Running;
704 LeaveCriticalSection(&This->csFilter);
709 static HRESULT WINAPI VideoRenderer_GetState(IBaseFilter * iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState)
711 VideoRendererImpl *This = (VideoRendererImpl *)iface;
713 TRACE("(%p/%p)->(%d, %p)\n", This, iface, dwMilliSecsTimeout, pState);
715 EnterCriticalSection(&This->csFilter);
717 *pState = This->state;
719 LeaveCriticalSection(&This->csFilter);
724 static HRESULT WINAPI VideoRenderer_SetSyncSource(IBaseFilter * iface, IReferenceClock *pClock)
726 VideoRendererImpl *This = (VideoRendererImpl *)iface;
728 TRACE("(%p/%p)->(%p)\n", This, iface, pClock);
730 EnterCriticalSection(&This->csFilter);
733 IReferenceClock_Release(This->pClock);
734 This->pClock = pClock;
736 IReferenceClock_AddRef(This->pClock);
738 LeaveCriticalSection(&This->csFilter);
743 static HRESULT WINAPI VideoRenderer_GetSyncSource(IBaseFilter * iface, IReferenceClock **ppClock)
745 VideoRendererImpl *This = (VideoRendererImpl *)iface;
747 TRACE("(%p/%p)->(%p)\n", This, iface, ppClock);
749 EnterCriticalSection(&This->csFilter);
751 *ppClock = This->pClock;
753 IReferenceClock_AddRef(This->pClock);
755 LeaveCriticalSection(&This->csFilter);
760 /** IBaseFilter implementation **/
762 static HRESULT VideoRenderer_GetPin(IBaseFilter *iface, ULONG pos, IPin **pin, DWORD *lastsynctick)
764 VideoRendererImpl *This = (VideoRendererImpl *)iface;
766 /* Our pins are static, not changing so setting static tick count is ok */
772 *pin = (IPin *)This->pInputPin;
777 static HRESULT WINAPI VideoRenderer_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum)
779 VideoRendererImpl *This = (VideoRendererImpl *)iface;
781 TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
783 return IEnumPinsImpl_Construct(ppEnum, VideoRenderer_GetPin, iface);
786 static HRESULT WINAPI VideoRenderer_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)
788 VideoRendererImpl *This = (VideoRendererImpl *)iface;
790 TRACE("(%p/%p)->(%p,%p)\n", This, iface, debugstr_w(Id), ppPin);
792 FIXME("VideoRenderer::FindPin(...)\n");
794 /* FIXME: critical section */
799 static HRESULT WINAPI VideoRenderer_QueryFilterInfo(IBaseFilter * iface, FILTER_INFO *pInfo)
801 VideoRendererImpl *This = (VideoRendererImpl *)iface;
803 TRACE("(%p/%p)->(%p)\n", This, iface, pInfo);
805 strcpyW(pInfo->achName, This->filterInfo.achName);
806 pInfo->pGraph = This->filterInfo.pGraph;
809 IFilterGraph_AddRef(pInfo->pGraph);
814 static HRESULT WINAPI VideoRenderer_JoinFilterGraph(IBaseFilter * iface, IFilterGraph *pGraph, LPCWSTR pName)
816 VideoRendererImpl *This = (VideoRendererImpl *)iface;
818 TRACE("(%p/%p)->(%p, %s)\n", This, iface, pGraph, debugstr_w(pName));
820 EnterCriticalSection(&This->csFilter);
823 strcpyW(This->filterInfo.achName, pName);
825 *This->filterInfo.achName = '\0';
826 This->filterInfo.pGraph = pGraph; /* NOTE: do NOT increase ref. count */
828 LeaveCriticalSection(&This->csFilter);
833 static HRESULT WINAPI VideoRenderer_QueryVendorInfo(IBaseFilter * iface, LPWSTR *pVendorInfo)
835 VideoRendererImpl *This = (VideoRendererImpl *)iface;
836 TRACE("(%p/%p)->(%p)\n", This, iface, pVendorInfo);
840 static const IBaseFilterVtbl VideoRenderer_Vtbl =
842 VideoRenderer_QueryInterface,
843 VideoRenderer_AddRef,
844 VideoRenderer_Release,
845 VideoRenderer_GetClassID,
849 VideoRenderer_GetState,
850 VideoRenderer_SetSyncSource,
851 VideoRenderer_GetSyncSource,
852 VideoRenderer_EnumPins,
853 VideoRenderer_FindPin,
854 VideoRenderer_QueryFilterInfo,
855 VideoRenderer_JoinFilterGraph,
856 VideoRenderer_QueryVendorInfo
859 static HRESULT WINAPI VideoRenderer_InputPin_EndOfStream(IPin * iface)
861 InputPin* This = (InputPin*)iface;
862 IMediaEventSink* pEventSink;
865 TRACE("(%p/%p)->()\n", This, iface);
867 hr = IFilterGraph_QueryInterface(((VideoRendererImpl*)This->pin.pinInfo.pFilter)->filterInfo.pGraph, &IID_IMediaEventSink, (LPVOID*)&pEventSink);
870 hr = IMediaEventSink_Notify(pEventSink, EC_COMPLETE, S_OK, 0);
871 IMediaEventSink_Release(pEventSink);
877 static const IPinVtbl VideoRenderer_InputPin_Vtbl =
879 InputPin_QueryInterface,
883 InputPin_ReceiveConnection,
885 IPinImpl_ConnectedTo,
886 IPinImpl_ConnectionMediaType,
887 IPinImpl_QueryPinInfo,
888 IPinImpl_QueryDirection,
890 IPinImpl_QueryAccept,
891 IPinImpl_EnumMediaTypes,
892 IPinImpl_QueryInternalConnections,
893 VideoRenderer_InputPin_EndOfStream,
899 /*** IUnknown methods ***/
900 static HRESULT WINAPI Basicvideo_QueryInterface(IBasicVideo *iface,
903 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
905 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
907 return VideoRenderer_QueryInterface((IBaseFilter*)This, riid, ppvObj);
910 static ULONG WINAPI Basicvideo_AddRef(IBasicVideo *iface) {
911 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
913 TRACE("(%p/%p)->()\n", This, iface);
915 return VideoRenderer_AddRef((IBaseFilter*)This);
918 static ULONG WINAPI Basicvideo_Release(IBasicVideo *iface) {
919 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
921 TRACE("(%p/%p)->()\n", This, iface);
923 return VideoRenderer_Release((IBaseFilter*)This);
926 /*** IDispatch methods ***/
927 static HRESULT WINAPI Basicvideo_GetTypeInfoCount(IBasicVideo *iface,
929 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
931 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
936 static HRESULT WINAPI Basicvideo_GetTypeInfo(IBasicVideo *iface,
939 ITypeInfo**ppTInfo) {
940 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
942 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
947 static HRESULT WINAPI Basicvideo_GetIDsOfNames(IBasicVideo *iface,
953 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
955 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
960 static HRESULT WINAPI Basicvideo_Invoke(IBasicVideo *iface,
965 DISPPARAMS*pDispParams,
969 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
971 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);
976 /*** IBasicVideo methods ***/
977 static HRESULT WINAPI Basicvideo_get_AvgTimePerFrame(IBasicVideo *iface,
978 REFTIME *pAvgTimePerFrame) {
979 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
981 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pAvgTimePerFrame);
986 static HRESULT WINAPI Basicvideo_get_BitRate(IBasicVideo *iface,
988 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
990 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBitRate);
995 static HRESULT WINAPI Basicvideo_get_BitErrorRate(IBasicVideo *iface,
996 long *pBitErrorRate) {
997 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
999 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBitErrorRate);
1004 static HRESULT WINAPI Basicvideo_get_VideoWidth(IBasicVideo *iface,
1005 long *pVideoWidth) {
1006 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1008 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoWidth);
1010 *pVideoWidth = This->VideoWidth;
1015 static HRESULT WINAPI Basicvideo_get_VideoHeight(IBasicVideo *iface,
1016 long *pVideoHeight) {
1017 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1019 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoHeight);
1021 *pVideoHeight = This->VideoHeight;
1026 static HRESULT WINAPI Basicvideo_put_SourceLeft(IBasicVideo *iface,
1028 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1030 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceLeft);
1032 This->SourceRect.left = SourceLeft;
1037 static HRESULT WINAPI Basicvideo_get_SourceLeft(IBasicVideo *iface,
1038 long *pSourceLeft) {
1039 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1041 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceLeft);
1043 *pSourceLeft = This->SourceRect.left;
1048 static HRESULT WINAPI Basicvideo_put_SourceWidth(IBasicVideo *iface,
1050 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1052 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceWidth);
1054 This->SourceRect.right = This->SourceRect.left + SourceWidth;
1059 static HRESULT WINAPI Basicvideo_get_SourceWidth(IBasicVideo *iface,
1060 long *pSourceWidth) {
1061 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1063 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceWidth);
1065 *pSourceWidth = This->SourceRect.right - This->SourceRect.left;
1070 static HRESULT WINAPI Basicvideo_put_SourceTop(IBasicVideo *iface,
1072 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1074 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceTop);
1076 This->SourceRect.top = SourceTop;
1081 static HRESULT WINAPI Basicvideo_get_SourceTop(IBasicVideo *iface,
1083 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1085 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceTop);
1087 *pSourceTop = This->SourceRect.top;
1092 static HRESULT WINAPI Basicvideo_put_SourceHeight(IBasicVideo *iface,
1093 long SourceHeight) {
1094 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1096 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceHeight);
1098 This->SourceRect.bottom = This->SourceRect.top + SourceHeight;
1103 static HRESULT WINAPI Basicvideo_get_SourceHeight(IBasicVideo *iface,
1104 long *pSourceHeight) {
1105 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1107 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceHeight);
1109 *pSourceHeight = This->SourceRect.bottom - This->SourceRect.top;
1114 static HRESULT WINAPI Basicvideo_put_DestinationLeft(IBasicVideo *iface,
1115 long DestinationLeft) {
1116 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1118 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationLeft);
1120 This->DestRect.left = DestinationLeft;
1125 static HRESULT WINAPI Basicvideo_get_DestinationLeft(IBasicVideo *iface,
1126 long *pDestinationLeft) {
1127 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1129 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationLeft);
1131 *pDestinationLeft = This->DestRect.left;
1136 static HRESULT WINAPI Basicvideo_put_DestinationWidth(IBasicVideo *iface,
1137 long DestinationWidth) {
1138 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1140 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationWidth);
1142 This->DestRect.right = This->DestRect.left + DestinationWidth;
1147 static HRESULT WINAPI Basicvideo_get_DestinationWidth(IBasicVideo *iface,
1148 long *pDestinationWidth) {
1149 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1151 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationWidth);
1153 *pDestinationWidth = This->DestRect.right - This->DestRect.left;
1158 static HRESULT WINAPI Basicvideo_put_DestinationTop(IBasicVideo *iface,
1159 long DestinationTop) {
1160 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1162 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationTop);
1164 This->DestRect.top = DestinationTop;
1169 static HRESULT WINAPI Basicvideo_get_DestinationTop(IBasicVideo *iface,
1170 long *pDestinationTop) {
1171 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1173 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationTop);
1175 *pDestinationTop = This->DestRect.top;
1180 static HRESULT WINAPI Basicvideo_put_DestinationHeight(IBasicVideo *iface,
1181 long DestinationHeight) {
1182 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1184 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationHeight);
1186 This->DestRect.right = This->DestRect.left + DestinationHeight;
1191 static HRESULT WINAPI Basicvideo_get_DestinationHeight(IBasicVideo *iface,
1192 long *pDestinationHeight) {
1193 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1195 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationHeight);
1197 *pDestinationHeight = This->DestRect.right - This->DestRect.left;
1202 static HRESULT WINAPI Basicvideo_SetSourcePosition(IBasicVideo *iface,
1207 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1209 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
1211 This->SourceRect.left = Left;
1212 This->SourceRect.top = Top;
1213 This->SourceRect.right = Left + Width;
1214 This->SourceRect.bottom = Top + Height;
1219 static HRESULT WINAPI Basicvideo_GetSourcePosition(IBasicVideo *iface,
1224 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1226 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1228 *pLeft = This->SourceRect.left;
1229 *pTop = This->SourceRect.top;
1230 *pWidth = This->SourceRect.right - This->SourceRect.left;
1231 *pHeight = This->SourceRect.bottom - This->SourceRect.top;
1236 static HRESULT WINAPI Basicvideo_SetDefaultSourcePosition(IBasicVideo *iface) {
1237 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1239 TRACE("(%p/%p)->()\n", This, iface);
1241 This->SourceRect.left = 0;
1242 This->SourceRect.top = 0;
1243 This->SourceRect.right = This->VideoWidth;
1244 This->SourceRect.bottom = This->VideoHeight;
1249 static HRESULT WINAPI Basicvideo_SetDestinationPosition(IBasicVideo *iface,
1254 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1256 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
1258 This->DestRect.left = Left;
1259 This->DestRect.top = Top;
1260 This->DestRect.right = Left + Width;
1261 This->DestRect.bottom = Top + Height;
1266 static HRESULT WINAPI Basicvideo_GetDestinationPosition(IBasicVideo *iface,
1271 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1273 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1275 *pLeft = This->DestRect.left;
1276 *pTop = This->DestRect.top;
1277 *pWidth = This->DestRect.right - This->DestRect.left;
1278 *pHeight = This->DestRect.bottom - This->DestRect.top;
1283 static HRESULT WINAPI Basicvideo_SetDefaultDestinationPosition(IBasicVideo *iface) {
1284 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1287 TRACE("(%p/%p)->()\n", This, iface);
1289 if (!GetClientRect(This->hWnd, &rect))
1292 This->SourceRect.left = 0;
1293 This->SourceRect.top = 0;
1294 This->SourceRect.right = rect.right;
1295 This->SourceRect.bottom = rect.bottom;
1300 static HRESULT WINAPI Basicvideo_GetVideoSize(IBasicVideo *iface,
1303 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1305 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
1307 *pWidth = This->VideoWidth;
1308 *pHeight = This->VideoHeight;
1313 static HRESULT WINAPI Basicvideo_GetVideoPaletteEntries(IBasicVideo *iface,
1318 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1320 FIXME("(%p/%p)->(%ld, %ld, %p, %p): stub !!!\n", This, iface, StartIndex, Entries, pRetrieved, pPalette);
1325 static HRESULT WINAPI Basicvideo_GetCurrentImage(IBasicVideo *iface,
1328 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1330 FIXME("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pBufferSize, pDIBImage);
1335 static HRESULT WINAPI Basicvideo_IsUsingDefaultSource(IBasicVideo *iface) {
1336 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1338 FIXME("(%p/%p)->(): stub !!!\n", This, iface);
1343 static HRESULT WINAPI Basicvideo_IsUsingDefaultDestination(IBasicVideo *iface) {
1344 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1346 FIXME("(%p/%p)->(): stub !!!\n", This, iface);
1352 static const IBasicVideoVtbl IBasicVideo_VTable =
1354 Basicvideo_QueryInterface,
1357 Basicvideo_GetTypeInfoCount,
1358 Basicvideo_GetTypeInfo,
1359 Basicvideo_GetIDsOfNames,
1361 Basicvideo_get_AvgTimePerFrame,
1362 Basicvideo_get_BitRate,
1363 Basicvideo_get_BitErrorRate,
1364 Basicvideo_get_VideoWidth,
1365 Basicvideo_get_VideoHeight,
1366 Basicvideo_put_SourceLeft,
1367 Basicvideo_get_SourceLeft,
1368 Basicvideo_put_SourceWidth,
1369 Basicvideo_get_SourceWidth,
1370 Basicvideo_put_SourceTop,
1371 Basicvideo_get_SourceTop,
1372 Basicvideo_put_SourceHeight,
1373 Basicvideo_get_SourceHeight,
1374 Basicvideo_put_DestinationLeft,
1375 Basicvideo_get_DestinationLeft,
1376 Basicvideo_put_DestinationWidth,
1377 Basicvideo_get_DestinationWidth,
1378 Basicvideo_put_DestinationTop,
1379 Basicvideo_get_DestinationTop,
1380 Basicvideo_put_DestinationHeight,
1381 Basicvideo_get_DestinationHeight,
1382 Basicvideo_SetSourcePosition,
1383 Basicvideo_GetSourcePosition,
1384 Basicvideo_SetDefaultSourcePosition,
1385 Basicvideo_SetDestinationPosition,
1386 Basicvideo_GetDestinationPosition,
1387 Basicvideo_SetDefaultDestinationPosition,
1388 Basicvideo_GetVideoSize,
1389 Basicvideo_GetVideoPaletteEntries,
1390 Basicvideo_GetCurrentImage,
1391 Basicvideo_IsUsingDefaultSource,
1392 Basicvideo_IsUsingDefaultDestination
1396 /*** IUnknown methods ***/
1397 static HRESULT WINAPI Videowindow_QueryInterface(IVideoWindow *iface,
1400 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1402 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1404 return VideoRenderer_QueryInterface((IBaseFilter*)This, riid, ppvObj);
1407 static ULONG WINAPI Videowindow_AddRef(IVideoWindow *iface) {
1408 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1410 TRACE("(%p/%p)->()\n", This, iface);
1412 return VideoRenderer_AddRef((IBaseFilter*)This);
1415 static ULONG WINAPI Videowindow_Release(IVideoWindow *iface) {
1416 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1418 TRACE("(%p/%p)->()\n", This, iface);
1420 return VideoRenderer_Release((IBaseFilter*)This);
1423 /*** IDispatch methods ***/
1424 static HRESULT WINAPI Videowindow_GetTypeInfoCount(IVideoWindow *iface,
1426 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1428 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
1433 static HRESULT WINAPI Videowindow_GetTypeInfo(IVideoWindow *iface,
1436 ITypeInfo**ppTInfo) {
1437 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1439 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
1444 static HRESULT WINAPI Videowindow_GetIDsOfNames(IVideoWindow *iface,
1450 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1452 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1457 static HRESULT WINAPI Videowindow_Invoke(IVideoWindow *iface,
1458 DISPID dispIdMember,
1462 DISPPARAMS*pDispParams,
1464 EXCEPINFO*pExepInfo,
1466 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1468 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);
1473 /*** IVideoWindow methods ***/
1474 static HRESULT WINAPI Videowindow_put_Caption(IVideoWindow *iface,
1476 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1478 TRACE("(%p/%p)->(%s (%p))\n", This, iface, debugstr_w(strCaption), strCaption);
1480 if (!SetWindowTextW(This->hWnd, strCaption))
1486 static HRESULT WINAPI Videowindow_get_Caption(IVideoWindow *iface,
1488 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1490 TRACE("(%p/%p)->(%p)\n", This, iface, strCaption);
1492 GetWindowTextW(This->hWnd, (LPWSTR)strCaption, 100);
1497 static HRESULT WINAPI Videowindow_put_WindowStyle(IVideoWindow *iface,
1499 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1502 old = GetWindowLongA(This->hWnd, GWL_STYLE);
1504 TRACE("(%p/%p)->(%x -> %lx)\n", This, iface, old, WindowStyle);
1506 if (WindowStyle & (WS_DISABLED|WS_HSCROLL|WS_ICONIC|WS_MAXIMIZE|WS_MINIMIZE|WS_VSCROLL))
1507 return E_INVALIDARG;
1509 SetWindowLongA(This->hWnd, GWL_STYLE, WindowStyle);
1514 static HRESULT WINAPI Videowindow_get_WindowStyle(IVideoWindow *iface,
1515 long *WindowStyle) {
1516 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1518 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyle);
1520 *WindowStyle = GetWindowLongA(This->hWnd, GWL_STYLE);
1525 static HRESULT WINAPI Videowindow_put_WindowStyleEx(IVideoWindow *iface,
1526 long WindowStyleEx) {
1527 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1529 TRACE("(%p/%p)->(%ld)\n", This, iface, WindowStyleEx);
1531 if (WindowStyleEx & (WS_DISABLED|WS_HSCROLL|WS_ICONIC|WS_MAXIMIZE|WS_MINIMIZE|WS_VSCROLL))
1532 return E_INVALIDARG;
1534 if (!SetWindowLongA(This->hWnd, GWL_EXSTYLE, WindowStyleEx))
1540 static HRESULT WINAPI Videowindow_get_WindowStyleEx(IVideoWindow *iface,
1541 long *WindowStyleEx) {
1542 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1544 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyleEx);
1546 *WindowStyleEx = GetWindowLongA(This->hWnd, GWL_EXSTYLE);
1551 static HRESULT WINAPI Videowindow_put_AutoShow(IVideoWindow *iface,
1553 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1555 TRACE("(%p/%p)->(%ld)\n", This, iface, AutoShow);
1557 This->AutoShow = 1; /* FXIME: Should be AutoShow */;
1562 static HRESULT WINAPI Videowindow_get_AutoShow(IVideoWindow *iface,
1564 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1566 TRACE("(%p/%p)->(%p)\n", This, iface, AutoShow);
1568 *AutoShow = This->AutoShow;
1573 static HRESULT WINAPI Videowindow_put_WindowState(IVideoWindow *iface,
1575 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1577 FIXME("(%p/%p)->(%ld): stub !!!\n", This, iface, WindowState);
1582 static HRESULT WINAPI Videowindow_get_WindowState(IVideoWindow *iface,
1583 long *WindowState) {
1584 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1586 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, WindowState);
1591 static HRESULT WINAPI Videowindow_put_BackgroundPalette(IVideoWindow *iface,
1592 long BackgroundPalette) {
1593 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1595 FIXME("(%p/%p)->(%ld): stub !!!\n", This, iface, BackgroundPalette);
1600 static HRESULT WINAPI Videowindow_get_BackgroundPalette(IVideoWindow *iface,
1601 long *pBackgroundPalette) {
1602 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1604 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBackgroundPalette);
1609 static HRESULT WINAPI Videowindow_put_Visible(IVideoWindow *iface,
1611 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1613 TRACE("(%p/%p)->(%ld)\n", This, iface, Visible);
1615 ShowWindow(This->hWnd, Visible ? SW_SHOW : SW_HIDE);
1620 static HRESULT WINAPI Videowindow_get_Visible(IVideoWindow *iface,
1622 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1624 TRACE("(%p/%p)->(%p)\n", This, iface, pVisible);
1626 *pVisible = IsWindowVisible(This->hWnd);
1631 static HRESULT WINAPI Videowindow_put_Left(IVideoWindow *iface,
1633 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1635 TRACE("(%p/%p)->(%ld)\n", This, iface, Left);
1637 if (!SetWindowPos(This->hWnd, NULL, Left, This->WindowPos.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE))
1640 This->WindowPos.left = Left;
1645 static HRESULT WINAPI Videowindow_get_Left(IVideoWindow *iface,
1647 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1649 TRACE("(%p/%p)->(%p)\n", This, iface, pLeft);
1651 *pLeft = This->WindowPos.left;
1656 static HRESULT WINAPI Videowindow_put_Width(IVideoWindow *iface,
1658 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1660 TRACE("(%p/%p)->(%ld)\n", This, iface, Width);
1662 if (!SetWindowPos(This->hWnd, NULL, 0, 0, Width, This->WindowPos.bottom-This->WindowPos.top, SWP_NOZORDER|SWP_NOMOVE))
1665 This->WindowPos.right = This->WindowPos.left + Width;
1670 static HRESULT WINAPI Videowindow_get_Width(IVideoWindow *iface,
1672 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1674 TRACE("(%p/%p)->(%p)\n", This, iface, pWidth);
1676 *pWidth = This->WindowPos.right - This->WindowPos.left;
1681 static HRESULT WINAPI Videowindow_put_Top(IVideoWindow *iface,
1683 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1685 TRACE("(%p/%p)->(%ld)\n", This, iface, Top);
1687 if (!SetWindowPos(This->hWnd, NULL, This->WindowPos.left, Top, 0, 0, SWP_NOZORDER|SWP_NOSIZE))
1690 This->WindowPos.top = Top;
1695 static HRESULT WINAPI Videowindow_get_Top(IVideoWindow *iface,
1697 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1699 TRACE("(%p/%p)->(%p)\n", This, iface, pTop);
1701 *pTop = This->WindowPos.top;
1706 static HRESULT WINAPI Videowindow_put_Height(IVideoWindow *iface,
1708 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1710 TRACE("(%p/%p)->(%ld)\n", This, iface, Height);
1712 if (!SetWindowPos(This->hWnd, NULL, 0, 0, This->WindowPos.right-This->WindowPos.left, Height, SWP_NOZORDER|SWP_NOMOVE))
1715 This->WindowPos.bottom = This->WindowPos.top + Height;
1720 static HRESULT WINAPI Videowindow_get_Height(IVideoWindow *iface,
1722 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1724 TRACE("(%p/%p)->(%p)\n", This, iface, pHeight);
1726 *pHeight = This->WindowPos.bottom - This->WindowPos.top;
1731 static HRESULT WINAPI Videowindow_put_Owner(IVideoWindow *iface,
1733 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1735 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Owner);
1737 SetParent(This->hWnd, (HWND)Owner);
1742 static HRESULT WINAPI Videowindow_get_Owner(IVideoWindow *iface,
1744 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1746 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Owner);
1748 *(HWND*)Owner = GetParent(This->hWnd);
1753 static HRESULT WINAPI Videowindow_put_MessageDrain(IVideoWindow *iface,
1755 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1757 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Drain);
1759 This->hWndMsgDrain = (HWND)Drain;
1764 static HRESULT WINAPI Videowindow_get_MessageDrain(IVideoWindow *iface,
1766 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1768 TRACE("(%p/%p)->(%p)\n", This, iface, Drain);
1770 *Drain = (OAHWND)This->hWndMsgDrain;
1775 static HRESULT WINAPI Videowindow_get_BorderColor(IVideoWindow *iface,
1777 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1779 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, Color);
1784 static HRESULT WINAPI Videowindow_put_BorderColor(IVideoWindow *iface,
1786 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1788 FIXME("(%p/%p)->(%ld): stub !!!\n", This, iface, Color);
1793 static HRESULT WINAPI Videowindow_get_FullScreenMode(IVideoWindow *iface,
1794 long *FullScreenMode) {
1795 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1797 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, FullScreenMode);
1802 static HRESULT WINAPI Videowindow_put_FullScreenMode(IVideoWindow *iface,
1803 long FullScreenMode) {
1804 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1806 FIXME("(%p/%p)->(%ld): stub !!!\n", This, iface, FullScreenMode);
1811 static HRESULT WINAPI Videowindow_SetWindowForeground(IVideoWindow *iface,
1813 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1818 TRACE("(%p/%p)->(%ld)\n", This, iface, Focus);
1820 if ((Focus != FALSE) && (Focus != TRUE))
1821 return E_INVALIDARG;
1823 hr = IPin_ConnectedTo((IPin *)This->pInputPin, &pPin);
1824 if ((hr != S_OK) || !pPin)
1825 return VFW_E_NOT_CONNECTED;
1828 ret = SetForegroundWindow(This->hWnd);
1830 ret = SetWindowPos(This->hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
1838 static HRESULT WINAPI Videowindow_NotifyOwnerMessage(IVideoWindow *iface,
1843 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1845 TRACE("(%p/%p)->(%08x, %ld, %08lx, %08lx)\n", This, iface, (DWORD) hwnd, uMsg, wParam, lParam);
1847 if (!PostMessageA(This->hWnd, uMsg, wParam, lParam))
1853 static HRESULT WINAPI Videowindow_SetWindowPosition(IVideoWindow *iface,
1858 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1860 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
1862 if (!SetWindowPos(This->hWnd, NULL, Left, Top, Width, Height, SWP_NOZORDER))
1865 This->WindowPos.left = Left;
1866 This->WindowPos.top = Top;
1867 This->WindowPos.right = Left + Width;
1868 This->WindowPos.bottom = Top + Height;
1873 static HRESULT WINAPI Videowindow_GetWindowPosition(IVideoWindow *iface,
1878 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1880 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1882 *pLeft = This->WindowPos.left;
1883 *pTop = This->WindowPos.top;
1884 *pWidth = This->WindowPos.right - This->WindowPos.left;
1885 *pHeight = This->WindowPos.bottom - This->WindowPos.top;
1890 static HRESULT WINAPI Videowindow_GetMinIdealImageSize(IVideoWindow *iface,
1893 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1895 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This, iface, pWidth, pHeight);
1897 *pWidth = This->VideoWidth;
1898 *pHeight = This->VideoHeight;
1903 static HRESULT WINAPI Videowindow_GetMaxIdealImageSize(IVideoWindow *iface,
1906 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1908 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This, iface, pWidth, pHeight);
1910 *pWidth = This->VideoWidth;
1911 *pHeight = This->VideoHeight;
1916 static HRESULT WINAPI Videowindow_GetRestorePosition(IVideoWindow *iface,
1921 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1923 FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This, iface, pLeft, pTop, pWidth, pHeight);
1928 static HRESULT WINAPI Videowindow_HideCursor(IVideoWindow *iface,
1930 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1932 FIXME("(%p/%p)->(%ld): stub !!!\n", This, iface, HideCursor);
1937 static HRESULT WINAPI Videowindow_IsCursorHidden(IVideoWindow *iface,
1938 long *CursorHidden) {
1939 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1941 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, CursorHidden);
1946 static const IVideoWindowVtbl IVideoWindow_VTable =
1948 Videowindow_QueryInterface,
1950 Videowindow_Release,
1951 Videowindow_GetTypeInfoCount,
1952 Videowindow_GetTypeInfo,
1953 Videowindow_GetIDsOfNames,
1955 Videowindow_put_Caption,
1956 Videowindow_get_Caption,
1957 Videowindow_put_WindowStyle,
1958 Videowindow_get_WindowStyle,
1959 Videowindow_put_WindowStyleEx,
1960 Videowindow_get_WindowStyleEx,
1961 Videowindow_put_AutoShow,
1962 Videowindow_get_AutoShow,
1963 Videowindow_put_WindowState,
1964 Videowindow_get_WindowState,
1965 Videowindow_put_BackgroundPalette,
1966 Videowindow_get_BackgroundPalette,
1967 Videowindow_put_Visible,
1968 Videowindow_get_Visible,
1969 Videowindow_put_Left,
1970 Videowindow_get_Left,
1971 Videowindow_put_Width,
1972 Videowindow_get_Width,
1973 Videowindow_put_Top,
1974 Videowindow_get_Top,
1975 Videowindow_put_Height,
1976 Videowindow_get_Height,
1977 Videowindow_put_Owner,
1978 Videowindow_get_Owner,
1979 Videowindow_put_MessageDrain,
1980 Videowindow_get_MessageDrain,
1981 Videowindow_get_BorderColor,
1982 Videowindow_put_BorderColor,
1983 Videowindow_get_FullScreenMode,
1984 Videowindow_put_FullScreenMode,
1985 Videowindow_SetWindowForeground,
1986 Videowindow_NotifyOwnerMessage,
1987 Videowindow_SetWindowPosition,
1988 Videowindow_GetWindowPosition,
1989 Videowindow_GetMinIdealImageSize,
1990 Videowindow_GetMaxIdealImageSize,
1991 Videowindow_GetRestorePosition,
1992 Videowindow_HideCursor,
1993 Videowindow_IsCursorHidden