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 FIXME("No interface for %s!\n", qzdebugstr_guid(riid
));
528 return E_NOINTERFACE
;
531 static ULONG WINAPI
VideoRendererInner_AddRef(IUnknown
* iface
)
533 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
534 ULONG refCount
= InterlockedIncrement(&This
->refCount
);
536 TRACE("(%p/%p)->() AddRef from %d\n", This
, iface
, refCount
- 1);
541 static ULONG WINAPI
VideoRendererInner_Release(IUnknown
* iface
)
543 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
544 ULONG refCount
= InterlockedDecrement(&This
->refCount
);
546 TRACE("(%p/%p)->() Release from %d\n", This
, iface
, refCount
+ 1);
552 DestroyWindow(This
->hWnd
);
553 PostThreadMessageA(This
->ThreadID
, WM_QUIT
, 0, 0);
554 WaitForSingleObject(This
->hThread
, INFINITE
);
555 CloseHandle(This
->hThread
);
558 IReferenceClock_Release(This
->pClock
);
560 if (SUCCEEDED(IPin_ConnectedTo(This
->ppPins
[0], &pConnectedTo
)))
562 IPin_Disconnect(pConnectedTo
);
563 IPin_Release(pConnectedTo
);
565 IPin_Disconnect(This
->ppPins
[0]);
567 IPin_Release(This
->ppPins
[0]);
569 CoTaskMemFree(This
->ppPins
);
572 This
->csFilter
.DebugInfo
->Spare
[0] = 0;
573 DeleteCriticalSection(&This
->csFilter
);
575 TRACE("Destroying Video Renderer\n");
584 static const IUnknownVtbl IInner_VTable
=
586 VideoRendererInner_QueryInterface
,
587 VideoRendererInner_AddRef
,
588 VideoRendererInner_Release
591 static HRESULT WINAPI
VideoRenderer_QueryInterface(IBaseFilter
* iface
, REFIID riid
, LPVOID
* ppv
)
593 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
595 if (This
->bAggregatable
)
596 This
->bUnkOuterValid
= TRUE
;
600 if (This
->bAggregatable
)
601 return IUnknown_QueryInterface(This
->pUnkOuter
, riid
, ppv
);
603 if (IsEqualIID(riid
, &IID_IUnknown
))
607 IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
608 hr
= IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
609 IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
610 This
->bAggregatable
= TRUE
;
615 return E_NOINTERFACE
;
618 return IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
621 static ULONG WINAPI
VideoRenderer_AddRef(IBaseFilter
* iface
)
623 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
625 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
626 return IUnknown_AddRef(This
->pUnkOuter
);
627 return IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
630 static ULONG WINAPI
VideoRenderer_Release(IBaseFilter
* iface
)
632 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
634 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
635 return IUnknown_Release(This
->pUnkOuter
);
636 return IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
639 /** IPersist methods **/
641 static HRESULT WINAPI
VideoRenderer_GetClassID(IBaseFilter
* iface
, CLSID
* pClsid
)
643 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
645 TRACE("(%p/%p)->(%p)\n", This
, iface
, pClsid
);
647 *pClsid
= CLSID_VideoRenderer
;
652 /** IMediaFilter methods **/
654 static HRESULT WINAPI
VideoRenderer_Stop(IBaseFilter
* iface
)
656 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
658 TRACE("(%p/%p)->()\n", This
, iface
);
660 EnterCriticalSection(&This
->csFilter
);
662 This
->state
= State_Stopped
;
664 LeaveCriticalSection(&This
->csFilter
);
669 static HRESULT WINAPI
VideoRenderer_Pause(IBaseFilter
* iface
)
671 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
673 TRACE("(%p/%p)->()\n", This
, iface
);
675 EnterCriticalSection(&This
->csFilter
);
677 This
->state
= State_Paused
;
679 LeaveCriticalSection(&This
->csFilter
);
684 static HRESULT WINAPI
VideoRenderer_Run(IBaseFilter
* iface
, REFERENCE_TIME tStart
)
686 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
688 TRACE("(%p/%p)->(%s)\n", This
, iface
, wine_dbgstr_longlong(tStart
));
690 EnterCriticalSection(&This
->csFilter
);
692 This
->rtStreamStart
= tStart
;
693 This
->state
= State_Running
;
695 LeaveCriticalSection(&This
->csFilter
);
700 static HRESULT WINAPI
VideoRenderer_GetState(IBaseFilter
* iface
, DWORD dwMilliSecsTimeout
, FILTER_STATE
*pState
)
702 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
704 TRACE("(%p/%p)->(%d, %p)\n", This
, iface
, dwMilliSecsTimeout
, pState
);
706 EnterCriticalSection(&This
->csFilter
);
708 *pState
= This
->state
;
710 LeaveCriticalSection(&This
->csFilter
);
715 static HRESULT WINAPI
VideoRenderer_SetSyncSource(IBaseFilter
* iface
, IReferenceClock
*pClock
)
717 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
719 TRACE("(%p/%p)->(%p)\n", This
, iface
, pClock
);
721 EnterCriticalSection(&This
->csFilter
);
724 IReferenceClock_Release(This
->pClock
);
725 This
->pClock
= pClock
;
727 IReferenceClock_AddRef(This
->pClock
);
729 LeaveCriticalSection(&This
->csFilter
);
734 static HRESULT WINAPI
VideoRenderer_GetSyncSource(IBaseFilter
* iface
, IReferenceClock
**ppClock
)
736 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
738 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppClock
);
740 EnterCriticalSection(&This
->csFilter
);
742 *ppClock
= This
->pClock
;
743 IReferenceClock_AddRef(This
->pClock
);
745 LeaveCriticalSection(&This
->csFilter
);
750 /** IBaseFilter implementation **/
752 static HRESULT WINAPI
VideoRenderer_EnumPins(IBaseFilter
* iface
, IEnumPins
**ppEnum
)
755 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
757 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppEnum
);
759 epd
.cPins
= 1; /* input pin */
760 epd
.ppPins
= This
->ppPins
;
761 return IEnumPinsImpl_Construct(&epd
, ppEnum
);
764 static HRESULT WINAPI
VideoRenderer_FindPin(IBaseFilter
* iface
, LPCWSTR Id
, IPin
**ppPin
)
766 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
768 TRACE("(%p/%p)->(%p,%p)\n", This
, iface
, debugstr_w(Id
), ppPin
);
770 FIXME("VideoRenderer::FindPin(...)\n");
772 /* FIXME: critical section */
777 static HRESULT WINAPI
VideoRenderer_QueryFilterInfo(IBaseFilter
* iface
, FILTER_INFO
*pInfo
)
779 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
781 TRACE("(%p/%p)->(%p)\n", This
, iface
, pInfo
);
783 strcpyW(pInfo
->achName
, This
->filterInfo
.achName
);
784 pInfo
->pGraph
= This
->filterInfo
.pGraph
;
787 IFilterGraph_AddRef(pInfo
->pGraph
);
792 static HRESULT WINAPI
VideoRenderer_JoinFilterGraph(IBaseFilter
* iface
, IFilterGraph
*pGraph
, LPCWSTR pName
)
794 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
796 TRACE("(%p/%p)->(%p, %s)\n", This
, iface
, pGraph
, debugstr_w(pName
));
798 EnterCriticalSection(&This
->csFilter
);
801 strcpyW(This
->filterInfo
.achName
, pName
);
803 *This
->filterInfo
.achName
= '\0';
804 This
->filterInfo
.pGraph
= pGraph
; /* NOTE: do NOT increase ref. count */
806 LeaveCriticalSection(&This
->csFilter
);
811 static HRESULT WINAPI
VideoRenderer_QueryVendorInfo(IBaseFilter
* iface
, LPWSTR
*pVendorInfo
)
813 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
814 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVendorInfo
);
818 static const IBaseFilterVtbl VideoRenderer_Vtbl
=
820 VideoRenderer_QueryInterface
,
821 VideoRenderer_AddRef
,
822 VideoRenderer_Release
,
823 VideoRenderer_GetClassID
,
827 VideoRenderer_GetState
,
828 VideoRenderer_SetSyncSource
,
829 VideoRenderer_GetSyncSource
,
830 VideoRenderer_EnumPins
,
831 VideoRenderer_FindPin
,
832 VideoRenderer_QueryFilterInfo
,
833 VideoRenderer_JoinFilterGraph
,
834 VideoRenderer_QueryVendorInfo
837 static HRESULT WINAPI
VideoRenderer_InputPin_EndOfStream(IPin
* iface
)
839 InputPin
* This
= (InputPin
*)iface
;
840 IMediaEventSink
* pEventSink
;
843 TRACE("(%p/%p)->()\n", This
, iface
);
845 hr
= IFilterGraph_QueryInterface(((VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
)->filterInfo
.pGraph
, &IID_IMediaEventSink
, (LPVOID
*)&pEventSink
);
848 hr
= IMediaEventSink_Notify(pEventSink
, EC_COMPLETE
, S_OK
, 0);
849 IMediaEventSink_Release(pEventSink
);
855 static const IPinVtbl VideoRenderer_InputPin_Vtbl
=
857 InputPin_QueryInterface
,
861 InputPin_ReceiveConnection
,
863 IPinImpl_ConnectedTo
,
864 IPinImpl_ConnectionMediaType
,
865 IPinImpl_QueryPinInfo
,
866 IPinImpl_QueryDirection
,
868 IPinImpl_QueryAccept
,
869 IPinImpl_EnumMediaTypes
,
870 IPinImpl_QueryInternalConnections
,
871 VideoRenderer_InputPin_EndOfStream
,
877 /*** IUnknown methods ***/
878 static HRESULT WINAPI
Basicvideo_QueryInterface(IBasicVideo
*iface
,
881 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
883 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
885 return VideoRenderer_QueryInterface((IBaseFilter
*)This
, riid
, ppvObj
);
888 static ULONG WINAPI
Basicvideo_AddRef(IBasicVideo
*iface
) {
889 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
891 TRACE("(%p/%p)->()\n", This
, iface
);
893 return VideoRenderer_AddRef((IBaseFilter
*)This
);
896 static ULONG WINAPI
Basicvideo_Release(IBasicVideo
*iface
) {
897 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
899 TRACE("(%p/%p)->()\n", This
, iface
);
901 return VideoRenderer_Release((IBaseFilter
*)This
);
904 /*** IDispatch methods ***/
905 static HRESULT WINAPI
Basicvideo_GetTypeInfoCount(IBasicVideo
*iface
,
907 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
909 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
914 static HRESULT WINAPI
Basicvideo_GetTypeInfo(IBasicVideo
*iface
,
917 ITypeInfo
**ppTInfo
) {
918 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
920 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
925 static HRESULT WINAPI
Basicvideo_GetIDsOfNames(IBasicVideo
*iface
,
931 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
933 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
938 static HRESULT WINAPI
Basicvideo_Invoke(IBasicVideo
*iface
,
943 DISPPARAMS
*pDispParams
,
947 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
949 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
);
954 /*** IBasicVideo methods ***/
955 static HRESULT WINAPI
Basicvideo_get_AvgTimePerFrame(IBasicVideo
*iface
,
956 REFTIME
*pAvgTimePerFrame
) {
957 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
959 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pAvgTimePerFrame
);
964 static HRESULT WINAPI
Basicvideo_get_BitRate(IBasicVideo
*iface
,
966 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
968 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBitRate
);
973 static HRESULT WINAPI
Basicvideo_get_BitErrorRate(IBasicVideo
*iface
,
974 long *pBitErrorRate
) {
975 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
977 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBitErrorRate
);
982 static HRESULT WINAPI
Basicvideo_get_VideoWidth(IBasicVideo
*iface
,
984 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
986 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoWidth
);
988 *pVideoWidth
= This
->VideoWidth
;
993 static HRESULT WINAPI
Basicvideo_get_VideoHeight(IBasicVideo
*iface
,
994 long *pVideoHeight
) {
995 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
997 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoHeight
);
999 *pVideoHeight
= This
->VideoHeight
;
1004 static HRESULT WINAPI
Basicvideo_put_SourceLeft(IBasicVideo
*iface
,
1006 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1008 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceLeft
);
1010 This
->SourceRect
.left
= SourceLeft
;
1015 static HRESULT WINAPI
Basicvideo_get_SourceLeft(IBasicVideo
*iface
,
1016 long *pSourceLeft
) {
1017 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1019 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceLeft
);
1021 *pSourceLeft
= This
->SourceRect
.left
;
1026 static HRESULT WINAPI
Basicvideo_put_SourceWidth(IBasicVideo
*iface
,
1028 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1030 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceWidth
);
1032 This
->SourceRect
.right
= This
->SourceRect
.left
+ SourceWidth
;
1037 static HRESULT WINAPI
Basicvideo_get_SourceWidth(IBasicVideo
*iface
,
1038 long *pSourceWidth
) {
1039 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1041 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceWidth
);
1043 *pSourceWidth
= This
->SourceRect
.right
- This
->SourceRect
.left
;
1048 static HRESULT WINAPI
Basicvideo_put_SourceTop(IBasicVideo
*iface
,
1050 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1052 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceTop
);
1054 This
->SourceRect
.top
= SourceTop
;
1059 static HRESULT WINAPI
Basicvideo_get_SourceTop(IBasicVideo
*iface
,
1061 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1063 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceTop
);
1065 *pSourceTop
= This
->SourceRect
.top
;
1070 static HRESULT WINAPI
Basicvideo_put_SourceHeight(IBasicVideo
*iface
,
1071 long SourceHeight
) {
1072 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1074 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceHeight
);
1076 This
->SourceRect
.bottom
= This
->SourceRect
.top
+ SourceHeight
;
1081 static HRESULT WINAPI
Basicvideo_get_SourceHeight(IBasicVideo
*iface
,
1082 long *pSourceHeight
) {
1083 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1085 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceHeight
);
1087 *pSourceHeight
= This
->SourceRect
.bottom
- This
->SourceRect
.top
;
1092 static HRESULT WINAPI
Basicvideo_put_DestinationLeft(IBasicVideo
*iface
,
1093 long DestinationLeft
) {
1094 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1096 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationLeft
);
1098 This
->DestRect
.left
= DestinationLeft
;
1103 static HRESULT WINAPI
Basicvideo_get_DestinationLeft(IBasicVideo
*iface
,
1104 long *pDestinationLeft
) {
1105 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1107 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationLeft
);
1109 *pDestinationLeft
= This
->DestRect
.left
;
1114 static HRESULT WINAPI
Basicvideo_put_DestinationWidth(IBasicVideo
*iface
,
1115 long DestinationWidth
) {
1116 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1118 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationWidth
);
1120 This
->DestRect
.right
= This
->DestRect
.left
+ DestinationWidth
;
1125 static HRESULT WINAPI
Basicvideo_get_DestinationWidth(IBasicVideo
*iface
,
1126 long *pDestinationWidth
) {
1127 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1129 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationWidth
);
1131 *pDestinationWidth
= This
->DestRect
.right
- This
->DestRect
.left
;
1136 static HRESULT WINAPI
Basicvideo_put_DestinationTop(IBasicVideo
*iface
,
1137 long DestinationTop
) {
1138 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1140 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationTop
);
1142 This
->DestRect
.top
= DestinationTop
;
1147 static HRESULT WINAPI
Basicvideo_get_DestinationTop(IBasicVideo
*iface
,
1148 long *pDestinationTop
) {
1149 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1151 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationTop
);
1153 *pDestinationTop
= This
->DestRect
.top
;
1158 static HRESULT WINAPI
Basicvideo_put_DestinationHeight(IBasicVideo
*iface
,
1159 long DestinationHeight
) {
1160 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1162 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationHeight
);
1164 This
->DestRect
.right
= This
->DestRect
.left
+ DestinationHeight
;
1169 static HRESULT WINAPI
Basicvideo_get_DestinationHeight(IBasicVideo
*iface
,
1170 long *pDestinationHeight
) {
1171 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1173 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationHeight
);
1175 *pDestinationHeight
= This
->DestRect
.right
- This
->DestRect
.left
;
1180 static HRESULT WINAPI
Basicvideo_SetSourcePosition(IBasicVideo
*iface
,
1185 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1187 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This
, iface
, Left
, Top
, Width
, Height
);
1189 This
->SourceRect
.left
= Left
;
1190 This
->SourceRect
.top
= Top
;
1191 This
->SourceRect
.right
= Left
+ Width
;
1192 This
->SourceRect
.bottom
= Top
+ Height
;
1197 static HRESULT WINAPI
Basicvideo_GetSourcePosition(IBasicVideo
*iface
,
1202 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1204 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1206 *pLeft
= This
->SourceRect
.left
;
1207 *pTop
= This
->SourceRect
.top
;
1208 *pWidth
= This
->SourceRect
.right
- This
->SourceRect
.left
;
1209 *pHeight
= This
->SourceRect
.bottom
- This
->SourceRect
.top
;
1214 static HRESULT WINAPI
Basicvideo_SetDefaultSourcePosition(IBasicVideo
*iface
) {
1215 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1217 TRACE("(%p/%p)->()\n", This
, iface
);
1219 This
->SourceRect
.left
= 0;
1220 This
->SourceRect
.top
= 0;
1221 This
->SourceRect
.right
= This
->VideoWidth
;
1222 This
->SourceRect
.bottom
= This
->VideoHeight
;
1227 static HRESULT WINAPI
Basicvideo_SetDestinationPosition(IBasicVideo
*iface
,
1232 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1234 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This
, iface
, Left
, Top
, Width
, Height
);
1236 This
->DestRect
.left
= Left
;
1237 This
->DestRect
.top
= Top
;
1238 This
->DestRect
.right
= Left
+ Width
;
1239 This
->DestRect
.bottom
= Top
+ Height
;
1244 static HRESULT WINAPI
Basicvideo_GetDestinationPosition(IBasicVideo
*iface
,
1249 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1251 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1253 *pLeft
= This
->DestRect
.left
;
1254 *pTop
= This
->DestRect
.top
;
1255 *pWidth
= This
->DestRect
.right
- This
->DestRect
.left
;
1256 *pHeight
= This
->DestRect
.bottom
- This
->DestRect
.top
;
1261 static HRESULT WINAPI
Basicvideo_SetDefaultDestinationPosition(IBasicVideo
*iface
) {
1262 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1265 TRACE("(%p/%p)->()\n", This
, iface
);
1267 if (!GetClientRect(This
->hWnd
, &rect
))
1270 This
->SourceRect
.left
= 0;
1271 This
->SourceRect
.top
= 0;
1272 This
->SourceRect
.right
= rect
.right
;
1273 This
->SourceRect
.bottom
= rect
.bottom
;
1278 static HRESULT WINAPI
Basicvideo_GetVideoSize(IBasicVideo
*iface
,
1281 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1283 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pWidth
, pHeight
);
1285 *pWidth
= This
->VideoWidth
;
1286 *pHeight
= This
->VideoHeight
;
1291 static HRESULT WINAPI
Basicvideo_GetVideoPaletteEntries(IBasicVideo
*iface
,
1296 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1298 FIXME("(%p/%p)->(%ld, %ld, %p, %p): stub !!!\n", This
, iface
, StartIndex
, Entries
, pRetrieved
, pPalette
);
1303 static HRESULT WINAPI
Basicvideo_GetCurrentImage(IBasicVideo
*iface
,
1306 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1308 FIXME("(%p/%p)->(%p, %p): stub !!!\n", This
, iface
, pBufferSize
, pDIBImage
);
1313 static HRESULT WINAPI
Basicvideo_IsUsingDefaultSource(IBasicVideo
*iface
) {
1314 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1316 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
1321 static HRESULT WINAPI
Basicvideo_IsUsingDefaultDestination(IBasicVideo
*iface
) {
1322 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1324 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
1330 static const IBasicVideoVtbl IBasicVideo_VTable
=
1332 Basicvideo_QueryInterface
,
1335 Basicvideo_GetTypeInfoCount
,
1336 Basicvideo_GetTypeInfo
,
1337 Basicvideo_GetIDsOfNames
,
1339 Basicvideo_get_AvgTimePerFrame
,
1340 Basicvideo_get_BitRate
,
1341 Basicvideo_get_BitErrorRate
,
1342 Basicvideo_get_VideoWidth
,
1343 Basicvideo_get_VideoHeight
,
1344 Basicvideo_put_SourceLeft
,
1345 Basicvideo_get_SourceLeft
,
1346 Basicvideo_put_SourceWidth
,
1347 Basicvideo_get_SourceWidth
,
1348 Basicvideo_put_SourceTop
,
1349 Basicvideo_get_SourceTop
,
1350 Basicvideo_put_SourceHeight
,
1351 Basicvideo_get_SourceHeight
,
1352 Basicvideo_put_DestinationLeft
,
1353 Basicvideo_get_DestinationLeft
,
1354 Basicvideo_put_DestinationWidth
,
1355 Basicvideo_get_DestinationWidth
,
1356 Basicvideo_put_DestinationTop
,
1357 Basicvideo_get_DestinationTop
,
1358 Basicvideo_put_DestinationHeight
,
1359 Basicvideo_get_DestinationHeight
,
1360 Basicvideo_SetSourcePosition
,
1361 Basicvideo_GetSourcePosition
,
1362 Basicvideo_SetDefaultSourcePosition
,
1363 Basicvideo_SetDestinationPosition
,
1364 Basicvideo_GetDestinationPosition
,
1365 Basicvideo_SetDefaultDestinationPosition
,
1366 Basicvideo_GetVideoSize
,
1367 Basicvideo_GetVideoPaletteEntries
,
1368 Basicvideo_GetCurrentImage
,
1369 Basicvideo_IsUsingDefaultSource
,
1370 Basicvideo_IsUsingDefaultDestination
1374 /*** IUnknown methods ***/
1375 static HRESULT WINAPI
Videowindow_QueryInterface(IVideoWindow
*iface
,
1378 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1380 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
1382 return VideoRenderer_QueryInterface((IBaseFilter
*)This
, riid
, ppvObj
);
1385 static ULONG WINAPI
Videowindow_AddRef(IVideoWindow
*iface
) {
1386 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1388 TRACE("(%p/%p)->()\n", This
, iface
);
1390 return VideoRenderer_AddRef((IBaseFilter
*)This
);
1393 static ULONG WINAPI
Videowindow_Release(IVideoWindow
*iface
) {
1394 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1396 TRACE("(%p/%p)->()\n", This
, iface
);
1398 return VideoRenderer_Release((IBaseFilter
*)This
);
1401 /*** IDispatch methods ***/
1402 static HRESULT WINAPI
Videowindow_GetTypeInfoCount(IVideoWindow
*iface
,
1404 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1406 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
1411 static HRESULT WINAPI
Videowindow_GetTypeInfo(IVideoWindow
*iface
,
1414 ITypeInfo
**ppTInfo
) {
1415 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1417 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
1422 static HRESULT WINAPI
Videowindow_GetIDsOfNames(IVideoWindow
*iface
,
1428 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1430 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1435 static HRESULT WINAPI
Videowindow_Invoke(IVideoWindow
*iface
,
1436 DISPID dispIdMember
,
1440 DISPPARAMS
*pDispParams
,
1442 EXCEPINFO
*pExepInfo
,
1444 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1446 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
);
1451 /*** IVideoWindow methods ***/
1452 static HRESULT WINAPI
Videowindow_put_Caption(IVideoWindow
*iface
,
1454 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1456 TRACE("(%p/%p)->(%s (%p))\n", This
, iface
, debugstr_w(strCaption
), strCaption
);
1458 if (!SetWindowTextW(This
->hWnd
, strCaption
))
1464 static HRESULT WINAPI
Videowindow_get_Caption(IVideoWindow
*iface
,
1466 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1468 TRACE("(%p/%p)->(%p)\n", This
, iface
, strCaption
);
1470 GetWindowTextW(This
->hWnd
, (LPWSTR
)strCaption
, 100);
1475 static HRESULT WINAPI
Videowindow_put_WindowStyle(IVideoWindow
*iface
,
1477 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1480 old
= GetWindowLongA(This
->hWnd
, GWL_STYLE
);
1482 TRACE("(%p/%p)->(%x -> %lx)\n", This
, iface
, old
, WindowStyle
);
1484 if (WindowStyle
& (WS_DISABLED
|WS_HSCROLL
|WS_ICONIC
|WS_MAXIMIZE
|WS_MINIMIZE
|WS_VSCROLL
))
1485 return E_INVALIDARG
;
1487 SetWindowLongA(This
->hWnd
, GWL_STYLE
, WindowStyle
);
1492 static HRESULT WINAPI
Videowindow_get_WindowStyle(IVideoWindow
*iface
,
1493 long *WindowStyle
) {
1494 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1496 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyle
);
1498 *WindowStyle
= GetWindowLongA(This
->hWnd
, GWL_STYLE
);
1503 static HRESULT WINAPI
Videowindow_put_WindowStyleEx(IVideoWindow
*iface
,
1504 long WindowStyleEx
) {
1505 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1507 TRACE("(%p/%p)->(%ld)\n", This
, iface
, WindowStyleEx
);
1509 if (WindowStyleEx
& (WS_DISABLED
|WS_HSCROLL
|WS_ICONIC
|WS_MAXIMIZE
|WS_MINIMIZE
|WS_VSCROLL
))
1510 return E_INVALIDARG
;
1512 if (!SetWindowLongA(This
->hWnd
, GWL_EXSTYLE
, WindowStyleEx
))
1518 static HRESULT WINAPI
Videowindow_get_WindowStyleEx(IVideoWindow
*iface
,
1519 long *WindowStyleEx
) {
1520 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1522 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyleEx
);
1524 *WindowStyleEx
= GetWindowLongA(This
->hWnd
, GWL_EXSTYLE
);
1529 static HRESULT WINAPI
Videowindow_put_AutoShow(IVideoWindow
*iface
,
1531 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1533 TRACE("(%p/%p)->(%ld)\n", This
, iface
, AutoShow
);
1535 This
->AutoShow
= 1; /* FXIME: Should be AutoShow */;
1540 static HRESULT WINAPI
Videowindow_get_AutoShow(IVideoWindow
*iface
,
1542 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1544 TRACE("(%p/%p)->(%p)\n", This
, iface
, AutoShow
);
1546 *AutoShow
= This
->AutoShow
;
1551 static HRESULT WINAPI
Videowindow_put_WindowState(IVideoWindow
*iface
,
1553 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1555 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, WindowState
);
1560 static HRESULT WINAPI
Videowindow_get_WindowState(IVideoWindow
*iface
,
1561 long *WindowState
) {
1562 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1564 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, WindowState
);
1569 static HRESULT WINAPI
Videowindow_put_BackgroundPalette(IVideoWindow
*iface
,
1570 long BackgroundPalette
) {
1571 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1573 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, BackgroundPalette
);
1578 static HRESULT WINAPI
Videowindow_get_BackgroundPalette(IVideoWindow
*iface
,
1579 long *pBackgroundPalette
) {
1580 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1582 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBackgroundPalette
);
1587 static HRESULT WINAPI
Videowindow_put_Visible(IVideoWindow
*iface
,
1589 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1591 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Visible
);
1593 ShowWindow(This
->hWnd
, Visible
? SW_SHOW
: SW_HIDE
);
1598 static HRESULT WINAPI
Videowindow_get_Visible(IVideoWindow
*iface
,
1600 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1602 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVisible
);
1604 *pVisible
= IsWindowVisible(This
->hWnd
);
1609 static HRESULT WINAPI
Videowindow_put_Left(IVideoWindow
*iface
,
1611 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1613 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Left
);
1615 if (!SetWindowPos(This
->hWnd
, NULL
, Left
, This
->WindowPos
.top
, 0, 0, SWP_NOZORDER
|SWP_NOSIZE
))
1618 This
->WindowPos
.left
= Left
;
1623 static HRESULT WINAPI
Videowindow_get_Left(IVideoWindow
*iface
,
1625 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1627 TRACE("(%p/%p)->(%p)\n", This
, iface
, pLeft
);
1629 *pLeft
= This
->WindowPos
.left
;
1634 static HRESULT WINAPI
Videowindow_put_Width(IVideoWindow
*iface
,
1636 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1638 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Width
);
1640 if (!SetWindowPos(This
->hWnd
, NULL
, 0, 0, Width
, This
->WindowPos
.bottom
-This
->WindowPos
.top
, SWP_NOZORDER
|SWP_NOMOVE
))
1643 This
->WindowPos
.right
= This
->WindowPos
.left
+ Width
;
1648 static HRESULT WINAPI
Videowindow_get_Width(IVideoWindow
*iface
,
1650 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1652 TRACE("(%p/%p)->(%p)\n", This
, iface
, pWidth
);
1654 *pWidth
= This
->WindowPos
.right
- This
->WindowPos
.left
;
1659 static HRESULT WINAPI
Videowindow_put_Top(IVideoWindow
*iface
,
1661 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1663 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Top
);
1665 if (!SetWindowPos(This
->hWnd
, NULL
, This
->WindowPos
.left
, Top
, 0, 0, SWP_NOZORDER
|SWP_NOSIZE
))
1668 This
->WindowPos
.top
= Top
;
1673 static HRESULT WINAPI
Videowindow_get_Top(IVideoWindow
*iface
,
1675 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1677 TRACE("(%p/%p)->(%p)\n", This
, iface
, pTop
);
1679 *pTop
= This
->WindowPos
.top
;
1684 static HRESULT WINAPI
Videowindow_put_Height(IVideoWindow
*iface
,
1686 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1688 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Height
);
1690 if (!SetWindowPos(This
->hWnd
, NULL
, 0, 0, This
->WindowPos
.right
-This
->WindowPos
.left
, Height
, SWP_NOZORDER
|SWP_NOMOVE
))
1693 This
->WindowPos
.bottom
= This
->WindowPos
.top
+ Height
;
1698 static HRESULT WINAPI
Videowindow_get_Height(IVideoWindow
*iface
,
1700 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1702 TRACE("(%p/%p)->(%p)\n", This
, iface
, pHeight
);
1704 *pHeight
= This
->WindowPos
.bottom
- This
->WindowPos
.top
;
1709 static HRESULT WINAPI
Videowindow_put_Owner(IVideoWindow
*iface
,
1711 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1713 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Owner
);
1715 SetParent(This
->hWnd
, (HWND
)Owner
);
1720 static HRESULT WINAPI
Videowindow_get_Owner(IVideoWindow
*iface
,
1722 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1724 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Owner
);
1726 *(HWND
*)Owner
= GetParent(This
->hWnd
);
1731 static HRESULT WINAPI
Videowindow_put_MessageDrain(IVideoWindow
*iface
,
1733 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1735 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Drain
);
1737 This
->hWndMsgDrain
= (HWND
)Drain
;
1742 static HRESULT WINAPI
Videowindow_get_MessageDrain(IVideoWindow
*iface
,
1744 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1746 TRACE("(%p/%p)->(%p)\n", This
, iface
, Drain
);
1748 *Drain
= (OAHWND
)This
->hWndMsgDrain
;
1753 static HRESULT WINAPI
Videowindow_get_BorderColor(IVideoWindow
*iface
,
1755 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1757 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, Color
);
1762 static HRESULT WINAPI
Videowindow_put_BorderColor(IVideoWindow
*iface
,
1764 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1766 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, Color
);
1771 static HRESULT WINAPI
Videowindow_get_FullScreenMode(IVideoWindow
*iface
,
1772 long *FullScreenMode
) {
1773 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1775 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, FullScreenMode
);
1780 static HRESULT WINAPI
Videowindow_put_FullScreenMode(IVideoWindow
*iface
,
1781 long FullScreenMode
) {
1782 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1784 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, FullScreenMode
);
1789 static HRESULT WINAPI
Videowindow_SetWindowForeground(IVideoWindow
*iface
,
1791 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1796 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Focus
);
1798 if ((Focus
!= FALSE
) && (Focus
!= TRUE
))
1799 return E_INVALIDARG
;
1801 hr
= IPin_ConnectedTo(This
->ppPins
[0], &pPin
);
1802 if ((hr
!= S_OK
) || !pPin
)
1803 return VFW_E_NOT_CONNECTED
;
1806 ret
= SetForegroundWindow(This
->hWnd
);
1808 ret
= SetWindowPos(This
->hWnd
, HWND_TOP
, 0, 0, 0, 0, SWP_NOMOVE
|SWP_NOSIZE
);
1816 static HRESULT WINAPI
Videowindow_NotifyOwnerMessage(IVideoWindow
*iface
,
1821 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1823 TRACE("(%p/%p)->(%08x, %ld, %08lx, %08lx)\n", This
, iface
, (DWORD
) hwnd
, uMsg
, wParam
, lParam
);
1825 if (!PostMessageA(This
->hWnd
, uMsg
, wParam
, lParam
))
1831 static HRESULT WINAPI
Videowindow_SetWindowPosition(IVideoWindow
*iface
,
1836 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1838 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This
, iface
, Left
, Top
, Width
, Height
);
1840 if (!SetWindowPos(This
->hWnd
, NULL
, Left
, Top
, Width
, Height
, SWP_NOZORDER
))
1843 This
->WindowPos
.left
= Left
;
1844 This
->WindowPos
.top
= Top
;
1845 This
->WindowPos
.right
= Left
+ Width
;
1846 This
->WindowPos
.bottom
= Top
+ Height
;
1851 static HRESULT WINAPI
Videowindow_GetWindowPosition(IVideoWindow
*iface
,
1856 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1858 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1860 *pLeft
= This
->WindowPos
.left
;
1861 *pTop
= This
->WindowPos
.top
;
1862 *pWidth
= This
->WindowPos
.right
- This
->WindowPos
.left
;
1863 *pHeight
= This
->WindowPos
.bottom
- This
->WindowPos
.top
;
1868 static HRESULT WINAPI
Videowindow_GetMinIdealImageSize(IVideoWindow
*iface
,
1871 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1873 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This
, iface
, pWidth
, pHeight
);
1875 *pWidth
= This
->VideoWidth
;
1876 *pHeight
= This
->VideoHeight
;
1881 static HRESULT WINAPI
Videowindow_GetMaxIdealImageSize(IVideoWindow
*iface
,
1884 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1886 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This
, iface
, pWidth
, pHeight
);
1888 *pWidth
= This
->VideoWidth
;
1889 *pHeight
= This
->VideoHeight
;
1894 static HRESULT WINAPI
Videowindow_GetRestorePosition(IVideoWindow
*iface
,
1899 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1901 FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1906 static HRESULT WINAPI
Videowindow_HideCursor(IVideoWindow
*iface
,
1908 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1910 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, HideCursor
);
1915 static HRESULT WINAPI
Videowindow_IsCursorHidden(IVideoWindow
*iface
,
1916 long *CursorHidden
) {
1917 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1919 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, CursorHidden
);
1924 static const IVideoWindowVtbl IVideoWindow_VTable
=
1926 Videowindow_QueryInterface
,
1928 Videowindow_Release
,
1929 Videowindow_GetTypeInfoCount
,
1930 Videowindow_GetTypeInfo
,
1931 Videowindow_GetIDsOfNames
,
1933 Videowindow_put_Caption
,
1934 Videowindow_get_Caption
,
1935 Videowindow_put_WindowStyle
,
1936 Videowindow_get_WindowStyle
,
1937 Videowindow_put_WindowStyleEx
,
1938 Videowindow_get_WindowStyleEx
,
1939 Videowindow_put_AutoShow
,
1940 Videowindow_get_AutoShow
,
1941 Videowindow_put_WindowState
,
1942 Videowindow_get_WindowState
,
1943 Videowindow_put_BackgroundPalette
,
1944 Videowindow_get_BackgroundPalette
,
1945 Videowindow_put_Visible
,
1946 Videowindow_get_Visible
,
1947 Videowindow_put_Left
,
1948 Videowindow_get_Left
,
1949 Videowindow_put_Width
,
1950 Videowindow_get_Width
,
1951 Videowindow_put_Top
,
1952 Videowindow_get_Top
,
1953 Videowindow_put_Height
,
1954 Videowindow_get_Height
,
1955 Videowindow_put_Owner
,
1956 Videowindow_get_Owner
,
1957 Videowindow_put_MessageDrain
,
1958 Videowindow_get_MessageDrain
,
1959 Videowindow_get_BorderColor
,
1960 Videowindow_put_BorderColor
,
1961 Videowindow_get_FullScreenMode
,
1962 Videowindow_put_FullScreenMode
,
1963 Videowindow_SetWindowForeground
,
1964 Videowindow_NotifyOwnerMessage
,
1965 Videowindow_SetWindowPosition
,
1966 Videowindow_GetWindowPosition
,
1967 Videowindow_GetMinIdealImageSize
,
1968 Videowindow_GetMaxIdealImageSize
,
1969 Videowindow_GetRestorePosition
,
1970 Videowindow_HideCursor
,
1971 Videowindow_IsCursorHidden