2 * Video Renderer (Fullscreen and Windowed using Direct Draw)
4 * Copyright 2004 Christian Costa
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #define NONAMELESSSTRUCT
24 #define NONAMELESSUNION
25 #include "quartz_private.h"
26 #include "control_private.h"
39 #include "wine/unicode.h"
40 #include "wine/debug.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(quartz
);
44 static BOOL wnd_class_registered
= FALSE
;
46 static const WCHAR wcsInputPinName
[] = {'i','n','p','u','t',' ','p','i','n',0};
48 static const IBaseFilterVtbl VideoRenderer_Vtbl
;
49 static const IUnknownVtbl IInner_VTable
;
50 static const IBasicVideoVtbl IBasicVideo_VTable
;
51 static const IVideoWindowVtbl IVideoWindow_VTable
;
52 static const IPinVtbl VideoRenderer_InputPin_Vtbl
;
54 typedef struct VideoRendererImpl
56 const IBaseFilterVtbl
* lpVtbl
;
57 const IBasicVideoVtbl
* IBasicVideo_vtbl
;
58 const IVideoWindowVtbl
* IVideoWindow_vtbl
;
59 const IUnknownVtbl
* IInner_vtbl
;
62 CRITICAL_SECTION csFilter
;
64 REFERENCE_TIME rtStreamStart
;
65 IReferenceClock
* pClock
;
66 FILTER_INFO filterInfo
;
89 static LRESULT CALLBACK
VideoWndProcA(HWND hwnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
91 VideoRendererImpl
* pVideoRenderer
= (VideoRendererImpl
*)GetWindowLongA(hwnd
, 0);
92 LPRECT lprect
= (LPRECT
)lParam
;
94 if (pVideoRenderer
&& pVideoRenderer
->hWndMsgDrain
)
100 case WM_LBUTTONDBLCLK
:
103 case WM_MBUTTONDBLCLK
:
106 case WM_MOUSEACTIVATE
:
108 case WM_NCLBUTTONDBLCLK
:
109 case WM_NCLBUTTONDOWN
:
111 case WM_NCMBUTTONDBLCLK
:
112 case WM_NCMBUTTONDOWN
:
115 case WM_NCRBUTTONDBLCLK
:
116 case WM_NCRBUTTONDOWN
:
118 case WM_RBUTTONDBLCLK
:
121 PostMessageA(pVideoRenderer
->hWndMsgDrain
, uMsg
, wParam
, lParam
);
131 /* TRACE("WM_SIZING %d %d %d %d\n", lprect->left, lprect->top, lprect->right, lprect->bottom); */
132 SetWindowPos(hwnd
, NULL
, lprect
->left
, lprect
->top
, lprect
->right
- lprect
->left
, lprect
->bottom
- lprect
->top
, SWP_NOZORDER
);
133 GetClientRect(hwnd
, &pVideoRenderer
->DestRect
);
134 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
135 pVideoRenderer
->DestRect
.left
,
136 pVideoRenderer
->DestRect
.top
,
137 pVideoRenderer
->DestRect
.right
- pVideoRenderer
->DestRect
.left
,
138 pVideoRenderer
->DestRect
.bottom
- pVideoRenderer
->DestRect
.top
);
141 TRACE("WM_SIZE %d %d\n", LOWORD(lParam
), HIWORD(lParam
));
142 GetClientRect(hwnd
, &pVideoRenderer
->DestRect
);
143 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
144 pVideoRenderer
->DestRect
.left
,
145 pVideoRenderer
->DestRect
.top
,
146 pVideoRenderer
->DestRect
.right
- pVideoRenderer
->DestRect
.left
,
147 pVideoRenderer
->DestRect
.bottom
- pVideoRenderer
->DestRect
.top
);
150 return DefWindowProcA(hwnd
, uMsg
, wParam
, lParam
);
155 static BOOL
CreateRenderingWindow(VideoRendererImpl
* This
)
159 TRACE("(%p)->()\n", This
);
162 winclass
.lpfnWndProc
= VideoWndProcA
;
163 winclass
.cbClsExtra
= 0;
164 winclass
.cbWndExtra
= sizeof(VideoRendererImpl
*);
165 winclass
.hInstance
= NULL
;
166 winclass
.hIcon
= NULL
;
167 winclass
.hCursor
= NULL
;
168 winclass
.hbrBackground
= GetStockObject(BLACK_BRUSH
);
169 winclass
.lpszMenuName
= NULL
;
170 winclass
.lpszClassName
= "Wine ActiveMovie Class";
172 if (!wnd_class_registered
)
174 if (!RegisterClassA(&winclass
))
176 ERR("Unable to register window %u\n", GetLastError());
179 wnd_class_registered
= TRUE
;
182 This
->hWnd
= CreateWindowExA(0, "Wine ActiveMovie Class", "Wine ActiveMovie Window", WS_SIZEBOX
,
183 CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
, NULL
,
188 ERR("Unable to create window\n");
192 SetWindowLongA(This
->hWnd
, 0, (LONG
)This
);
197 static DWORD WINAPI
MessageLoop(LPVOID lpParameter
)
199 VideoRendererImpl
* This
= (VideoRendererImpl
*) lpParameter
;
203 TRACE("Starting message loop\n");
205 if (!CreateRenderingWindow(This
))
207 This
->ThreadResult
= FALSE
;
208 SetEvent(This
->hEvent
);
212 This
->ThreadResult
= TRUE
;
213 SetEvent(This
->hEvent
);
215 while ((fGotMessage
= GetMessageA(&msg
, NULL
, 0, 0)) != 0 && fGotMessage
!= -1)
217 TranslateMessage(&msg
);
218 DispatchMessageA(&msg
);
221 TRACE("End of message loop\n");
226 static BOOL
CreateRenderingSubsystem(VideoRendererImpl
* This
)
228 This
->hEvent
= CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
232 This
->hThread
= CreateThread(NULL
, 0, MessageLoop
, (LPVOID
)This
, 0, &This
->ThreadID
);
235 CloseHandle(This
->hEvent
);
239 WaitForSingleObject(This
->hEvent
, INFINITE
);
240 CloseHandle(This
->hEvent
);
242 if (!This
->ThreadResult
)
244 CloseHandle(This
->hThread
);
251 static const IMemInputPinVtbl MemInputPin_Vtbl
=
253 MemInputPin_QueryInterface
,
256 MemInputPin_GetAllocator
,
257 MemInputPin_NotifyAllocator
,
258 MemInputPin_GetAllocatorRequirements
,
260 MemInputPin_ReceiveMultiple
,
261 MemInputPin_ReceiveCanBlock
264 static HRESULT
VideoRenderer_InputPin_Construct(const PIN_INFO
* pPinInfo
, SAMPLEPROC pSampleProc
, LPVOID pUserData
, QUERYACCEPTPROC pQueryAccept
, LPCRITICAL_SECTION pCritSec
, IPin
** ppPin
)
270 if (pPinInfo
->dir
!= PINDIR_INPUT
)
272 ERR("Pin direction(%x) != PINDIR_INPUT\n", pPinInfo
->dir
);
276 pPinImpl
= CoTaskMemAlloc(sizeof(*pPinImpl
));
279 return E_OUTOFMEMORY
;
281 if (SUCCEEDED(InputPin_Init(pPinInfo
, pSampleProc
, pUserData
, pQueryAccept
, pCritSec
, pPinImpl
)))
283 pPinImpl
->pin
.lpVtbl
= &VideoRenderer_InputPin_Vtbl
;
284 pPinImpl
->lpVtblMemInput
= &MemInputPin_Vtbl
;
286 *ppPin
= (IPin
*)(&pPinImpl
->pin
.lpVtbl
);
290 CoTaskMemFree(pPinImpl
);
294 static DWORD
VideoRenderer_SendSampleData(VideoRendererImpl
* This
, LPBYTE data
, DWORD size
)
296 VIDEOINFOHEADER
* format
;
302 LPBYTE palette
= NULL
;
305 TRACE("%p %p %d\n", This
, data
, size
);
307 sdesc
.dwSize
= sizeof(sdesc
);
308 hr
= IPin_ConnectionMediaType(This
->ppPins
[0], &amt
);
310 ERR("Unable to retrieve media type\n");
313 format
= (VIDEOINFOHEADER
*)amt
.pbFormat
;
315 TRACE("biSize = %d\n", format
->bmiHeader
.biSize
);
316 TRACE("biWidth = %d\n", format
->bmiHeader
.biWidth
);
317 TRACE("biHeight = %d\n", format
->bmiHeader
.biHeight
);
318 TRACE("biPlanes = %d\n", format
->bmiHeader
.biPlanes
);
319 TRACE("biBitCount = %d\n", format
->bmiHeader
.biBitCount
);
320 TRACE("biCompression = %s\n", debugstr_an((LPSTR
)&(format
->bmiHeader
.biCompression
), 4));
321 TRACE("biSizeImage = %d\n", format
->bmiHeader
.biSizeImage
);
323 width
= format
->bmiHeader
.biWidth
;
324 height
= format
->bmiHeader
.biHeight
;
325 palette
= ((LPBYTE
)&format
->bmiHeader
) + format
->bmiHeader
.biSize
;
329 /* Honor previously set WindowPos */
330 TRACE("WindowPos: %d %d %d %d\n", This
->WindowPos
.left
, This
->WindowPos
.top
, This
->WindowPos
.right
, This
->WindowPos
.bottom
);
331 SetWindowPos(This
->hWnd
, NULL
,
332 This
->WindowPos
.left
,
334 This
->WindowPos
.right
- This
->WindowPos
.left
,
335 This
->WindowPos
.bottom
- This
->WindowPos
.top
,
336 SWP_NOZORDER
|SWP_NOMOVE
);
337 GetClientRect(This
->hWnd
, &This
->DestRect
);
341 hDC
= GetDC(This
->hWnd
);
344 ERR("Cannot get DC from window!\n");
348 TRACE("Src Rect: %d %d %d %d\n", This
->SourceRect
.left
, This
->SourceRect
.top
, This
->SourceRect
.right
, This
->SourceRect
.bottom
);
349 TRACE("Dst Rect: %d %d %d %d\n", This
->DestRect
.left
, This
->DestRect
.top
, This
->DestRect
.right
, This
->DestRect
.bottom
);
351 StretchDIBits(hDC
, This
->DestRect
.left
, This
->DestRect
.top
, This
->DestRect
.right
-This
->DestRect
.left
,
352 This
->DestRect
.bottom
- This
->DestRect
.top
, This
->SourceRect
.left
, This
->SourceRect
.top
,
353 This
->SourceRect
.right
- This
->SourceRect
.left
, This
->SourceRect
.bottom
- This
->SourceRect
.top
,
354 data
, (BITMAPINFO
*)&format
->bmiHeader
, DIB_RGB_COLORS
, SRCCOPY
);
356 ReleaseDC(This
->hWnd
, hDC
);
359 ShowWindow(This
->hWnd
, SW_SHOW
);
364 static HRESULT
VideoRenderer_Sample(LPVOID iface
, IMediaSample
* pSample
)
366 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
367 LPBYTE pbSrcStream
= NULL
;
368 long cbSrcStream
= 0;
369 REFERENCE_TIME tStart
, tStop
;
372 TRACE("%p %p\n", iface
, pSample
);
374 hr
= IMediaSample_GetPointer(pSample
, &pbSrcStream
);
377 ERR("Cannot get pointer to sample data (%x)\n", hr
);
381 hr
= IMediaSample_GetTime(pSample
, &tStart
, &tStop
);
383 ERR("Cannot get sample time (%x)\n", hr
);
385 cbSrcStream
= IMediaSample_GetActualDataLength(pSample
);
387 TRACE("val %p %ld\n", pbSrcStream
, cbSrcStream
);
389 #if 0 /* For debugging purpose */
392 for(i
= 0; i
< cbSrcStream
; i
++)
394 if ((i
!=0) && !(i
%16))
396 TRACE("%02x ", pbSrcStream
[i
]);
402 VideoRenderer_SendSampleData(This
, pbSrcStream
, cbSrcStream
);
407 static HRESULT
VideoRenderer_QueryAccept(LPVOID iface
, const AM_MEDIA_TYPE
* pmt
)
409 if (!IsEqualIID(&pmt
->majortype
, &MEDIATYPE_Video
))
412 if (IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB32
) ||
413 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB24
) ||
414 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB565
) ||
415 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB8
))
417 VideoRendererImpl
* This
= (VideoRendererImpl
*) iface
;
418 VIDEOINFOHEADER
* format
= (VIDEOINFOHEADER
*)pmt
->pbFormat
;
420 if (!IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo
))
422 WARN("Format type %s not supported\n", debugstr_guid(&pmt
->formattype
));
425 This
->SourceRect
.left
= 0;
426 This
->SourceRect
.top
= 0;
427 This
->SourceRect
.right
= This
->VideoWidth
= format
->bmiHeader
.biWidth
;
428 This
->SourceRect
.bottom
= This
->VideoHeight
= format
->bmiHeader
.biHeight
;
434 HRESULT
VideoRenderer_create(IUnknown
* pUnkOuter
, LPVOID
* ppv
)
438 VideoRendererImpl
* pVideoRenderer
;
440 TRACE("(%p, %p)\n", pUnkOuter
, ppv
);
444 pVideoRenderer
= CoTaskMemAlloc(sizeof(VideoRendererImpl
));
445 pVideoRenderer
->pUnkOuter
= pUnkOuter
;
446 pVideoRenderer
->bUnkOuterValid
= FALSE
;
447 pVideoRenderer
->bAggregatable
= FALSE
;
448 pVideoRenderer
->IInner_vtbl
= &IInner_VTable
;
450 pVideoRenderer
->lpVtbl
= &VideoRenderer_Vtbl
;
451 pVideoRenderer
->IBasicVideo_vtbl
= &IBasicVideo_VTable
;
452 pVideoRenderer
->IVideoWindow_vtbl
= &IVideoWindow_VTable
;
454 pVideoRenderer
->refCount
= 1;
455 InitializeCriticalSection(&pVideoRenderer
->csFilter
);
456 pVideoRenderer
->csFilter
.DebugInfo
->Spare
[0] = (DWORD_PTR
)(__FILE__
": VideoRendererImpl.csFilter");
457 pVideoRenderer
->state
= State_Stopped
;
458 pVideoRenderer
->pClock
= NULL
;
459 pVideoRenderer
->init
= 0;
460 pVideoRenderer
->AutoShow
= 1;
461 ZeroMemory(&pVideoRenderer
->filterInfo
, sizeof(FILTER_INFO
));
463 pVideoRenderer
->ppPins
= CoTaskMemAlloc(1 * sizeof(IPin
*));
465 /* construct input pin */
466 piInput
.dir
= PINDIR_INPUT
;
467 piInput
.pFilter
= (IBaseFilter
*)pVideoRenderer
;
468 lstrcpynW(piInput
.achName
, wcsInputPinName
, sizeof(piInput
.achName
) / sizeof(piInput
.achName
[0]));
470 hr
= VideoRenderer_InputPin_Construct(&piInput
, VideoRenderer_Sample
, (LPVOID
)pVideoRenderer
, VideoRenderer_QueryAccept
, &pVideoRenderer
->csFilter
, (IPin
**)&pVideoRenderer
->pInputPin
);
474 pVideoRenderer
->ppPins
[0] = (IPin
*)pVideoRenderer
->pInputPin
;
475 *ppv
= (LPVOID
)pVideoRenderer
;
479 CoTaskMemFree(pVideoRenderer
->ppPins
);
480 pVideoRenderer
->csFilter
.DebugInfo
->Spare
[0] = 0;
481 DeleteCriticalSection(&pVideoRenderer
->csFilter
);
482 CoTaskMemFree(pVideoRenderer
);
485 if (!CreateRenderingSubsystem(pVideoRenderer
))
491 HRESULT
VideoRendererDefault_create(IUnknown
* pUnkOuter
, LPVOID
* ppv
)
493 /* TODO: Attenmpt to use the VMR-7 renderer instead when possible */
494 return VideoRenderer_create(pUnkOuter
, ppv
);
497 static HRESULT WINAPI
VideoRendererInner_QueryInterface(IUnknown
* iface
, REFIID riid
, LPVOID
* ppv
)
499 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
500 TRACE("(%p/%p)->(%s, %p)\n", This
, iface
, qzdebugstr_guid(riid
), ppv
);
502 if (This
->bAggregatable
)
503 This
->bUnkOuterValid
= TRUE
;
507 if (IsEqualIID(riid
, &IID_IUnknown
))
508 *ppv
= (LPVOID
)&(This
->IInner_vtbl
);
509 else if (IsEqualIID(riid
, &IID_IPersist
))
511 else if (IsEqualIID(riid
, &IID_IMediaFilter
))
513 else if (IsEqualIID(riid
, &IID_IBaseFilter
))
515 else if (IsEqualIID(riid
, &IID_IBasicVideo
))
516 *ppv
= (LPVOID
)&(This
->IBasicVideo_vtbl
);
517 else if (IsEqualIID(riid
, &IID_IVideoWindow
))
518 *ppv
= (LPVOID
)&(This
->IVideoWindow_vtbl
);
522 IUnknown_AddRef((IUnknown
*)(*ppv
));
526 if (!IsEqualIID(riid
, &IID_IPin
))
527 FIXME("No interface for %s!\n", qzdebugstr_guid(riid
));
529 return E_NOINTERFACE
;
532 static ULONG WINAPI
VideoRendererInner_AddRef(IUnknown
* iface
)
534 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
535 ULONG refCount
= InterlockedIncrement(&This
->refCount
);
537 TRACE("(%p/%p)->() AddRef from %d\n", This
, iface
, refCount
- 1);
542 static ULONG WINAPI
VideoRendererInner_Release(IUnknown
* iface
)
544 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
545 ULONG refCount
= InterlockedDecrement(&This
->refCount
);
547 TRACE("(%p/%p)->() Release from %d\n", This
, iface
, refCount
+ 1);
553 DestroyWindow(This
->hWnd
);
554 PostThreadMessageA(This
->ThreadID
, WM_QUIT
, 0, 0);
555 WaitForSingleObject(This
->hThread
, INFINITE
);
556 CloseHandle(This
->hThread
);
559 IReferenceClock_Release(This
->pClock
);
561 if (SUCCEEDED(IPin_ConnectedTo(This
->ppPins
[0], &pConnectedTo
)))
563 IPin_Disconnect(pConnectedTo
);
564 IPin_Release(pConnectedTo
);
566 IPin_Disconnect(This
->ppPins
[0]);
568 IPin_Release(This
->ppPins
[0]);
570 CoTaskMemFree(This
->ppPins
);
573 This
->csFilter
.DebugInfo
->Spare
[0] = 0;
574 DeleteCriticalSection(&This
->csFilter
);
576 TRACE("Destroying Video Renderer\n");
585 static const IUnknownVtbl IInner_VTable
=
587 VideoRendererInner_QueryInterface
,
588 VideoRendererInner_AddRef
,
589 VideoRendererInner_Release
592 static HRESULT WINAPI
VideoRenderer_QueryInterface(IBaseFilter
* iface
, REFIID riid
, LPVOID
* ppv
)
594 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
596 if (This
->bAggregatable
)
597 This
->bUnkOuterValid
= TRUE
;
601 if (This
->bAggregatable
)
602 return IUnknown_QueryInterface(This
->pUnkOuter
, riid
, ppv
);
604 if (IsEqualIID(riid
, &IID_IUnknown
))
608 IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
609 hr
= IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
610 IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
611 This
->bAggregatable
= TRUE
;
616 return E_NOINTERFACE
;
619 return IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
622 static ULONG WINAPI
VideoRenderer_AddRef(IBaseFilter
* iface
)
624 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
626 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
627 return IUnknown_AddRef(This
->pUnkOuter
);
628 return IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
631 static ULONG WINAPI
VideoRenderer_Release(IBaseFilter
* iface
)
633 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
635 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
636 return IUnknown_Release(This
->pUnkOuter
);
637 return IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
640 /** IPersist methods **/
642 static HRESULT WINAPI
VideoRenderer_GetClassID(IBaseFilter
* iface
, CLSID
* pClsid
)
644 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
646 TRACE("(%p/%p)->(%p)\n", This
, iface
, pClsid
);
648 *pClsid
= CLSID_VideoRenderer
;
653 /** IMediaFilter methods **/
655 static HRESULT WINAPI
VideoRenderer_Stop(IBaseFilter
* iface
)
657 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
659 TRACE("(%p/%p)->()\n", This
, iface
);
661 EnterCriticalSection(&This
->csFilter
);
663 This
->state
= State_Stopped
;
665 LeaveCriticalSection(&This
->csFilter
);
670 static HRESULT WINAPI
VideoRenderer_Pause(IBaseFilter
* iface
)
672 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
674 TRACE("(%p/%p)->()\n", This
, iface
);
676 EnterCriticalSection(&This
->csFilter
);
678 This
->state
= State_Paused
;
680 LeaveCriticalSection(&This
->csFilter
);
685 static HRESULT WINAPI
VideoRenderer_Run(IBaseFilter
* iface
, REFERENCE_TIME tStart
)
687 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
689 TRACE("(%p/%p)->(%s)\n", This
, iface
, wine_dbgstr_longlong(tStart
));
691 EnterCriticalSection(&This
->csFilter
);
693 This
->rtStreamStart
= tStart
;
694 This
->state
= State_Running
;
696 LeaveCriticalSection(&This
->csFilter
);
701 static HRESULT WINAPI
VideoRenderer_GetState(IBaseFilter
* iface
, DWORD dwMilliSecsTimeout
, FILTER_STATE
*pState
)
703 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
705 TRACE("(%p/%p)->(%d, %p)\n", This
, iface
, dwMilliSecsTimeout
, pState
);
707 EnterCriticalSection(&This
->csFilter
);
709 *pState
= This
->state
;
711 LeaveCriticalSection(&This
->csFilter
);
716 static HRESULT WINAPI
VideoRenderer_SetSyncSource(IBaseFilter
* iface
, IReferenceClock
*pClock
)
718 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
720 TRACE("(%p/%p)->(%p)\n", This
, iface
, pClock
);
722 EnterCriticalSection(&This
->csFilter
);
725 IReferenceClock_Release(This
->pClock
);
726 This
->pClock
= pClock
;
728 IReferenceClock_AddRef(This
->pClock
);
730 LeaveCriticalSection(&This
->csFilter
);
735 static HRESULT WINAPI
VideoRenderer_GetSyncSource(IBaseFilter
* iface
, IReferenceClock
**ppClock
)
737 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
739 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppClock
);
741 EnterCriticalSection(&This
->csFilter
);
743 *ppClock
= This
->pClock
;
744 IReferenceClock_AddRef(This
->pClock
);
746 LeaveCriticalSection(&This
->csFilter
);
751 /** IBaseFilter implementation **/
753 static HRESULT WINAPI
VideoRenderer_EnumPins(IBaseFilter
* iface
, IEnumPins
**ppEnum
)
756 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
758 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppEnum
);
760 epd
.cPins
= 1; /* input pin */
761 epd
.ppPins
= This
->ppPins
;
762 return IEnumPinsImpl_Construct(&epd
, ppEnum
);
765 static HRESULT WINAPI
VideoRenderer_FindPin(IBaseFilter
* iface
, LPCWSTR Id
, IPin
**ppPin
)
767 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
769 TRACE("(%p/%p)->(%p,%p)\n", This
, iface
, debugstr_w(Id
), ppPin
);
771 FIXME("VideoRenderer::FindPin(...)\n");
773 /* FIXME: critical section */
778 static HRESULT WINAPI
VideoRenderer_QueryFilterInfo(IBaseFilter
* iface
, FILTER_INFO
*pInfo
)
780 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
782 TRACE("(%p/%p)->(%p)\n", This
, iface
, pInfo
);
784 strcpyW(pInfo
->achName
, This
->filterInfo
.achName
);
785 pInfo
->pGraph
= This
->filterInfo
.pGraph
;
788 IFilterGraph_AddRef(pInfo
->pGraph
);
793 static HRESULT WINAPI
VideoRenderer_JoinFilterGraph(IBaseFilter
* iface
, IFilterGraph
*pGraph
, LPCWSTR pName
)
795 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
797 TRACE("(%p/%p)->(%p, %s)\n", This
, iface
, pGraph
, debugstr_w(pName
));
799 EnterCriticalSection(&This
->csFilter
);
802 strcpyW(This
->filterInfo
.achName
, pName
);
804 *This
->filterInfo
.achName
= '\0';
805 This
->filterInfo
.pGraph
= pGraph
; /* NOTE: do NOT increase ref. count */
807 LeaveCriticalSection(&This
->csFilter
);
812 static HRESULT WINAPI
VideoRenderer_QueryVendorInfo(IBaseFilter
* iface
, LPWSTR
*pVendorInfo
)
814 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
815 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVendorInfo
);
819 static const IBaseFilterVtbl VideoRenderer_Vtbl
=
821 VideoRenderer_QueryInterface
,
822 VideoRenderer_AddRef
,
823 VideoRenderer_Release
,
824 VideoRenderer_GetClassID
,
828 VideoRenderer_GetState
,
829 VideoRenderer_SetSyncSource
,
830 VideoRenderer_GetSyncSource
,
831 VideoRenderer_EnumPins
,
832 VideoRenderer_FindPin
,
833 VideoRenderer_QueryFilterInfo
,
834 VideoRenderer_JoinFilterGraph
,
835 VideoRenderer_QueryVendorInfo
838 static HRESULT WINAPI
VideoRenderer_InputPin_EndOfStream(IPin
* iface
)
840 InputPin
* This
= (InputPin
*)iface
;
841 IMediaEventSink
* pEventSink
;
844 TRACE("(%p/%p)->()\n", This
, iface
);
846 hr
= IFilterGraph_QueryInterface(((VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
)->filterInfo
.pGraph
, &IID_IMediaEventSink
, (LPVOID
*)&pEventSink
);
849 hr
= IMediaEventSink_Notify(pEventSink
, EC_COMPLETE
, S_OK
, 0);
850 IMediaEventSink_Release(pEventSink
);
856 static const IPinVtbl VideoRenderer_InputPin_Vtbl
=
858 InputPin_QueryInterface
,
862 InputPin_ReceiveConnection
,
864 IPinImpl_ConnectedTo
,
865 IPinImpl_ConnectionMediaType
,
866 IPinImpl_QueryPinInfo
,
867 IPinImpl_QueryDirection
,
869 IPinImpl_QueryAccept
,
870 IPinImpl_EnumMediaTypes
,
871 IPinImpl_QueryInternalConnections
,
872 VideoRenderer_InputPin_EndOfStream
,
878 /*** IUnknown methods ***/
879 static HRESULT WINAPI
Basicvideo_QueryInterface(IBasicVideo
*iface
,
882 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
884 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
886 return VideoRenderer_QueryInterface((IBaseFilter
*)This
, riid
, ppvObj
);
889 static ULONG WINAPI
Basicvideo_AddRef(IBasicVideo
*iface
) {
890 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
892 TRACE("(%p/%p)->()\n", This
, iface
);
894 return VideoRenderer_AddRef((IBaseFilter
*)This
);
897 static ULONG WINAPI
Basicvideo_Release(IBasicVideo
*iface
) {
898 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
900 TRACE("(%p/%p)->()\n", This
, iface
);
902 return VideoRenderer_Release((IBaseFilter
*)This
);
905 /*** IDispatch methods ***/
906 static HRESULT WINAPI
Basicvideo_GetTypeInfoCount(IBasicVideo
*iface
,
908 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
910 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
915 static HRESULT WINAPI
Basicvideo_GetTypeInfo(IBasicVideo
*iface
,
918 ITypeInfo
**ppTInfo
) {
919 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
921 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
926 static HRESULT WINAPI
Basicvideo_GetIDsOfNames(IBasicVideo
*iface
,
932 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
934 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
939 static HRESULT WINAPI
Basicvideo_Invoke(IBasicVideo
*iface
,
944 DISPPARAMS
*pDispParams
,
948 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
950 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
);
955 /*** IBasicVideo methods ***/
956 static HRESULT WINAPI
Basicvideo_get_AvgTimePerFrame(IBasicVideo
*iface
,
957 REFTIME
*pAvgTimePerFrame
) {
958 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
960 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pAvgTimePerFrame
);
965 static HRESULT WINAPI
Basicvideo_get_BitRate(IBasicVideo
*iface
,
967 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
969 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBitRate
);
974 static HRESULT WINAPI
Basicvideo_get_BitErrorRate(IBasicVideo
*iface
,
975 long *pBitErrorRate
) {
976 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
978 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBitErrorRate
);
983 static HRESULT WINAPI
Basicvideo_get_VideoWidth(IBasicVideo
*iface
,
985 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
987 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoWidth
);
989 *pVideoWidth
= This
->VideoWidth
;
994 static HRESULT WINAPI
Basicvideo_get_VideoHeight(IBasicVideo
*iface
,
995 long *pVideoHeight
) {
996 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
998 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoHeight
);
1000 *pVideoHeight
= This
->VideoHeight
;
1005 static HRESULT WINAPI
Basicvideo_put_SourceLeft(IBasicVideo
*iface
,
1007 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1009 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceLeft
);
1011 This
->SourceRect
.left
= SourceLeft
;
1016 static HRESULT WINAPI
Basicvideo_get_SourceLeft(IBasicVideo
*iface
,
1017 long *pSourceLeft
) {
1018 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1020 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceLeft
);
1022 *pSourceLeft
= This
->SourceRect
.left
;
1027 static HRESULT WINAPI
Basicvideo_put_SourceWidth(IBasicVideo
*iface
,
1029 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1031 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceWidth
);
1033 This
->SourceRect
.right
= This
->SourceRect
.left
+ SourceWidth
;
1038 static HRESULT WINAPI
Basicvideo_get_SourceWidth(IBasicVideo
*iface
,
1039 long *pSourceWidth
) {
1040 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1042 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceWidth
);
1044 *pSourceWidth
= This
->SourceRect
.right
- This
->SourceRect
.left
;
1049 static HRESULT WINAPI
Basicvideo_put_SourceTop(IBasicVideo
*iface
,
1051 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1053 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceTop
);
1055 This
->SourceRect
.top
= SourceTop
;
1060 static HRESULT WINAPI
Basicvideo_get_SourceTop(IBasicVideo
*iface
,
1062 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1064 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceTop
);
1066 *pSourceTop
= This
->SourceRect
.top
;
1071 static HRESULT WINAPI
Basicvideo_put_SourceHeight(IBasicVideo
*iface
,
1072 long SourceHeight
) {
1073 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1075 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceHeight
);
1077 This
->SourceRect
.bottom
= This
->SourceRect
.top
+ SourceHeight
;
1082 static HRESULT WINAPI
Basicvideo_get_SourceHeight(IBasicVideo
*iface
,
1083 long *pSourceHeight
) {
1084 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1086 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceHeight
);
1088 *pSourceHeight
= This
->SourceRect
.bottom
- This
->SourceRect
.top
;
1093 static HRESULT WINAPI
Basicvideo_put_DestinationLeft(IBasicVideo
*iface
,
1094 long DestinationLeft
) {
1095 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1097 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationLeft
);
1099 This
->DestRect
.left
= DestinationLeft
;
1104 static HRESULT WINAPI
Basicvideo_get_DestinationLeft(IBasicVideo
*iface
,
1105 long *pDestinationLeft
) {
1106 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1108 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationLeft
);
1110 *pDestinationLeft
= This
->DestRect
.left
;
1115 static HRESULT WINAPI
Basicvideo_put_DestinationWidth(IBasicVideo
*iface
,
1116 long DestinationWidth
) {
1117 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1119 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationWidth
);
1121 This
->DestRect
.right
= This
->DestRect
.left
+ DestinationWidth
;
1126 static HRESULT WINAPI
Basicvideo_get_DestinationWidth(IBasicVideo
*iface
,
1127 long *pDestinationWidth
) {
1128 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1130 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationWidth
);
1132 *pDestinationWidth
= This
->DestRect
.right
- This
->DestRect
.left
;
1137 static HRESULT WINAPI
Basicvideo_put_DestinationTop(IBasicVideo
*iface
,
1138 long DestinationTop
) {
1139 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1141 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationTop
);
1143 This
->DestRect
.top
= DestinationTop
;
1148 static HRESULT WINAPI
Basicvideo_get_DestinationTop(IBasicVideo
*iface
,
1149 long *pDestinationTop
) {
1150 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1152 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationTop
);
1154 *pDestinationTop
= This
->DestRect
.top
;
1159 static HRESULT WINAPI
Basicvideo_put_DestinationHeight(IBasicVideo
*iface
,
1160 long DestinationHeight
) {
1161 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1163 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationHeight
);
1165 This
->DestRect
.right
= This
->DestRect
.left
+ DestinationHeight
;
1170 static HRESULT WINAPI
Basicvideo_get_DestinationHeight(IBasicVideo
*iface
,
1171 long *pDestinationHeight
) {
1172 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1174 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationHeight
);
1176 *pDestinationHeight
= This
->DestRect
.right
- This
->DestRect
.left
;
1181 static HRESULT WINAPI
Basicvideo_SetSourcePosition(IBasicVideo
*iface
,
1186 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1188 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This
, iface
, Left
, Top
, Width
, Height
);
1190 This
->SourceRect
.left
= Left
;
1191 This
->SourceRect
.top
= Top
;
1192 This
->SourceRect
.right
= Left
+ Width
;
1193 This
->SourceRect
.bottom
= Top
+ Height
;
1198 static HRESULT WINAPI
Basicvideo_GetSourcePosition(IBasicVideo
*iface
,
1203 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1205 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1207 *pLeft
= This
->SourceRect
.left
;
1208 *pTop
= This
->SourceRect
.top
;
1209 *pWidth
= This
->SourceRect
.right
- This
->SourceRect
.left
;
1210 *pHeight
= This
->SourceRect
.bottom
- This
->SourceRect
.top
;
1215 static HRESULT WINAPI
Basicvideo_SetDefaultSourcePosition(IBasicVideo
*iface
) {
1216 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1218 TRACE("(%p/%p)->()\n", This
, iface
);
1220 This
->SourceRect
.left
= 0;
1221 This
->SourceRect
.top
= 0;
1222 This
->SourceRect
.right
= This
->VideoWidth
;
1223 This
->SourceRect
.bottom
= This
->VideoHeight
;
1228 static HRESULT WINAPI
Basicvideo_SetDestinationPosition(IBasicVideo
*iface
,
1233 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1235 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This
, iface
, Left
, Top
, Width
, Height
);
1237 This
->DestRect
.left
= Left
;
1238 This
->DestRect
.top
= Top
;
1239 This
->DestRect
.right
= Left
+ Width
;
1240 This
->DestRect
.bottom
= Top
+ Height
;
1245 static HRESULT WINAPI
Basicvideo_GetDestinationPosition(IBasicVideo
*iface
,
1250 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1252 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1254 *pLeft
= This
->DestRect
.left
;
1255 *pTop
= This
->DestRect
.top
;
1256 *pWidth
= This
->DestRect
.right
- This
->DestRect
.left
;
1257 *pHeight
= This
->DestRect
.bottom
- This
->DestRect
.top
;
1262 static HRESULT WINAPI
Basicvideo_SetDefaultDestinationPosition(IBasicVideo
*iface
) {
1263 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1266 TRACE("(%p/%p)->()\n", This
, iface
);
1268 if (!GetClientRect(This
->hWnd
, &rect
))
1271 This
->SourceRect
.left
= 0;
1272 This
->SourceRect
.top
= 0;
1273 This
->SourceRect
.right
= rect
.right
;
1274 This
->SourceRect
.bottom
= rect
.bottom
;
1279 static HRESULT WINAPI
Basicvideo_GetVideoSize(IBasicVideo
*iface
,
1282 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1284 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pWidth
, pHeight
);
1286 *pWidth
= This
->VideoWidth
;
1287 *pHeight
= This
->VideoHeight
;
1292 static HRESULT WINAPI
Basicvideo_GetVideoPaletteEntries(IBasicVideo
*iface
,
1297 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1299 FIXME("(%p/%p)->(%ld, %ld, %p, %p): stub !!!\n", This
, iface
, StartIndex
, Entries
, pRetrieved
, pPalette
);
1304 static HRESULT WINAPI
Basicvideo_GetCurrentImage(IBasicVideo
*iface
,
1307 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1309 FIXME("(%p/%p)->(%p, %p): stub !!!\n", This
, iface
, pBufferSize
, pDIBImage
);
1314 static HRESULT WINAPI
Basicvideo_IsUsingDefaultSource(IBasicVideo
*iface
) {
1315 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1317 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
1322 static HRESULT WINAPI
Basicvideo_IsUsingDefaultDestination(IBasicVideo
*iface
) {
1323 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1325 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
1331 static const IBasicVideoVtbl IBasicVideo_VTable
=
1333 Basicvideo_QueryInterface
,
1336 Basicvideo_GetTypeInfoCount
,
1337 Basicvideo_GetTypeInfo
,
1338 Basicvideo_GetIDsOfNames
,
1340 Basicvideo_get_AvgTimePerFrame
,
1341 Basicvideo_get_BitRate
,
1342 Basicvideo_get_BitErrorRate
,
1343 Basicvideo_get_VideoWidth
,
1344 Basicvideo_get_VideoHeight
,
1345 Basicvideo_put_SourceLeft
,
1346 Basicvideo_get_SourceLeft
,
1347 Basicvideo_put_SourceWidth
,
1348 Basicvideo_get_SourceWidth
,
1349 Basicvideo_put_SourceTop
,
1350 Basicvideo_get_SourceTop
,
1351 Basicvideo_put_SourceHeight
,
1352 Basicvideo_get_SourceHeight
,
1353 Basicvideo_put_DestinationLeft
,
1354 Basicvideo_get_DestinationLeft
,
1355 Basicvideo_put_DestinationWidth
,
1356 Basicvideo_get_DestinationWidth
,
1357 Basicvideo_put_DestinationTop
,
1358 Basicvideo_get_DestinationTop
,
1359 Basicvideo_put_DestinationHeight
,
1360 Basicvideo_get_DestinationHeight
,
1361 Basicvideo_SetSourcePosition
,
1362 Basicvideo_GetSourcePosition
,
1363 Basicvideo_SetDefaultSourcePosition
,
1364 Basicvideo_SetDestinationPosition
,
1365 Basicvideo_GetDestinationPosition
,
1366 Basicvideo_SetDefaultDestinationPosition
,
1367 Basicvideo_GetVideoSize
,
1368 Basicvideo_GetVideoPaletteEntries
,
1369 Basicvideo_GetCurrentImage
,
1370 Basicvideo_IsUsingDefaultSource
,
1371 Basicvideo_IsUsingDefaultDestination
1375 /*** IUnknown methods ***/
1376 static HRESULT WINAPI
Videowindow_QueryInterface(IVideoWindow
*iface
,
1379 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1381 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
1383 return VideoRenderer_QueryInterface((IBaseFilter
*)This
, riid
, ppvObj
);
1386 static ULONG WINAPI
Videowindow_AddRef(IVideoWindow
*iface
) {
1387 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1389 TRACE("(%p/%p)->()\n", This
, iface
);
1391 return VideoRenderer_AddRef((IBaseFilter
*)This
);
1394 static ULONG WINAPI
Videowindow_Release(IVideoWindow
*iface
) {
1395 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1397 TRACE("(%p/%p)->()\n", This
, iface
);
1399 return VideoRenderer_Release((IBaseFilter
*)This
);
1402 /*** IDispatch methods ***/
1403 static HRESULT WINAPI
Videowindow_GetTypeInfoCount(IVideoWindow
*iface
,
1405 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1407 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
1412 static HRESULT WINAPI
Videowindow_GetTypeInfo(IVideoWindow
*iface
,
1415 ITypeInfo
**ppTInfo
) {
1416 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1418 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
1423 static HRESULT WINAPI
Videowindow_GetIDsOfNames(IVideoWindow
*iface
,
1429 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1431 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1436 static HRESULT WINAPI
Videowindow_Invoke(IVideoWindow
*iface
,
1437 DISPID dispIdMember
,
1441 DISPPARAMS
*pDispParams
,
1443 EXCEPINFO
*pExepInfo
,
1445 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1447 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
);
1452 /*** IVideoWindow methods ***/
1453 static HRESULT WINAPI
Videowindow_put_Caption(IVideoWindow
*iface
,
1455 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1457 TRACE("(%p/%p)->(%s (%p))\n", This
, iface
, debugstr_w(strCaption
), strCaption
);
1459 if (!SetWindowTextW(This
->hWnd
, strCaption
))
1465 static HRESULT WINAPI
Videowindow_get_Caption(IVideoWindow
*iface
,
1467 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1469 TRACE("(%p/%p)->(%p)\n", This
, iface
, strCaption
);
1471 GetWindowTextW(This
->hWnd
, (LPWSTR
)strCaption
, 100);
1476 static HRESULT WINAPI
Videowindow_put_WindowStyle(IVideoWindow
*iface
,
1478 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1481 old
= GetWindowLongA(This
->hWnd
, GWL_STYLE
);
1483 TRACE("(%p/%p)->(%x -> %lx)\n", This
, iface
, old
, WindowStyle
);
1485 if (WindowStyle
& (WS_DISABLED
|WS_HSCROLL
|WS_ICONIC
|WS_MAXIMIZE
|WS_MINIMIZE
|WS_VSCROLL
))
1486 return E_INVALIDARG
;
1488 SetWindowLongA(This
->hWnd
, GWL_STYLE
, WindowStyle
);
1493 static HRESULT WINAPI
Videowindow_get_WindowStyle(IVideoWindow
*iface
,
1494 long *WindowStyle
) {
1495 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1497 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyle
);
1499 *WindowStyle
= GetWindowLongA(This
->hWnd
, GWL_STYLE
);
1504 static HRESULT WINAPI
Videowindow_put_WindowStyleEx(IVideoWindow
*iface
,
1505 long WindowStyleEx
) {
1506 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1508 TRACE("(%p/%p)->(%ld)\n", This
, iface
, WindowStyleEx
);
1510 if (WindowStyleEx
& (WS_DISABLED
|WS_HSCROLL
|WS_ICONIC
|WS_MAXIMIZE
|WS_MINIMIZE
|WS_VSCROLL
))
1511 return E_INVALIDARG
;
1513 if (!SetWindowLongA(This
->hWnd
, GWL_EXSTYLE
, WindowStyleEx
))
1519 static HRESULT WINAPI
Videowindow_get_WindowStyleEx(IVideoWindow
*iface
,
1520 long *WindowStyleEx
) {
1521 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1523 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyleEx
);
1525 *WindowStyleEx
= GetWindowLongA(This
->hWnd
, GWL_EXSTYLE
);
1530 static HRESULT WINAPI
Videowindow_put_AutoShow(IVideoWindow
*iface
,
1532 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1534 TRACE("(%p/%p)->(%ld)\n", This
, iface
, AutoShow
);
1536 This
->AutoShow
= 1; /* FXIME: Should be AutoShow */;
1541 static HRESULT WINAPI
Videowindow_get_AutoShow(IVideoWindow
*iface
,
1543 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1545 TRACE("(%p/%p)->(%p)\n", This
, iface
, AutoShow
);
1547 *AutoShow
= This
->AutoShow
;
1552 static HRESULT WINAPI
Videowindow_put_WindowState(IVideoWindow
*iface
,
1554 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1556 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, WindowState
);
1561 static HRESULT WINAPI
Videowindow_get_WindowState(IVideoWindow
*iface
,
1562 long *WindowState
) {
1563 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1565 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, WindowState
);
1570 static HRESULT WINAPI
Videowindow_put_BackgroundPalette(IVideoWindow
*iface
,
1571 long BackgroundPalette
) {
1572 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1574 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, BackgroundPalette
);
1579 static HRESULT WINAPI
Videowindow_get_BackgroundPalette(IVideoWindow
*iface
,
1580 long *pBackgroundPalette
) {
1581 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1583 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBackgroundPalette
);
1588 static HRESULT WINAPI
Videowindow_put_Visible(IVideoWindow
*iface
,
1590 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1592 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Visible
);
1594 ShowWindow(This
->hWnd
, Visible
? SW_SHOW
: SW_HIDE
);
1599 static HRESULT WINAPI
Videowindow_get_Visible(IVideoWindow
*iface
,
1601 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1603 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVisible
);
1605 *pVisible
= IsWindowVisible(This
->hWnd
);
1610 static HRESULT WINAPI
Videowindow_put_Left(IVideoWindow
*iface
,
1612 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1614 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Left
);
1616 if (!SetWindowPos(This
->hWnd
, NULL
, Left
, This
->WindowPos
.top
, 0, 0, SWP_NOZORDER
|SWP_NOSIZE
))
1619 This
->WindowPos
.left
= Left
;
1624 static HRESULT WINAPI
Videowindow_get_Left(IVideoWindow
*iface
,
1626 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1628 TRACE("(%p/%p)->(%p)\n", This
, iface
, pLeft
);
1630 *pLeft
= This
->WindowPos
.left
;
1635 static HRESULT WINAPI
Videowindow_put_Width(IVideoWindow
*iface
,
1637 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1639 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Width
);
1641 if (!SetWindowPos(This
->hWnd
, NULL
, 0, 0, Width
, This
->WindowPos
.bottom
-This
->WindowPos
.top
, SWP_NOZORDER
|SWP_NOMOVE
))
1644 This
->WindowPos
.right
= This
->WindowPos
.left
+ Width
;
1649 static HRESULT WINAPI
Videowindow_get_Width(IVideoWindow
*iface
,
1651 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1653 TRACE("(%p/%p)->(%p)\n", This
, iface
, pWidth
);
1655 *pWidth
= This
->WindowPos
.right
- This
->WindowPos
.left
;
1660 static HRESULT WINAPI
Videowindow_put_Top(IVideoWindow
*iface
,
1662 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1664 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Top
);
1666 if (!SetWindowPos(This
->hWnd
, NULL
, This
->WindowPos
.left
, Top
, 0, 0, SWP_NOZORDER
|SWP_NOSIZE
))
1669 This
->WindowPos
.top
= Top
;
1674 static HRESULT WINAPI
Videowindow_get_Top(IVideoWindow
*iface
,
1676 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1678 TRACE("(%p/%p)->(%p)\n", This
, iface
, pTop
);
1680 *pTop
= This
->WindowPos
.top
;
1685 static HRESULT WINAPI
Videowindow_put_Height(IVideoWindow
*iface
,
1687 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1689 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Height
);
1691 if (!SetWindowPos(This
->hWnd
, NULL
, 0, 0, This
->WindowPos
.right
-This
->WindowPos
.left
, Height
, SWP_NOZORDER
|SWP_NOMOVE
))
1694 This
->WindowPos
.bottom
= This
->WindowPos
.top
+ Height
;
1699 static HRESULT WINAPI
Videowindow_get_Height(IVideoWindow
*iface
,
1701 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1703 TRACE("(%p/%p)->(%p)\n", This
, iface
, pHeight
);
1705 *pHeight
= This
->WindowPos
.bottom
- This
->WindowPos
.top
;
1710 static HRESULT WINAPI
Videowindow_put_Owner(IVideoWindow
*iface
,
1712 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1714 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Owner
);
1716 SetParent(This
->hWnd
, (HWND
)Owner
);
1721 static HRESULT WINAPI
Videowindow_get_Owner(IVideoWindow
*iface
,
1723 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1725 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Owner
);
1727 *(HWND
*)Owner
= GetParent(This
->hWnd
);
1732 static HRESULT WINAPI
Videowindow_put_MessageDrain(IVideoWindow
*iface
,
1734 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1736 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Drain
);
1738 This
->hWndMsgDrain
= (HWND
)Drain
;
1743 static HRESULT WINAPI
Videowindow_get_MessageDrain(IVideoWindow
*iface
,
1745 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1747 TRACE("(%p/%p)->(%p)\n", This
, iface
, Drain
);
1749 *Drain
= (OAHWND
)This
->hWndMsgDrain
;
1754 static HRESULT WINAPI
Videowindow_get_BorderColor(IVideoWindow
*iface
,
1756 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1758 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, Color
);
1763 static HRESULT WINAPI
Videowindow_put_BorderColor(IVideoWindow
*iface
,
1765 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1767 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, Color
);
1772 static HRESULT WINAPI
Videowindow_get_FullScreenMode(IVideoWindow
*iface
,
1773 long *FullScreenMode
) {
1774 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1776 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, FullScreenMode
);
1781 static HRESULT WINAPI
Videowindow_put_FullScreenMode(IVideoWindow
*iface
,
1782 long FullScreenMode
) {
1783 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1785 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, FullScreenMode
);
1790 static HRESULT WINAPI
Videowindow_SetWindowForeground(IVideoWindow
*iface
,
1792 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1797 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Focus
);
1799 if ((Focus
!= FALSE
) && (Focus
!= TRUE
))
1800 return E_INVALIDARG
;
1802 hr
= IPin_ConnectedTo(This
->ppPins
[0], &pPin
);
1803 if ((hr
!= S_OK
) || !pPin
)
1804 return VFW_E_NOT_CONNECTED
;
1807 ret
= SetForegroundWindow(This
->hWnd
);
1809 ret
= SetWindowPos(This
->hWnd
, HWND_TOP
, 0, 0, 0, 0, SWP_NOMOVE
|SWP_NOSIZE
);
1817 static HRESULT WINAPI
Videowindow_NotifyOwnerMessage(IVideoWindow
*iface
,
1822 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1824 TRACE("(%p/%p)->(%08x, %ld, %08lx, %08lx)\n", This
, iface
, (DWORD
) hwnd
, uMsg
, wParam
, lParam
);
1826 if (!PostMessageA(This
->hWnd
, uMsg
, wParam
, lParam
))
1832 static HRESULT WINAPI
Videowindow_SetWindowPosition(IVideoWindow
*iface
,
1837 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1839 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This
, iface
, Left
, Top
, Width
, Height
);
1841 if (!SetWindowPos(This
->hWnd
, NULL
, Left
, Top
, Width
, Height
, SWP_NOZORDER
))
1844 This
->WindowPos
.left
= Left
;
1845 This
->WindowPos
.top
= Top
;
1846 This
->WindowPos
.right
= Left
+ Width
;
1847 This
->WindowPos
.bottom
= Top
+ Height
;
1852 static HRESULT WINAPI
Videowindow_GetWindowPosition(IVideoWindow
*iface
,
1857 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1859 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1861 *pLeft
= This
->WindowPos
.left
;
1862 *pTop
= This
->WindowPos
.top
;
1863 *pWidth
= This
->WindowPos
.right
- This
->WindowPos
.left
;
1864 *pHeight
= This
->WindowPos
.bottom
- This
->WindowPos
.top
;
1869 static HRESULT WINAPI
Videowindow_GetMinIdealImageSize(IVideoWindow
*iface
,
1872 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1874 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This
, iface
, pWidth
, pHeight
);
1876 *pWidth
= This
->VideoWidth
;
1877 *pHeight
= This
->VideoHeight
;
1882 static HRESULT WINAPI
Videowindow_GetMaxIdealImageSize(IVideoWindow
*iface
,
1885 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1887 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This
, iface
, pWidth
, pHeight
);
1889 *pWidth
= This
->VideoWidth
;
1890 *pHeight
= This
->VideoHeight
;
1895 static HRESULT WINAPI
Videowindow_GetRestorePosition(IVideoWindow
*iface
,
1900 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1902 FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1907 static HRESULT WINAPI
Videowindow_HideCursor(IVideoWindow
*iface
,
1909 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1911 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, HideCursor
);
1916 static HRESULT WINAPI
Videowindow_IsCursorHidden(IVideoWindow
*iface
,
1917 long *CursorHidden
) {
1918 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1920 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, CursorHidden
);
1925 static const IVideoWindowVtbl IVideoWindow_VTable
=
1927 Videowindow_QueryInterface
,
1929 Videowindow_Release
,
1930 Videowindow_GetTypeInfoCount
,
1931 Videowindow_GetTypeInfo
,
1932 Videowindow_GetIDsOfNames
,
1934 Videowindow_put_Caption
,
1935 Videowindow_get_Caption
,
1936 Videowindow_put_WindowStyle
,
1937 Videowindow_get_WindowStyle
,
1938 Videowindow_put_WindowStyleEx
,
1939 Videowindow_get_WindowStyleEx
,
1940 Videowindow_put_AutoShow
,
1941 Videowindow_get_AutoShow
,
1942 Videowindow_put_WindowState
,
1943 Videowindow_get_WindowState
,
1944 Videowindow_put_BackgroundPalette
,
1945 Videowindow_get_BackgroundPalette
,
1946 Videowindow_put_Visible
,
1947 Videowindow_get_Visible
,
1948 Videowindow_put_Left
,
1949 Videowindow_get_Left
,
1950 Videowindow_put_Width
,
1951 Videowindow_get_Width
,
1952 Videowindow_put_Top
,
1953 Videowindow_get_Top
,
1954 Videowindow_put_Height
,
1955 Videowindow_get_Height
,
1956 Videowindow_put_Owner
,
1957 Videowindow_get_Owner
,
1958 Videowindow_put_MessageDrain
,
1959 Videowindow_get_MessageDrain
,
1960 Videowindow_get_BorderColor
,
1961 Videowindow_put_BorderColor
,
1962 Videowindow_get_FullScreenMode
,
1963 Videowindow_put_FullScreenMode
,
1964 Videowindow_SetWindowForeground
,
1965 Videowindow_NotifyOwnerMessage
,
1966 Videowindow_SetWindowPosition
,
1967 Videowindow_GetWindowPosition
,
1968 Videowindow_GetMinIdealImageSize
,
1969 Videowindow_GetMaxIdealImageSize
,
1970 Videowindow_GetRestorePosition
,
1971 Videowindow_HideCursor
,
1972 Videowindow_IsCursorHidden