2 * Video Renderer (Fullscreen and Windowed using Direct Draw)
4 * Copyright 2004 Christian Costa
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #define NONAMELESSSTRUCT
24 #define NONAMELESSUNION
25 #include "quartz_private.h"
26 #include "control_private.h"
39 #include "wine/unicode.h"
40 #include "wine/debug.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(quartz
);
44 static BOOL wnd_class_registered
= FALSE
;
46 static const WCHAR wcsInputPinName
[] = {'i','n','p','u','t',' ','p','i','n',0};
48 static const IBaseFilterVtbl VideoRenderer_Vtbl
;
49 static const IBasicVideoVtbl IBasicVideo_VTable
;
50 static const IVideoWindowVtbl IVideoWindow_VTable
;
51 static const IPinVtbl VideoRenderer_InputPin_Vtbl
;
53 typedef struct VideoRendererImpl
55 const IBaseFilterVtbl
* lpVtbl
;
56 const IBasicVideoVtbl
* IBasicVideo_vtbl
;
57 const IVideoWindowVtbl
* IVideoWindow_vtbl
;
60 CRITICAL_SECTION csFilter
;
62 REFERENCE_TIME rtStreamStart
;
63 IReferenceClock
* pClock
;
64 FILTER_INFO filterInfo
;
84 static LRESULT CALLBACK
VideoWndProcA(HWND hwnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
86 VideoRendererImpl
* pVideoRenderer
= (VideoRendererImpl
*)GetWindowLongA(hwnd
, 0);
87 LPRECT lprect
= (LPRECT
)lParam
;
89 if (pVideoRenderer
&& pVideoRenderer
->hWndMsgDrain
)
95 case WM_LBUTTONDBLCLK
:
98 case WM_MBUTTONDBLCLK
:
101 case WM_MOUSEACTIVATE
:
103 case WM_NCLBUTTONDBLCLK
:
104 case WM_NCLBUTTONDOWN
:
106 case WM_NCMBUTTONDBLCLK
:
107 case WM_NCMBUTTONDOWN
:
110 case WM_NCRBUTTONDBLCLK
:
111 case WM_NCRBUTTONDOWN
:
113 case WM_RBUTTONDBLCLK
:
116 PostMessageA(pVideoRenderer
->hWndMsgDrain
, uMsg
, wParam
, lParam
);
126 /* TRACE("WM_SIZING %d %d %d %d\n", lprect->left, lprect->top, lprect->right, lprect->bottom); */
127 SetWindowPos(hwnd
, NULL
, lprect
->left
, lprect
->top
, lprect
->right
- lprect
->left
, lprect
->bottom
- lprect
->top
, SWP_NOZORDER
);
128 GetClientRect(hwnd
, &pVideoRenderer
->DestRect
);
129 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
130 pVideoRenderer
->DestRect
.left
,
131 pVideoRenderer
->DestRect
.top
,
132 pVideoRenderer
->DestRect
.right
- pVideoRenderer
->DestRect
.left
,
133 pVideoRenderer
->DestRect
.bottom
- pVideoRenderer
->DestRect
.top
);
136 TRACE("WM_SIZE %d %d\n", LOWORD(lParam
), HIWORD(lParam
));
137 GetClientRect(hwnd
, &pVideoRenderer
->DestRect
);
138 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
139 pVideoRenderer
->DestRect
.left
,
140 pVideoRenderer
->DestRect
.top
,
141 pVideoRenderer
->DestRect
.right
- pVideoRenderer
->DestRect
.left
,
142 pVideoRenderer
->DestRect
.bottom
- pVideoRenderer
->DestRect
.top
);
145 return DefWindowProcA(hwnd
, uMsg
, wParam
, lParam
);
150 static BOOL
CreateRenderingWindow(VideoRendererImpl
* This
)
154 TRACE("(%p)->()\n", This
);
157 winclass
.lpfnWndProc
= VideoWndProcA
;
158 winclass
.cbClsExtra
= 0;
159 winclass
.cbWndExtra
= sizeof(VideoRendererImpl
*);
160 winclass
.hInstance
= NULL
;
161 winclass
.hIcon
= NULL
;
162 winclass
.hCursor
= NULL
;
163 winclass
.hbrBackground
= GetStockObject(BLACK_BRUSH
);
164 winclass
.lpszMenuName
= NULL
;
165 winclass
.lpszClassName
= "Wine ActiveMovie Class";
167 if (!wnd_class_registered
)
169 if (!RegisterClassA(&winclass
))
171 ERR("Unable to register window %u\n", GetLastError());
174 wnd_class_registered
= TRUE
;
177 This
->hWnd
= CreateWindowExA(0, "Wine ActiveMovie Class", "Wine ActiveMovie Window", WS_SIZEBOX
,
178 CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
, NULL
,
183 ERR("Unable to create window\n");
187 SetWindowLongA(This
->hWnd
, 0, (LONG
)This
);
192 static DWORD WINAPI
MessageLoop(LPVOID lpParameter
)
194 VideoRendererImpl
* This
= (VideoRendererImpl
*) lpParameter
;
198 TRACE("Starting message loop\n");
200 if (!CreateRenderingWindow(This
))
202 This
->ThreadResult
= FALSE
;
203 SetEvent(This
->hEvent
);
207 This
->ThreadResult
= TRUE
;
208 SetEvent(This
->hEvent
);
210 while ((fGotMessage
= GetMessageA(&msg
, NULL
, 0, 0)) != 0 && fGotMessage
!= -1)
212 TranslateMessage(&msg
);
213 DispatchMessageA(&msg
);
216 TRACE("End of message loop\n");
221 static BOOL
CreateRenderingSubsystem(VideoRendererImpl
* This
)
223 This
->hEvent
= CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
227 This
->hThread
= CreateThread(NULL
, 0, MessageLoop
, (LPVOID
)This
, 0, &This
->ThreadID
);
230 CloseHandle(This
->hEvent
);
234 WaitForSingleObject(This
->hEvent
, INFINITE
);
235 CloseHandle(This
->hEvent
);
237 if (!This
->ThreadResult
)
239 CloseHandle(This
->hThread
);
246 static const IMemInputPinVtbl MemInputPin_Vtbl
=
248 MemInputPin_QueryInterface
,
251 MemInputPin_GetAllocator
,
252 MemInputPin_NotifyAllocator
,
253 MemInputPin_GetAllocatorRequirements
,
255 MemInputPin_ReceiveMultiple
,
256 MemInputPin_ReceiveCanBlock
259 static HRESULT
VideoRenderer_InputPin_Construct(const PIN_INFO
* pPinInfo
, SAMPLEPROC pSampleProc
, LPVOID pUserData
, QUERYACCEPTPROC pQueryAccept
, LPCRITICAL_SECTION pCritSec
, IPin
** ppPin
)
265 if (pPinInfo
->dir
!= PINDIR_INPUT
)
267 ERR("Pin direction(%x) != PINDIR_INPUT\n", pPinInfo
->dir
);
271 pPinImpl
= CoTaskMemAlloc(sizeof(*pPinImpl
));
274 return E_OUTOFMEMORY
;
276 if (SUCCEEDED(InputPin_Init(pPinInfo
, pSampleProc
, pUserData
, pQueryAccept
, pCritSec
, pPinImpl
)))
278 pPinImpl
->pin
.lpVtbl
= &VideoRenderer_InputPin_Vtbl
;
279 pPinImpl
->lpVtblMemInput
= &MemInputPin_Vtbl
;
281 *ppPin
= (IPin
*)(&pPinImpl
->pin
.lpVtbl
);
287 static DWORD
VideoRenderer_SendSampleData(VideoRendererImpl
* This
, LPBYTE data
, DWORD size
)
289 VIDEOINFOHEADER
* format
;
295 LPBYTE palette
= NULL
;
298 TRACE("%p %p %d\n", This
, data
, size
);
300 sdesc
.dwSize
= sizeof(sdesc
);
301 hr
= IPin_ConnectionMediaType(This
->ppPins
[0], &amt
);
303 ERR("Unable to retrieve media type\n");
306 format
= (VIDEOINFOHEADER
*)amt
.pbFormat
;
308 TRACE("biSize = %d\n", format
->bmiHeader
.biSize
);
309 TRACE("biWidth = %d\n", format
->bmiHeader
.biWidth
);
310 TRACE("biHeight = %d\n", format
->bmiHeader
.biHeight
);
311 TRACE("biPlanes = %d\n", format
->bmiHeader
.biPlanes
);
312 TRACE("biBitCount = %d\n", format
->bmiHeader
.biBitCount
);
313 TRACE("biCompression = %s\n", debugstr_an((LPSTR
)&(format
->bmiHeader
.biCompression
), 4));
314 TRACE("biSizeImage = %d\n", format
->bmiHeader
.biSizeImage
);
316 width
= format
->bmiHeader
.biWidth
;
317 height
= format
->bmiHeader
.biHeight
;
318 palette
= ((LPBYTE
)&format
->bmiHeader
) + format
->bmiHeader
.biSize
;
322 /* Honor previously set WindowPos */
323 TRACE("WindowPos: %d %d %d %d\n", This
->WindowPos
.left
, This
->WindowPos
.top
, This
->WindowPos
.right
, This
->WindowPos
.bottom
);
324 SetWindowPos(This
->hWnd
, NULL
,
325 This
->WindowPos
.left
,
327 This
->WindowPos
.right
- This
->WindowPos
.left
,
328 This
->WindowPos
.bottom
- This
->WindowPos
.top
,
329 SWP_NOZORDER
|SWP_NOMOVE
);
330 GetClientRect(This
->hWnd
, &This
->DestRect
);
334 hDC
= GetDC(This
->hWnd
);
337 ERR("Cannot get DC from window!\n");
341 TRACE("Src Rect: %d %d %d %d\n", This
->SourceRect
.left
, This
->SourceRect
.top
, This
->SourceRect
.right
, This
->SourceRect
.bottom
);
342 TRACE("Dst Rect: %d %d %d %d\n", This
->DestRect
.left
, This
->DestRect
.top
, This
->DestRect
.right
, This
->DestRect
.bottom
);
344 StretchDIBits(hDC
, This
->DestRect
.left
, This
->DestRect
.top
, This
->DestRect
.right
-This
->DestRect
.left
,
345 This
->DestRect
.bottom
- This
->DestRect
.top
, This
->SourceRect
.left
, This
->SourceRect
.top
,
346 This
->SourceRect
.right
- This
->SourceRect
.left
, This
->SourceRect
.bottom
- This
->SourceRect
.top
,
347 data
, (BITMAPINFO
*)&format
->bmiHeader
, DIB_RGB_COLORS
, SRCCOPY
);
349 ReleaseDC(This
->hWnd
, hDC
);
352 ShowWindow(This
->hWnd
, SW_SHOW
);
357 static HRESULT
VideoRenderer_Sample(LPVOID iface
, IMediaSample
* pSample
)
359 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
360 LPBYTE pbSrcStream
= NULL
;
361 long cbSrcStream
= 0;
362 REFERENCE_TIME tStart
, tStop
;
365 TRACE("%p %p\n", iface
, pSample
);
367 hr
= IMediaSample_GetPointer(pSample
, &pbSrcStream
);
370 ERR("Cannot get pointer to sample data (%x)\n", hr
);
374 hr
= IMediaSample_GetTime(pSample
, &tStart
, &tStop
);
376 ERR("Cannot get sample time (%x)\n", hr
);
378 cbSrcStream
= IMediaSample_GetActualDataLength(pSample
);
380 TRACE("val %p %ld\n", pbSrcStream
, cbSrcStream
);
382 #if 0 /* For debugging purpose */
385 for(i
= 0; i
< cbSrcStream
; i
++)
387 if ((i
!=0) && !(i
%16))
389 TRACE("%02x ", pbSrcStream
[i
]);
395 VideoRenderer_SendSampleData(This
, pbSrcStream
, cbSrcStream
);
400 static HRESULT
VideoRenderer_QueryAccept(LPVOID iface
, const AM_MEDIA_TYPE
* pmt
)
402 if (!IsEqualIID(&pmt
->majortype
, &MEDIATYPE_Video
))
405 if (IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB32
) ||
406 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB24
) ||
407 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB565
) ||
408 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB8
))
410 VideoRendererImpl
* This
= (VideoRendererImpl
*) iface
;
411 VIDEOINFOHEADER
* format
= (VIDEOINFOHEADER
*)pmt
->pbFormat
;
413 if (!IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo
))
415 WARN("Format type %s not supported\n", debugstr_guid(&pmt
->formattype
));
418 This
->SourceRect
.left
= 0;
419 This
->SourceRect
.top
= 0;
420 This
->SourceRect
.right
= This
->VideoWidth
= format
->bmiHeader
.biWidth
;
421 This
->SourceRect
.bottom
= This
->VideoHeight
= format
->bmiHeader
.biHeight
;
427 HRESULT
VideoRenderer_create(IUnknown
* pUnkOuter
, LPVOID
* ppv
)
431 VideoRendererImpl
* pVideoRenderer
;
433 TRACE("(%p, %p)\n", pUnkOuter
, ppv
);
438 return CLASS_E_NOAGGREGATION
;
440 pVideoRenderer
= CoTaskMemAlloc(sizeof(VideoRendererImpl
));
442 pVideoRenderer
->lpVtbl
= &VideoRenderer_Vtbl
;
443 pVideoRenderer
->IBasicVideo_vtbl
= &IBasicVideo_VTable
;
444 pVideoRenderer
->IVideoWindow_vtbl
= &IVideoWindow_VTable
;
446 pVideoRenderer
->refCount
= 1;
447 InitializeCriticalSection(&pVideoRenderer
->csFilter
);
448 pVideoRenderer
->csFilter
.DebugInfo
->Spare
[0] = (DWORD_PTR
)(__FILE__
": VideoRendererImpl.csFilter");
449 pVideoRenderer
->state
= State_Stopped
;
450 pVideoRenderer
->pClock
= NULL
;
451 pVideoRenderer
->init
= 0;
452 pVideoRenderer
->AutoShow
= 1;
453 ZeroMemory(&pVideoRenderer
->filterInfo
, sizeof(FILTER_INFO
));
455 pVideoRenderer
->ppPins
= CoTaskMemAlloc(1 * sizeof(IPin
*));
457 /* construct input pin */
458 piInput
.dir
= PINDIR_INPUT
;
459 piInput
.pFilter
= (IBaseFilter
*)pVideoRenderer
;
460 lstrcpynW(piInput
.achName
, wcsInputPinName
, sizeof(piInput
.achName
) / sizeof(piInput
.achName
[0]));
462 hr
= VideoRenderer_InputPin_Construct(&piInput
, VideoRenderer_Sample
, (LPVOID
)pVideoRenderer
, VideoRenderer_QueryAccept
, &pVideoRenderer
->csFilter
, (IPin
**)&pVideoRenderer
->pInputPin
);
466 pVideoRenderer
->ppPins
[0] = (IPin
*)pVideoRenderer
->pInputPin
;
467 *ppv
= (LPVOID
)pVideoRenderer
;
471 CoTaskMemFree(pVideoRenderer
->ppPins
);
472 pVideoRenderer
->csFilter
.DebugInfo
->Spare
[0] = 0;
473 DeleteCriticalSection(&pVideoRenderer
->csFilter
);
474 CoTaskMemFree(pVideoRenderer
);
477 if (!CreateRenderingSubsystem(pVideoRenderer
))
483 static HRESULT WINAPI
VideoRenderer_QueryInterface(IBaseFilter
* iface
, REFIID riid
, LPVOID
* ppv
)
485 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
486 TRACE("(%p/%p)->(%s, %p)\n", This
, iface
, qzdebugstr_guid(riid
), ppv
);
490 if (IsEqualIID(riid
, &IID_IUnknown
))
492 else if (IsEqualIID(riid
, &IID_IPersist
))
494 else if (IsEqualIID(riid
, &IID_IMediaFilter
))
496 else if (IsEqualIID(riid
, &IID_IBaseFilter
))
498 else if (IsEqualIID(riid
, &IID_IBasicVideo
))
499 *ppv
= (LPVOID
)&(This
->IBasicVideo_vtbl
);
500 else if (IsEqualIID(riid
, &IID_IVideoWindow
))
501 *ppv
= (LPVOID
)&(This
->IVideoWindow_vtbl
);
505 IUnknown_AddRef((IUnknown
*)(*ppv
));
509 FIXME("No interface for %s!\n", qzdebugstr_guid(riid
));
511 return E_NOINTERFACE
;
514 static ULONG WINAPI
VideoRenderer_AddRef(IBaseFilter
* iface
)
516 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
517 ULONG refCount
= InterlockedIncrement(&This
->refCount
);
519 TRACE("(%p/%p)->() AddRef from %d\n", This
, iface
, refCount
- 1);
524 static ULONG WINAPI
VideoRenderer_Release(IBaseFilter
* iface
)
526 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
527 ULONG refCount
= InterlockedDecrement(&This
->refCount
);
529 TRACE("(%p/%p)->() Release from %d\n", This
, iface
, refCount
+ 1);
535 DestroyWindow(This
->hWnd
);
536 PostThreadMessageA(This
->ThreadID
, WM_QUIT
, 0, 0);
537 WaitForSingleObject(This
->hThread
, INFINITE
);
538 CloseHandle(This
->hThread
);
541 IReferenceClock_Release(This
->pClock
);
543 if (SUCCEEDED(IPin_ConnectedTo(This
->ppPins
[0], &pConnectedTo
)))
545 IPin_Disconnect(pConnectedTo
);
546 IPin_Release(pConnectedTo
);
548 IPin_Disconnect(This
->ppPins
[0]);
550 IPin_Release(This
->ppPins
[0]);
552 CoTaskMemFree(This
->ppPins
);
555 This
->csFilter
.DebugInfo
->Spare
[0] = 0;
556 DeleteCriticalSection(&This
->csFilter
);
558 TRACE("Destroying Video Renderer\n");
567 /** IPersist methods **/
569 static HRESULT WINAPI
VideoRenderer_GetClassID(IBaseFilter
* iface
, CLSID
* pClsid
)
571 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
573 TRACE("(%p/%p)->(%p)\n", This
, iface
, pClsid
);
575 *pClsid
= CLSID_VideoRenderer
;
580 /** IMediaFilter methods **/
582 static HRESULT WINAPI
VideoRenderer_Stop(IBaseFilter
* iface
)
584 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
586 TRACE("(%p/%p)->()\n", This
, iface
);
588 EnterCriticalSection(&This
->csFilter
);
590 This
->state
= State_Stopped
;
592 LeaveCriticalSection(&This
->csFilter
);
597 static HRESULT WINAPI
VideoRenderer_Pause(IBaseFilter
* iface
)
599 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
601 TRACE("(%p/%p)->()\n", This
, iface
);
603 EnterCriticalSection(&This
->csFilter
);
605 This
->state
= State_Paused
;
607 LeaveCriticalSection(&This
->csFilter
);
612 static HRESULT WINAPI
VideoRenderer_Run(IBaseFilter
* iface
, REFERENCE_TIME tStart
)
614 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
616 TRACE("(%p/%p)->(%s)\n", This
, iface
, wine_dbgstr_longlong(tStart
));
618 EnterCriticalSection(&This
->csFilter
);
620 This
->rtStreamStart
= tStart
;
621 This
->state
= State_Running
;
623 LeaveCriticalSection(&This
->csFilter
);
628 static HRESULT WINAPI
VideoRenderer_GetState(IBaseFilter
* iface
, DWORD dwMilliSecsTimeout
, FILTER_STATE
*pState
)
630 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
632 TRACE("(%p/%p)->(%d, %p)\n", This
, iface
, dwMilliSecsTimeout
, pState
);
634 EnterCriticalSection(&This
->csFilter
);
636 *pState
= This
->state
;
638 LeaveCriticalSection(&This
->csFilter
);
643 static HRESULT WINAPI
VideoRenderer_SetSyncSource(IBaseFilter
* iface
, IReferenceClock
*pClock
)
645 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
647 TRACE("(%p/%p)->(%p)\n", This
, iface
, pClock
);
649 EnterCriticalSection(&This
->csFilter
);
652 IReferenceClock_Release(This
->pClock
);
653 This
->pClock
= pClock
;
655 IReferenceClock_AddRef(This
->pClock
);
657 LeaveCriticalSection(&This
->csFilter
);
662 static HRESULT WINAPI
VideoRenderer_GetSyncSource(IBaseFilter
* iface
, IReferenceClock
**ppClock
)
664 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
666 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppClock
);
668 EnterCriticalSection(&This
->csFilter
);
670 *ppClock
= This
->pClock
;
671 IReferenceClock_AddRef(This
->pClock
);
673 LeaveCriticalSection(&This
->csFilter
);
678 /** IBaseFilter implementation **/
680 static HRESULT WINAPI
VideoRenderer_EnumPins(IBaseFilter
* iface
, IEnumPins
**ppEnum
)
683 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
685 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppEnum
);
687 epd
.cPins
= 1; /* input pin */
688 epd
.ppPins
= This
->ppPins
;
689 return IEnumPinsImpl_Construct(&epd
, ppEnum
);
692 static HRESULT WINAPI
VideoRenderer_FindPin(IBaseFilter
* iface
, LPCWSTR Id
, IPin
**ppPin
)
694 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
696 TRACE("(%p/%p)->(%p,%p)\n", This
, iface
, debugstr_w(Id
), ppPin
);
698 FIXME("VideoRenderer::FindPin(...)\n");
700 /* FIXME: critical section */
705 static HRESULT WINAPI
VideoRenderer_QueryFilterInfo(IBaseFilter
* iface
, FILTER_INFO
*pInfo
)
707 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
709 TRACE("(%p/%p)->(%p)\n", This
, iface
, pInfo
);
711 strcpyW(pInfo
->achName
, This
->filterInfo
.achName
);
712 pInfo
->pGraph
= This
->filterInfo
.pGraph
;
715 IFilterGraph_AddRef(pInfo
->pGraph
);
720 static HRESULT WINAPI
VideoRenderer_JoinFilterGraph(IBaseFilter
* iface
, IFilterGraph
*pGraph
, LPCWSTR pName
)
722 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
724 TRACE("(%p/%p)->(%p, %s)\n", This
, iface
, pGraph
, debugstr_w(pName
));
726 EnterCriticalSection(&This
->csFilter
);
729 strcpyW(This
->filterInfo
.achName
, pName
);
731 *This
->filterInfo
.achName
= '\0';
732 This
->filterInfo
.pGraph
= pGraph
; /* NOTE: do NOT increase ref. count */
734 LeaveCriticalSection(&This
->csFilter
);
739 static HRESULT WINAPI
VideoRenderer_QueryVendorInfo(IBaseFilter
* iface
, LPWSTR
*pVendorInfo
)
741 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
742 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVendorInfo
);
746 static const IBaseFilterVtbl VideoRenderer_Vtbl
=
748 VideoRenderer_QueryInterface
,
749 VideoRenderer_AddRef
,
750 VideoRenderer_Release
,
751 VideoRenderer_GetClassID
,
755 VideoRenderer_GetState
,
756 VideoRenderer_SetSyncSource
,
757 VideoRenderer_GetSyncSource
,
758 VideoRenderer_EnumPins
,
759 VideoRenderer_FindPin
,
760 VideoRenderer_QueryFilterInfo
,
761 VideoRenderer_JoinFilterGraph
,
762 VideoRenderer_QueryVendorInfo
765 static HRESULT WINAPI
VideoRenderer_InputPin_EndOfStream(IPin
* iface
)
767 InputPin
* This
= (InputPin
*)iface
;
768 IMediaEventSink
* pEventSink
;
771 TRACE("(%p/%p)->()\n", This
, iface
);
773 hr
= IFilterGraph_QueryInterface(((VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
)->filterInfo
.pGraph
, &IID_IMediaEventSink
, (LPVOID
*)&pEventSink
);
776 hr
= IMediaEventSink_Notify(pEventSink
, EC_COMPLETE
, S_OK
, 0);
777 IMediaEventSink_Release(pEventSink
);
783 static const IPinVtbl VideoRenderer_InputPin_Vtbl
=
785 InputPin_QueryInterface
,
789 InputPin_ReceiveConnection
,
791 IPinImpl_ConnectedTo
,
792 IPinImpl_ConnectionMediaType
,
793 IPinImpl_QueryPinInfo
,
794 IPinImpl_QueryDirection
,
796 IPinImpl_QueryAccept
,
797 IPinImpl_EnumMediaTypes
,
798 IPinImpl_QueryInternalConnections
,
799 VideoRenderer_InputPin_EndOfStream
,
805 /*** IUnknown methods ***/
806 static HRESULT WINAPI
Basicvideo_QueryInterface(IBasicVideo
*iface
,
809 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
811 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
813 return VideoRenderer_QueryInterface((IBaseFilter
*)This
, riid
, ppvObj
);
816 static ULONG WINAPI
Basicvideo_AddRef(IBasicVideo
*iface
) {
817 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
819 TRACE("(%p/%p)->()\n", This
, iface
);
821 return VideoRenderer_AddRef((IBaseFilter
*)This
);
824 static ULONG WINAPI
Basicvideo_Release(IBasicVideo
*iface
) {
825 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
827 TRACE("(%p/%p)->()\n", This
, iface
);
829 return VideoRenderer_Release((IBaseFilter
*)This
);
832 /*** IDispatch methods ***/
833 static HRESULT WINAPI
Basicvideo_GetTypeInfoCount(IBasicVideo
*iface
,
835 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
837 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
842 static HRESULT WINAPI
Basicvideo_GetTypeInfo(IBasicVideo
*iface
,
845 ITypeInfo
**ppTInfo
) {
846 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
848 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
853 static HRESULT WINAPI
Basicvideo_GetIDsOfNames(IBasicVideo
*iface
,
859 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
861 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
866 static HRESULT WINAPI
Basicvideo_Invoke(IBasicVideo
*iface
,
871 DISPPARAMS
*pDispParams
,
875 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
877 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
);
882 /*** IBasicVideo methods ***/
883 static HRESULT WINAPI
Basicvideo_get_AvgTimePerFrame(IBasicVideo
*iface
,
884 REFTIME
*pAvgTimePerFrame
) {
885 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
887 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pAvgTimePerFrame
);
892 static HRESULT WINAPI
Basicvideo_get_BitRate(IBasicVideo
*iface
,
894 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
896 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBitRate
);
901 static HRESULT WINAPI
Basicvideo_get_BitErrorRate(IBasicVideo
*iface
,
902 long *pBitErrorRate
) {
903 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
905 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBitErrorRate
);
910 static HRESULT WINAPI
Basicvideo_get_VideoWidth(IBasicVideo
*iface
,
912 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
914 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoWidth
);
916 *pVideoWidth
= This
->VideoWidth
;
921 static HRESULT WINAPI
Basicvideo_get_VideoHeight(IBasicVideo
*iface
,
922 long *pVideoHeight
) {
923 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
925 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoHeight
);
927 *pVideoHeight
= This
->VideoHeight
;
932 static HRESULT WINAPI
Basicvideo_put_SourceLeft(IBasicVideo
*iface
,
934 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
936 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceLeft
);
938 This
->SourceRect
.left
= SourceLeft
;
943 static HRESULT WINAPI
Basicvideo_get_SourceLeft(IBasicVideo
*iface
,
945 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
947 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceLeft
);
949 *pSourceLeft
= This
->SourceRect
.left
;
954 static HRESULT WINAPI
Basicvideo_put_SourceWidth(IBasicVideo
*iface
,
956 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
958 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceWidth
);
960 This
->SourceRect
.right
= This
->SourceRect
.left
+ SourceWidth
;
965 static HRESULT WINAPI
Basicvideo_get_SourceWidth(IBasicVideo
*iface
,
966 long *pSourceWidth
) {
967 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
969 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceWidth
);
971 *pSourceWidth
= This
->SourceRect
.right
- This
->SourceRect
.left
;
976 static HRESULT WINAPI
Basicvideo_put_SourceTop(IBasicVideo
*iface
,
978 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
980 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceTop
);
982 This
->SourceRect
.top
= SourceTop
;
987 static HRESULT WINAPI
Basicvideo_get_SourceTop(IBasicVideo
*iface
,
989 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
991 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceTop
);
993 *pSourceTop
= This
->SourceRect
.top
;
998 static HRESULT WINAPI
Basicvideo_put_SourceHeight(IBasicVideo
*iface
,
1000 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1002 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceHeight
);
1004 This
->SourceRect
.bottom
= This
->SourceRect
.top
+ SourceHeight
;
1009 static HRESULT WINAPI
Basicvideo_get_SourceHeight(IBasicVideo
*iface
,
1010 long *pSourceHeight
) {
1011 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1013 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceHeight
);
1015 *pSourceHeight
= This
->SourceRect
.bottom
- This
->SourceRect
.top
;
1020 static HRESULT WINAPI
Basicvideo_put_DestinationLeft(IBasicVideo
*iface
,
1021 long DestinationLeft
) {
1022 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1024 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationLeft
);
1026 This
->DestRect
.left
= DestinationLeft
;
1031 static HRESULT WINAPI
Basicvideo_get_DestinationLeft(IBasicVideo
*iface
,
1032 long *pDestinationLeft
) {
1033 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1035 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationLeft
);
1037 *pDestinationLeft
= This
->DestRect
.left
;
1042 static HRESULT WINAPI
Basicvideo_put_DestinationWidth(IBasicVideo
*iface
,
1043 long DestinationWidth
) {
1044 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1046 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationWidth
);
1048 This
->DestRect
.right
= This
->DestRect
.left
+ DestinationWidth
;
1053 static HRESULT WINAPI
Basicvideo_get_DestinationWidth(IBasicVideo
*iface
,
1054 long *pDestinationWidth
) {
1055 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1057 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationWidth
);
1059 *pDestinationWidth
= This
->DestRect
.right
- This
->DestRect
.left
;
1064 static HRESULT WINAPI
Basicvideo_put_DestinationTop(IBasicVideo
*iface
,
1065 long DestinationTop
) {
1066 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1068 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationTop
);
1070 This
->DestRect
.top
= DestinationTop
;
1075 static HRESULT WINAPI
Basicvideo_get_DestinationTop(IBasicVideo
*iface
,
1076 long *pDestinationTop
) {
1077 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1079 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationTop
);
1081 *pDestinationTop
= This
->DestRect
.top
;
1086 static HRESULT WINAPI
Basicvideo_put_DestinationHeight(IBasicVideo
*iface
,
1087 long DestinationHeight
) {
1088 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1090 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationHeight
);
1092 This
->DestRect
.right
= This
->DestRect
.left
+ DestinationHeight
;
1097 static HRESULT WINAPI
Basicvideo_get_DestinationHeight(IBasicVideo
*iface
,
1098 long *pDestinationHeight
) {
1099 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1101 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationHeight
);
1103 *pDestinationHeight
= This
->DestRect
.right
- This
->DestRect
.left
;
1108 static HRESULT WINAPI
Basicvideo_SetSourcePosition(IBasicVideo
*iface
,
1113 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1115 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This
, iface
, Left
, Top
, Width
, Height
);
1117 This
->SourceRect
.left
= Left
;
1118 This
->SourceRect
.top
= Top
;
1119 This
->SourceRect
.right
= Left
+ Width
;
1120 This
->SourceRect
.bottom
= Top
+ Height
;
1125 static HRESULT WINAPI
Basicvideo_GetSourcePosition(IBasicVideo
*iface
,
1130 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1132 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1134 *pLeft
= This
->SourceRect
.left
;
1135 *pTop
= This
->SourceRect
.top
;
1136 *pWidth
= This
->SourceRect
.right
- This
->SourceRect
.left
;
1137 *pHeight
= This
->SourceRect
.bottom
- This
->SourceRect
.top
;
1142 static HRESULT WINAPI
Basicvideo_SetDefaultSourcePosition(IBasicVideo
*iface
) {
1143 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1145 TRACE("(%p/%p)->()\n", This
, iface
);
1147 This
->SourceRect
.left
= 0;
1148 This
->SourceRect
.top
= 0;
1149 This
->SourceRect
.right
= This
->VideoWidth
;
1150 This
->SourceRect
.bottom
= This
->VideoHeight
;
1155 static HRESULT WINAPI
Basicvideo_SetDestinationPosition(IBasicVideo
*iface
,
1160 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1162 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This
, iface
, Left
, Top
, Width
, Height
);
1164 This
->DestRect
.left
= Left
;
1165 This
->DestRect
.top
= Top
;
1166 This
->DestRect
.right
= Left
+ Width
;
1167 This
->DestRect
.bottom
= Top
+ Height
;
1172 static HRESULT WINAPI
Basicvideo_GetDestinationPosition(IBasicVideo
*iface
,
1177 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1179 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1181 *pLeft
= This
->DestRect
.left
;
1182 *pTop
= This
->DestRect
.top
;
1183 *pWidth
= This
->DestRect
.right
- This
->DestRect
.left
;
1184 *pHeight
= This
->DestRect
.bottom
- This
->DestRect
.top
;
1189 static HRESULT WINAPI
Basicvideo_SetDefaultDestinationPosition(IBasicVideo
*iface
) {
1190 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1193 TRACE("(%p/%p)->()\n", This
, iface
);
1195 if (!GetClientRect(This
->hWnd
, &rect
))
1198 This
->SourceRect
.left
= 0;
1199 This
->SourceRect
.top
= 0;
1200 This
->SourceRect
.right
= rect
.right
;
1201 This
->SourceRect
.bottom
= rect
.bottom
;
1206 static HRESULT WINAPI
Basicvideo_GetVideoSize(IBasicVideo
*iface
,
1209 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1211 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pWidth
, pHeight
);
1213 *pWidth
= This
->VideoWidth
;
1214 *pHeight
= This
->VideoHeight
;
1219 static HRESULT WINAPI
Basicvideo_GetVideoPaletteEntries(IBasicVideo
*iface
,
1224 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1226 FIXME("(%p/%p)->(%ld, %ld, %p, %p): stub !!!\n", This
, iface
, StartIndex
, Entries
, pRetrieved
, pPalette
);
1231 static HRESULT WINAPI
Basicvideo_GetCurrentImage(IBasicVideo
*iface
,
1234 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1236 FIXME("(%p/%p)->(%p, %p): stub !!!\n", This
, iface
, pBufferSize
, pDIBImage
);
1241 static HRESULT WINAPI
Basicvideo_IsUsingDefaultSource(IBasicVideo
*iface
) {
1242 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1244 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
1249 static HRESULT WINAPI
Basicvideo_IsUsingDefaultDestination(IBasicVideo
*iface
) {
1250 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1252 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
1258 static const IBasicVideoVtbl IBasicVideo_VTable
=
1260 Basicvideo_QueryInterface
,
1263 Basicvideo_GetTypeInfoCount
,
1264 Basicvideo_GetTypeInfo
,
1265 Basicvideo_GetIDsOfNames
,
1267 Basicvideo_get_AvgTimePerFrame
,
1268 Basicvideo_get_BitRate
,
1269 Basicvideo_get_BitErrorRate
,
1270 Basicvideo_get_VideoWidth
,
1271 Basicvideo_get_VideoHeight
,
1272 Basicvideo_put_SourceLeft
,
1273 Basicvideo_get_SourceLeft
,
1274 Basicvideo_put_SourceWidth
,
1275 Basicvideo_get_SourceWidth
,
1276 Basicvideo_put_SourceTop
,
1277 Basicvideo_get_SourceTop
,
1278 Basicvideo_put_SourceHeight
,
1279 Basicvideo_get_SourceHeight
,
1280 Basicvideo_put_DestinationLeft
,
1281 Basicvideo_get_DestinationLeft
,
1282 Basicvideo_put_DestinationWidth
,
1283 Basicvideo_get_DestinationWidth
,
1284 Basicvideo_put_DestinationTop
,
1285 Basicvideo_get_DestinationTop
,
1286 Basicvideo_put_DestinationHeight
,
1287 Basicvideo_get_DestinationHeight
,
1288 Basicvideo_SetSourcePosition
,
1289 Basicvideo_GetSourcePosition
,
1290 Basicvideo_SetDefaultSourcePosition
,
1291 Basicvideo_SetDestinationPosition
,
1292 Basicvideo_GetDestinationPosition
,
1293 Basicvideo_SetDefaultDestinationPosition
,
1294 Basicvideo_GetVideoSize
,
1295 Basicvideo_GetVideoPaletteEntries
,
1296 Basicvideo_GetCurrentImage
,
1297 Basicvideo_IsUsingDefaultSource
,
1298 Basicvideo_IsUsingDefaultDestination
1302 /*** IUnknown methods ***/
1303 static HRESULT WINAPI
Videowindow_QueryInterface(IVideoWindow
*iface
,
1306 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1308 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
1310 return VideoRenderer_QueryInterface((IBaseFilter
*)This
, riid
, ppvObj
);
1313 static ULONG WINAPI
Videowindow_AddRef(IVideoWindow
*iface
) {
1314 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1316 TRACE("(%p/%p)->()\n", This
, iface
);
1318 return VideoRenderer_AddRef((IBaseFilter
*)This
);
1321 static ULONG WINAPI
Videowindow_Release(IVideoWindow
*iface
) {
1322 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1324 TRACE("(%p/%p)->()\n", This
, iface
);
1326 return VideoRenderer_Release((IBaseFilter
*)This
);
1329 /*** IDispatch methods ***/
1330 static HRESULT WINAPI
Videowindow_GetTypeInfoCount(IVideoWindow
*iface
,
1332 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1334 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
1339 static HRESULT WINAPI
Videowindow_GetTypeInfo(IVideoWindow
*iface
,
1342 ITypeInfo
**ppTInfo
) {
1343 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1345 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
1350 static HRESULT WINAPI
Videowindow_GetIDsOfNames(IVideoWindow
*iface
,
1356 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1358 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1363 static HRESULT WINAPI
Videowindow_Invoke(IVideoWindow
*iface
,
1364 DISPID dispIdMember
,
1368 DISPPARAMS
*pDispParams
,
1370 EXCEPINFO
*pExepInfo
,
1372 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1374 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
);
1379 /*** IVideoWindow methods ***/
1380 static HRESULT WINAPI
Videowindow_put_Caption(IVideoWindow
*iface
,
1382 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1384 TRACE("(%p/%p)->(%s (%p))\n", This
, iface
, debugstr_w(strCaption
), strCaption
);
1386 if (!SetWindowTextW(This
->hWnd
, strCaption
))
1392 static HRESULT WINAPI
Videowindow_get_Caption(IVideoWindow
*iface
,
1394 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1396 TRACE("(%p/%p)->(%p)\n", This
, iface
, strCaption
);
1398 GetWindowTextW(This
->hWnd
, (LPWSTR
)strCaption
, 100);
1403 static HRESULT WINAPI
Videowindow_put_WindowStyle(IVideoWindow
*iface
,
1405 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1408 old
= GetWindowLongA(This
->hWnd
, GWL_STYLE
);
1410 TRACE("(%p/%p)->(%x -> %lx)\n", This
, iface
, old
, WindowStyle
);
1412 if (WindowStyle
& (WS_DISABLED
|WS_HSCROLL
|WS_ICONIC
|WS_MAXIMIZE
|WS_MINIMIZE
|WS_VSCROLL
))
1413 return E_INVALIDARG
;
1415 SetWindowLongA(This
->hWnd
, GWL_STYLE
, WindowStyle
);
1420 static HRESULT WINAPI
Videowindow_get_WindowStyle(IVideoWindow
*iface
,
1421 long *WindowStyle
) {
1422 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1424 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyle
);
1426 *WindowStyle
= GetWindowLongA(This
->hWnd
, GWL_STYLE
);
1431 static HRESULT WINAPI
Videowindow_put_WindowStyleEx(IVideoWindow
*iface
,
1432 long WindowStyleEx
) {
1433 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1435 TRACE("(%p/%p)->(%ld)\n", This
, iface
, WindowStyleEx
);
1437 if (WindowStyleEx
& (WS_DISABLED
|WS_HSCROLL
|WS_ICONIC
|WS_MAXIMIZE
|WS_MINIMIZE
|WS_VSCROLL
))
1438 return E_INVALIDARG
;
1440 if (!SetWindowLongA(This
->hWnd
, GWL_EXSTYLE
, WindowStyleEx
))
1446 static HRESULT WINAPI
Videowindow_get_WindowStyleEx(IVideoWindow
*iface
,
1447 long *WindowStyleEx
) {
1448 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1450 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyleEx
);
1452 *WindowStyleEx
= GetWindowLongA(This
->hWnd
, GWL_EXSTYLE
);
1457 static HRESULT WINAPI
Videowindow_put_AutoShow(IVideoWindow
*iface
,
1459 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1461 TRACE("(%p/%p)->(%ld)\n", This
, iface
, AutoShow
);
1463 This
->AutoShow
= 1; /* FXIME: Should be AutoShow */;
1468 static HRESULT WINAPI
Videowindow_get_AutoShow(IVideoWindow
*iface
,
1470 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1472 TRACE("(%p/%p)->(%p)\n", This
, iface
, AutoShow
);
1474 *AutoShow
= This
->AutoShow
;
1479 static HRESULT WINAPI
Videowindow_put_WindowState(IVideoWindow
*iface
,
1481 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1483 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, WindowState
);
1488 static HRESULT WINAPI
Videowindow_get_WindowState(IVideoWindow
*iface
,
1489 long *WindowState
) {
1490 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1492 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, WindowState
);
1497 static HRESULT WINAPI
Videowindow_put_BackgroundPalette(IVideoWindow
*iface
,
1498 long BackgroundPalette
) {
1499 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1501 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, BackgroundPalette
);
1506 static HRESULT WINAPI
Videowindow_get_BackgroundPalette(IVideoWindow
*iface
,
1507 long *pBackgroundPalette
) {
1508 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1510 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBackgroundPalette
);
1515 static HRESULT WINAPI
Videowindow_put_Visible(IVideoWindow
*iface
,
1517 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1519 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Visible
);
1521 ShowWindow(This
->hWnd
, Visible
? SW_SHOW
: SW_HIDE
);
1526 static HRESULT WINAPI
Videowindow_get_Visible(IVideoWindow
*iface
,
1528 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1530 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVisible
);
1532 *pVisible
= IsWindowVisible(This
->hWnd
);
1537 static HRESULT WINAPI
Videowindow_put_Left(IVideoWindow
*iface
,
1539 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1541 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Left
);
1543 if (!SetWindowPos(This
->hWnd
, NULL
, Left
, This
->WindowPos
.top
, 0, 0, SWP_NOZORDER
|SWP_NOSIZE
))
1546 This
->WindowPos
.left
= Left
;
1551 static HRESULT WINAPI
Videowindow_get_Left(IVideoWindow
*iface
,
1553 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1555 TRACE("(%p/%p)->(%p)\n", This
, iface
, pLeft
);
1557 *pLeft
= This
->WindowPos
.left
;
1562 static HRESULT WINAPI
Videowindow_put_Width(IVideoWindow
*iface
,
1564 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1566 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Width
);
1568 if (!SetWindowPos(This
->hWnd
, NULL
, 0, 0, Width
, This
->WindowPos
.bottom
-This
->WindowPos
.top
, SWP_NOZORDER
|SWP_NOMOVE
))
1571 This
->WindowPos
.right
= This
->WindowPos
.left
+ Width
;
1576 static HRESULT WINAPI
Videowindow_get_Width(IVideoWindow
*iface
,
1578 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1580 TRACE("(%p/%p)->(%p)\n", This
, iface
, pWidth
);
1582 *pWidth
= This
->WindowPos
.right
- This
->WindowPos
.left
;
1587 static HRESULT WINAPI
Videowindow_put_Top(IVideoWindow
*iface
,
1589 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1591 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Top
);
1593 if (!SetWindowPos(This
->hWnd
, NULL
, This
->WindowPos
.left
, Top
, 0, 0, SWP_NOZORDER
|SWP_NOSIZE
))
1596 This
->WindowPos
.top
= Top
;
1601 static HRESULT WINAPI
Videowindow_get_Top(IVideoWindow
*iface
,
1603 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1605 TRACE("(%p/%p)->(%p)\n", This
, iface
, pTop
);
1607 *pTop
= This
->WindowPos
.top
;
1612 static HRESULT WINAPI
Videowindow_put_Height(IVideoWindow
*iface
,
1614 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1616 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Height
);
1618 if (!SetWindowPos(This
->hWnd
, NULL
, 0, 0, This
->WindowPos
.right
-This
->WindowPos
.left
, Height
, SWP_NOZORDER
|SWP_NOMOVE
))
1621 This
->WindowPos
.bottom
= This
->WindowPos
.top
+ Height
;
1626 static HRESULT WINAPI
Videowindow_get_Height(IVideoWindow
*iface
,
1628 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1630 TRACE("(%p/%p)->(%p)\n", This
, iface
, pHeight
);
1632 *pHeight
= This
->WindowPos
.bottom
- This
->WindowPos
.top
;
1637 static HRESULT WINAPI
Videowindow_put_Owner(IVideoWindow
*iface
,
1639 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1641 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Owner
);
1643 SetParent(This
->hWnd
, (HWND
)Owner
);
1648 static HRESULT WINAPI
Videowindow_get_Owner(IVideoWindow
*iface
,
1650 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1652 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Owner
);
1654 *(HWND
*)Owner
= GetParent(This
->hWnd
);
1659 static HRESULT WINAPI
Videowindow_put_MessageDrain(IVideoWindow
*iface
,
1661 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1663 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Drain
);
1665 This
->hWndMsgDrain
= (HWND
)Drain
;
1670 static HRESULT WINAPI
Videowindow_get_MessageDrain(IVideoWindow
*iface
,
1672 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1674 TRACE("(%p/%p)->(%p)\n", This
, iface
, Drain
);
1676 *Drain
= (OAHWND
)This
->hWndMsgDrain
;
1681 static HRESULT WINAPI
Videowindow_get_BorderColor(IVideoWindow
*iface
,
1683 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1685 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, Color
);
1690 static HRESULT WINAPI
Videowindow_put_BorderColor(IVideoWindow
*iface
,
1692 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1694 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, Color
);
1699 static HRESULT WINAPI
Videowindow_get_FullScreenMode(IVideoWindow
*iface
,
1700 long *FullScreenMode
) {
1701 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1703 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, FullScreenMode
);
1708 static HRESULT WINAPI
Videowindow_put_FullScreenMode(IVideoWindow
*iface
,
1709 long FullScreenMode
) {
1710 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1712 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, FullScreenMode
);
1717 static HRESULT WINAPI
Videowindow_SetWindowForeground(IVideoWindow
*iface
,
1719 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1724 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Focus
);
1726 if ((Focus
!= FALSE
) && (Focus
!= TRUE
))
1727 return E_INVALIDARG
;
1729 hr
= IPin_ConnectedTo(This
->ppPins
[0], &pPin
);
1730 if ((hr
!= S_OK
) || !pPin
)
1731 return VFW_E_NOT_CONNECTED
;
1734 ret
= SetForegroundWindow(This
->hWnd
);
1736 ret
= SetWindowPos(This
->hWnd
, HWND_TOP
, 0, 0, 0, 0, SWP_NOMOVE
|SWP_NOSIZE
);
1744 static HRESULT WINAPI
Videowindow_NotifyOwnerMessage(IVideoWindow
*iface
,
1749 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1751 TRACE("(%p/%p)->(%08x, %ld, %08lx, %08lx)\n", This
, iface
, (DWORD
) hwnd
, uMsg
, wParam
, lParam
);
1753 if (!PostMessageA(This
->hWnd
, uMsg
, wParam
, lParam
))
1759 static HRESULT WINAPI
Videowindow_SetWindowPosition(IVideoWindow
*iface
,
1764 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1766 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This
, iface
, Left
, Top
, Width
, Height
);
1768 if (!SetWindowPos(This
->hWnd
, NULL
, Left
, Top
, Width
, Height
, SWP_NOZORDER
))
1771 This
->WindowPos
.left
= Left
;
1772 This
->WindowPos
.top
= Top
;
1773 This
->WindowPos
.right
= Left
+ Width
;
1774 This
->WindowPos
.bottom
= Top
+ Height
;
1779 static HRESULT WINAPI
Videowindow_GetWindowPosition(IVideoWindow
*iface
,
1784 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1786 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1788 *pLeft
= This
->WindowPos
.left
;
1789 *pTop
= This
->WindowPos
.top
;
1790 *pWidth
= This
->WindowPos
.right
- This
->WindowPos
.left
;
1791 *pHeight
= This
->WindowPos
.bottom
- This
->WindowPos
.top
;
1796 static HRESULT WINAPI
Videowindow_GetMinIdealImageSize(IVideoWindow
*iface
,
1799 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1801 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This
, iface
, pWidth
, pHeight
);
1803 *pWidth
= This
->VideoWidth
;
1804 *pHeight
= This
->VideoHeight
;
1809 static HRESULT WINAPI
Videowindow_GetMaxIdealImageSize(IVideoWindow
*iface
,
1812 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1814 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This
, iface
, pWidth
, pHeight
);
1816 *pWidth
= This
->VideoWidth
;
1817 *pHeight
= This
->VideoHeight
;
1822 static HRESULT WINAPI
Videowindow_GetRestorePosition(IVideoWindow
*iface
,
1827 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1829 FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1834 static HRESULT WINAPI
Videowindow_HideCursor(IVideoWindow
*iface
,
1836 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1838 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, HideCursor
);
1843 static HRESULT WINAPI
Videowindow_IsCursorHidden(IVideoWindow
*iface
,
1844 long *CursorHidden
) {
1845 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1847 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, CursorHidden
);
1852 static const IVideoWindowVtbl IVideoWindow_VTable
=
1854 Videowindow_QueryInterface
,
1856 Videowindow_Release
,
1857 Videowindow_GetTypeInfoCount
,
1858 Videowindow_GetTypeInfo
,
1859 Videowindow_GetIDsOfNames
,
1861 Videowindow_put_Caption
,
1862 Videowindow_get_Caption
,
1863 Videowindow_put_WindowStyle
,
1864 Videowindow_get_WindowStyle
,
1865 Videowindow_put_WindowStyleEx
,
1866 Videowindow_get_WindowStyleEx
,
1867 Videowindow_put_AutoShow
,
1868 Videowindow_get_AutoShow
,
1869 Videowindow_put_WindowState
,
1870 Videowindow_get_WindowState
,
1871 Videowindow_put_BackgroundPalette
,
1872 Videowindow_get_BackgroundPalette
,
1873 Videowindow_put_Visible
,
1874 Videowindow_get_Visible
,
1875 Videowindow_put_Left
,
1876 Videowindow_get_Left
,
1877 Videowindow_put_Width
,
1878 Videowindow_get_Width
,
1879 Videowindow_put_Top
,
1880 Videowindow_get_Top
,
1881 Videowindow_put_Height
,
1882 Videowindow_get_Height
,
1883 Videowindow_put_Owner
,
1884 Videowindow_get_Owner
,
1885 Videowindow_put_MessageDrain
,
1886 Videowindow_get_MessageDrain
,
1887 Videowindow_get_BorderColor
,
1888 Videowindow_put_BorderColor
,
1889 Videowindow_get_FullScreenMode
,
1890 Videowindow_put_FullScreenMode
,
1891 Videowindow_SetWindowForeground
,
1892 Videowindow_NotifyOwnerMessage
,
1893 Videowindow_SetWindowPosition
,
1894 Videowindow_GetWindowPosition
,
1895 Videowindow_GetMinIdealImageSize
,
1896 Videowindow_GetMaxIdealImageSize
,
1897 Videowindow_GetRestorePosition
,
1898 Videowindow_HideCursor
,
1899 Videowindow_IsCursorHidden