2 * Video Renderer (Fullscreen and Windowed using Direct Draw)
4 * Copyright 2004 Christian Costa
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #define NONAMELESSSTRUCT
24 #define NONAMELESSUNION
25 #include "quartz_private.h"
26 #include "control_private.h"
41 #include "wine/unicode.h"
42 #include "wine/debug.h"
44 WINE_DEFAULT_DEBUG_CHANNEL(quartz
);
46 static BOOL wnd_class_registered
= FALSE
;
48 static const WCHAR wcsInputPinName
[] = {'i','n','p','u','t',' ','p','i','n',0};
50 static const IBaseFilterVtbl VideoRenderer_Vtbl
;
51 static const 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 %d %d %d %d\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
= GetStockObject(BLACK_BRUSH
);
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 %x\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 %d\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 = %d\n", format
->bmiHeader
.biSize
);
297 TRACE("biWidth = %d\n", format
->bmiHeader
.biWidth
);
298 TRACE("biHeight = %d\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 = %d\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
= abs(height
);
322 GetClientRect(This
->hWnd
, &This
->DestRect
);
326 hDC
= GetDC(This
->hWnd
);
329 ERR("Cannot get DC from window!\n");
333 TRACE("Src Rect: %d %d %d %d\n", This
->SourceRect
.left
, This
->SourceRect
.top
, This
->SourceRect
.right
, This
->SourceRect
.bottom
);
334 TRACE("Dst Rect: %d %d %d %d\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_RGB_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 (%x)\n", hr
);
366 hr
= IMediaSample_GetTime(pSample
, &tStart
, &tStop
);
368 ERR("Cannot get sample time (%x)\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 TRACE("%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
))
397 if (IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB32
) ||
398 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB24
) ||
399 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB565
) ||
400 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB8
))
402 VideoRendererImpl
* This
= (VideoRendererImpl
*) iface
;
403 VIDEOINFOHEADER
* format
= (VIDEOINFOHEADER
*)pmt
->pbFormat
;
405 if (!IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo
))
407 WARN("Format type %s not supported\n", debugstr_guid(&pmt
->formattype
));
410 This
->SourceRect
.left
= 0;
411 This
->SourceRect
.top
= 0;
412 This
->SourceRect
.right
= This
->VideoWidth
= format
->bmiHeader
.biWidth
;
413 This
->SourceRect
.bottom
= This
->VideoHeight
= format
->bmiHeader
.biHeight
;
419 HRESULT
VideoRenderer_create(IUnknown
* pUnkOuter
, LPVOID
* ppv
)
423 VideoRendererImpl
* pVideoRenderer
;
425 TRACE("(%p, %p)\n", pUnkOuter
, ppv
);
430 return CLASS_E_NOAGGREGATION
;
432 pVideoRenderer
= CoTaskMemAlloc(sizeof(VideoRendererImpl
));
434 pVideoRenderer
->lpVtbl
= &VideoRenderer_Vtbl
;
435 pVideoRenderer
->IBasicVideo_vtbl
= &IBasicVideo_VTable
;
436 pVideoRenderer
->IVideoWindow_vtbl
= &IVideoWindow_VTable
;
438 pVideoRenderer
->refCount
= 1;
439 InitializeCriticalSection(&pVideoRenderer
->csFilter
);
440 pVideoRenderer
->state
= State_Stopped
;
441 pVideoRenderer
->pClock
= NULL
;
442 pVideoRenderer
->init
= 0;
443 pVideoRenderer
->AutoShow
= 1;
444 ZeroMemory(&pVideoRenderer
->filterInfo
, sizeof(FILTER_INFO
));
446 pVideoRenderer
->ppPins
= CoTaskMemAlloc(1 * sizeof(IPin
*));
448 /* construct input pin */
449 piInput
.dir
= PINDIR_INPUT
;
450 piInput
.pFilter
= (IBaseFilter
*)pVideoRenderer
;
451 lstrcpynW(piInput
.achName
, wcsInputPinName
, sizeof(piInput
.achName
) / sizeof(piInput
.achName
[0]));
453 hr
= VideoRenderer_InputPin_Construct(&piInput
, VideoRenderer_Sample
, (LPVOID
)pVideoRenderer
, VideoRenderer_QueryAccept
, &pVideoRenderer
->csFilter
, (IPin
**)&pVideoRenderer
->pInputPin
);
457 pVideoRenderer
->ppPins
[0] = (IPin
*)pVideoRenderer
->pInputPin
;
458 *ppv
= (LPVOID
)pVideoRenderer
;
462 CoTaskMemFree(pVideoRenderer
->ppPins
);
463 DeleteCriticalSection(&pVideoRenderer
->csFilter
);
464 CoTaskMemFree(pVideoRenderer
);
467 if (!CreateRenderingSubsystem(pVideoRenderer
))
473 static HRESULT WINAPI
VideoRenderer_QueryInterface(IBaseFilter
* iface
, REFIID riid
, LPVOID
* ppv
)
475 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
476 TRACE("(%p/%p)->(%s, %p)\n", This
, iface
, qzdebugstr_guid(riid
), ppv
);
480 if (IsEqualIID(riid
, &IID_IUnknown
))
482 else if (IsEqualIID(riid
, &IID_IPersist
))
484 else if (IsEqualIID(riid
, &IID_IMediaFilter
))
486 else if (IsEqualIID(riid
, &IID_IBaseFilter
))
488 else if (IsEqualIID(riid
, &IID_IBasicVideo
))
489 *ppv
= (LPVOID
)&(This
->IBasicVideo_vtbl
);
490 else if (IsEqualIID(riid
, &IID_IVideoWindow
))
491 *ppv
= (LPVOID
)&(This
->IVideoWindow_vtbl
);
495 IUnknown_AddRef((IUnknown
*)(*ppv
));
499 FIXME("No interface for %s!\n", qzdebugstr_guid(riid
));
501 return E_NOINTERFACE
;
504 static ULONG WINAPI
VideoRenderer_AddRef(IBaseFilter
* iface
)
506 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
507 ULONG refCount
= InterlockedIncrement(&This
->refCount
);
509 TRACE("(%p/%p)->() AddRef from %d\n", This
, iface
, refCount
- 1);
514 static ULONG WINAPI
VideoRenderer_Release(IBaseFilter
* iface
)
516 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
517 ULONG refCount
= InterlockedDecrement(&This
->refCount
);
519 TRACE("(%p/%p)->() Release from %d\n", This
, iface
, refCount
+ 1);
523 DeleteCriticalSection(&This
->csFilter
);
525 DestroyWindow(This
->hWnd
);
526 PostThreadMessageA(This
->ThreadID
, WM_QUIT
, 0, 0);
527 WaitForSingleObject(This
->hThread
, INFINITE
);
528 CloseHandle(This
->hThread
);
531 IReferenceClock_Release(This
->pClock
);
533 IPin_Release(This
->ppPins
[0]);
535 HeapFree(GetProcessHeap(), 0, This
->ppPins
);
538 TRACE("Destroying Video Renderer\n");
547 /** IPersist methods **/
549 static HRESULT WINAPI
VideoRenderer_GetClassID(IBaseFilter
* iface
, CLSID
* pClsid
)
551 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
553 TRACE("(%p/%p)->(%p)\n", This
, iface
, pClsid
);
555 *pClsid
= CLSID_VideoRenderer
;
560 /** IMediaFilter methods **/
562 static HRESULT WINAPI
VideoRenderer_Stop(IBaseFilter
* iface
)
564 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
566 TRACE("(%p/%p)->()\n", This
, iface
);
568 EnterCriticalSection(&This
->csFilter
);
570 This
->state
= State_Stopped
;
572 LeaveCriticalSection(&This
->csFilter
);
577 static HRESULT WINAPI
VideoRenderer_Pause(IBaseFilter
* iface
)
579 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
581 TRACE("(%p/%p)->()\n", This
, iface
);
583 EnterCriticalSection(&This
->csFilter
);
585 This
->state
= State_Paused
;
587 LeaveCriticalSection(&This
->csFilter
);
592 static HRESULT WINAPI
VideoRenderer_Run(IBaseFilter
* iface
, REFERENCE_TIME tStart
)
594 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
596 TRACE("(%p/%p)->(%s)\n", This
, iface
, wine_dbgstr_longlong(tStart
));
598 EnterCriticalSection(&This
->csFilter
);
600 This
->rtStreamStart
= tStart
;
601 This
->state
= State_Running
;
603 LeaveCriticalSection(&This
->csFilter
);
608 static HRESULT WINAPI
VideoRenderer_GetState(IBaseFilter
* iface
, DWORD dwMilliSecsTimeout
, FILTER_STATE
*pState
)
610 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
612 TRACE("(%p/%p)->(%d, %p)\n", This
, iface
, dwMilliSecsTimeout
, pState
);
614 EnterCriticalSection(&This
->csFilter
);
616 *pState
= This
->state
;
618 LeaveCriticalSection(&This
->csFilter
);
623 static HRESULT WINAPI
VideoRenderer_SetSyncSource(IBaseFilter
* iface
, IReferenceClock
*pClock
)
625 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
627 TRACE("(%p/%p)->(%p)\n", This
, iface
, pClock
);
629 EnterCriticalSection(&This
->csFilter
);
632 IReferenceClock_Release(This
->pClock
);
633 This
->pClock
= pClock
;
635 IReferenceClock_AddRef(This
->pClock
);
637 LeaveCriticalSection(&This
->csFilter
);
642 static HRESULT WINAPI
VideoRenderer_GetSyncSource(IBaseFilter
* iface
, IReferenceClock
**ppClock
)
644 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
646 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppClock
);
648 EnterCriticalSection(&This
->csFilter
);
650 *ppClock
= This
->pClock
;
651 IReferenceClock_AddRef(This
->pClock
);
653 LeaveCriticalSection(&This
->csFilter
);
658 /** IBaseFilter implementation **/
660 static HRESULT WINAPI
VideoRenderer_EnumPins(IBaseFilter
* iface
, IEnumPins
**ppEnum
)
663 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
665 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppEnum
);
667 epd
.cPins
= 1; /* input pin */
668 epd
.ppPins
= This
->ppPins
;
669 return IEnumPinsImpl_Construct(&epd
, ppEnum
);
672 static HRESULT WINAPI
VideoRenderer_FindPin(IBaseFilter
* iface
, LPCWSTR Id
, IPin
**ppPin
)
674 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
676 TRACE("(%p/%p)->(%p,%p)\n", This
, iface
, debugstr_w(Id
), ppPin
);
678 FIXME("VideoRenderer::FindPin(...)\n");
680 /* FIXME: critical section */
685 static HRESULT WINAPI
VideoRenderer_QueryFilterInfo(IBaseFilter
* iface
, FILTER_INFO
*pInfo
)
687 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
689 TRACE("(%p/%p)->(%p)\n", This
, iface
, pInfo
);
691 strcpyW(pInfo
->achName
, This
->filterInfo
.achName
);
692 pInfo
->pGraph
= This
->filterInfo
.pGraph
;
695 IFilterGraph_AddRef(pInfo
->pGraph
);
700 static HRESULT WINAPI
VideoRenderer_JoinFilterGraph(IBaseFilter
* iface
, IFilterGraph
*pGraph
, LPCWSTR pName
)
702 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
704 TRACE("(%p/%p)->(%p, %s)\n", This
, iface
, pGraph
, debugstr_w(pName
));
706 EnterCriticalSection(&This
->csFilter
);
709 strcpyW(This
->filterInfo
.achName
, pName
);
711 *This
->filterInfo
.achName
= '\0';
712 This
->filterInfo
.pGraph
= pGraph
; /* NOTE: do NOT increase ref. count */
714 LeaveCriticalSection(&This
->csFilter
);
719 static HRESULT WINAPI
VideoRenderer_QueryVendorInfo(IBaseFilter
* iface
, LPWSTR
*pVendorInfo
)
721 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
722 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVendorInfo
);
726 static const IBaseFilterVtbl VideoRenderer_Vtbl
=
728 VideoRenderer_QueryInterface
,
729 VideoRenderer_AddRef
,
730 VideoRenderer_Release
,
731 VideoRenderer_GetClassID
,
735 VideoRenderer_GetState
,
736 VideoRenderer_SetSyncSource
,
737 VideoRenderer_GetSyncSource
,
738 VideoRenderer_EnumPins
,
739 VideoRenderer_FindPin
,
740 VideoRenderer_QueryFilterInfo
,
741 VideoRenderer_JoinFilterGraph
,
742 VideoRenderer_QueryVendorInfo
745 static HRESULT WINAPI
VideoRenderer_InputPin_EndOfStream(IPin
* iface
)
747 InputPin
* This
= (InputPin
*)iface
;
748 IMediaEventSink
* pEventSink
;
751 TRACE("(%p/%p)->()\n", This
, iface
);
753 hr
= IFilterGraph_QueryInterface(((VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
)->filterInfo
.pGraph
, &IID_IMediaEventSink
, (LPVOID
*)&pEventSink
);
756 hr
= IMediaEventSink_Notify(pEventSink
, EC_COMPLETE
, S_OK
, 0);
757 IMediaEventSink_Release(pEventSink
);
763 static const IPinVtbl VideoRenderer_InputPin_Vtbl
=
765 InputPin_QueryInterface
,
769 InputPin_ReceiveConnection
,
771 IPinImpl_ConnectedTo
,
772 IPinImpl_ConnectionMediaType
,
773 IPinImpl_QueryPinInfo
,
774 IPinImpl_QueryDirection
,
776 IPinImpl_QueryAccept
,
777 IPinImpl_EnumMediaTypes
,
778 IPinImpl_QueryInternalConnections
,
779 VideoRenderer_InputPin_EndOfStream
,
785 /*** IUnknown methods ***/
786 static HRESULT WINAPI
Basicvideo_QueryInterface(IBasicVideo
*iface
,
789 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
791 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
793 return VideoRenderer_QueryInterface((IBaseFilter
*)This
, riid
, ppvObj
);
796 static ULONG WINAPI
Basicvideo_AddRef(IBasicVideo
*iface
) {
797 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
799 TRACE("(%p/%p)->()\n", This
, iface
);
801 return VideoRenderer_AddRef((IBaseFilter
*)This
);
804 static ULONG WINAPI
Basicvideo_Release(IBasicVideo
*iface
) {
805 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
807 TRACE("(%p/%p)->()\n", This
, iface
);
809 return VideoRenderer_Release((IBaseFilter
*)This
);
812 /*** IDispatch methods ***/
813 static HRESULT WINAPI
Basicvideo_GetTypeInfoCount(IBasicVideo
*iface
,
815 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
817 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
822 static HRESULT WINAPI
Basicvideo_GetTypeInfo(IBasicVideo
*iface
,
825 ITypeInfo
**ppTInfo
) {
826 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
828 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
833 static HRESULT WINAPI
Basicvideo_GetIDsOfNames(IBasicVideo
*iface
,
839 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
841 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
846 static HRESULT WINAPI
Basicvideo_Invoke(IBasicVideo
*iface
,
851 DISPPARAMS
*pDispParams
,
855 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
857 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
);
862 /*** IBasicVideo methods ***/
863 static HRESULT WINAPI
Basicvideo_get_AvgTimePerFrame(IBasicVideo
*iface
,
864 REFTIME
*pAvgTimePerFrame
) {
865 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
867 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pAvgTimePerFrame
);
872 static HRESULT WINAPI
Basicvideo_get_BitRate(IBasicVideo
*iface
,
874 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
876 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBitRate
);
881 static HRESULT WINAPI
Basicvideo_get_BitErrorRate(IBasicVideo
*iface
,
882 long *pBitErrorRate
) {
883 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
885 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBitErrorRate
);
890 static HRESULT WINAPI
Basicvideo_get_VideoWidth(IBasicVideo
*iface
,
892 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
894 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoWidth
);
896 *pVideoWidth
= This
->VideoWidth
;
901 static HRESULT WINAPI
Basicvideo_get_VideoHeight(IBasicVideo
*iface
,
902 long *pVideoHeight
) {
903 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
905 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoHeight
);
907 *pVideoHeight
= This
->VideoHeight
;
912 static HRESULT WINAPI
Basicvideo_put_SourceLeft(IBasicVideo
*iface
,
914 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
916 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceLeft
);
918 This
->SourceRect
.left
= SourceLeft
;
923 static HRESULT WINAPI
Basicvideo_get_SourceLeft(IBasicVideo
*iface
,
925 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
927 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceLeft
);
929 *pSourceLeft
= This
->SourceRect
.left
;
934 static HRESULT WINAPI
Basicvideo_put_SourceWidth(IBasicVideo
*iface
,
936 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
938 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceWidth
);
940 This
->SourceRect
.right
= This
->SourceRect
.left
+ SourceWidth
;
945 static HRESULT WINAPI
Basicvideo_get_SourceWidth(IBasicVideo
*iface
,
946 long *pSourceWidth
) {
947 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
949 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceWidth
);
951 *pSourceWidth
= This
->SourceRect
.right
- This
->SourceRect
.left
;
956 static HRESULT WINAPI
Basicvideo_put_SourceTop(IBasicVideo
*iface
,
958 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
960 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceTop
);
962 This
->SourceRect
.top
= SourceTop
;
967 static HRESULT WINAPI
Basicvideo_get_SourceTop(IBasicVideo
*iface
,
969 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
971 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceTop
);
973 *pSourceTop
= This
->SourceRect
.top
;
978 static HRESULT WINAPI
Basicvideo_put_SourceHeight(IBasicVideo
*iface
,
980 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
982 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceHeight
);
984 This
->SourceRect
.bottom
= This
->SourceRect
.top
+ SourceHeight
;
989 static HRESULT WINAPI
Basicvideo_get_SourceHeight(IBasicVideo
*iface
,
990 long *pSourceHeight
) {
991 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
993 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceHeight
);
995 *pSourceHeight
= This
->SourceRect
.bottom
- This
->SourceRect
.top
;
1000 static HRESULT WINAPI
Basicvideo_put_DestinationLeft(IBasicVideo
*iface
,
1001 long DestinationLeft
) {
1002 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1004 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationLeft
);
1006 This
->DestRect
.left
= DestinationLeft
;
1011 static HRESULT WINAPI
Basicvideo_get_DestinationLeft(IBasicVideo
*iface
,
1012 long *pDestinationLeft
) {
1013 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1015 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationLeft
);
1017 *pDestinationLeft
= This
->DestRect
.left
;
1022 static HRESULT WINAPI
Basicvideo_put_DestinationWidth(IBasicVideo
*iface
,
1023 long DestinationWidth
) {
1024 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1026 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationWidth
);
1028 This
->DestRect
.right
= This
->DestRect
.left
+ DestinationWidth
;
1033 static HRESULT WINAPI
Basicvideo_get_DestinationWidth(IBasicVideo
*iface
,
1034 long *pDestinationWidth
) {
1035 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1037 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationWidth
);
1039 *pDestinationWidth
= This
->DestRect
.right
- This
->DestRect
.left
;
1044 static HRESULT WINAPI
Basicvideo_put_DestinationTop(IBasicVideo
*iface
,
1045 long DestinationTop
) {
1046 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1048 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationTop
);
1050 This
->DestRect
.top
= DestinationTop
;
1055 static HRESULT WINAPI
Basicvideo_get_DestinationTop(IBasicVideo
*iface
,
1056 long *pDestinationTop
) {
1057 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1059 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationTop
);
1061 *pDestinationTop
= This
->DestRect
.top
;
1066 static HRESULT WINAPI
Basicvideo_put_DestinationHeight(IBasicVideo
*iface
,
1067 long DestinationHeight
) {
1068 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1070 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationHeight
);
1072 This
->DestRect
.right
= This
->DestRect
.left
+ DestinationHeight
;
1077 static HRESULT WINAPI
Basicvideo_get_DestinationHeight(IBasicVideo
*iface
,
1078 long *pDestinationHeight
) {
1079 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1081 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationHeight
);
1083 *pDestinationHeight
= This
->DestRect
.right
- This
->DestRect
.left
;
1088 static HRESULT WINAPI
Basicvideo_SetSourcePosition(IBasicVideo
*iface
,
1093 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1095 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This
, iface
, Left
, Top
, Width
, Height
);
1097 This
->SourceRect
.left
= Left
;
1098 This
->SourceRect
.top
= Top
;
1099 This
->SourceRect
.right
= Left
+ Width
;
1100 This
->SourceRect
.bottom
= Top
+ Height
;
1105 static HRESULT WINAPI
Basicvideo_GetSourcePosition(IBasicVideo
*iface
,
1110 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1112 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1114 *pLeft
= This
->SourceRect
.left
;
1115 *pTop
= This
->SourceRect
.top
;
1116 *pWidth
= This
->SourceRect
.right
- This
->SourceRect
.left
;
1117 *pHeight
= This
->SourceRect
.bottom
- This
->SourceRect
.top
;
1122 static HRESULT WINAPI
Basicvideo_SetDefaultSourcePosition(IBasicVideo
*iface
) {
1123 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1125 TRACE("(%p/%p)->()\n", This
, iface
);
1127 This
->SourceRect
.left
= 0;
1128 This
->SourceRect
.top
= 0;
1129 This
->SourceRect
.right
= This
->VideoWidth
;
1130 This
->SourceRect
.bottom
= This
->VideoHeight
;
1135 static HRESULT WINAPI
Basicvideo_SetDestinationPosition(IBasicVideo
*iface
,
1140 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1142 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This
, iface
, Left
, Top
, Width
, Height
);
1144 This
->DestRect
.left
= Left
;
1145 This
->DestRect
.top
= Top
;
1146 This
->DestRect
.right
= Left
+ Width
;
1147 This
->DestRect
.bottom
= Top
+ Height
;
1152 static HRESULT WINAPI
Basicvideo_GetDestinationPosition(IBasicVideo
*iface
,
1157 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1159 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1161 *pLeft
= This
->DestRect
.left
;
1162 *pTop
= This
->DestRect
.top
;
1163 *pWidth
= This
->DestRect
.right
- This
->DestRect
.left
;
1164 *pHeight
= This
->DestRect
.bottom
- This
->DestRect
.top
;
1169 static HRESULT WINAPI
Basicvideo_SetDefaultDestinationPosition(IBasicVideo
*iface
) {
1170 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1173 TRACE("(%p/%p)->()\n", This
, iface
);
1175 if (!GetClientRect(This
->hWnd
, &rect
))
1178 This
->SourceRect
.left
= 0;
1179 This
->SourceRect
.top
= 0;
1180 This
->SourceRect
.right
= rect
.right
;
1181 This
->SourceRect
.bottom
= rect
.bottom
;
1186 static HRESULT WINAPI
Basicvideo_GetVideoSize(IBasicVideo
*iface
,
1189 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1191 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pWidth
, pHeight
);
1193 *pWidth
= This
->VideoWidth
;
1194 *pHeight
= This
->VideoHeight
;
1199 static HRESULT WINAPI
Basicvideo_GetVideoPaletteEntries(IBasicVideo
*iface
,
1204 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1206 FIXME("(%p/%p)->(%ld, %ld, %p, %p): stub !!!\n", This
, iface
, StartIndex
, Entries
, pRetrieved
, pPalette
);
1211 static HRESULT WINAPI
Basicvideo_GetCurrentImage(IBasicVideo
*iface
,
1214 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1216 FIXME("(%p/%p)->(%p, %p): stub !!!\n", This
, iface
, pBufferSize
, pDIBImage
);
1221 static HRESULT WINAPI
Basicvideo_IsUsingDefaultSource(IBasicVideo
*iface
) {
1222 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1224 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
1229 static HRESULT WINAPI
Basicvideo_IsUsingDefaultDestination(IBasicVideo
*iface
) {
1230 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1232 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
1238 static const IBasicVideoVtbl IBasicVideo_VTable
=
1240 Basicvideo_QueryInterface
,
1243 Basicvideo_GetTypeInfoCount
,
1244 Basicvideo_GetTypeInfo
,
1245 Basicvideo_GetIDsOfNames
,
1247 Basicvideo_get_AvgTimePerFrame
,
1248 Basicvideo_get_BitRate
,
1249 Basicvideo_get_BitErrorRate
,
1250 Basicvideo_get_VideoWidth
,
1251 Basicvideo_get_VideoHeight
,
1252 Basicvideo_put_SourceLeft
,
1253 Basicvideo_get_SourceLeft
,
1254 Basicvideo_put_SourceWidth
,
1255 Basicvideo_get_SourceWidth
,
1256 Basicvideo_put_SourceTop
,
1257 Basicvideo_get_SourceTop
,
1258 Basicvideo_put_SourceHeight
,
1259 Basicvideo_get_SourceHeight
,
1260 Basicvideo_put_DestinationLeft
,
1261 Basicvideo_get_DestinationLeft
,
1262 Basicvideo_put_DestinationWidth
,
1263 Basicvideo_get_DestinationWidth
,
1264 Basicvideo_put_DestinationTop
,
1265 Basicvideo_get_DestinationTop
,
1266 Basicvideo_put_DestinationHeight
,
1267 Basicvideo_get_DestinationHeight
,
1268 Basicvideo_SetSourcePosition
,
1269 Basicvideo_GetSourcePosition
,
1270 Basicvideo_SetDefaultSourcePosition
,
1271 Basicvideo_SetDestinationPosition
,
1272 Basicvideo_GetDestinationPosition
,
1273 Basicvideo_SetDefaultDestinationPosition
,
1274 Basicvideo_GetVideoSize
,
1275 Basicvideo_GetVideoPaletteEntries
,
1276 Basicvideo_GetCurrentImage
,
1277 Basicvideo_IsUsingDefaultSource
,
1278 Basicvideo_IsUsingDefaultDestination
1282 /*** IUnknown methods ***/
1283 static HRESULT WINAPI
Videowindow_QueryInterface(IVideoWindow
*iface
,
1286 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1288 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
1290 return VideoRenderer_QueryInterface((IBaseFilter
*)This
, riid
, ppvObj
);
1293 static ULONG WINAPI
Videowindow_AddRef(IVideoWindow
*iface
) {
1294 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1296 TRACE("(%p/%p)->()\n", This
, iface
);
1298 return VideoRenderer_AddRef((IBaseFilter
*)This
);
1301 static ULONG WINAPI
Videowindow_Release(IVideoWindow
*iface
) {
1302 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1304 TRACE("(%p/%p)->()\n", This
, iface
);
1306 return VideoRenderer_Release((IBaseFilter
*)This
);
1309 /*** IDispatch methods ***/
1310 static HRESULT WINAPI
Videowindow_GetTypeInfoCount(IVideoWindow
*iface
,
1312 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1314 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
1319 static HRESULT WINAPI
Videowindow_GetTypeInfo(IVideoWindow
*iface
,
1322 ITypeInfo
**ppTInfo
) {
1323 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1325 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
1330 static HRESULT WINAPI
Videowindow_GetIDsOfNames(IVideoWindow
*iface
,
1336 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1338 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1343 static HRESULT WINAPI
Videowindow_Invoke(IVideoWindow
*iface
,
1344 DISPID dispIdMember
,
1348 DISPPARAMS
*pDispParams
,
1350 EXCEPINFO
*pExepInfo
,
1352 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1354 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
);
1359 /*** IVideoWindow methods ***/
1360 static HRESULT WINAPI
Videowindow_put_Caption(IVideoWindow
*iface
,
1362 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1364 TRACE("(%p/%p)->(%s (%p))\n", This
, iface
, debugstr_w(strCaption
), strCaption
);
1366 if (!SetWindowTextW(This
->hWnd
, strCaption
))
1372 static HRESULT WINAPI
Videowindow_get_Caption(IVideoWindow
*iface
,
1374 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1376 TRACE("(%p/%p)->(%p)\n", This
, iface
, strCaption
);
1378 GetWindowTextW(This
->hWnd
, (LPWSTR
)strCaption
, 100);
1383 static HRESULT WINAPI
Videowindow_put_WindowStyle(IVideoWindow
*iface
,
1385 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1388 old
= GetWindowLongA(This
->hWnd
, GWL_STYLE
);
1390 TRACE("(%p/%p)->(%x -> %lx)\n", This
, iface
, old
, WindowStyle
);
1392 if (WindowStyle
& (WS_DISABLED
|WS_HSCROLL
|WS_ICONIC
|WS_MAXIMIZE
|WS_MINIMIZE
|WS_VSCROLL
))
1393 return E_INVALIDARG
;
1395 SetWindowLongA(This
->hWnd
, GWL_STYLE
, WindowStyle
);
1400 static HRESULT WINAPI
Videowindow_get_WindowStyle(IVideoWindow
*iface
,
1401 long *WindowStyle
) {
1402 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1404 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyle
);
1406 *WindowStyle
= GetWindowLongA(This
->hWnd
, GWL_STYLE
);
1411 static HRESULT WINAPI
Videowindow_put_WindowStyleEx(IVideoWindow
*iface
,
1412 long WindowStyleEx
) {
1413 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1415 TRACE("(%p/%p)->(%ld)\n", This
, iface
, WindowStyleEx
);
1417 if (WindowStyleEx
& (WS_DISABLED
|WS_HSCROLL
|WS_ICONIC
|WS_MAXIMIZE
|WS_MINIMIZE
|WS_VSCROLL
))
1418 return E_INVALIDARG
;
1420 if (!SetWindowLongA(This
->hWnd
, GWL_EXSTYLE
, WindowStyleEx
))
1426 static HRESULT WINAPI
Videowindow_get_WindowStyleEx(IVideoWindow
*iface
,
1427 long *WindowStyleEx
) {
1428 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1430 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyleEx
);
1432 *WindowStyleEx
= GetWindowLongA(This
->hWnd
, GWL_EXSTYLE
);
1437 static HRESULT WINAPI
Videowindow_put_AutoShow(IVideoWindow
*iface
,
1439 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1441 TRACE("(%p/%p)->(%ld)\n", This
, iface
, AutoShow
);
1443 This
->AutoShow
= 1; /* FXIME: Should be AutoShow */;
1448 static HRESULT WINAPI
Videowindow_get_AutoShow(IVideoWindow
*iface
,
1450 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1452 TRACE("(%p/%p)->(%p)\n", This
, iface
, AutoShow
);
1454 *AutoShow
= This
->AutoShow
;
1459 static HRESULT WINAPI
Videowindow_put_WindowState(IVideoWindow
*iface
,
1461 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1463 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, WindowState
);
1468 static HRESULT WINAPI
Videowindow_get_WindowState(IVideoWindow
*iface
,
1469 long *WindowState
) {
1470 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1472 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, WindowState
);
1477 static HRESULT WINAPI
Videowindow_put_BackgroundPalette(IVideoWindow
*iface
,
1478 long BackgroundPalette
) {
1479 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1481 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, BackgroundPalette
);
1486 static HRESULT WINAPI
Videowindow_get_BackgroundPalette(IVideoWindow
*iface
,
1487 long *pBackgroundPalette
) {
1488 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1490 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBackgroundPalette
);
1495 static HRESULT WINAPI
Videowindow_put_Visible(IVideoWindow
*iface
,
1497 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1499 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Visible
);
1501 ShowWindow(This
->hWnd
, Visible
? SW_SHOW
: SW_HIDE
);
1506 static HRESULT WINAPI
Videowindow_get_Visible(IVideoWindow
*iface
,
1508 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1510 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVisible
);
1512 *pVisible
= IsWindowVisible(This
->hWnd
);
1517 static HRESULT WINAPI
Videowindow_put_Left(IVideoWindow
*iface
,
1519 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1521 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Left
);
1523 if (!SetWindowPos(This
->hWnd
, NULL
, Left
, This
->WindowPos
.top
, 0, 0, SWP_NOZORDER
|SWP_NOSIZE
))
1526 This
->WindowPos
.left
= Left
;
1531 static HRESULT WINAPI
Videowindow_get_Left(IVideoWindow
*iface
,
1533 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1535 TRACE("(%p/%p)->(%p)\n", This
, iface
, pLeft
);
1537 *pLeft
= This
->WindowPos
.left
;
1542 static HRESULT WINAPI
Videowindow_put_Width(IVideoWindow
*iface
,
1544 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1546 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Width
);
1548 if (!SetWindowPos(This
->hWnd
, NULL
, 0, 0, Width
, This
->WindowPos
.bottom
-This
->WindowPos
.top
, SWP_NOZORDER
|SWP_NOMOVE
))
1551 This
->WindowPos
.right
= This
->WindowPos
.left
+ Width
;
1556 static HRESULT WINAPI
Videowindow_get_Width(IVideoWindow
*iface
,
1558 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1560 TRACE("(%p/%p)->(%p)\n", This
, iface
, pWidth
);
1562 *pWidth
= This
->WindowPos
.right
- This
->WindowPos
.left
;
1567 static HRESULT WINAPI
Videowindow_put_Top(IVideoWindow
*iface
,
1569 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1571 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Top
);
1573 if (!SetWindowPos(This
->hWnd
, NULL
, This
->WindowPos
.left
, Top
, 0, 0, SWP_NOZORDER
|SWP_NOSIZE
))
1576 This
->WindowPos
.top
= Top
;
1581 static HRESULT WINAPI
Videowindow_get_Top(IVideoWindow
*iface
,
1583 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1585 TRACE("(%p/%p)->(%p)\n", This
, iface
, pTop
);
1587 *pTop
= This
->WindowPos
.top
;
1592 static HRESULT WINAPI
Videowindow_put_Height(IVideoWindow
*iface
,
1594 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1596 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Height
);
1598 if (!SetWindowPos(This
->hWnd
, NULL
, 0, 0, This
->WindowPos
.right
-This
->WindowPos
.left
, Height
, SWP_NOZORDER
|SWP_NOMOVE
))
1601 This
->WindowPos
.bottom
= This
->WindowPos
.top
+ Height
;
1606 static HRESULT WINAPI
Videowindow_get_Height(IVideoWindow
*iface
,
1608 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1610 TRACE("(%p/%p)->(%p)\n", This
, iface
, pHeight
);
1612 *pHeight
= This
->WindowPos
.bottom
- This
->WindowPos
.top
;
1617 static HRESULT WINAPI
Videowindow_put_Owner(IVideoWindow
*iface
,
1619 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1621 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Owner
);
1623 SetParent(This
->hWnd
, (HWND
)Owner
);
1628 static HRESULT WINAPI
Videowindow_get_Owner(IVideoWindow
*iface
,
1630 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1632 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Owner
);
1634 *(HWND
*)Owner
= GetParent(This
->hWnd
);
1639 static HRESULT WINAPI
Videowindow_put_MessageDrain(IVideoWindow
*iface
,
1641 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1643 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Drain
);
1645 This
->hWndMsgDrain
= (HWND
)Drain
;
1650 static HRESULT WINAPI
Videowindow_get_MessageDrain(IVideoWindow
*iface
,
1652 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1654 TRACE("(%p/%p)->(%p)\n", This
, iface
, Drain
);
1656 *Drain
= (OAHWND
)This
->hWndMsgDrain
;
1661 static HRESULT WINAPI
Videowindow_get_BorderColor(IVideoWindow
*iface
,
1663 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1665 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, Color
);
1670 static HRESULT WINAPI
Videowindow_put_BorderColor(IVideoWindow
*iface
,
1672 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1674 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, Color
);
1679 static HRESULT WINAPI
Videowindow_get_FullScreenMode(IVideoWindow
*iface
,
1680 long *FullScreenMode
) {
1681 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1683 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, FullScreenMode
);
1688 static HRESULT WINAPI
Videowindow_put_FullScreenMode(IVideoWindow
*iface
,
1689 long FullScreenMode
) {
1690 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1692 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, FullScreenMode
);
1697 static HRESULT WINAPI
Videowindow_SetWindowForeground(IVideoWindow
*iface
,
1699 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1704 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Focus
);
1706 if ((Focus
!= FALSE
) && (Focus
!= TRUE
))
1707 return E_INVALIDARG
;
1709 hr
= IPin_ConnectedTo(This
->ppPins
[0], &pPin
);
1710 if ((hr
!= S_OK
) || !pPin
)
1711 return VFW_E_NOT_CONNECTED
;
1714 ret
= SetForegroundWindow(This
->hWnd
);
1716 ret
= SetWindowPos(This
->hWnd
, HWND_TOP
, 0, 0, 0, 0, SWP_NOMOVE
|SWP_NOSIZE
);
1724 static HRESULT WINAPI
Videowindow_NotifyOwnerMessage(IVideoWindow
*iface
,
1729 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1731 TRACE("(%p/%p)->(%08x, %ld, %08lx, %08lx)\n", This
, iface
, (DWORD
) hwnd
, uMsg
, wParam
, lParam
);
1733 if (!PostMessageA(This
->hWnd
, uMsg
, wParam
, lParam
))
1739 static HRESULT WINAPI
Videowindow_SetWindowPosition(IVideoWindow
*iface
,
1744 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1746 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This
, iface
, Left
, Top
, Width
, Height
);
1748 if (!SetWindowPos(This
->hWnd
, NULL
, Left
, Top
, Width
, Height
, SWP_NOZORDER
))
1751 This
->WindowPos
.left
= Left
;
1752 This
->WindowPos
.top
= Top
;
1753 This
->WindowPos
.right
= Left
+ Width
;
1754 This
->WindowPos
.bottom
= Top
+ Height
;
1759 static HRESULT WINAPI
Videowindow_GetWindowPosition(IVideoWindow
*iface
,
1764 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1766 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1768 *pLeft
= This
->WindowPos
.left
;
1769 *pTop
= This
->WindowPos
.top
;
1770 *pWidth
= This
->WindowPos
.right
- This
->WindowPos
.left
;
1771 *pHeight
= This
->WindowPos
.bottom
- This
->WindowPos
.top
;
1776 static HRESULT WINAPI
Videowindow_GetMinIdealImageSize(IVideoWindow
*iface
,
1779 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1781 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This
, iface
, pWidth
, pHeight
);
1783 *pWidth
= This
->VideoWidth
;
1784 *pHeight
= This
->VideoHeight
;
1789 static HRESULT WINAPI
Videowindow_GetMaxIdealImageSize(IVideoWindow
*iface
,
1792 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1794 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This
, iface
, pWidth
, pHeight
);
1796 *pWidth
= This
->VideoWidth
;
1797 *pHeight
= This
->VideoHeight
;
1802 static HRESULT WINAPI
Videowindow_GetRestorePosition(IVideoWindow
*iface
,
1807 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1809 FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1814 static HRESULT WINAPI
Videowindow_HideCursor(IVideoWindow
*iface
,
1816 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1818 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, HideCursor
);
1823 static HRESULT WINAPI
Videowindow_IsCursorHidden(IVideoWindow
*iface
,
1824 long *CursorHidden
) {
1825 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1827 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, CursorHidden
);
1832 static const IVideoWindowVtbl IVideoWindow_VTable
=
1834 Videowindow_QueryInterface
,
1836 Videowindow_Release
,
1837 Videowindow_GetTypeInfoCount
,
1838 Videowindow_GetTypeInfo
,
1839 Videowindow_GetIDsOfNames
,
1841 Videowindow_put_Caption
,
1842 Videowindow_get_Caption
,
1843 Videowindow_put_WindowStyle
,
1844 Videowindow_get_WindowStyle
,
1845 Videowindow_put_WindowStyleEx
,
1846 Videowindow_get_WindowStyleEx
,
1847 Videowindow_put_AutoShow
,
1848 Videowindow_get_AutoShow
,
1849 Videowindow_put_WindowState
,
1850 Videowindow_get_WindowState
,
1851 Videowindow_put_BackgroundPalette
,
1852 Videowindow_get_BackgroundPalette
,
1853 Videowindow_put_Visible
,
1854 Videowindow_get_Visible
,
1855 Videowindow_put_Left
,
1856 Videowindow_get_Left
,
1857 Videowindow_put_Width
,
1858 Videowindow_get_Width
,
1859 Videowindow_put_Top
,
1860 Videowindow_get_Top
,
1861 Videowindow_put_Height
,
1862 Videowindow_get_Height
,
1863 Videowindow_put_Owner
,
1864 Videowindow_get_Owner
,
1865 Videowindow_put_MessageDrain
,
1866 Videowindow_get_MessageDrain
,
1867 Videowindow_get_BorderColor
,
1868 Videowindow_put_BorderColor
,
1869 Videowindow_get_FullScreenMode
,
1870 Videowindow_put_FullScreenMode
,
1871 Videowindow_SetWindowForeground
,
1872 Videowindow_NotifyOwnerMessage
,
1873 Videowindow_SetWindowPosition
,
1874 Videowindow_GetWindowPosition
,
1875 Videowindow_GetMinIdealImageSize
,
1876 Videowindow_GetMaxIdealImageSize
,
1877 Videowindow_GetRestorePosition
,
1878 Videowindow_HideCursor
,
1879 Videowindow_IsCursorHidden