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;
91 static LRESULT CALLBACK VideoWndProcA(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
93 VideoRendererImpl* pVideoRenderer = (VideoRendererImpl*)GetWindowLongA(hwnd, 0);
94 LPRECT lprect = (LPRECT)lParam;
96 if (pVideoRenderer && pVideoRenderer->hWndMsgDrain)
102 case WM_LBUTTONDBLCLK:
105 case WM_MBUTTONDBLCLK:
108 case WM_MOUSEACTIVATE:
110 case WM_NCLBUTTONDBLCLK:
111 case WM_NCLBUTTONDOWN:
113 case WM_NCMBUTTONDBLCLK:
114 case WM_NCMBUTTONDOWN:
117 case WM_NCRBUTTONDBLCLK:
118 case WM_NCRBUTTONDOWN:
120 case WM_RBUTTONDBLCLK:
123 PostMessageA(pVideoRenderer->hWndMsgDrain, uMsg, wParam, lParam);
133 /* TRACE("WM_SIZING %d %d %d %d\n", lprect->left, lprect->top, lprect->right, lprect->bottom); */
134 SetWindowPos(hwnd, NULL, lprect->left, lprect->top, lprect->right - lprect->left, lprect->bottom - lprect->top, SWP_NOZORDER);
135 GetClientRect(hwnd, &pVideoRenderer->DestRect);
136 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
137 pVideoRenderer->DestRect.left,
138 pVideoRenderer->DestRect.top,
139 pVideoRenderer->DestRect.right - pVideoRenderer->DestRect.left,
140 pVideoRenderer->DestRect.bottom - pVideoRenderer->DestRect.top);
143 TRACE("WM_SIZE %d %d\n", LOWORD(lParam), HIWORD(lParam));
144 GetClientRect(hwnd, &pVideoRenderer->DestRect);
145 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
146 pVideoRenderer->DestRect.left,
147 pVideoRenderer->DestRect.top,
148 pVideoRenderer->DestRect.right - pVideoRenderer->DestRect.left,
149 pVideoRenderer->DestRect.bottom - pVideoRenderer->DestRect.top);
152 return DefWindowProcA(hwnd, uMsg, wParam, lParam);
157 static BOOL CreateRenderingWindow(VideoRendererImpl* This)
161 TRACE("(%p)->()\n", This);
164 winclass.lpfnWndProc = VideoWndProcA;
165 winclass.cbClsExtra = 0;
166 winclass.cbWndExtra = sizeof(VideoRendererImpl*);
167 winclass.hInstance = NULL;
168 winclass.hIcon = NULL;
169 winclass.hCursor = NULL;
170 winclass.hbrBackground = GetStockObject(BLACK_BRUSH);
171 winclass.lpszMenuName = NULL;
172 winclass.lpszClassName = "Wine ActiveMovie Class";
174 if (!wnd_class_registered)
176 if (!RegisterClassA(&winclass))
178 ERR("Unable to register window %u\n", GetLastError());
181 wnd_class_registered = TRUE;
184 This->hWnd = CreateWindowExA(0, "Wine ActiveMovie Class", "Wine ActiveMovie Window", WS_SIZEBOX,
185 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL,
190 ERR("Unable to create window\n");
194 SetWindowLongA(This->hWnd, 0, (LONG)This);
199 static DWORD WINAPI MessageLoop(LPVOID lpParameter)
201 VideoRendererImpl* This = (VideoRendererImpl*) lpParameter;
205 TRACE("Starting message loop\n");
207 if (!CreateRenderingWindow(This))
209 This->ThreadResult = FALSE;
210 SetEvent(This->hEvent);
214 This->ThreadResult = TRUE;
215 SetEvent(This->hEvent);
217 while ((fGotMessage = GetMessageA(&msg, NULL, 0, 0)) != 0 && fGotMessage != -1)
219 TranslateMessage(&msg);
220 DispatchMessageA(&msg);
223 TRACE("End of message loop\n");
228 static BOOL CreateRenderingSubsystem(VideoRendererImpl* This)
230 This->hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
234 This->hThread = CreateThread(NULL, 0, MessageLoop, (LPVOID)This, 0, &This->ThreadID);
237 CloseHandle(This->hEvent);
241 WaitForSingleObject(This->hEvent, INFINITE);
242 CloseHandle(This->hEvent);
244 if (!This->ThreadResult)
246 CloseHandle(This->hThread);
253 static const IMemInputPinVtbl MemInputPin_Vtbl =
255 MemInputPin_QueryInterface,
258 MemInputPin_GetAllocator,
259 MemInputPin_NotifyAllocator,
260 MemInputPin_GetAllocatorRequirements,
262 MemInputPin_ReceiveMultiple,
263 MemInputPin_ReceiveCanBlock
266 static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data, DWORD size)
273 LPBYTE palette = NULL;
275 BITMAPINFOHEADER *bmiHeader;
277 TRACE("%p %p %d\n", This, data, size);
279 sdesc.dwSize = sizeof(sdesc);
280 hr = IPin_ConnectionMediaType(This->ppPins[0], &amt);
282 ERR("Unable to retrieve media type\n");
286 if (IsEqualIID(&amt.formattype, &FORMAT_VideoInfo))
288 bmiHeader = &((VIDEOINFOHEADER *)amt.pbFormat)->bmiHeader;
290 else if (IsEqualIID(&amt.formattype, &FORMAT_VideoInfo2))
292 bmiHeader = &((VIDEOINFOHEADER2 *)amt.pbFormat)->bmiHeader;
296 FIXME("Unknown type %s\n", debugstr_guid(&amt.subtype));
297 return VFW_E_RUNTIME_ERROR;
301 TRACE("biSize = %d\n", bmiHeader->biSize);
302 TRACE("biWidth = %d\n", bmiHeader->biWidth);
303 TRACE("biHeight = %d\n", bmiHeader->biHeight);
304 TRACE("biPlanes = %d\n", bmiHeader->biPlanes);
305 TRACE("biBitCount = %d\n", bmiHeader->biBitCount);
306 TRACE("biCompression = %s\n", debugstr_an((LPSTR)&(bmiHeader->biCompression), 4));
307 TRACE("biSizeImage = %d\n", bmiHeader->biSizeImage);
309 width = bmiHeader->biWidth;
310 height = bmiHeader->biHeight;
311 palette = ((LPBYTE)bmiHeader) + bmiHeader->biSize;
315 if (!This->WindowPos.right || !This->WindowPos.bottom)
316 This->WindowPos = This->SourceRect;
318 TRACE("WindowPos: %d %d %d %d\n", This->WindowPos.left, This->WindowPos.top, This->WindowPos.right, This->WindowPos.bottom);
319 SetWindowPos(This->hWnd, NULL,
320 This->WindowPos.left,
322 This->WindowPos.right - This->WindowPos.left,
323 This->WindowPos.bottom - This->WindowPos.top,
324 SWP_NOZORDER|SWP_NOMOVE);
326 GetClientRect(This->hWnd, &This->DestRect);
330 hDC = GetDC(This->hWnd);
333 ERR("Cannot get DC from window!\n");
337 TRACE("Src Rect: %d %d %d %d\n", This->SourceRect.left, This->SourceRect.top, This->SourceRect.right, This->SourceRect.bottom);
338 TRACE("Dst Rect: %d %d %d %d\n", This->DestRect.left, This->DestRect.top, This->DestRect.right, This->DestRect.bottom);
340 StretchDIBits(hDC, This->DestRect.left, This->DestRect.top, This->DestRect.right -This->DestRect.left,
341 This->DestRect.bottom - This->DestRect.top, This->SourceRect.left, This->SourceRect.top,
342 This->SourceRect.right - This->SourceRect.left, This->SourceRect.bottom - This->SourceRect.top,
343 data, (BITMAPINFO *)bmiHeader, DIB_RGB_COLORS, SRCCOPY);
345 ReleaseDC(This->hWnd, hDC);
347 ShowWindow(This->hWnd, SW_SHOW);
352 static HRESULT VideoRenderer_Sample(LPVOID iface, IMediaSample * pSample)
354 VideoRendererImpl *This = (VideoRendererImpl *)iface;
355 LPBYTE pbSrcStream = NULL;
356 long cbSrcStream = 0;
357 REFERENCE_TIME tStart, tStop;
360 if (This->state == State_Stopped)
363 TRACE("%p %p\n", iface, pSample);
365 hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
368 ERR("Cannot get pointer to sample data (%x)\n", hr);
372 hr = IMediaSample_GetTime(pSample, &tStart, &tStop);
374 ERR("Cannot get sample time (%x)\n", hr);
376 cbSrcStream = IMediaSample_GetActualDataLength(pSample);
378 TRACE("val %p %ld\n", pbSrcStream, cbSrcStream);
380 #if 0 /* For debugging purpose */
383 for(i = 0; i < cbSrcStream; i++)
385 if ((i!=0) && !(i%16))
387 TRACE("%02x ", pbSrcStream[i]);
393 VideoRenderer_SendSampleData(This, pbSrcStream, cbSrcStream);
398 static HRESULT VideoRenderer_QueryAccept(LPVOID iface, const AM_MEDIA_TYPE * pmt)
400 if (!IsEqualIID(&pmt->majortype, &MEDIATYPE_Video))
403 if (IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB32) ||
404 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB24) ||
405 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB565) ||
406 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB8))
408 VideoRendererImpl* This = (VideoRendererImpl*) iface;
410 if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo))
412 VIDEOINFOHEADER *format = (VIDEOINFOHEADER *)pmt->pbFormat;
413 This->SourceRect.left = 0;
414 This->SourceRect.top = 0;
415 This->SourceRect.right = This->VideoWidth = format->bmiHeader.biWidth;
416 This->SourceRect.bottom = This->VideoHeight = format->bmiHeader.biHeight;
418 else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2))
420 VIDEOINFOHEADER2 *format2 = (VIDEOINFOHEADER2 *)pmt->pbFormat;
422 This->SourceRect.left = 0;
423 This->SourceRect.top = 0;
424 This->SourceRect.right = This->VideoWidth = format2->bmiHeader.biWidth;
425 This->SourceRect.bottom = This->VideoHeight = format2->bmiHeader.biHeight;
429 WARN("Format type %s not supported\n", debugstr_guid(&pmt->formattype));
437 HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
441 VideoRendererImpl * pVideoRenderer;
443 TRACE("(%p, %p)\n", pUnkOuter, ppv);
447 pVideoRenderer = CoTaskMemAlloc(sizeof(VideoRendererImpl));
448 pVideoRenderer->pUnkOuter = pUnkOuter;
449 pVideoRenderer->bUnkOuterValid = FALSE;
450 pVideoRenderer->bAggregatable = FALSE;
451 pVideoRenderer->IInner_vtbl = &IInner_VTable;
453 pVideoRenderer->lpVtbl = &VideoRenderer_Vtbl;
454 pVideoRenderer->IBasicVideo_vtbl = &IBasicVideo_VTable;
455 pVideoRenderer->IVideoWindow_vtbl = &IVideoWindow_VTable;
457 pVideoRenderer->refCount = 1;
458 InitializeCriticalSection(&pVideoRenderer->csFilter);
459 pVideoRenderer->csFilter.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": VideoRendererImpl.csFilter");
460 pVideoRenderer->state = State_Stopped;
461 pVideoRenderer->pClock = NULL;
462 pVideoRenderer->init = 0;
463 pVideoRenderer->AutoShow = 1;
464 ZeroMemory(&pVideoRenderer->filterInfo, sizeof(FILTER_INFO));
466 pVideoRenderer->ppPins = CoTaskMemAlloc(1 * sizeof(IPin *));
468 /* construct input pin */
469 piInput.dir = PINDIR_INPUT;
470 piInput.pFilter = (IBaseFilter *)pVideoRenderer;
471 lstrcpynW(piInput.achName, wcsInputPinName, sizeof(piInput.achName) / sizeof(piInput.achName[0]));
473 hr = InputPin_Construct(&VideoRenderer_InputPin_Vtbl, &piInput, VideoRenderer_Sample, (LPVOID)pVideoRenderer, VideoRenderer_QueryAccept, NULL, &pVideoRenderer->csFilter, (IPin **)&pVideoRenderer->pInputPin);
477 pVideoRenderer->ppPins[0] = (IPin *)pVideoRenderer->pInputPin;
478 *ppv = (LPVOID)pVideoRenderer;
482 CoTaskMemFree(pVideoRenderer->ppPins);
483 pVideoRenderer->csFilter.DebugInfo->Spare[0] = 0;
484 DeleteCriticalSection(&pVideoRenderer->csFilter);
485 CoTaskMemFree(pVideoRenderer);
488 if (!CreateRenderingSubsystem(pVideoRenderer))
494 HRESULT VideoRendererDefault_create(IUnknown * pUnkOuter, LPVOID * ppv)
496 /* TODO: Attempt to use the VMR-7 renderer instead when possible */
497 return VideoRenderer_create(pUnkOuter, ppv);
500 static HRESULT WINAPI VideoRendererInner_QueryInterface(IUnknown * iface, REFIID riid, LPVOID * ppv)
502 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
503 TRACE("(%p/%p)->(%s, %p)\n", This, iface, qzdebugstr_guid(riid), ppv);
505 if (This->bAggregatable)
506 This->bUnkOuterValid = TRUE;
510 if (IsEqualIID(riid, &IID_IUnknown))
511 *ppv = (LPVOID)&(This->IInner_vtbl);
512 else if (IsEqualIID(riid, &IID_IPersist))
514 else if (IsEqualIID(riid, &IID_IMediaFilter))
516 else if (IsEqualIID(riid, &IID_IBaseFilter))
518 else if (IsEqualIID(riid, &IID_IBasicVideo))
519 *ppv = (LPVOID)&(This->IBasicVideo_vtbl);
520 else if (IsEqualIID(riid, &IID_IVideoWindow))
521 *ppv = (LPVOID)&(This->IVideoWindow_vtbl);
525 IUnknown_AddRef((IUnknown *)(*ppv));
529 if (!IsEqualIID(riid, &IID_IPin))
530 FIXME("No interface for %s!\n", qzdebugstr_guid(riid));
532 return E_NOINTERFACE;
535 static ULONG WINAPI VideoRendererInner_AddRef(IUnknown * iface)
537 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
538 ULONG refCount = InterlockedIncrement(&This->refCount);
540 TRACE("(%p/%p)->() AddRef from %d\n", This, iface, refCount - 1);
545 static ULONG WINAPI VideoRendererInner_Release(IUnknown * iface)
547 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
548 ULONG refCount = InterlockedDecrement(&This->refCount);
550 TRACE("(%p/%p)->() Release from %d\n", This, iface, refCount + 1);
556 DestroyWindow(This->hWnd);
557 PostThreadMessageA(This->ThreadID, WM_QUIT, 0, 0);
558 WaitForSingleObject(This->hThread, INFINITE);
559 CloseHandle(This->hThread);
562 IReferenceClock_Release(This->pClock);
564 if (SUCCEEDED(IPin_ConnectedTo(This->ppPins[0], &pConnectedTo)))
566 IPin_Disconnect(pConnectedTo);
567 IPin_Release(pConnectedTo);
569 IPin_Disconnect(This->ppPins[0]);
571 IPin_Release(This->ppPins[0]);
573 CoTaskMemFree(This->ppPins);
576 This->csFilter.DebugInfo->Spare[0] = 0;
577 DeleteCriticalSection(&This->csFilter);
579 TRACE("Destroying Video Renderer\n");
588 static const IUnknownVtbl IInner_VTable =
590 VideoRendererInner_QueryInterface,
591 VideoRendererInner_AddRef,
592 VideoRendererInner_Release
595 static HRESULT WINAPI VideoRenderer_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv)
597 VideoRendererImpl *This = (VideoRendererImpl *)iface;
599 if (This->bAggregatable)
600 This->bUnkOuterValid = TRUE;
604 if (This->bAggregatable)
605 return IUnknown_QueryInterface(This->pUnkOuter, riid, ppv);
607 if (IsEqualIID(riid, &IID_IUnknown))
611 IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
612 hr = IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
613 IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
614 This->bAggregatable = TRUE;
619 return E_NOINTERFACE;
622 return IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
625 static ULONG WINAPI VideoRenderer_AddRef(IBaseFilter * iface)
627 VideoRendererImpl *This = (VideoRendererImpl *)iface;
629 if (This->pUnkOuter && This->bUnkOuterValid)
630 return IUnknown_AddRef(This->pUnkOuter);
631 return IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
634 static ULONG WINAPI VideoRenderer_Release(IBaseFilter * iface)
636 VideoRendererImpl *This = (VideoRendererImpl *)iface;
638 if (This->pUnkOuter && This->bUnkOuterValid)
639 return IUnknown_Release(This->pUnkOuter);
640 return IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
643 /** IPersist methods **/
645 static HRESULT WINAPI VideoRenderer_GetClassID(IBaseFilter * iface, CLSID * pClsid)
647 VideoRendererImpl *This = (VideoRendererImpl *)iface;
649 TRACE("(%p/%p)->(%p)\n", This, iface, pClsid);
651 *pClsid = CLSID_VideoRenderer;
656 /** IMediaFilter methods **/
658 static HRESULT WINAPI VideoRenderer_Stop(IBaseFilter * iface)
660 VideoRendererImpl *This = (VideoRendererImpl *)iface;
662 TRACE("(%p/%p)->()\n", This, iface);
664 EnterCriticalSection(&This->csFilter);
666 This->state = State_Stopped;
668 LeaveCriticalSection(&This->csFilter);
673 static HRESULT WINAPI VideoRenderer_Pause(IBaseFilter * iface)
675 VideoRendererImpl *This = (VideoRendererImpl *)iface;
677 TRACE("(%p/%p)->()\n", This, iface);
679 EnterCriticalSection(&This->csFilter);
681 if (This->state == State_Stopped)
682 This->pInputPin->end_of_stream = 0;
684 This->state = State_Paused;
686 LeaveCriticalSection(&This->csFilter);
691 static HRESULT WINAPI VideoRenderer_Run(IBaseFilter * iface, REFERENCE_TIME tStart)
693 VideoRendererImpl *This = (VideoRendererImpl *)iface;
695 TRACE("(%p/%p)->(%s)\n", This, iface, wine_dbgstr_longlong(tStart));
697 EnterCriticalSection(&This->csFilter);
699 if (This->state == State_Stopped)
700 This->pInputPin->end_of_stream = 0;
702 This->rtStreamStart = tStart;
703 This->state = State_Running;
705 LeaveCriticalSection(&This->csFilter);
710 static HRESULT WINAPI VideoRenderer_GetState(IBaseFilter * iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState)
712 VideoRendererImpl *This = (VideoRendererImpl *)iface;
714 TRACE("(%p/%p)->(%d, %p)\n", This, iface, dwMilliSecsTimeout, pState);
716 EnterCriticalSection(&This->csFilter);
718 *pState = This->state;
720 LeaveCriticalSection(&This->csFilter);
725 static HRESULT WINAPI VideoRenderer_SetSyncSource(IBaseFilter * iface, IReferenceClock *pClock)
727 VideoRendererImpl *This = (VideoRendererImpl *)iface;
729 TRACE("(%p/%p)->(%p)\n", This, iface, pClock);
731 EnterCriticalSection(&This->csFilter);
734 IReferenceClock_Release(This->pClock);
735 This->pClock = pClock;
737 IReferenceClock_AddRef(This->pClock);
739 LeaveCriticalSection(&This->csFilter);
744 static HRESULT WINAPI VideoRenderer_GetSyncSource(IBaseFilter * iface, IReferenceClock **ppClock)
746 VideoRendererImpl *This = (VideoRendererImpl *)iface;
748 TRACE("(%p/%p)->(%p)\n", This, iface, ppClock);
750 EnterCriticalSection(&This->csFilter);
752 *ppClock = This->pClock;
753 IReferenceClock_AddRef(This->pClock);
755 LeaveCriticalSection(&This->csFilter);
760 /** IBaseFilter implementation **/
762 static HRESULT WINAPI VideoRenderer_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum)
765 VideoRendererImpl *This = (VideoRendererImpl *)iface;
767 TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
769 epd.cPins = 1; /* input pin */
770 epd.ppPins = This->ppPins;
771 return IEnumPinsImpl_Construct(&epd, ppEnum);
774 static HRESULT WINAPI VideoRenderer_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)
776 VideoRendererImpl *This = (VideoRendererImpl *)iface;
778 TRACE("(%p/%p)->(%p,%p)\n", This, iface, debugstr_w(Id), ppPin);
780 FIXME("VideoRenderer::FindPin(...)\n");
782 /* FIXME: critical section */
787 static HRESULT WINAPI VideoRenderer_QueryFilterInfo(IBaseFilter * iface, FILTER_INFO *pInfo)
789 VideoRendererImpl *This = (VideoRendererImpl *)iface;
791 TRACE("(%p/%p)->(%p)\n", This, iface, pInfo);
793 strcpyW(pInfo->achName, This->filterInfo.achName);
794 pInfo->pGraph = This->filterInfo.pGraph;
797 IFilterGraph_AddRef(pInfo->pGraph);
802 static HRESULT WINAPI VideoRenderer_JoinFilterGraph(IBaseFilter * iface, IFilterGraph *pGraph, LPCWSTR pName)
804 VideoRendererImpl *This = (VideoRendererImpl *)iface;
806 TRACE("(%p/%p)->(%p, %s)\n", This, iface, pGraph, debugstr_w(pName));
808 EnterCriticalSection(&This->csFilter);
811 strcpyW(This->filterInfo.achName, pName);
813 *This->filterInfo.achName = '\0';
814 This->filterInfo.pGraph = pGraph; /* NOTE: do NOT increase ref. count */
816 LeaveCriticalSection(&This->csFilter);
821 static HRESULT WINAPI VideoRenderer_QueryVendorInfo(IBaseFilter * iface, LPWSTR *pVendorInfo)
823 VideoRendererImpl *This = (VideoRendererImpl *)iface;
824 TRACE("(%p/%p)->(%p)\n", This, iface, pVendorInfo);
828 static const IBaseFilterVtbl VideoRenderer_Vtbl =
830 VideoRenderer_QueryInterface,
831 VideoRenderer_AddRef,
832 VideoRenderer_Release,
833 VideoRenderer_GetClassID,
837 VideoRenderer_GetState,
838 VideoRenderer_SetSyncSource,
839 VideoRenderer_GetSyncSource,
840 VideoRenderer_EnumPins,
841 VideoRenderer_FindPin,
842 VideoRenderer_QueryFilterInfo,
843 VideoRenderer_JoinFilterGraph,
844 VideoRenderer_QueryVendorInfo
847 static HRESULT WINAPI VideoRenderer_InputPin_EndOfStream(IPin * iface)
849 InputPin* This = (InputPin*)iface;
850 IMediaEventSink* pEventSink;
853 TRACE("(%p/%p)->()\n", This, iface);
855 hr = IFilterGraph_QueryInterface(((VideoRendererImpl*)This->pin.pinInfo.pFilter)->filterInfo.pGraph, &IID_IMediaEventSink, (LPVOID*)&pEventSink);
858 hr = IMediaEventSink_Notify(pEventSink, EC_COMPLETE, S_OK, 0);
859 IMediaEventSink_Release(pEventSink);
865 static const IPinVtbl VideoRenderer_InputPin_Vtbl =
867 InputPin_QueryInterface,
871 InputPin_ReceiveConnection,
873 IPinImpl_ConnectedTo,
874 IPinImpl_ConnectionMediaType,
875 IPinImpl_QueryPinInfo,
876 IPinImpl_QueryDirection,
878 IPinImpl_QueryAccept,
879 IPinImpl_EnumMediaTypes,
880 IPinImpl_QueryInternalConnections,
881 VideoRenderer_InputPin_EndOfStream,
887 /*** IUnknown methods ***/
888 static HRESULT WINAPI Basicvideo_QueryInterface(IBasicVideo *iface,
891 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
893 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
895 return VideoRenderer_QueryInterface((IBaseFilter*)This, riid, ppvObj);
898 static ULONG WINAPI Basicvideo_AddRef(IBasicVideo *iface) {
899 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
901 TRACE("(%p/%p)->()\n", This, iface);
903 return VideoRenderer_AddRef((IBaseFilter*)This);
906 static ULONG WINAPI Basicvideo_Release(IBasicVideo *iface) {
907 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
909 TRACE("(%p/%p)->()\n", This, iface);
911 return VideoRenderer_Release((IBaseFilter*)This);
914 /*** IDispatch methods ***/
915 static HRESULT WINAPI Basicvideo_GetTypeInfoCount(IBasicVideo *iface,
917 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
919 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
924 static HRESULT WINAPI Basicvideo_GetTypeInfo(IBasicVideo *iface,
927 ITypeInfo**ppTInfo) {
928 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
930 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
935 static HRESULT WINAPI Basicvideo_GetIDsOfNames(IBasicVideo *iface,
941 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
943 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
948 static HRESULT WINAPI Basicvideo_Invoke(IBasicVideo *iface,
953 DISPPARAMS*pDispParams,
957 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
959 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);
964 /*** IBasicVideo methods ***/
965 static HRESULT WINAPI Basicvideo_get_AvgTimePerFrame(IBasicVideo *iface,
966 REFTIME *pAvgTimePerFrame) {
967 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
969 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pAvgTimePerFrame);
974 static HRESULT WINAPI Basicvideo_get_BitRate(IBasicVideo *iface,
976 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
978 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBitRate);
983 static HRESULT WINAPI Basicvideo_get_BitErrorRate(IBasicVideo *iface,
984 long *pBitErrorRate) {
985 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
987 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBitErrorRate);
992 static HRESULT WINAPI Basicvideo_get_VideoWidth(IBasicVideo *iface,
994 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
996 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoWidth);
998 *pVideoWidth = This->VideoWidth;
1003 static HRESULT WINAPI Basicvideo_get_VideoHeight(IBasicVideo *iface,
1004 long *pVideoHeight) {
1005 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1007 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoHeight);
1009 *pVideoHeight = This->VideoHeight;
1014 static HRESULT WINAPI Basicvideo_put_SourceLeft(IBasicVideo *iface,
1016 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1018 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceLeft);
1020 This->SourceRect.left = SourceLeft;
1025 static HRESULT WINAPI Basicvideo_get_SourceLeft(IBasicVideo *iface,
1026 long *pSourceLeft) {
1027 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1029 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceLeft);
1031 *pSourceLeft = This->SourceRect.left;
1036 static HRESULT WINAPI Basicvideo_put_SourceWidth(IBasicVideo *iface,
1038 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1040 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceWidth);
1042 This->SourceRect.right = This->SourceRect.left + SourceWidth;
1047 static HRESULT WINAPI Basicvideo_get_SourceWidth(IBasicVideo *iface,
1048 long *pSourceWidth) {
1049 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1051 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceWidth);
1053 *pSourceWidth = This->SourceRect.right - This->SourceRect.left;
1058 static HRESULT WINAPI Basicvideo_put_SourceTop(IBasicVideo *iface,
1060 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1062 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceTop);
1064 This->SourceRect.top = SourceTop;
1069 static HRESULT WINAPI Basicvideo_get_SourceTop(IBasicVideo *iface,
1071 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1073 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceTop);
1075 *pSourceTop = This->SourceRect.top;
1080 static HRESULT WINAPI Basicvideo_put_SourceHeight(IBasicVideo *iface,
1081 long SourceHeight) {
1082 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1084 TRACE("(%p/%p)->(%ld)\n", This, iface, SourceHeight);
1086 This->SourceRect.bottom = This->SourceRect.top + SourceHeight;
1091 static HRESULT WINAPI Basicvideo_get_SourceHeight(IBasicVideo *iface,
1092 long *pSourceHeight) {
1093 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1095 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceHeight);
1097 *pSourceHeight = This->SourceRect.bottom - This->SourceRect.top;
1102 static HRESULT WINAPI Basicvideo_put_DestinationLeft(IBasicVideo *iface,
1103 long DestinationLeft) {
1104 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1106 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationLeft);
1108 This->DestRect.left = DestinationLeft;
1113 static HRESULT WINAPI Basicvideo_get_DestinationLeft(IBasicVideo *iface,
1114 long *pDestinationLeft) {
1115 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1117 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationLeft);
1119 *pDestinationLeft = This->DestRect.left;
1124 static HRESULT WINAPI Basicvideo_put_DestinationWidth(IBasicVideo *iface,
1125 long DestinationWidth) {
1126 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1128 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationWidth);
1130 This->DestRect.right = This->DestRect.left + DestinationWidth;
1135 static HRESULT WINAPI Basicvideo_get_DestinationWidth(IBasicVideo *iface,
1136 long *pDestinationWidth) {
1137 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1139 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationWidth);
1141 *pDestinationWidth = This->DestRect.right - This->DestRect.left;
1146 static HRESULT WINAPI Basicvideo_put_DestinationTop(IBasicVideo *iface,
1147 long DestinationTop) {
1148 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1150 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationTop);
1152 This->DestRect.top = DestinationTop;
1157 static HRESULT WINAPI Basicvideo_get_DestinationTop(IBasicVideo *iface,
1158 long *pDestinationTop) {
1159 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1161 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationTop);
1163 *pDestinationTop = This->DestRect.top;
1168 static HRESULT WINAPI Basicvideo_put_DestinationHeight(IBasicVideo *iface,
1169 long DestinationHeight) {
1170 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1172 TRACE("(%p/%p)->(%ld)\n", This, iface, DestinationHeight);
1174 This->DestRect.right = This->DestRect.left + DestinationHeight;
1179 static HRESULT WINAPI Basicvideo_get_DestinationHeight(IBasicVideo *iface,
1180 long *pDestinationHeight) {
1181 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1183 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationHeight);
1185 *pDestinationHeight = This->DestRect.right - This->DestRect.left;
1190 static HRESULT WINAPI Basicvideo_SetSourcePosition(IBasicVideo *iface,
1195 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1197 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
1199 This->SourceRect.left = Left;
1200 This->SourceRect.top = Top;
1201 This->SourceRect.right = Left + Width;
1202 This->SourceRect.bottom = Top + Height;
1207 static HRESULT WINAPI Basicvideo_GetSourcePosition(IBasicVideo *iface,
1212 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1214 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1216 *pLeft = This->SourceRect.left;
1217 *pTop = This->SourceRect.top;
1218 *pWidth = This->SourceRect.right - This->SourceRect.left;
1219 *pHeight = This->SourceRect.bottom - This->SourceRect.top;
1224 static HRESULT WINAPI Basicvideo_SetDefaultSourcePosition(IBasicVideo *iface) {
1225 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1227 TRACE("(%p/%p)->()\n", This, iface);
1229 This->SourceRect.left = 0;
1230 This->SourceRect.top = 0;
1231 This->SourceRect.right = This->VideoWidth;
1232 This->SourceRect.bottom = This->VideoHeight;
1237 static HRESULT WINAPI Basicvideo_SetDestinationPosition(IBasicVideo *iface,
1242 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1244 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
1246 This->DestRect.left = Left;
1247 This->DestRect.top = Top;
1248 This->DestRect.right = Left + Width;
1249 This->DestRect.bottom = Top + Height;
1254 static HRESULT WINAPI Basicvideo_GetDestinationPosition(IBasicVideo *iface,
1259 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1261 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1263 *pLeft = This->DestRect.left;
1264 *pTop = This->DestRect.top;
1265 *pWidth = This->DestRect.right - This->DestRect.left;
1266 *pHeight = This->DestRect.bottom - This->DestRect.top;
1271 static HRESULT WINAPI Basicvideo_SetDefaultDestinationPosition(IBasicVideo *iface) {
1272 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1275 TRACE("(%p/%p)->()\n", This, iface);
1277 if (!GetClientRect(This->hWnd, &rect))
1280 This->SourceRect.left = 0;
1281 This->SourceRect.top = 0;
1282 This->SourceRect.right = rect.right;
1283 This->SourceRect.bottom = rect.bottom;
1288 static HRESULT WINAPI Basicvideo_GetVideoSize(IBasicVideo *iface,
1291 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1293 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
1295 *pWidth = This->VideoWidth;
1296 *pHeight = This->VideoHeight;
1301 static HRESULT WINAPI Basicvideo_GetVideoPaletteEntries(IBasicVideo *iface,
1306 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1308 FIXME("(%p/%p)->(%ld, %ld, %p, %p): stub !!!\n", This, iface, StartIndex, Entries, pRetrieved, pPalette);
1313 static HRESULT WINAPI Basicvideo_GetCurrentImage(IBasicVideo *iface,
1316 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1318 FIXME("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pBufferSize, pDIBImage);
1323 static HRESULT WINAPI Basicvideo_IsUsingDefaultSource(IBasicVideo *iface) {
1324 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1326 FIXME("(%p/%p)->(): stub !!!\n", This, iface);
1331 static HRESULT WINAPI Basicvideo_IsUsingDefaultDestination(IBasicVideo *iface) {
1332 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1334 FIXME("(%p/%p)->(): stub !!!\n", This, iface);
1340 static const IBasicVideoVtbl IBasicVideo_VTable =
1342 Basicvideo_QueryInterface,
1345 Basicvideo_GetTypeInfoCount,
1346 Basicvideo_GetTypeInfo,
1347 Basicvideo_GetIDsOfNames,
1349 Basicvideo_get_AvgTimePerFrame,
1350 Basicvideo_get_BitRate,
1351 Basicvideo_get_BitErrorRate,
1352 Basicvideo_get_VideoWidth,
1353 Basicvideo_get_VideoHeight,
1354 Basicvideo_put_SourceLeft,
1355 Basicvideo_get_SourceLeft,
1356 Basicvideo_put_SourceWidth,
1357 Basicvideo_get_SourceWidth,
1358 Basicvideo_put_SourceTop,
1359 Basicvideo_get_SourceTop,
1360 Basicvideo_put_SourceHeight,
1361 Basicvideo_get_SourceHeight,
1362 Basicvideo_put_DestinationLeft,
1363 Basicvideo_get_DestinationLeft,
1364 Basicvideo_put_DestinationWidth,
1365 Basicvideo_get_DestinationWidth,
1366 Basicvideo_put_DestinationTop,
1367 Basicvideo_get_DestinationTop,
1368 Basicvideo_put_DestinationHeight,
1369 Basicvideo_get_DestinationHeight,
1370 Basicvideo_SetSourcePosition,
1371 Basicvideo_GetSourcePosition,
1372 Basicvideo_SetDefaultSourcePosition,
1373 Basicvideo_SetDestinationPosition,
1374 Basicvideo_GetDestinationPosition,
1375 Basicvideo_SetDefaultDestinationPosition,
1376 Basicvideo_GetVideoSize,
1377 Basicvideo_GetVideoPaletteEntries,
1378 Basicvideo_GetCurrentImage,
1379 Basicvideo_IsUsingDefaultSource,
1380 Basicvideo_IsUsingDefaultDestination
1384 /*** IUnknown methods ***/
1385 static HRESULT WINAPI Videowindow_QueryInterface(IVideoWindow *iface,
1388 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1390 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1392 return VideoRenderer_QueryInterface((IBaseFilter*)This, riid, ppvObj);
1395 static ULONG WINAPI Videowindow_AddRef(IVideoWindow *iface) {
1396 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1398 TRACE("(%p/%p)->()\n", This, iface);
1400 return VideoRenderer_AddRef((IBaseFilter*)This);
1403 static ULONG WINAPI Videowindow_Release(IVideoWindow *iface) {
1404 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1406 TRACE("(%p/%p)->()\n", This, iface);
1408 return VideoRenderer_Release((IBaseFilter*)This);
1411 /*** IDispatch methods ***/
1412 static HRESULT WINAPI Videowindow_GetTypeInfoCount(IVideoWindow *iface,
1414 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1416 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
1421 static HRESULT WINAPI Videowindow_GetTypeInfo(IVideoWindow *iface,
1424 ITypeInfo**ppTInfo) {
1425 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1427 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
1432 static HRESULT WINAPI Videowindow_GetIDsOfNames(IVideoWindow *iface,
1438 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1440 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1445 static HRESULT WINAPI Videowindow_Invoke(IVideoWindow *iface,
1446 DISPID dispIdMember,
1450 DISPPARAMS*pDispParams,
1452 EXCEPINFO*pExepInfo,
1454 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1456 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);
1461 /*** IVideoWindow methods ***/
1462 static HRESULT WINAPI Videowindow_put_Caption(IVideoWindow *iface,
1464 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1466 TRACE("(%p/%p)->(%s (%p))\n", This, iface, debugstr_w(strCaption), strCaption);
1468 if (!SetWindowTextW(This->hWnd, strCaption))
1474 static HRESULT WINAPI Videowindow_get_Caption(IVideoWindow *iface,
1476 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1478 TRACE("(%p/%p)->(%p)\n", This, iface, strCaption);
1480 GetWindowTextW(This->hWnd, (LPWSTR)strCaption, 100);
1485 static HRESULT WINAPI Videowindow_put_WindowStyle(IVideoWindow *iface,
1487 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1490 old = GetWindowLongA(This->hWnd, GWL_STYLE);
1492 TRACE("(%p/%p)->(%x -> %lx)\n", This, iface, old, WindowStyle);
1494 if (WindowStyle & (WS_DISABLED|WS_HSCROLL|WS_ICONIC|WS_MAXIMIZE|WS_MINIMIZE|WS_VSCROLL))
1495 return E_INVALIDARG;
1497 SetWindowLongA(This->hWnd, GWL_STYLE, WindowStyle);
1502 static HRESULT WINAPI Videowindow_get_WindowStyle(IVideoWindow *iface,
1503 long *WindowStyle) {
1504 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1506 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyle);
1508 *WindowStyle = GetWindowLongA(This->hWnd, GWL_STYLE);
1513 static HRESULT WINAPI Videowindow_put_WindowStyleEx(IVideoWindow *iface,
1514 long WindowStyleEx) {
1515 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1517 TRACE("(%p/%p)->(%ld)\n", This, iface, WindowStyleEx);
1519 if (WindowStyleEx & (WS_DISABLED|WS_HSCROLL|WS_ICONIC|WS_MAXIMIZE|WS_MINIMIZE|WS_VSCROLL))
1520 return E_INVALIDARG;
1522 if (!SetWindowLongA(This->hWnd, GWL_EXSTYLE, WindowStyleEx))
1528 static HRESULT WINAPI Videowindow_get_WindowStyleEx(IVideoWindow *iface,
1529 long *WindowStyleEx) {
1530 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1532 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyleEx);
1534 *WindowStyleEx = GetWindowLongA(This->hWnd, GWL_EXSTYLE);
1539 static HRESULT WINAPI Videowindow_put_AutoShow(IVideoWindow *iface,
1541 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1543 TRACE("(%p/%p)->(%ld)\n", This, iface, AutoShow);
1545 This->AutoShow = 1; /* FXIME: Should be AutoShow */;
1550 static HRESULT WINAPI Videowindow_get_AutoShow(IVideoWindow *iface,
1552 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1554 TRACE("(%p/%p)->(%p)\n", This, iface, AutoShow);
1556 *AutoShow = This->AutoShow;
1561 static HRESULT WINAPI Videowindow_put_WindowState(IVideoWindow *iface,
1563 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1565 FIXME("(%p/%p)->(%ld): stub !!!\n", This, iface, WindowState);
1570 static HRESULT WINAPI Videowindow_get_WindowState(IVideoWindow *iface,
1571 long *WindowState) {
1572 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1574 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, WindowState);
1579 static HRESULT WINAPI Videowindow_put_BackgroundPalette(IVideoWindow *iface,
1580 long BackgroundPalette) {
1581 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1583 FIXME("(%p/%p)->(%ld): stub !!!\n", This, iface, BackgroundPalette);
1588 static HRESULT WINAPI Videowindow_get_BackgroundPalette(IVideoWindow *iface,
1589 long *pBackgroundPalette) {
1590 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1592 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBackgroundPalette);
1597 static HRESULT WINAPI Videowindow_put_Visible(IVideoWindow *iface,
1599 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1601 TRACE("(%p/%p)->(%ld)\n", This, iface, Visible);
1603 ShowWindow(This->hWnd, Visible ? SW_SHOW : SW_HIDE);
1608 static HRESULT WINAPI Videowindow_get_Visible(IVideoWindow *iface,
1610 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1612 TRACE("(%p/%p)->(%p)\n", This, iface, pVisible);
1614 *pVisible = IsWindowVisible(This->hWnd);
1619 static HRESULT WINAPI Videowindow_put_Left(IVideoWindow *iface,
1621 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1623 TRACE("(%p/%p)->(%ld)\n", This, iface, Left);
1625 if (!SetWindowPos(This->hWnd, NULL, Left, This->WindowPos.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE))
1628 This->WindowPos.left = Left;
1633 static HRESULT WINAPI Videowindow_get_Left(IVideoWindow *iface,
1635 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1637 TRACE("(%p/%p)->(%p)\n", This, iface, pLeft);
1639 *pLeft = This->WindowPos.left;
1644 static HRESULT WINAPI Videowindow_put_Width(IVideoWindow *iface,
1646 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1648 TRACE("(%p/%p)->(%ld)\n", This, iface, Width);
1650 if (!SetWindowPos(This->hWnd, NULL, 0, 0, Width, This->WindowPos.bottom-This->WindowPos.top, SWP_NOZORDER|SWP_NOMOVE))
1653 This->WindowPos.right = This->WindowPos.left + Width;
1658 static HRESULT WINAPI Videowindow_get_Width(IVideoWindow *iface,
1660 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1662 TRACE("(%p/%p)->(%p)\n", This, iface, pWidth);
1664 *pWidth = This->WindowPos.right - This->WindowPos.left;
1669 static HRESULT WINAPI Videowindow_put_Top(IVideoWindow *iface,
1671 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1673 TRACE("(%p/%p)->(%ld)\n", This, iface, Top);
1675 if (!SetWindowPos(This->hWnd, NULL, This->WindowPos.left, Top, 0, 0, SWP_NOZORDER|SWP_NOSIZE))
1678 This->WindowPos.top = Top;
1683 static HRESULT WINAPI Videowindow_get_Top(IVideoWindow *iface,
1685 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1687 TRACE("(%p/%p)->(%p)\n", This, iface, pTop);
1689 *pTop = This->WindowPos.top;
1694 static HRESULT WINAPI Videowindow_put_Height(IVideoWindow *iface,
1696 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1698 TRACE("(%p/%p)->(%ld)\n", This, iface, Height);
1700 if (!SetWindowPos(This->hWnd, NULL, 0, 0, This->WindowPos.right-This->WindowPos.left, Height, SWP_NOZORDER|SWP_NOMOVE))
1703 This->WindowPos.bottom = This->WindowPos.top + Height;
1708 static HRESULT WINAPI Videowindow_get_Height(IVideoWindow *iface,
1710 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1712 TRACE("(%p/%p)->(%p)\n", This, iface, pHeight);
1714 *pHeight = This->WindowPos.bottom - This->WindowPos.top;
1719 static HRESULT WINAPI Videowindow_put_Owner(IVideoWindow *iface,
1721 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1723 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Owner);
1725 SetParent(This->hWnd, (HWND)Owner);
1730 static HRESULT WINAPI Videowindow_get_Owner(IVideoWindow *iface,
1732 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1734 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Owner);
1736 *(HWND*)Owner = GetParent(This->hWnd);
1741 static HRESULT WINAPI Videowindow_put_MessageDrain(IVideoWindow *iface,
1743 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1745 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Drain);
1747 This->hWndMsgDrain = (HWND)Drain;
1752 static HRESULT WINAPI Videowindow_get_MessageDrain(IVideoWindow *iface,
1754 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1756 TRACE("(%p/%p)->(%p)\n", This, iface, Drain);
1758 *Drain = (OAHWND)This->hWndMsgDrain;
1763 static HRESULT WINAPI Videowindow_get_BorderColor(IVideoWindow *iface,
1765 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1767 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, Color);
1772 static HRESULT WINAPI Videowindow_put_BorderColor(IVideoWindow *iface,
1774 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1776 FIXME("(%p/%p)->(%ld): stub !!!\n", This, iface, Color);
1781 static HRESULT WINAPI Videowindow_get_FullScreenMode(IVideoWindow *iface,
1782 long *FullScreenMode) {
1783 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1785 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, FullScreenMode);
1790 static HRESULT WINAPI Videowindow_put_FullScreenMode(IVideoWindow *iface,
1791 long FullScreenMode) {
1792 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1794 FIXME("(%p/%p)->(%ld): stub !!!\n", This, iface, FullScreenMode);
1799 static HRESULT WINAPI Videowindow_SetWindowForeground(IVideoWindow *iface,
1801 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1806 TRACE("(%p/%p)->(%ld)\n", This, iface, Focus);
1808 if ((Focus != FALSE) && (Focus != TRUE))
1809 return E_INVALIDARG;
1811 hr = IPin_ConnectedTo(This->ppPins[0], &pPin);
1812 if ((hr != S_OK) || !pPin)
1813 return VFW_E_NOT_CONNECTED;
1816 ret = SetForegroundWindow(This->hWnd);
1818 ret = SetWindowPos(This->hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
1826 static HRESULT WINAPI Videowindow_NotifyOwnerMessage(IVideoWindow *iface,
1831 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1833 TRACE("(%p/%p)->(%08x, %ld, %08lx, %08lx)\n", This, iface, (DWORD) hwnd, uMsg, wParam, lParam);
1835 if (!PostMessageA(This->hWnd, uMsg, wParam, lParam))
1841 static HRESULT WINAPI Videowindow_SetWindowPosition(IVideoWindow *iface,
1846 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1848 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This, iface, Left, Top, Width, Height);
1850 if (!SetWindowPos(This->hWnd, NULL, Left, Top, Width, Height, SWP_NOZORDER))
1853 This->WindowPos.left = Left;
1854 This->WindowPos.top = Top;
1855 This->WindowPos.right = Left + Width;
1856 This->WindowPos.bottom = Top + Height;
1861 static HRESULT WINAPI Videowindow_GetWindowPosition(IVideoWindow *iface,
1866 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1868 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1870 *pLeft = This->WindowPos.left;
1871 *pTop = This->WindowPos.top;
1872 *pWidth = This->WindowPos.right - This->WindowPos.left;
1873 *pHeight = This->WindowPos.bottom - This->WindowPos.top;
1878 static HRESULT WINAPI Videowindow_GetMinIdealImageSize(IVideoWindow *iface,
1881 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1883 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This, iface, pWidth, pHeight);
1885 *pWidth = This->VideoWidth;
1886 *pHeight = This->VideoHeight;
1891 static HRESULT WINAPI Videowindow_GetMaxIdealImageSize(IVideoWindow *iface,
1894 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1896 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This, iface, pWidth, pHeight);
1898 *pWidth = This->VideoWidth;
1899 *pHeight = This->VideoHeight;
1904 static HRESULT WINAPI Videowindow_GetRestorePosition(IVideoWindow *iface,
1909 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1911 FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This, iface, pLeft, pTop, pWidth, pHeight);
1916 static HRESULT WINAPI Videowindow_HideCursor(IVideoWindow *iface,
1918 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1920 FIXME("(%p/%p)->(%ld): stub !!!\n", This, iface, HideCursor);
1925 static HRESULT WINAPI Videowindow_IsCursorHidden(IVideoWindow *iface,
1926 long *CursorHidden) {
1927 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1929 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, CursorHidden);
1934 static const IVideoWindowVtbl IVideoWindow_VTable =
1936 Videowindow_QueryInterface,
1938 Videowindow_Release,
1939 Videowindow_GetTypeInfoCount,
1940 Videowindow_GetTypeInfo,
1941 Videowindow_GetIDsOfNames,
1943 Videowindow_put_Caption,
1944 Videowindow_get_Caption,
1945 Videowindow_put_WindowStyle,
1946 Videowindow_get_WindowStyle,
1947 Videowindow_put_WindowStyleEx,
1948 Videowindow_get_WindowStyleEx,
1949 Videowindow_put_AutoShow,
1950 Videowindow_get_AutoShow,
1951 Videowindow_put_WindowState,
1952 Videowindow_get_WindowState,
1953 Videowindow_put_BackgroundPalette,
1954 Videowindow_get_BackgroundPalette,
1955 Videowindow_put_Visible,
1956 Videowindow_get_Visible,
1957 Videowindow_put_Left,
1958 Videowindow_get_Left,
1959 Videowindow_put_Width,
1960 Videowindow_get_Width,
1961 Videowindow_put_Top,
1962 Videowindow_get_Top,
1963 Videowindow_put_Height,
1964 Videowindow_get_Height,
1965 Videowindow_put_Owner,
1966 Videowindow_get_Owner,
1967 Videowindow_put_MessageDrain,
1968 Videowindow_get_MessageDrain,
1969 Videowindow_get_BorderColor,
1970 Videowindow_put_BorderColor,
1971 Videowindow_get_FullScreenMode,
1972 Videowindow_put_FullScreenMode,
1973 Videowindow_SetWindowForeground,
1974 Videowindow_NotifyOwnerMessage,
1975 Videowindow_SetWindowPosition,
1976 Videowindow_GetWindowPosition,
1977 Videowindow_GetMinIdealImageSize,
1978 Videowindow_GetMaxIdealImageSize,
1979 Videowindow_GetRestorePosition,
1980 Videowindow_HideCursor,
1981 Videowindow_IsCursorHidden