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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #define NONAMELESSSTRUCT
24 #define NONAMELESSUNION
25 #include "quartz_private.h"
26 #include "control_private.h"
41 #include "wine/unicode.h"
42 #include "wine/debug.h"
44 WINE_DEFAULT_DEBUG_CHANNEL(quartz
);
46 static BOOL wnd_class_registered
= FALSE
;
48 static const WCHAR wcsInputPinName
[] = {'i','n','p','u','t',' ','p','i','n',0};
50 static const IBaseFilterVtbl VideoRenderer_Vtbl
;
51 static const IBasicVideoVtbl IBasicVideo_VTable
;
52 static const IVideoWindowVtbl IVideoWindow_VTable
;
53 static const IPinVtbl VideoRenderer_InputPin_Vtbl
;
55 typedef struct VideoRendererImpl
57 const IBaseFilterVtbl
* lpVtbl
;
58 const IBasicVideoVtbl
* IBasicVideo_vtbl
;
59 const IVideoWindowVtbl
* IVideoWindow_vtbl
;
62 CRITICAL_SECTION csFilter
;
64 REFERENCE_TIME rtStreamStart
;
65 IReferenceClock
* pClock
;
66 FILTER_INFO filterInfo
;
86 static LRESULT CALLBACK
VideoWndProcA(HWND hwnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
88 VideoRendererImpl
* pVideoRenderer
= (VideoRendererImpl
*)GetWindowLongA(hwnd
, 0);
89 LPRECT lprect
= (LPRECT
)lParam
;
91 if (pVideoRenderer
&& pVideoRenderer
->hWndMsgDrain
)
97 case WM_LBUTTONDBLCLK
:
100 case WM_MBUTTONDBLCLK
:
103 case WM_MOUSEACTIVATE
:
105 case WM_NCLBUTTONDBLCLK
:
106 case WM_NCLBUTTONDOWN
:
108 case WM_NCMBUTTONDBLCLK
:
109 case WM_NCMBUTTONDOWN
:
112 case WM_NCRBUTTONDBLCLK
:
113 case WM_NCRBUTTONDOWN
:
115 case WM_RBUTTONDBLCLK
:
118 PostMessageA(pVideoRenderer
->hWndMsgDrain
, uMsg
, wParam
, lParam
);
128 /* TRACE("WM_SIZING %ld %ld %ld %ld\n", lprect->left, lprect->top, lprect->right, lprect->bottom); */
129 SetWindowPos(hwnd
, NULL
, lprect
->left
, lprect
->top
, lprect
->right
- lprect
->left
, lprect
->bottom
- lprect
->top
, SWP_NOZORDER
);
130 GetClientRect(hwnd
, &pVideoRenderer
->DestRect
);
133 return DefWindowProcA(hwnd
, uMsg
, wParam
, lParam
);
138 static BOOL
CreateRenderingWindow(VideoRendererImpl
* This
)
142 TRACE("(%p)->()\n", This
);
145 winclass
.lpfnWndProc
= VideoWndProcA
;
146 winclass
.cbClsExtra
= 0;
147 winclass
.cbWndExtra
= sizeof(VideoRendererImpl
*);
148 winclass
.hInstance
= NULL
;
149 winclass
.hIcon
= NULL
;
150 winclass
.hCursor
= NULL
;
151 winclass
.hbrBackground
= NULL
;
152 winclass
.lpszMenuName
= NULL
;
153 winclass
.lpszClassName
= "Wine ActiveMovie Class";
155 if (!wnd_class_registered
)
157 if (!RegisterClassA(&winclass
))
159 ERR("Unable to register window %lx\n", GetLastError());
162 wnd_class_registered
= TRUE
;
165 This
->hWnd
= CreateWindowExA(0, "Wine ActiveMovie Class", "Wine ActiveMovie Window", WS_SIZEBOX
,
166 CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
, NULL
,
171 ERR("Unable to create window\n");
175 SetWindowLongA(This
->hWnd
, 0, (LONG
)This
);
180 static DWORD WINAPI
MessageLoop(LPVOID lpParameter
)
182 VideoRendererImpl
* This
= (VideoRendererImpl
*) lpParameter
;
186 TRACE("Starting message loop\n");
188 if (!CreateRenderingWindow(This
))
190 This
->ThreadResult
= FALSE
;
191 SetEvent(This
->hEvent
);
195 This
->ThreadResult
= TRUE
;
196 SetEvent(This
->hEvent
);
198 while ((fGotMessage
= GetMessageA(&msg
, NULL
, 0, 0)) != 0 && fGotMessage
!= -1)
200 TranslateMessage(&msg
);
201 DispatchMessageA(&msg
);
204 TRACE("End of message loop\n");
209 static BOOL
CreateRenderingSubsystem(VideoRendererImpl
* This
)
211 This
->hEvent
= CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
215 This
->hThread
= CreateThread(NULL
, 0, MessageLoop
, (LPVOID
)This
, 0, &This
->ThreadID
);
218 CloseHandle(This
->hEvent
);
222 WaitForSingleObject(This
->hEvent
, INFINITE
);
223 CloseHandle(This
->hEvent
);
225 if (!This
->ThreadResult
)
227 CloseHandle(This
->hThread
);
234 static const IMemInputPinVtbl MemInputPin_Vtbl
=
236 MemInputPin_QueryInterface
,
239 MemInputPin_GetAllocator
,
240 MemInputPin_NotifyAllocator
,
241 MemInputPin_GetAllocatorRequirements
,
243 MemInputPin_ReceiveMultiple
,
244 MemInputPin_ReceiveCanBlock
247 static HRESULT
VideoRenderer_InputPin_Construct(const PIN_INFO
* pPinInfo
, SAMPLEPROC pSampleProc
, LPVOID pUserData
, QUERYACCEPTPROC pQueryAccept
, LPCRITICAL_SECTION pCritSec
, IPin
** ppPin
)
253 if (pPinInfo
->dir
!= PINDIR_INPUT
)
255 ERR("Pin direction(%x) != PINDIR_INPUT\n", pPinInfo
->dir
);
259 pPinImpl
= CoTaskMemAlloc(sizeof(*pPinImpl
));
262 return E_OUTOFMEMORY
;
264 if (SUCCEEDED(InputPin_Init(pPinInfo
, pSampleProc
, pUserData
, pQueryAccept
, pCritSec
, pPinImpl
)))
266 pPinImpl
->pin
.lpVtbl
= &VideoRenderer_InputPin_Vtbl
;
267 pPinImpl
->lpVtblMemInput
= &MemInputPin_Vtbl
;
269 *ppPin
= (IPin
*)(&pPinImpl
->pin
.lpVtbl
);
275 static DWORD
VideoRenderer_SendSampleData(VideoRendererImpl
* This
, LPBYTE data
, DWORD size
)
277 VIDEOINFOHEADER
* format
;
283 LPBYTE palette
= NULL
;
286 TRACE("%p %p %ld\n", This
, data
, size
);
288 sdesc
.dwSize
= sizeof(sdesc
);
289 hr
= IPin_ConnectionMediaType(This
->ppPins
[0], &amt
);
291 ERR("Unable to retrieve media type\n");
294 format
= (VIDEOINFOHEADER
*)amt
.pbFormat
;
296 TRACE("biSize = %ld\n", format
->bmiHeader
.biSize
);
297 TRACE("biWidth = %ld\n", format
->bmiHeader
.biWidth
);
298 TRACE("biHeigth = %ld\n", format
->bmiHeader
.biHeight
);
299 TRACE("biPlanes = %d\n", format
->bmiHeader
.biPlanes
);
300 TRACE("biBitCount = %d\n", format
->bmiHeader
.biBitCount
);
301 TRACE("biCompression = %s\n", debugstr_an((LPSTR
)&(format
->bmiHeader
.biCompression
), 4));
302 TRACE("biSizeImage = %ld\n", format
->bmiHeader
.biSizeImage
);
304 width
= format
->bmiHeader
.biWidth
;
305 height
= format
->bmiHeader
.biHeight
;
306 palette
= ((LPBYTE
)&format
->bmiHeader
) + format
->bmiHeader
.biSize
;
310 /* Compute the size of the whole window so the client area size matches video one */
313 GetWindowRect(This
->hWnd
, &wrect
);
314 GetClientRect(This
->hWnd
, &crect
);
315 h
= (wrect
.right
- wrect
.left
) - (crect
.right
- crect
.left
);
316 v
= (wrect
.bottom
- wrect
.top
) - (crect
.bottom
- crect
.top
);
317 SetWindowPos(This
->hWnd
, NULL
, 0, 0, width
+ h
+20, height
+ v
+20, SWP_NOZORDER
|SWP_NOMOVE
);
318 This
->WindowPos
.left
= 0;
319 This
->WindowPos
.top
= 0;
320 This
->WindowPos
.right
= width
;
321 This
->WindowPos
.bottom
= height
;
322 GetClientRect(This
->hWnd
, &This
->DestRect
);
326 hDC
= GetDC(This
->hWnd
);
329 ERR("Cannot get DC from window!\n");
333 TRACE("Src Rect: %ld %ld %ld %ld\n", This
->SourceRect
.left
, This
->SourceRect
.top
, This
->SourceRect
.right
, This
->SourceRect
.bottom
);
334 TRACE("Dst Rect: %ld %ld %ld %ld\n", This
->DestRect
.left
, This
->DestRect
.top
, This
->DestRect
.right
, This
->DestRect
.bottom
);
336 StretchDIBits(hDC
, This
->DestRect
.left
, This
->DestRect
.top
, This
->DestRect
.right
-This
->DestRect
.left
,
337 This
->DestRect
.bottom
- This
->DestRect
.top
, This
->SourceRect
.left
, This
->SourceRect
.top
,
338 This
->SourceRect
.right
- This
->SourceRect
.left
, This
->SourceRect
.bottom
- This
->SourceRect
.top
,
339 data
, (BITMAPINFO
*)&format
->bmiHeader
, DIB_PAL_COLORS
, SRCCOPY
);
341 ReleaseDC(This
->hWnd
, hDC
);
344 ShowWindow(This
->hWnd
, SW_SHOW
);
349 static HRESULT
VideoRenderer_Sample(LPVOID iface
, IMediaSample
* pSample
)
351 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
352 LPBYTE pbSrcStream
= NULL
;
353 long cbSrcStream
= 0;
354 REFERENCE_TIME tStart
, tStop
;
357 TRACE("%p %p\n", iface
, pSample
);
359 hr
= IMediaSample_GetPointer(pSample
, &pbSrcStream
);
362 ERR("Cannot get pointer to sample data (%lx)\n", hr
);
366 hr
= IMediaSample_GetTime(pSample
, &tStart
, &tStop
);
368 ERR("Cannot get sample time (%lx)\n", hr
);
370 cbSrcStream
= IMediaSample_GetActualDataLength(pSample
);
372 TRACE("val %p %ld\n", pbSrcStream
, cbSrcStream
);
374 #if 0 /* For debugging purpose */
377 for(i
= 0; i
< cbSrcStream
; i
++)
379 if ((i
!=0) && !(i
%16))
381 DPRINTF("%02x ", pbSrcStream
[i
]);
387 VideoRenderer_SendSampleData(This
, pbSrcStream
, cbSrcStream
);
392 static HRESULT
VideoRenderer_QueryAccept(LPVOID iface
, const AM_MEDIA_TYPE
* pmt
)
394 if ((IsEqualIID(&pmt
->majortype
, &MEDIATYPE_Video
) && IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB32
)) ||
395 (IsEqualIID(&pmt
->majortype
, &MEDIATYPE_Video
) && IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB24
)) ||
396 (IsEqualIID(&pmt
->majortype
, &MEDIATYPE_Video
) && IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB565
)) ||
397 (IsEqualIID(&pmt
->majortype
, &MEDIATYPE_Video
) && IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB8
)))
399 VideoRendererImpl
* This
= (VideoRendererImpl
*) iface
;
400 VIDEOINFOHEADER
* format
= (VIDEOINFOHEADER
*)pmt
->pbFormat
;
401 This
->SourceRect
.left
= 0;
402 This
->SourceRect
.top
= 0;
403 This
->SourceRect
.right
= This
->VideoWidth
= format
->bmiHeader
.biWidth
;
404 This
->SourceRect
.bottom
= This
->VideoHeight
= format
->bmiHeader
.biHeight
;
410 HRESULT
VideoRenderer_create(IUnknown
* pUnkOuter
, LPVOID
* ppv
)
414 VideoRendererImpl
* pVideoRenderer
;
416 TRACE("(%p, %p)\n", pUnkOuter
, ppv
);
421 return CLASS_E_NOAGGREGATION
;
423 pVideoRenderer
= CoTaskMemAlloc(sizeof(VideoRendererImpl
));
425 pVideoRenderer
->lpVtbl
= &VideoRenderer_Vtbl
;
426 pVideoRenderer
->IBasicVideo_vtbl
= &IBasicVideo_VTable
;
427 pVideoRenderer
->IVideoWindow_vtbl
= &IVideoWindow_VTable
;
429 pVideoRenderer
->refCount
= 1;
430 InitializeCriticalSection(&pVideoRenderer
->csFilter
);
431 pVideoRenderer
->state
= State_Stopped
;
432 pVideoRenderer
->pClock
= NULL
;
433 pVideoRenderer
->init
= 0;
434 pVideoRenderer
->AutoShow
= 1;
435 ZeroMemory(&pVideoRenderer
->filterInfo
, sizeof(FILTER_INFO
));
437 pVideoRenderer
->ppPins
= CoTaskMemAlloc(1 * sizeof(IPin
*));
439 /* construct input pin */
440 piInput
.dir
= PINDIR_INPUT
;
441 piInput
.pFilter
= (IBaseFilter
*)pVideoRenderer
;
442 lstrcpynW(piInput
.achName
, wcsInputPinName
, sizeof(piInput
.achName
) / sizeof(piInput
.achName
[0]));
444 hr
= VideoRenderer_InputPin_Construct(&piInput
, VideoRenderer_Sample
, (LPVOID
)pVideoRenderer
, VideoRenderer_QueryAccept
, &pVideoRenderer
->csFilter
, (IPin
**)&pVideoRenderer
->pInputPin
);
448 pVideoRenderer
->ppPins
[0] = (IPin
*)pVideoRenderer
->pInputPin
;
449 *ppv
= (LPVOID
)pVideoRenderer
;
453 CoTaskMemFree(pVideoRenderer
->ppPins
);
454 DeleteCriticalSection(&pVideoRenderer
->csFilter
);
455 CoTaskMemFree(pVideoRenderer
);
458 if (!CreateRenderingSubsystem(pVideoRenderer
))
464 static HRESULT WINAPI
VideoRenderer_QueryInterface(IBaseFilter
* iface
, REFIID riid
, LPVOID
* ppv
)
466 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
467 TRACE("(%p/%p)->(%s, %p)\n", This
, iface
, qzdebugstr_guid(riid
), ppv
);
471 if (IsEqualIID(riid
, &IID_IUnknown
))
473 else if (IsEqualIID(riid
, &IID_IPersist
))
475 else if (IsEqualIID(riid
, &IID_IMediaFilter
))
477 else if (IsEqualIID(riid
, &IID_IBaseFilter
))
479 else if (IsEqualIID(riid
, &IID_IBasicVideo
))
480 *ppv
= (LPVOID
)&(This
->IBasicVideo_vtbl
);
481 else if (IsEqualIID(riid
, &IID_IVideoWindow
))
482 *ppv
= (LPVOID
)&(This
->IVideoWindow_vtbl
);
486 IUnknown_AddRef((IUnknown
*)(*ppv
));
490 FIXME("No interface for %s!\n", qzdebugstr_guid(riid
));
492 return E_NOINTERFACE
;
495 static ULONG WINAPI
VideoRenderer_AddRef(IBaseFilter
* iface
)
497 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
498 ULONG refCount
= InterlockedIncrement(&This
->refCount
);
500 TRACE("(%p/%p)->() AddRef from %ld\n", This
, iface
, refCount
- 1);
505 static ULONG WINAPI
VideoRenderer_Release(IBaseFilter
* iface
)
507 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
508 ULONG refCount
= InterlockedDecrement(&This
->refCount
);
510 TRACE("(%p/%p)->() Release from %ld\n", This
, iface
, refCount
+ 1);
514 DeleteCriticalSection(&This
->csFilter
);
516 DestroyWindow(This
->hWnd
);
517 PostThreadMessageA(This
->ThreadID
, WM_QUIT
, 0, 0);
518 WaitForSingleObject(This
->hThread
, INFINITE
);
519 CloseHandle(This
->hThread
);
522 IReferenceClock_Release(This
->pClock
);
524 IPin_Release(This
->ppPins
[0]);
526 HeapFree(GetProcessHeap(), 0, This
->ppPins
);
529 TRACE("Destroying Video Renderer\n");
538 /** IPersist methods **/
540 static HRESULT WINAPI
VideoRenderer_GetClassID(IBaseFilter
* iface
, CLSID
* pClsid
)
542 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
544 TRACE("(%p/%p)->(%p)\n", This
, iface
, pClsid
);
546 *pClsid
= CLSID_VideoRenderer
;
551 /** IMediaFilter methods **/
553 static HRESULT WINAPI
VideoRenderer_Stop(IBaseFilter
* iface
)
555 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
557 TRACE("(%p/%p)->()\n", This
, iface
);
559 EnterCriticalSection(&This
->csFilter
);
561 This
->state
= State_Stopped
;
563 LeaveCriticalSection(&This
->csFilter
);
568 static HRESULT WINAPI
VideoRenderer_Pause(IBaseFilter
* iface
)
570 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
572 TRACE("(%p/%p)->()\n", This
, iface
);
574 EnterCriticalSection(&This
->csFilter
);
576 This
->state
= State_Paused
;
578 LeaveCriticalSection(&This
->csFilter
);
583 static HRESULT WINAPI
VideoRenderer_Run(IBaseFilter
* iface
, REFERENCE_TIME tStart
)
585 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
587 TRACE("(%p/%p)->(%s)\n", This
, iface
, wine_dbgstr_longlong(tStart
));
589 EnterCriticalSection(&This
->csFilter
);
591 This
->rtStreamStart
= tStart
;
592 This
->state
= State_Running
;
594 LeaveCriticalSection(&This
->csFilter
);
599 static HRESULT WINAPI
VideoRenderer_GetState(IBaseFilter
* iface
, DWORD dwMilliSecsTimeout
, FILTER_STATE
*pState
)
601 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
603 TRACE("(%p/%p)->(%ld, %p)\n", This
, iface
, dwMilliSecsTimeout
, pState
);
605 EnterCriticalSection(&This
->csFilter
);
607 *pState
= This
->state
;
609 LeaveCriticalSection(&This
->csFilter
);
614 static HRESULT WINAPI
VideoRenderer_SetSyncSource(IBaseFilter
* iface
, IReferenceClock
*pClock
)
616 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
618 TRACE("(%p/%p)->(%p)\n", This
, iface
, pClock
);
620 EnterCriticalSection(&This
->csFilter
);
623 IReferenceClock_Release(This
->pClock
);
624 This
->pClock
= pClock
;
626 IReferenceClock_AddRef(This
->pClock
);
628 LeaveCriticalSection(&This
->csFilter
);
633 static HRESULT WINAPI
VideoRenderer_GetSyncSource(IBaseFilter
* iface
, IReferenceClock
**ppClock
)
635 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
637 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppClock
);
639 EnterCriticalSection(&This
->csFilter
);
641 *ppClock
= This
->pClock
;
642 IReferenceClock_AddRef(This
->pClock
);
644 LeaveCriticalSection(&This
->csFilter
);
649 /** IBaseFilter implementation **/
651 static HRESULT WINAPI
VideoRenderer_EnumPins(IBaseFilter
* iface
, IEnumPins
**ppEnum
)
654 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
656 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppEnum
);
658 epd
.cPins
= 1; /* input pin */
659 epd
.ppPins
= This
->ppPins
;
660 return IEnumPinsImpl_Construct(&epd
, ppEnum
);
663 static HRESULT WINAPI
VideoRenderer_FindPin(IBaseFilter
* iface
, LPCWSTR Id
, IPin
**ppPin
)
665 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
667 TRACE("(%p/%p)->(%p,%p)\n", This
, iface
, debugstr_w(Id
), ppPin
);
669 FIXME("VideoRenderer::FindPin(...)\n");
671 /* FIXME: critical section */
676 static HRESULT WINAPI
VideoRenderer_QueryFilterInfo(IBaseFilter
* iface
, FILTER_INFO
*pInfo
)
678 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
680 TRACE("(%p/%p)->(%p)\n", This
, iface
, pInfo
);
682 strcpyW(pInfo
->achName
, This
->filterInfo
.achName
);
683 pInfo
->pGraph
= This
->filterInfo
.pGraph
;
686 IFilterGraph_AddRef(pInfo
->pGraph
);
691 static HRESULT WINAPI
VideoRenderer_JoinFilterGraph(IBaseFilter
* iface
, IFilterGraph
*pGraph
, LPCWSTR pName
)
693 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
695 TRACE("(%p/%p)->(%p, %s)\n", This
, iface
, pGraph
, debugstr_w(pName
));
697 EnterCriticalSection(&This
->csFilter
);
700 strcpyW(This
->filterInfo
.achName
, pName
);
702 *This
->filterInfo
.achName
= '\0';
703 This
->filterInfo
.pGraph
= pGraph
; /* NOTE: do NOT increase ref. count */
705 LeaveCriticalSection(&This
->csFilter
);
710 static HRESULT WINAPI
VideoRenderer_QueryVendorInfo(IBaseFilter
* iface
, LPWSTR
*pVendorInfo
)
712 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
713 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVendorInfo
);
717 static const IBaseFilterVtbl VideoRenderer_Vtbl
=
719 VideoRenderer_QueryInterface
,
720 VideoRenderer_AddRef
,
721 VideoRenderer_Release
,
722 VideoRenderer_GetClassID
,
726 VideoRenderer_GetState
,
727 VideoRenderer_SetSyncSource
,
728 VideoRenderer_GetSyncSource
,
729 VideoRenderer_EnumPins
,
730 VideoRenderer_FindPin
,
731 VideoRenderer_QueryFilterInfo
,
732 VideoRenderer_JoinFilterGraph
,
733 VideoRenderer_QueryVendorInfo
736 static HRESULT WINAPI
VideoRenderer_InputPin_EndOfStream(IPin
* iface
)
738 InputPin
* This
= (InputPin
*)iface
;
739 IMediaEventSink
* pEventSink
;
742 TRACE("(%p/%p)->()\n", This
, iface
);
744 hr
= IFilterGraph_QueryInterface(((VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
)->filterInfo
.pGraph
, &IID_IMediaEventSink
, (LPVOID
*)&pEventSink
);
747 hr
= IMediaEventSink_Notify(pEventSink
, EC_COMPLETE
, S_OK
, 0);
748 IMediaEventSink_Release(pEventSink
);
754 static const IPinVtbl VideoRenderer_InputPin_Vtbl
=
756 InputPin_QueryInterface
,
760 InputPin_ReceiveConnection
,
762 IPinImpl_ConnectedTo
,
763 IPinImpl_ConnectionMediaType
,
764 IPinImpl_QueryPinInfo
,
765 IPinImpl_QueryDirection
,
767 IPinImpl_QueryAccept
,
768 IPinImpl_EnumMediaTypes
,
769 IPinImpl_QueryInternalConnections
,
770 VideoRenderer_InputPin_EndOfStream
,
776 /*** IUnknown methods ***/
777 static HRESULT WINAPI
Basicvideo_QueryInterface(IBasicVideo
*iface
,
780 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
782 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
784 return VideoRenderer_QueryInterface((IBaseFilter
*)This
, riid
, ppvObj
);
787 static ULONG WINAPI
Basicvideo_AddRef(IBasicVideo
*iface
) {
788 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
790 TRACE("(%p/%p)->()\n", This
, iface
);
792 return VideoRenderer_AddRef((IBaseFilter
*)This
);
795 static ULONG WINAPI
Basicvideo_Release(IBasicVideo
*iface
) {
796 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
798 TRACE("(%p/%p)->()\n", This
, iface
);
800 return VideoRenderer_Release((IBaseFilter
*)This
);
803 /*** IDispatch methods ***/
804 static HRESULT WINAPI
Basicvideo_GetTypeInfoCount(IBasicVideo
*iface
,
806 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
808 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
813 static HRESULT WINAPI
Basicvideo_GetTypeInfo(IBasicVideo
*iface
,
816 ITypeInfo
**ppTInfo
) {
817 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
819 FIXME("(%p/%p)->(%d, %ld, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
824 static HRESULT WINAPI
Basicvideo_GetIDsOfNames(IBasicVideo
*iface
,
830 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
832 FIXME("(%p/%p)->(%s (%p), %p, %d, %ld, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
837 static HRESULT WINAPI
Basicvideo_Invoke(IBasicVideo
*iface
,
842 DISPPARAMS
*pDispParams
,
846 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
848 FIXME("(%p/%p)->(%ld, %s (%p), %ld, %04x, %p, %p, %p, %p): stub !!!\n", This
, iface
, dispIdMember
, debugstr_guid(riid
), riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExepInfo
, puArgErr
);
853 /*** IBasicVideo methods ***/
854 static HRESULT WINAPI
Basicvideo_get_AvgTimePerFrame(IBasicVideo
*iface
,
855 REFTIME
*pAvgTimePerFrame
) {
856 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
858 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pAvgTimePerFrame
);
863 static HRESULT WINAPI
Basicvideo_get_BitRate(IBasicVideo
*iface
,
865 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
867 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBitRate
);
872 static HRESULT WINAPI
Basicvideo_get_BitErrorRate(IBasicVideo
*iface
,
873 long *pBitErrorRate
) {
874 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
876 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBitErrorRate
);
881 static HRESULT WINAPI
Basicvideo_get_VideoWidth(IBasicVideo
*iface
,
883 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
885 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoWidth
);
887 *pVideoWidth
= This
->VideoWidth
;
892 static HRESULT WINAPI
Basicvideo_get_VideoHeight(IBasicVideo
*iface
,
893 long *pVideoHeight
) {
894 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
896 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoHeight
);
898 *pVideoHeight
= This
->VideoHeight
;
903 static HRESULT WINAPI
Basicvideo_put_SourceLeft(IBasicVideo
*iface
,
905 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
907 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceLeft
);
909 This
->SourceRect
.left
= SourceLeft
;
914 static HRESULT WINAPI
Basicvideo_get_SourceLeft(IBasicVideo
*iface
,
916 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
918 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceLeft
);
920 *pSourceLeft
= This
->SourceRect
.left
;
925 static HRESULT WINAPI
Basicvideo_put_SourceWidth(IBasicVideo
*iface
,
927 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
929 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceWidth
);
931 This
->SourceRect
.right
= This
->SourceRect
.left
+ SourceWidth
;
936 static HRESULT WINAPI
Basicvideo_get_SourceWidth(IBasicVideo
*iface
,
937 long *pSourceWidth
) {
938 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
940 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceWidth
);
942 *pSourceWidth
= This
->SourceRect
.right
- This
->SourceRect
.left
;
947 static HRESULT WINAPI
Basicvideo_put_SourceTop(IBasicVideo
*iface
,
949 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
951 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceTop
);
953 This
->SourceRect
.top
= SourceTop
;
958 static HRESULT WINAPI
Basicvideo_get_SourceTop(IBasicVideo
*iface
,
960 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
962 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceTop
);
964 *pSourceTop
= This
->SourceRect
.top
;
969 static HRESULT WINAPI
Basicvideo_put_SourceHeight(IBasicVideo
*iface
,
971 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
973 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceHeight
);
975 This
->SourceRect
.bottom
= This
->SourceRect
.top
+ SourceHeight
;
980 static HRESULT WINAPI
Basicvideo_get_SourceHeight(IBasicVideo
*iface
,
981 long *pSourceHeight
) {
982 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
984 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceHeight
);
986 *pSourceHeight
= This
->SourceRect
.bottom
- This
->SourceRect
.top
;
991 static HRESULT WINAPI
Basicvideo_put_DestinationLeft(IBasicVideo
*iface
,
992 long DestinationLeft
) {
993 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
995 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationLeft
);
997 This
->DestRect
.left
= DestinationLeft
;
1002 static HRESULT WINAPI
Basicvideo_get_DestinationLeft(IBasicVideo
*iface
,
1003 long *pDestinationLeft
) {
1004 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1006 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationLeft
);
1008 *pDestinationLeft
= This
->DestRect
.left
;
1013 static HRESULT WINAPI
Basicvideo_put_DestinationWidth(IBasicVideo
*iface
,
1014 long DestinationWidth
) {
1015 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1017 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationWidth
);
1019 This
->DestRect
.right
= This
->DestRect
.left
+ DestinationWidth
;
1024 static HRESULT WINAPI
Basicvideo_get_DestinationWidth(IBasicVideo
*iface
,
1025 long *pDestinationWidth
) {
1026 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1028 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationWidth
);
1030 *pDestinationWidth
= This
->DestRect
.right
- This
->DestRect
.left
;
1035 static HRESULT WINAPI
Basicvideo_put_DestinationTop(IBasicVideo
*iface
,
1036 long DestinationTop
) {
1037 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1039 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationTop
);
1041 This
->DestRect
.top
= DestinationTop
;
1046 static HRESULT WINAPI
Basicvideo_get_DestinationTop(IBasicVideo
*iface
,
1047 long *pDestinationTop
) {
1048 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1050 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationTop
);
1052 *pDestinationTop
= This
->DestRect
.top
;
1057 static HRESULT WINAPI
Basicvideo_put_DestinationHeight(IBasicVideo
*iface
,
1058 long DestinationHeight
) {
1059 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1061 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationHeight
);
1063 This
->DestRect
.right
= This
->DestRect
.left
+ DestinationHeight
;
1068 static HRESULT WINAPI
Basicvideo_get_DestinationHeight(IBasicVideo
*iface
,
1069 long *pDestinationHeight
) {
1070 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1072 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationHeight
);
1074 *pDestinationHeight
= This
->DestRect
.right
- This
->DestRect
.left
;
1079 static HRESULT WINAPI
Basicvideo_SetSourcePosition(IBasicVideo
*iface
,
1084 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1086 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This
, iface
, Left
, Top
, Width
, Height
);
1088 This
->SourceRect
.left
= Left
;
1089 This
->SourceRect
.top
= Top
;
1090 This
->SourceRect
.right
= Left
+ Width
;
1091 This
->SourceRect
.bottom
= Top
+ Height
;
1096 static HRESULT WINAPI
Basicvideo_GetSourcePosition(IBasicVideo
*iface
,
1101 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1103 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1105 *pLeft
= This
->SourceRect
.left
;
1106 *pTop
= This
->SourceRect
.top
;
1107 *pWidth
= This
->SourceRect
.right
- This
->SourceRect
.left
;
1108 *pHeight
= This
->SourceRect
.bottom
- This
->SourceRect
.top
;
1113 static HRESULT WINAPI
Basicvideo_SetDefaultSourcePosition(IBasicVideo
*iface
) {
1114 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1116 TRACE("(%p/%p)->()\n", This
, iface
);
1118 This
->SourceRect
.left
= 0;
1119 This
->SourceRect
.top
= 0;
1120 This
->SourceRect
.right
= This
->VideoWidth
;
1121 This
->SourceRect
.bottom
= This
->VideoHeight
;
1126 static HRESULT WINAPI
Basicvideo_SetDestinationPosition(IBasicVideo
*iface
,
1131 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1133 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This
, iface
, Left
, Top
, Width
, Height
);
1135 This
->DestRect
.left
= Left
;
1136 This
->DestRect
.top
= Top
;
1137 This
->DestRect
.right
= Left
+ Width
;
1138 This
->DestRect
.bottom
= Top
+ Height
;
1143 static HRESULT WINAPI
Basicvideo_GetDestinationPosition(IBasicVideo
*iface
,
1148 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1150 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1152 *pLeft
= This
->DestRect
.left
;
1153 *pTop
= This
->DestRect
.top
;
1154 *pWidth
= This
->DestRect
.right
- This
->DestRect
.left
;
1155 *pHeight
= This
->DestRect
.bottom
- This
->DestRect
.top
;
1160 static HRESULT WINAPI
Basicvideo_SetDefaultDestinationPosition(IBasicVideo
*iface
) {
1161 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1164 TRACE("(%p/%p)->()\n", This
, iface
);
1166 if (!GetClientRect(This
->hWnd
, &rect
))
1169 This
->SourceRect
.left
= 0;
1170 This
->SourceRect
.top
= 0;
1171 This
->SourceRect
.right
= rect
.right
;
1172 This
->SourceRect
.bottom
= rect
.bottom
;
1177 static HRESULT WINAPI
Basicvideo_GetVideoSize(IBasicVideo
*iface
,
1180 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1182 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pWidth
, pHeight
);
1184 *pWidth
= This
->VideoWidth
;
1185 *pHeight
= This
->VideoHeight
;
1190 static HRESULT WINAPI
Basicvideo_GetVideoPaletteEntries(IBasicVideo
*iface
,
1195 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1197 FIXME("(%p/%p)->(%ld, %ld, %p, %p): stub !!!\n", This
, iface
, StartIndex
, Entries
, pRetrieved
, pPalette
);
1202 static HRESULT WINAPI
Basicvideo_GetCurrentImage(IBasicVideo
*iface
,
1205 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1207 FIXME("(%p/%p)->(%p, %p): stub !!!\n", This
, iface
, pBufferSize
, pDIBImage
);
1212 static HRESULT WINAPI
Basicvideo_IsUsingDefaultSource(IBasicVideo
*iface
) {
1213 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1215 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
1220 static HRESULT WINAPI
Basicvideo_IsUsingDefaultDestination(IBasicVideo
*iface
) {
1221 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1223 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
1229 static const IBasicVideoVtbl IBasicVideo_VTable
=
1231 Basicvideo_QueryInterface
,
1234 Basicvideo_GetTypeInfoCount
,
1235 Basicvideo_GetTypeInfo
,
1236 Basicvideo_GetIDsOfNames
,
1238 Basicvideo_get_AvgTimePerFrame
,
1239 Basicvideo_get_BitRate
,
1240 Basicvideo_get_BitErrorRate
,
1241 Basicvideo_get_VideoWidth
,
1242 Basicvideo_get_VideoHeight
,
1243 Basicvideo_put_SourceLeft
,
1244 Basicvideo_get_SourceLeft
,
1245 Basicvideo_put_SourceWidth
,
1246 Basicvideo_get_SourceWidth
,
1247 Basicvideo_put_SourceTop
,
1248 Basicvideo_get_SourceTop
,
1249 Basicvideo_put_SourceHeight
,
1250 Basicvideo_get_SourceHeight
,
1251 Basicvideo_put_DestinationLeft
,
1252 Basicvideo_get_DestinationLeft
,
1253 Basicvideo_put_DestinationWidth
,
1254 Basicvideo_get_DestinationWidth
,
1255 Basicvideo_put_DestinationTop
,
1256 Basicvideo_get_DestinationTop
,
1257 Basicvideo_put_DestinationHeight
,
1258 Basicvideo_get_DestinationHeight
,
1259 Basicvideo_SetSourcePosition
,
1260 Basicvideo_GetSourcePosition
,
1261 Basicvideo_SetDefaultSourcePosition
,
1262 Basicvideo_SetDestinationPosition
,
1263 Basicvideo_GetDestinationPosition
,
1264 Basicvideo_SetDefaultDestinationPosition
,
1265 Basicvideo_GetVideoSize
,
1266 Basicvideo_GetVideoPaletteEntries
,
1267 Basicvideo_GetCurrentImage
,
1268 Basicvideo_IsUsingDefaultSource
,
1269 Basicvideo_IsUsingDefaultDestination
1273 /*** IUnknown methods ***/
1274 static HRESULT WINAPI
Videowindow_QueryInterface(IVideoWindow
*iface
,
1277 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1279 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
1281 return VideoRenderer_QueryInterface((IBaseFilter
*)This
, riid
, ppvObj
);
1284 static ULONG WINAPI
Videowindow_AddRef(IVideoWindow
*iface
) {
1285 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1287 TRACE("(%p/%p)->()\n", This
, iface
);
1289 return VideoRenderer_AddRef((IBaseFilter
*)This
);
1292 static ULONG WINAPI
Videowindow_Release(IVideoWindow
*iface
) {
1293 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1295 TRACE("(%p/%p)->()\n", This
, iface
);
1297 return VideoRenderer_Release((IBaseFilter
*)This
);
1300 /*** IDispatch methods ***/
1301 static HRESULT WINAPI
Videowindow_GetTypeInfoCount(IVideoWindow
*iface
,
1303 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1305 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
1310 static HRESULT WINAPI
Videowindow_GetTypeInfo(IVideoWindow
*iface
,
1313 ITypeInfo
**ppTInfo
) {
1314 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1316 FIXME("(%p/%p)->(%d, %ld, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
1321 static HRESULT WINAPI
Videowindow_GetIDsOfNames(IVideoWindow
*iface
,
1327 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1329 FIXME("(%p/%p)->(%s (%p), %p, %d, %ld, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1334 static HRESULT WINAPI
Videowindow_Invoke(IVideoWindow
*iface
,
1335 DISPID dispIdMember
,
1339 DISPPARAMS
*pDispParams
,
1341 EXCEPINFO
*pExepInfo
,
1343 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1345 FIXME("(%p/%p)->(%ld, %s (%p), %ld, %04x, %p, %p, %p, %p): stub !!!\n", This
, iface
, dispIdMember
, debugstr_guid(riid
), riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExepInfo
, puArgErr
);
1350 /*** IVideoWindow methods ***/
1351 static HRESULT WINAPI
Videowindow_put_Caption(IVideoWindow
*iface
,
1353 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1355 TRACE("(%p/%p)->(%s (%p))\n", This
, iface
, debugstr_w(strCaption
), strCaption
);
1357 if (!SetWindowTextW(This
->hWnd
, strCaption
))
1363 static HRESULT WINAPI
Videowindow_get_Caption(IVideoWindow
*iface
,
1365 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1367 TRACE("(%p/%p)->(%p)\n", This
, iface
, strCaption
);
1369 GetWindowTextW(This
->hWnd
, (LPWSTR
)strCaption
, 100);
1374 static HRESULT WINAPI
Videowindow_put_WindowStyle(IVideoWindow
*iface
,
1376 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1379 old
= GetWindowLongA(This
->hWnd
, GWL_STYLE
);
1381 TRACE("(%p/%p)->(%lx -> %lx)\n", This
, iface
, old
, WindowStyle
);
1383 if (WindowStyle
& (WS_DISABLED
|WS_HSCROLL
|WS_ICONIC
|WS_MAXIMIZE
|WS_MINIMIZE
|WS_VSCROLL
))
1384 return E_INVALIDARG
;
1386 SetWindowLongA(This
->hWnd
, GWL_STYLE
, WindowStyle
);
1391 static HRESULT WINAPI
Videowindow_get_WindowStyle(IVideoWindow
*iface
,
1392 long *WindowStyle
) {
1393 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1395 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyle
);
1397 *WindowStyle
= GetWindowLongA(This
->hWnd
, GWL_STYLE
);
1402 static HRESULT WINAPI
Videowindow_put_WindowStyleEx(IVideoWindow
*iface
,
1403 long WindowStyleEx
) {
1404 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1406 TRACE("(%p/%p)->(%ld)\n", This
, iface
, WindowStyleEx
);
1408 if (WindowStyleEx
& (WS_DISABLED
|WS_HSCROLL
|WS_ICONIC
|WS_MAXIMIZE
|WS_MINIMIZE
|WS_VSCROLL
))
1409 return E_INVALIDARG
;
1411 if (!SetWindowLongA(This
->hWnd
, GWL_EXSTYLE
, WindowStyleEx
))
1417 static HRESULT WINAPI
Videowindow_get_WindowStyleEx(IVideoWindow
*iface
,
1418 long *WindowStyleEx
) {
1419 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1421 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyleEx
);
1423 *WindowStyleEx
= GetWindowLongA(This
->hWnd
, GWL_EXSTYLE
);
1428 static HRESULT WINAPI
Videowindow_put_AutoShow(IVideoWindow
*iface
,
1430 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1432 TRACE("(%p/%p)->(%ld)\n", This
, iface
, AutoShow
);
1434 This
->AutoShow
= 1; /* FXIME: Should be AutoShow */;
1439 static HRESULT WINAPI
Videowindow_get_AutoShow(IVideoWindow
*iface
,
1441 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1443 TRACE("(%p/%p)->(%p)\n", This
, iface
, AutoShow
);
1445 *AutoShow
= This
->AutoShow
;
1450 static HRESULT WINAPI
Videowindow_put_WindowState(IVideoWindow
*iface
,
1452 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1454 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, WindowState
);
1459 static HRESULT WINAPI
Videowindow_get_WindowState(IVideoWindow
*iface
,
1460 long *WindowState
) {
1461 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1463 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, WindowState
);
1468 static HRESULT WINAPI
Videowindow_put_BackgroundPalette(IVideoWindow
*iface
,
1469 long BackgroundPalette
) {
1470 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1472 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, BackgroundPalette
);
1477 static HRESULT WINAPI
Videowindow_get_BackgroundPalette(IVideoWindow
*iface
,
1478 long *pBackgroundPalette
) {
1479 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1481 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBackgroundPalette
);
1486 static HRESULT WINAPI
Videowindow_put_Visible(IVideoWindow
*iface
,
1488 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1490 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Visible
);
1492 ShowWindow(This
->hWnd
, Visible
? SW_SHOW
: SW_HIDE
);
1497 static HRESULT WINAPI
Videowindow_get_Visible(IVideoWindow
*iface
,
1499 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1501 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVisible
);
1503 *pVisible
= IsWindowVisible(This
->hWnd
);
1508 static HRESULT WINAPI
Videowindow_put_Left(IVideoWindow
*iface
,
1510 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1512 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Left
);
1514 if (!SetWindowPos(This
->hWnd
, NULL
, Left
, This
->WindowPos
.top
, 0, 0, SWP_NOZORDER
|SWP_NOSIZE
))
1517 This
->WindowPos
.left
= Left
;
1522 static HRESULT WINAPI
Videowindow_get_Left(IVideoWindow
*iface
,
1524 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1526 TRACE("(%p/%p)->(%p)\n", This
, iface
, pLeft
);
1528 *pLeft
= This
->WindowPos
.left
;
1533 static HRESULT WINAPI
Videowindow_put_Width(IVideoWindow
*iface
,
1535 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1537 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Width
);
1539 if (!SetWindowPos(This
->hWnd
, NULL
, 0, 0, Width
, This
->WindowPos
.bottom
-This
->WindowPos
.top
, SWP_NOZORDER
|SWP_NOMOVE
))
1542 This
->WindowPos
.right
= This
->WindowPos
.left
+ Width
;
1547 static HRESULT WINAPI
Videowindow_get_Width(IVideoWindow
*iface
,
1549 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1551 TRACE("(%p/%p)->(%p)\n", This
, iface
, pWidth
);
1553 *pWidth
= This
->WindowPos
.right
- This
->WindowPos
.left
;
1558 static HRESULT WINAPI
Videowindow_put_Top(IVideoWindow
*iface
,
1560 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1562 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Top
);
1564 if (!SetWindowPos(This
->hWnd
, NULL
, This
->WindowPos
.left
, Top
, 0, 0, SWP_NOZORDER
|SWP_NOSIZE
))
1567 This
->WindowPos
.top
= Top
;
1572 static HRESULT WINAPI
Videowindow_get_Top(IVideoWindow
*iface
,
1574 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1576 TRACE("(%p/%p)->(%p)\n", This
, iface
, pTop
);
1578 *pTop
= This
->WindowPos
.top
;
1583 static HRESULT WINAPI
Videowindow_put_Height(IVideoWindow
*iface
,
1585 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1587 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Height
);
1589 if (!SetWindowPos(This
->hWnd
, NULL
, 0, 0, This
->WindowPos
.right
-This
->WindowPos
.left
, Height
, SWP_NOZORDER
|SWP_NOMOVE
))
1592 This
->WindowPos
.bottom
= This
->WindowPos
.top
+ Height
;
1597 static HRESULT WINAPI
Videowindow_get_Height(IVideoWindow
*iface
,
1599 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1601 TRACE("(%p/%p)->(%p)\n", This
, iface
, pHeight
);
1603 *pHeight
= This
->WindowPos
.bottom
- This
->WindowPos
.top
;
1608 static HRESULT WINAPI
Videowindow_put_Owner(IVideoWindow
*iface
,
1610 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1612 TRACE("(%p/%p)->(%08lx)\n", This
, iface
, (DWORD
) Owner
);
1614 SetParent(This
->hWnd
, (HWND
)Owner
);
1619 static HRESULT WINAPI
Videowindow_get_Owner(IVideoWindow
*iface
,
1621 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1623 TRACE("(%p/%p)->(%08lx)\n", This
, iface
, (DWORD
) Owner
);
1625 *(HWND
*)Owner
= GetParent(This
->hWnd
);
1630 static HRESULT WINAPI
Videowindow_put_MessageDrain(IVideoWindow
*iface
,
1632 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1634 TRACE("(%p/%p)->(%08lx)\n", This
, iface
, (DWORD
) Drain
);
1636 This
->hWndMsgDrain
= (HWND
)Drain
;
1641 static HRESULT WINAPI
Videowindow_get_MessageDrain(IVideoWindow
*iface
,
1643 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1645 TRACE("(%p/%p)->(%p)\n", This
, iface
, Drain
);
1647 *Drain
= (OAHWND
)This
->hWndMsgDrain
;
1652 static HRESULT WINAPI
Videowindow_get_BorderColor(IVideoWindow
*iface
,
1654 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1656 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, Color
);
1661 static HRESULT WINAPI
Videowindow_put_BorderColor(IVideoWindow
*iface
,
1663 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1665 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, Color
);
1670 static HRESULT WINAPI
Videowindow_get_FullScreenMode(IVideoWindow
*iface
,
1671 long *FullScreenMode
) {
1672 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1674 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, FullScreenMode
);
1679 static HRESULT WINAPI
Videowindow_put_FullScreenMode(IVideoWindow
*iface
,
1680 long FullScreenMode
) {
1681 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1683 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, FullScreenMode
);
1688 static HRESULT WINAPI
Videowindow_SetWindowForeground(IVideoWindow
*iface
,
1690 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1695 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Focus
);
1697 if ((Focus
!= FALSE
) && (Focus
!= TRUE
))
1698 return E_INVALIDARG
;
1700 hr
= IPin_ConnectedTo(This
->ppPins
[0], &pPin
);
1701 if ((hr
!= S_OK
) || !pPin
)
1702 return VFW_E_NOT_CONNECTED
;
1705 ret
= SetForegroundWindow(This
->hWnd
);
1707 ret
= SetWindowPos(This
->hWnd
, HWND_TOP
, 0, 0, 0, 0, SWP_NOMOVE
|SWP_NOSIZE
);
1715 static HRESULT WINAPI
Videowindow_NotifyOwnerMessage(IVideoWindow
*iface
,
1720 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1722 TRACE("(%p/%p)->(%08lx, %ld, %08lx, %08lx)\n", This
, iface
, (DWORD
) hwnd
, uMsg
, wParam
, lParam
);
1724 if (!PostMessageA(This
->hWnd
, uMsg
, wParam
, lParam
))
1730 static HRESULT WINAPI
Videowindow_SetWindowPosition(IVideoWindow
*iface
,
1735 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1737 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This
, iface
, Left
, Top
, Width
, Height
);
1739 if (!SetWindowPos(This
->hWnd
, NULL
, Left
, Top
, Width
, Height
, SWP_NOZORDER
))
1742 This
->WindowPos
.left
= Left
;
1743 This
->WindowPos
.top
= Top
;
1744 This
->WindowPos
.right
= Left
+ Width
;
1745 This
->WindowPos
.bottom
= Top
+ Height
;
1750 static HRESULT WINAPI
Videowindow_GetWindowPosition(IVideoWindow
*iface
,
1755 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1757 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1759 *pLeft
= This
->WindowPos
.left
;
1760 *pTop
= This
->WindowPos
.top
;
1761 *pWidth
= This
->WindowPos
.right
- This
->WindowPos
.left
;
1762 *pHeight
= This
->WindowPos
.bottom
- This
->WindowPos
.top
;
1767 static HRESULT WINAPI
Videowindow_GetMinIdealImageSize(IVideoWindow
*iface
,
1770 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1772 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This
, iface
, pWidth
, pHeight
);
1774 *pWidth
= This
->VideoWidth
;
1775 *pHeight
= This
->VideoHeight
;
1780 static HRESULT WINAPI
Videowindow_GetMaxIdealImageSize(IVideoWindow
*iface
,
1783 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1785 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This
, iface
, pWidth
, pHeight
);
1787 *pWidth
= This
->VideoWidth
;
1788 *pHeight
= This
->VideoHeight
;
1793 static HRESULT WINAPI
Videowindow_GetRestorePosition(IVideoWindow
*iface
,
1798 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1800 FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1805 static HRESULT WINAPI
Videowindow_HideCursor(IVideoWindow
*iface
,
1807 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1809 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, HideCursor
);
1814 static HRESULT WINAPI
Videowindow_IsCursorHidden(IVideoWindow
*iface
,
1815 long *CursorHidden
) {
1816 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1818 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, CursorHidden
);
1823 static const IVideoWindowVtbl IVideoWindow_VTable
=
1825 Videowindow_QueryInterface
,
1827 Videowindow_Release
,
1828 Videowindow_GetTypeInfoCount
,
1829 Videowindow_GetTypeInfo
,
1830 Videowindow_GetIDsOfNames
,
1832 Videowindow_put_Caption
,
1833 Videowindow_get_Caption
,
1834 Videowindow_put_WindowStyle
,
1835 Videowindow_get_WindowStyle
,
1836 Videowindow_put_WindowStyleEx
,
1837 Videowindow_get_WindowStyleEx
,
1838 Videowindow_put_AutoShow
,
1839 Videowindow_get_AutoShow
,
1840 Videowindow_put_WindowState
,
1841 Videowindow_get_WindowState
,
1842 Videowindow_put_BackgroundPalette
,
1843 Videowindow_get_BackgroundPalette
,
1844 Videowindow_put_Visible
,
1845 Videowindow_get_Visible
,
1846 Videowindow_put_Left
,
1847 Videowindow_get_Left
,
1848 Videowindow_put_Width
,
1849 Videowindow_get_Width
,
1850 Videowindow_put_Top
,
1851 Videowindow_get_Top
,
1852 Videowindow_put_Height
,
1853 Videowindow_get_Height
,
1854 Videowindow_put_Owner
,
1855 Videowindow_get_Owner
,
1856 Videowindow_put_MessageDrain
,
1857 Videowindow_get_MessageDrain
,
1858 Videowindow_get_BorderColor
,
1859 Videowindow_put_BorderColor
,
1860 Videowindow_get_FullScreenMode
,
1861 Videowindow_put_FullScreenMode
,
1862 Videowindow_SetWindowForeground
,
1863 Videowindow_NotifyOwnerMessage
,
1864 Videowindow_SetWindowPosition
,
1865 Videowindow_GetWindowPosition
,
1866 Videowindow_GetMinIdealImageSize
,
1867 Videowindow_GetMaxIdealImageSize
,
1868 Videowindow_GetRestorePosition
,
1869 Videowindow_HideCursor
,
1870 Videowindow_IsCursorHidden