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 IUnknownVtbl IInner_VTable
;
52 static const IBasicVideoVtbl IBasicVideo_VTable
;
53 static const IVideoWindowVtbl IVideoWindow_VTable
;
54 static const IPinVtbl VideoRenderer_InputPin_Vtbl
;
55 static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl
;
56 static const IQualityControlVtbl VideoRenderer_QualityControl_Vtbl
= {
57 QualityControlImpl_QueryInterface
,
58 QualityControlImpl_AddRef
,
59 QualityControlImpl_Release
,
60 QualityControlImpl_Notify
,
61 QualityControlImpl_SetSink
64 typedef struct VideoRendererImpl
67 const IBasicVideoVtbl
* IBasicVideo_vtbl
;
68 const IVideoWindowVtbl
* IVideoWindow_vtbl
;
69 const IUnknownVtbl
* IInner_vtbl
;
70 const IAMFilterMiscFlagsVtbl
*IAMFilterMiscFlags_vtbl
;
71 IUnknown
*seekthru_unk
;
72 QualityControlImpl qcimpl
;
74 BaseInputPin
*pInputPin
;
96 /* During pause we can hold a single sample, for use in GetCurrentImage */
97 IMediaSample
*sample_held
;
100 static LRESULT CALLBACK
VideoWndProcA(HWND hwnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
102 VideoRendererImpl
* pVideoRenderer
= (VideoRendererImpl
*)GetWindowLongPtrW(hwnd
, 0);
103 LPRECT lprect
= (LPRECT
)lParam
;
105 if (pVideoRenderer
&& pVideoRenderer
->hWndMsgDrain
)
111 case WM_LBUTTONDBLCLK
:
114 case WM_MBUTTONDBLCLK
:
117 case WM_MOUSEACTIVATE
:
119 case WM_NCLBUTTONDBLCLK
:
120 case WM_NCLBUTTONDOWN
:
122 case WM_NCMBUTTONDBLCLK
:
123 case WM_NCMBUTTONDOWN
:
126 case WM_NCRBUTTONDBLCLK
:
127 case WM_NCRBUTTONDOWN
:
129 case WM_RBUTTONDBLCLK
:
132 PostMessageA(pVideoRenderer
->hWndMsgDrain
, uMsg
, wParam
, lParam
);
142 /* TRACE("WM_SIZING %d %d %d %d\n", lprect->left, lprect->top, lprect->right, lprect->bottom); */
143 SetWindowPos(hwnd
, NULL
, lprect
->left
, lprect
->top
, lprect
->right
- lprect
->left
, lprect
->bottom
- lprect
->top
, SWP_NOZORDER
);
144 GetClientRect(hwnd
, &pVideoRenderer
->DestRect
);
145 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
146 pVideoRenderer
->DestRect
.left
,
147 pVideoRenderer
->DestRect
.top
,
148 pVideoRenderer
->DestRect
.right
- pVideoRenderer
->DestRect
.left
,
149 pVideoRenderer
->DestRect
.bottom
- pVideoRenderer
->DestRect
.top
);
152 TRACE("WM_SIZE %d %d\n", LOWORD(lParam
), HIWORD(lParam
));
153 GetClientRect(hwnd
, &pVideoRenderer
->DestRect
);
154 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
155 pVideoRenderer
->DestRect
.left
,
156 pVideoRenderer
->DestRect
.top
,
157 pVideoRenderer
->DestRect
.right
- pVideoRenderer
->DestRect
.left
,
158 pVideoRenderer
->DestRect
.bottom
- pVideoRenderer
->DestRect
.top
);
161 return DefWindowProcA(hwnd
, uMsg
, wParam
, lParam
);
166 static BOOL
CreateRenderingWindow(VideoRendererImpl
* This
)
170 TRACE("(%p)->()\n", This
);
173 winclass
.lpfnWndProc
= VideoWndProcA
;
174 winclass
.cbClsExtra
= 0;
175 winclass
.cbWndExtra
= sizeof(VideoRendererImpl
*);
176 winclass
.hInstance
= NULL
;
177 winclass
.hIcon
= NULL
;
178 winclass
.hCursor
= NULL
;
179 winclass
.hbrBackground
= GetStockObject(BLACK_BRUSH
);
180 winclass
.lpszMenuName
= NULL
;
181 winclass
.lpszClassName
= "Wine ActiveMovie Class";
183 if (!wnd_class_registered
)
185 if (!RegisterClassA(&winclass
))
187 ERR("Unable to register window %u\n", GetLastError());
190 wnd_class_registered
= TRUE
;
193 This
->hWnd
= CreateWindowExA(0, "Wine ActiveMovie Class", "Wine ActiveMovie Window", WS_SIZEBOX
,
194 CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
, NULL
,
199 ERR("Unable to create window\n");
203 SetWindowLongPtrW(This
->hWnd
, 0, (LONG_PTR
)This
);
208 static DWORD WINAPI
MessageLoop(LPVOID lpParameter
)
210 VideoRendererImpl
* This
= lpParameter
;
214 TRACE("Starting message loop\n");
216 if (!CreateRenderingWindow(This
))
218 This
->ThreadResult
= FALSE
;
219 SetEvent(This
->hEvent
);
223 This
->ThreadResult
= TRUE
;
224 SetEvent(This
->hEvent
);
226 while ((fGotMessage
= GetMessageA(&msg
, NULL
, 0, 0)) != 0 && fGotMessage
!= -1)
228 TranslateMessage(&msg
);
229 DispatchMessageA(&msg
);
232 TRACE("End of message loop\n");
237 static BOOL
CreateRenderingSubsystem(VideoRendererImpl
* This
)
239 This
->hEvent
= CreateEventW(NULL
, TRUE
, FALSE
, NULL
);
243 This
->hThread
= CreateThread(NULL
, 0, MessageLoop
, This
, 0, &This
->ThreadID
);
246 CloseHandle(This
->hEvent
);
250 WaitForSingleObject(This
->hEvent
, INFINITE
);
252 if (!This
->ThreadResult
)
254 CloseHandle(This
->hEvent
);
255 CloseHandle(This
->hThread
);
262 static void VideoRenderer_AutoShowWindow(VideoRendererImpl
*This
) {
263 if (!This
->init
&& (!This
->WindowPos
.right
|| !This
->WindowPos
.top
))
265 DWORD style
= GetWindowLongW(This
->hWnd
, GWL_STYLE
);
266 DWORD style_ex
= GetWindowLongW(This
->hWnd
, GWL_EXSTYLE
);
268 if (!This
->WindowPos
.right
)
270 This
->WindowPos
.left
= This
->SourceRect
.left
;
271 This
->WindowPos
.right
= This
->SourceRect
.right
;
273 if (!This
->WindowPos
.bottom
)
275 This
->WindowPos
.top
= This
->SourceRect
.top
;
276 This
->WindowPos
.bottom
= This
->SourceRect
.bottom
;
279 AdjustWindowRectEx(&This
->WindowPos
, style
, TRUE
, style_ex
);
281 TRACE("WindowPos: %d %d %d %d\n", This
->WindowPos
.left
, This
->WindowPos
.top
, This
->WindowPos
.right
, This
->WindowPos
.bottom
);
282 SetWindowPos(This
->hWnd
, NULL
,
283 This
->WindowPos
.left
,
285 This
->WindowPos
.right
- This
->WindowPos
.left
,
286 This
->WindowPos
.bottom
- This
->WindowPos
.top
,
287 SWP_NOZORDER
|SWP_NOMOVE
|SWP_DEFERERASE
);
289 GetClientRect(This
->hWnd
, &This
->DestRect
);
291 else if (!This
->init
)
292 This
->DestRect
= This
->WindowPos
;
295 ShowWindow(This
->hWnd
, SW_SHOW
);
298 static DWORD
VideoRenderer_SendSampleData(VideoRendererImpl
* This
, LPBYTE data
, DWORD size
)
304 BITMAPINFOHEADER
*bmiHeader
;
306 TRACE("(%p)->(%p, %d)\n", This
, data
, size
);
308 sdesc
.dwSize
= sizeof(sdesc
);
309 hr
= IPin_ConnectionMediaType((IPin
*)This
->pInputPin
, &amt
);
311 ERR("Unable to retrieve media type\n");
315 if (IsEqualIID(&amt
.formattype
, &FORMAT_VideoInfo
))
317 bmiHeader
= &((VIDEOINFOHEADER
*)amt
.pbFormat
)->bmiHeader
;
319 else if (IsEqualIID(&amt
.formattype
, &FORMAT_VideoInfo2
))
321 bmiHeader
= &((VIDEOINFOHEADER2
*)amt
.pbFormat
)->bmiHeader
;
325 FIXME("Unknown type %s\n", debugstr_guid(&amt
.subtype
));
326 return VFW_E_RUNTIME_ERROR
;
329 TRACE("biSize = %d\n", bmiHeader
->biSize
);
330 TRACE("biWidth = %d\n", bmiHeader
->biWidth
);
331 TRACE("biHeight = %d\n", bmiHeader
->biHeight
);
332 TRACE("biPlanes = %d\n", bmiHeader
->biPlanes
);
333 TRACE("biBitCount = %d\n", bmiHeader
->biBitCount
);
334 TRACE("biCompression = %s\n", debugstr_an((LPSTR
)&(bmiHeader
->biCompression
), 4));
335 TRACE("biSizeImage = %d\n", bmiHeader
->biSizeImage
);
337 hDC
= GetDC(This
->hWnd
);
340 ERR("Cannot get DC from window!\n");
344 TRACE("Src Rect: %d %d %d %d\n", This
->SourceRect
.left
, This
->SourceRect
.top
, This
->SourceRect
.right
, This
->SourceRect
.bottom
);
345 TRACE("Dst Rect: %d %d %d %d\n", This
->DestRect
.left
, This
->DestRect
.top
, This
->DestRect
.right
, This
->DestRect
.bottom
);
347 StretchDIBits(hDC
, This
->DestRect
.left
, This
->DestRect
.top
, This
->DestRect
.right
-This
->DestRect
.left
,
348 This
->DestRect
.bottom
- This
->DestRect
.top
, This
->SourceRect
.left
, This
->SourceRect
.top
,
349 This
->SourceRect
.right
- This
->SourceRect
.left
, This
->SourceRect
.bottom
- This
->SourceRect
.top
,
350 data
, (BITMAPINFO
*)bmiHeader
, DIB_RGB_COLORS
, SRCCOPY
);
352 ReleaseDC(This
->hWnd
, hDC
);
357 static HRESULT WINAPI
VideoRenderer_Receive(BaseInputPin
* pin
, IMediaSample
* pSample
)
359 VideoRendererImpl
*This
= (VideoRendererImpl
*)pin
->pin
.pinInfo
.pFilter
;
360 LPBYTE pbSrcStream
= NULL
;
361 LONG cbSrcStream
= 0;
362 REFERENCE_TIME tStart
, tStop
;
365 TRACE("(%p)->(%p)\n", pin
, pSample
);
367 EnterCriticalSection(&This
->filter
.csFilter
);
369 if (This
->pInputPin
->flushing
|| This
->pInputPin
->end_of_stream
)
371 LeaveCriticalSection(&This
->filter
.csFilter
);
375 if (This
->filter
.state
== State_Stopped
)
377 LeaveCriticalSection(&This
->filter
.csFilter
);
378 return VFW_E_WRONG_STATE
;
381 if (IMediaSample_GetMediaTime(pSample
, &tStart
, &tStop
) == S_OK
)
382 MediaSeekingPassThru_RegisterMediaTime(This
->seekthru_unk
, tStart
);
384 /* Preroll means the sample isn't shown, this is used for key frames and things like that */
385 if (IMediaSample_IsPreroll(pSample
) == S_OK
) {
386 LeaveCriticalSection(&This
->filter
.csFilter
);
390 hr
= IMediaSample_GetPointer(pSample
, &pbSrcStream
);
393 ERR("Cannot get pointer to sample data (%x)\n", hr
);
394 LeaveCriticalSection(&This
->filter
.csFilter
);
398 cbSrcStream
= IMediaSample_GetActualDataLength(pSample
);
400 TRACE("val %p %d\n", pbSrcStream
, cbSrcStream
);
402 #if 0 /* For debugging purpose */
405 for(i
= 0; i
< cbSrcStream
; i
++)
407 if ((i
!=0) && !(i
%16))
409 TRACE("%02x ", pbSrcStream
[i
]);
415 SetEvent(This
->hEvent
);
416 if (This
->filter
.state
== State_Paused
)
418 VideoRenderer_SendSampleData(This
, pbSrcStream
, cbSrcStream
);
419 This
->sample_held
= pSample
;
420 LeaveCriticalSection(&This
->filter
.csFilter
);
421 WaitForSingleObject(This
->blocked
, INFINITE
);
422 EnterCriticalSection(&This
->filter
.csFilter
);
423 This
->sample_held
= NULL
;
424 if (This
->filter
.state
== State_Paused
)
427 LeaveCriticalSection(&This
->filter
.csFilter
);
430 if (This
->filter
.state
== State_Stopped
)
432 LeaveCriticalSection(&This
->filter
.csFilter
);
433 return VFW_E_WRONG_STATE
;
436 hr
= QualityControlRender_WaitFor(&This
->qcimpl
, pSample
, This
->blocked
);
438 QualityControlRender_BeginRender(&This
->qcimpl
);
439 VideoRenderer_SendSampleData(This
, pbSrcStream
, cbSrcStream
);
440 QualityControlRender_EndRender(&This
->qcimpl
);
442 QualityControlRender_DoQOS(&This
->qcimpl
);
444 LeaveCriticalSection(&This
->filter
.csFilter
);
448 static HRESULT WINAPI
VideoRenderer_CheckMediaType(BasePin
*iface
, const AM_MEDIA_TYPE
* pmt
)
450 BaseInputPin
* pin
= (BaseInputPin
*)iface
;
451 VideoRendererImpl
*This
= (VideoRendererImpl
*)pin
->pin
.pinInfo
.pFilter
;
453 if (!IsEqualIID(&pmt
->majortype
, &MEDIATYPE_Video
))
456 if (IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB32
) ||
457 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB24
) ||
458 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB565
) ||
459 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB8
))
463 if (IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo
))
465 VIDEOINFOHEADER
*format
= (VIDEOINFOHEADER
*)pmt
->pbFormat
;
466 This
->SourceRect
.left
= 0;
467 This
->SourceRect
.top
= 0;
468 This
->SourceRect
.right
= This
->VideoWidth
= format
->bmiHeader
.biWidth
;
469 height
= format
->bmiHeader
.biHeight
;
471 This
->SourceRect
.bottom
= This
->VideoHeight
= -height
;
473 This
->SourceRect
.bottom
= This
->VideoHeight
= height
;
475 else if (IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo2
))
477 VIDEOINFOHEADER2
*format2
= (VIDEOINFOHEADER2
*)pmt
->pbFormat
;
479 This
->SourceRect
.left
= 0;
480 This
->SourceRect
.top
= 0;
481 This
->SourceRect
.right
= This
->VideoWidth
= format2
->bmiHeader
.biWidth
;
482 height
= format2
->bmiHeader
.biHeight
;
484 This
->SourceRect
.bottom
= This
->VideoHeight
= -height
;
486 This
->SourceRect
.bottom
= This
->VideoHeight
= height
;
490 WARN("Format type %s not supported\n", debugstr_guid(&pmt
->formattype
));
498 static IPin
* WINAPI
VideoRenderer_GetPin(BaseFilter
*iface
, int pos
)
500 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
502 if (pos
>= 1 || pos
< 0)
505 IPin_AddRef((IPin
*)This
->pInputPin
);
506 return (IPin
*)This
->pInputPin
;
509 static LONG WINAPI
VideoRenderer_GetPinCount(BaseFilter
*iface
)
514 static const BaseFilterFuncTable BaseFuncTable
= {
515 VideoRenderer_GetPin
,
516 VideoRenderer_GetPinCount
519 static const BasePinFuncTable input_BaseFuncTable
= {
520 VideoRenderer_CheckMediaType
,
522 BasePinImpl_GetMediaTypeVersion
,
523 BasePinImpl_GetMediaType
526 static const BaseInputPinFuncTable input_BaseInputFuncTable
= {
527 VideoRenderer_Receive
530 HRESULT
VideoRenderer_create(IUnknown
* pUnkOuter
, LPVOID
* ppv
)
534 VideoRendererImpl
* pVideoRenderer
;
535 ISeekingPassThru
*passthru
;
537 TRACE("(%p, %p)\n", pUnkOuter
, ppv
);
541 pVideoRenderer
= CoTaskMemAlloc(sizeof(VideoRendererImpl
));
542 pVideoRenderer
->pUnkOuter
= pUnkOuter
;
543 pVideoRenderer
->bUnkOuterValid
= FALSE
;
544 pVideoRenderer
->bAggregatable
= FALSE
;
545 pVideoRenderer
->IInner_vtbl
= &IInner_VTable
;
546 pVideoRenderer
->IAMFilterMiscFlags_vtbl
= &IAMFilterMiscFlags_Vtbl
;
548 BaseFilter_Init(&pVideoRenderer
->filter
, &VideoRenderer_Vtbl
, &CLSID_VideoRenderer
, (DWORD_PTR
)(__FILE__
": VideoRendererImpl.csFilter"), &BaseFuncTable
);
550 pVideoRenderer
->IBasicVideo_vtbl
= &IBasicVideo_VTable
;
551 pVideoRenderer
->IVideoWindow_vtbl
= &IVideoWindow_VTable
;
553 pVideoRenderer
->init
= 0;
554 pVideoRenderer
->AutoShow
= 1;
555 ZeroMemory(&pVideoRenderer
->SourceRect
, sizeof(RECT
));
556 ZeroMemory(&pVideoRenderer
->DestRect
, sizeof(RECT
));
557 ZeroMemory(&pVideoRenderer
->WindowPos
, sizeof(RECT
));
558 pVideoRenderer
->hWndMsgDrain
= NULL
;
559 pVideoRenderer
->WindowStyle
= WS_OVERLAPPED
;
561 /* construct input pin */
562 piInput
.dir
= PINDIR_INPUT
;
563 piInput
.pFilter
= (IBaseFilter
*)pVideoRenderer
;
564 lstrcpynW(piInput
.achName
, wcsInputPinName
, sizeof(piInput
.achName
) / sizeof(piInput
.achName
[0]));
566 hr
= BaseInputPin_Construct(&VideoRenderer_InputPin_Vtbl
, &piInput
, &input_BaseFuncTable
, &input_BaseInputFuncTable
, &pVideoRenderer
->filter
.csFilter
, NULL
, (IPin
**)&pVideoRenderer
->pInputPin
);
570 hr
= CoCreateInstance(&CLSID_SeekingPassThru
, pUnkOuter
? pUnkOuter
: (IUnknown
*)&pVideoRenderer
->IInner_vtbl
, CLSCTX_INPROC_SERVER
, &IID_IUnknown
, (void**)&pVideoRenderer
->seekthru_unk
);
572 IPin_Release((IPin
*)pVideoRenderer
->pInputPin
);
575 IUnknown_QueryInterface(pVideoRenderer
->seekthru_unk
, &IID_ISeekingPassThru
, (void**)&passthru
);
576 ISeekingPassThru_Init(passthru
, TRUE
, (IPin
*)pVideoRenderer
->pInputPin
);
577 ISeekingPassThru_Release(passthru
);
578 pVideoRenderer
->sample_held
= NULL
;
579 *ppv
= pVideoRenderer
;
584 QualityControlImpl_init(&pVideoRenderer
->qcimpl
, (IPin
*)pVideoRenderer
->pInputPin
, (IBaseFilter
*)pVideoRenderer
);
585 pVideoRenderer
->qcimpl
.lpVtbl
= &VideoRenderer_QualityControl_Vtbl
;
587 if (!CreateRenderingSubsystem(pVideoRenderer
))
590 pVideoRenderer
->blocked
= CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
591 if (!pVideoRenderer
->blocked
)
593 hr
= HRESULT_FROM_WIN32(GetLastError());
594 IUnknown_Release((IUnknown
*)pVideoRenderer
);
599 BaseFilterImpl_Release((IBaseFilter
*)pVideoRenderer
);
600 CoTaskMemFree(pVideoRenderer
);
604 HRESULT
VideoRendererDefault_create(IUnknown
* pUnkOuter
, LPVOID
* ppv
)
606 /* TODO: Attempt to use the VMR-7 renderer instead when possible */
607 return VideoRenderer_create(pUnkOuter
, ppv
);
610 static HRESULT WINAPI
VideoRendererInner_QueryInterface(IUnknown
* iface
, REFIID riid
, LPVOID
* ppv
)
612 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
613 TRACE("(%p/%p)->(%s, %p)\n", This
, iface
, qzdebugstr_guid(riid
), ppv
);
615 if (This
->bAggregatable
)
616 This
->bUnkOuterValid
= TRUE
;
620 if (IsEqualIID(riid
, &IID_IUnknown
))
621 *ppv
= &This
->IInner_vtbl
;
622 else if (IsEqualIID(riid
, &IID_IPersist
))
624 else if (IsEqualIID(riid
, &IID_IMediaFilter
))
626 else if (IsEqualIID(riid
, &IID_IBaseFilter
))
628 else if (IsEqualIID(riid
, &IID_IBasicVideo
))
629 *ppv
= &This
->IBasicVideo_vtbl
;
630 else if (IsEqualIID(riid
, &IID_IVideoWindow
))
631 *ppv
= &This
->IVideoWindow_vtbl
;
632 else if (IsEqualIID(riid
, &IID_IMediaSeeking
))
633 return IUnknown_QueryInterface(This
->seekthru_unk
, riid
, ppv
);
634 else if (IsEqualIID(riid
, &IID_IAMFilterMiscFlags
))
635 *ppv
= &This
->IAMFilterMiscFlags_vtbl
;
636 else if (IsEqualIID(riid
, &IID_IQualityControl
))
637 *ppv
= &This
->qcimpl
;
641 IUnknown_AddRef((IUnknown
*)(*ppv
));
645 if (!IsEqualIID(riid
, &IID_IPin
))
646 FIXME("No interface for %s!\n", qzdebugstr_guid(riid
));
648 return E_NOINTERFACE
;
651 static ULONG WINAPI
VideoRendererInner_AddRef(IUnknown
* iface
)
653 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
654 ULONG refCount
= InterlockedIncrement(&This
->filter
.refCount
);
656 TRACE("(%p/%p)->() AddRef from %d\n", This
, iface
, refCount
- 1);
661 static ULONG WINAPI
VideoRendererInner_Release(IUnknown
* iface
)
663 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
664 ULONG refCount
= InterlockedDecrement(&This
->filter
.refCount
);
666 TRACE("(%p/%p)->() Release from %d\n", This
, iface
, refCount
+ 1);
672 DestroyWindow(This
->hWnd
);
673 PostThreadMessageA(This
->ThreadID
, WM_QUIT
, 0, 0);
674 WaitForSingleObject(This
->hThread
, INFINITE
);
675 CloseHandle(This
->hThread
);
676 CloseHandle(This
->hEvent
);
678 if (SUCCEEDED(IPin_ConnectedTo((IPin
*)This
->pInputPin
, &pConnectedTo
)))
680 IPin_Disconnect(pConnectedTo
);
681 IPin_Release(pConnectedTo
);
683 IPin_Disconnect((IPin
*)This
->pInputPin
);
685 IPin_Release((IPin
*)This
->pInputPin
);
687 This
->filter
.lpVtbl
= NULL
;
688 IUnknown_Release(This
->seekthru_unk
);
689 This
->filter
.csFilter
.DebugInfo
->Spare
[0] = 0;
690 DeleteCriticalSection(&This
->filter
.csFilter
);
692 TRACE("Destroying Video Renderer\n");
701 static const IUnknownVtbl IInner_VTable
=
703 VideoRendererInner_QueryInterface
,
704 VideoRendererInner_AddRef
,
705 VideoRendererInner_Release
708 static HRESULT WINAPI
VideoRenderer_QueryInterface(IBaseFilter
* iface
, REFIID riid
, LPVOID
* ppv
)
710 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
712 if (This
->bAggregatable
)
713 This
->bUnkOuterValid
= TRUE
;
717 if (This
->bAggregatable
)
718 return IUnknown_QueryInterface(This
->pUnkOuter
, riid
, ppv
);
720 if (IsEqualIID(riid
, &IID_IUnknown
))
724 IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
725 hr
= IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
726 IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
727 This
->bAggregatable
= TRUE
;
732 return E_NOINTERFACE
;
735 return IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
738 static ULONG WINAPI
VideoRenderer_AddRef(IBaseFilter
* iface
)
740 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
742 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
743 return IUnknown_AddRef(This
->pUnkOuter
);
744 return IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
747 static ULONG WINAPI
VideoRenderer_Release(IBaseFilter
* iface
)
749 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
751 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
752 return IUnknown_Release(This
->pUnkOuter
);
753 return IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
756 /** IMediaFilter methods **/
758 static HRESULT WINAPI
VideoRenderer_Stop(IBaseFilter
* iface
)
760 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
762 TRACE("(%p/%p)->()\n", This
, iface
);
764 EnterCriticalSection(&This
->filter
.csFilter
);
766 This
->filter
.state
= State_Stopped
;
767 SetEvent(This
->hEvent
);
768 SetEvent(This
->blocked
);
769 MediaSeekingPassThru_ResetMediaTime(This
->seekthru_unk
);
772 RedrawWindow(This
->hWnd
, NULL
, NULL
, RDW_INVALIDATE
|RDW_ERASE
);
774 LeaveCriticalSection(&This
->filter
.csFilter
);
779 static HRESULT WINAPI
VideoRenderer_Pause(IBaseFilter
* iface
)
781 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
783 TRACE("(%p/%p)->()\n", This
, iface
);
785 EnterCriticalSection(&This
->filter
.csFilter
);
786 if (This
->filter
.state
!= State_Paused
)
788 if (This
->filter
.state
== State_Stopped
)
790 This
->pInputPin
->end_of_stream
= 0;
791 ResetEvent(This
->hEvent
);
792 VideoRenderer_AutoShowWindow(This
);
795 This
->filter
.state
= State_Paused
;
796 ResetEvent(This
->blocked
);
798 LeaveCriticalSection(&This
->filter
.csFilter
);
803 static HRESULT WINAPI
VideoRenderer_SetSyncSource(IBaseFilter
*iface
, IReferenceClock
*clock
) {
804 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
807 EnterCriticalSection(&This
->filter
.csFilter
);
808 QualityControlRender_SetClock(&This
->qcimpl
, clock
);
809 hr
= BaseFilterImpl_SetSyncSource(iface
, clock
);
810 LeaveCriticalSection(&This
->filter
.csFilter
);
814 static HRESULT WINAPI
VideoRenderer_Run(IBaseFilter
* iface
, REFERENCE_TIME tStart
)
817 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
819 TRACE("(%p/%p)->(%s)\n", This
, iface
, wine_dbgstr_longlong(tStart
));
821 EnterCriticalSection(&This
->filter
.csFilter
);
822 if (This
->filter
.state
== State_Running
)
824 if (This
->pInputPin
->pin
.pConnectedTo
)
826 if (This
->filter
.state
== State_Stopped
)
828 This
->pInputPin
->end_of_stream
= 0;
829 ResetEvent(This
->hEvent
);
830 VideoRenderer_AutoShowWindow(This
);
832 SetEvent(This
->blocked
);
834 This
->filter
.rtStreamStart
= tStart
;
835 This
->filter
.state
= State_Running
;
836 QualityControlRender_Start(&This
->qcimpl
, tStart
);
837 } else if (This
->filter
.filterInfo
.pGraph
) {
838 IMediaEventSink
*pEventSink
;
839 hr
= IFilterGraph_QueryInterface(This
->filter
.filterInfo
.pGraph
, &IID_IMediaEventSink
, (LPVOID
*)&pEventSink
);
842 hr
= IMediaEventSink_Notify(pEventSink
, EC_COMPLETE
, S_OK
, (LONG_PTR
)This
);
843 IMediaEventSink_Release(pEventSink
);
848 This
->filter
.state
= State_Running
;
850 LeaveCriticalSection(&This
->filter
.csFilter
);
855 static HRESULT WINAPI
VideoRenderer_GetState(IBaseFilter
* iface
, DWORD dwMilliSecsTimeout
, FILTER_STATE
*pState
)
857 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
860 TRACE("(%p/%p)->(%d, %p)\n", This
, iface
, dwMilliSecsTimeout
, pState
);
862 if (WaitForSingleObject(This
->hEvent
, dwMilliSecsTimeout
) == WAIT_TIMEOUT
)
863 hr
= VFW_S_STATE_INTERMEDIATE
;
867 BaseFilterImpl_GetState(iface
, dwMilliSecsTimeout
, pState
);
872 /** IBaseFilter implementation **/
874 static HRESULT WINAPI
VideoRenderer_FindPin(IBaseFilter
* iface
, LPCWSTR Id
, IPin
**ppPin
)
876 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
878 FIXME("(%p/%p)->(%p,%p): stub !!!\n", This
, iface
, debugstr_w(Id
), ppPin
);
880 /* FIXME: critical section */
885 static const IBaseFilterVtbl VideoRenderer_Vtbl
=
887 VideoRenderer_QueryInterface
,
888 VideoRenderer_AddRef
,
889 VideoRenderer_Release
,
890 BaseFilterImpl_GetClassID
,
894 VideoRenderer_GetState
,
895 VideoRenderer_SetSyncSource
,
896 BaseFilterImpl_GetSyncSource
,
897 BaseFilterImpl_EnumPins
,
898 VideoRenderer_FindPin
,
899 BaseFilterImpl_QueryFilterInfo
,
900 BaseFilterImpl_JoinFilterGraph
,
901 BaseFilterImpl_QueryVendorInfo
904 static HRESULT WINAPI
VideoRenderer_InputPin_EndOfStream(IPin
* iface
)
906 BaseInputPin
* This
= (BaseInputPin
*)iface
;
907 VideoRendererImpl
*pFilter
;
908 IMediaEventSink
* pEventSink
;
911 TRACE("(%p/%p)->()\n", This
, iface
);
913 EnterCriticalSection(This
->pin
.pCritSec
);
914 pFilter
= (VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
;
915 if (This
->flushing
|| This
->end_of_stream
)
917 hr
= IFilterGraph_QueryInterface(pFilter
->filter
.filterInfo
.pGraph
, &IID_IMediaEventSink
, (LPVOID
*)&pEventSink
);
920 hr
= IMediaEventSink_Notify(pEventSink
, EC_COMPLETE
, S_OK
, (LONG_PTR
)pFilter
);
921 IMediaEventSink_Release(pEventSink
);
923 MediaSeekingPassThru_EOS(pFilter
->seekthru_unk
);
924 This
->end_of_stream
= 1;
926 LeaveCriticalSection(This
->pin
.pCritSec
);
931 static HRESULT WINAPI
VideoRenderer_InputPin_BeginFlush(IPin
* iface
)
933 BaseInputPin
* This
= (BaseInputPin
*)iface
;
934 VideoRendererImpl
*pVideoRenderer
= (VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
;
936 TRACE("(%p/%p)->()\n", This
, iface
);
938 SetEvent(pVideoRenderer
->blocked
);
939 return BaseInputPinImpl_BeginFlush(iface
);
942 static HRESULT WINAPI
VideoRenderer_InputPin_EndFlush(IPin
* iface
)
944 BaseInputPin
* This
= (BaseInputPin
*)iface
;
945 VideoRendererImpl
*pVideoRenderer
= (VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
;
948 TRACE("(%p/%p)->()\n", This
, iface
);
950 EnterCriticalSection(This
->pin
.pCritSec
);
951 if (pVideoRenderer
->filter
.state
== State_Paused
) {
952 ResetEvent(pVideoRenderer
->blocked
);
953 ResetEvent(pVideoRenderer
->hEvent
);
956 QualityControlRender_Start(&pVideoRenderer
->qcimpl
, pVideoRenderer
->filter
.rtStreamStart
);
957 hr
= BaseInputPinImpl_EndFlush(iface
);
958 LeaveCriticalSection(This
->pin
.pCritSec
);
959 MediaSeekingPassThru_ResetMediaTime(pVideoRenderer
->seekthru_unk
);
964 static const IPinVtbl VideoRenderer_InputPin_Vtbl
=
966 BaseInputPinImpl_QueryInterface
,
968 BaseInputPinImpl_Release
,
969 BaseInputPinImpl_Connect
,
970 BaseInputPinImpl_ReceiveConnection
,
971 BasePinImpl_Disconnect
,
972 BasePinImpl_ConnectedTo
,
973 BasePinImpl_ConnectionMediaType
,
974 BasePinImpl_QueryPinInfo
,
975 BasePinImpl_QueryDirection
,
977 BaseInputPinImpl_QueryAccept
,
978 BasePinImpl_EnumMediaTypes
,
979 BasePinImpl_QueryInternalConnections
,
980 VideoRenderer_InputPin_EndOfStream
,
981 VideoRenderer_InputPin_BeginFlush
,
982 VideoRenderer_InputPin_EndFlush
,
983 BaseInputPinImpl_NewSegment
986 /*** IUnknown methods ***/
987 static HRESULT WINAPI
Basicvideo_QueryInterface(IBasicVideo
*iface
,
990 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
992 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
994 return VideoRenderer_QueryInterface((IBaseFilter
*)This
, riid
, ppvObj
);
997 static ULONG WINAPI
Basicvideo_AddRef(IBasicVideo
*iface
) {
998 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1000 TRACE("(%p/%p)->()\n", This
, iface
);
1002 return VideoRenderer_AddRef((IBaseFilter
*)This
);
1005 static ULONG WINAPI
Basicvideo_Release(IBasicVideo
*iface
) {
1006 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1008 TRACE("(%p/%p)->()\n", This
, iface
);
1010 return VideoRenderer_Release((IBaseFilter
*)This
);
1013 /*** IDispatch methods ***/
1014 static HRESULT WINAPI
Basicvideo_GetTypeInfoCount(IBasicVideo
*iface
,
1016 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1018 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
1023 static HRESULT WINAPI
Basicvideo_GetTypeInfo(IBasicVideo
*iface
,
1026 ITypeInfo
**ppTInfo
) {
1027 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1029 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
1034 static HRESULT WINAPI
Basicvideo_GetIDsOfNames(IBasicVideo
*iface
,
1040 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1042 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1047 static HRESULT WINAPI
Basicvideo_Invoke(IBasicVideo
*iface
,
1048 DISPID dispIdMember
,
1052 DISPPARAMS
*pDispParams
,
1054 EXCEPINFO
*pExepInfo
,
1056 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1058 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
);
1063 /*** IBasicVideo methods ***/
1064 static HRESULT WINAPI
Basicvideo_get_AvgTimePerFrame(IBasicVideo
*iface
,
1065 REFTIME
*pAvgTimePerFrame
) {
1067 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1069 if (!This
->pInputPin
->pin
.pConnectedTo
)
1070 return VFW_E_NOT_CONNECTED
;
1072 TRACE("(%p/%p)->(%p)\n", This
, iface
, pAvgTimePerFrame
);
1074 pmt
= &This
->pInputPin
->pin
.mtCurrent
;
1075 if (IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo
)) {
1076 VIDEOINFOHEADER
*vih
= (VIDEOINFOHEADER
*)pmt
->pbFormat
;
1077 *pAvgTimePerFrame
= vih
->AvgTimePerFrame
;
1078 } else if (IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo2
)) {
1079 VIDEOINFOHEADER2
*vih
= (VIDEOINFOHEADER2
*)pmt
->pbFormat
;
1080 *pAvgTimePerFrame
= vih
->AvgTimePerFrame
;
1082 ERR("Unknown format type %s\n", qzdebugstr_guid(&pmt
->formattype
));
1083 *pAvgTimePerFrame
= 0;
1088 static HRESULT WINAPI
Basicvideo_get_BitRate(IBasicVideo
*iface
,
1090 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1092 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBitRate
);
1097 static HRESULT WINAPI
Basicvideo_get_BitErrorRate(IBasicVideo
*iface
,
1098 LONG
*pBitErrorRate
) {
1099 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1101 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBitErrorRate
);
1106 static HRESULT WINAPI
Basicvideo_get_VideoWidth(IBasicVideo
*iface
,
1107 LONG
*pVideoWidth
) {
1108 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1110 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoWidth
);
1112 *pVideoWidth
= This
->VideoWidth
;
1117 static HRESULT WINAPI
Basicvideo_get_VideoHeight(IBasicVideo
*iface
,
1118 LONG
*pVideoHeight
) {
1119 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1121 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoHeight
);
1123 *pVideoHeight
= This
->VideoHeight
;
1128 static HRESULT WINAPI
Basicvideo_put_SourceLeft(IBasicVideo
*iface
,
1130 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1132 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceLeft
);
1134 This
->SourceRect
.left
= SourceLeft
;
1139 static HRESULT WINAPI
Basicvideo_get_SourceLeft(IBasicVideo
*iface
,
1140 LONG
*pSourceLeft
) {
1141 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1143 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceLeft
);
1145 *pSourceLeft
= This
->SourceRect
.left
;
1150 static HRESULT WINAPI
Basicvideo_put_SourceWidth(IBasicVideo
*iface
,
1152 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1154 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceWidth
);
1156 This
->SourceRect
.right
= This
->SourceRect
.left
+ SourceWidth
;
1161 static HRESULT WINAPI
Basicvideo_get_SourceWidth(IBasicVideo
*iface
,
1162 LONG
*pSourceWidth
) {
1163 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1165 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceWidth
);
1167 *pSourceWidth
= This
->SourceRect
.right
- This
->SourceRect
.left
;
1172 static HRESULT WINAPI
Basicvideo_put_SourceTop(IBasicVideo
*iface
,
1174 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1176 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceTop
);
1178 This
->SourceRect
.top
= SourceTop
;
1183 static HRESULT WINAPI
Basicvideo_get_SourceTop(IBasicVideo
*iface
,
1185 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1187 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceTop
);
1189 *pSourceTop
= This
->SourceRect
.top
;
1194 static HRESULT WINAPI
Basicvideo_put_SourceHeight(IBasicVideo
*iface
,
1195 LONG SourceHeight
) {
1196 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1198 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceHeight
);
1200 This
->SourceRect
.bottom
= This
->SourceRect
.top
+ SourceHeight
;
1205 static HRESULT WINAPI
Basicvideo_get_SourceHeight(IBasicVideo
*iface
,
1206 LONG
*pSourceHeight
) {
1207 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1209 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceHeight
);
1211 *pSourceHeight
= This
->SourceRect
.bottom
- This
->SourceRect
.top
;
1216 static HRESULT WINAPI
Basicvideo_put_DestinationLeft(IBasicVideo
*iface
,
1217 LONG DestinationLeft
) {
1218 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1220 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationLeft
);
1222 This
->DestRect
.left
= DestinationLeft
;
1227 static HRESULT WINAPI
Basicvideo_get_DestinationLeft(IBasicVideo
*iface
,
1228 LONG
*pDestinationLeft
) {
1229 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1231 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationLeft
);
1233 *pDestinationLeft
= This
->DestRect
.left
;
1238 static HRESULT WINAPI
Basicvideo_put_DestinationWidth(IBasicVideo
*iface
,
1239 LONG DestinationWidth
) {
1240 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1242 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationWidth
);
1244 This
->DestRect
.right
= This
->DestRect
.left
+ DestinationWidth
;
1249 static HRESULT WINAPI
Basicvideo_get_DestinationWidth(IBasicVideo
*iface
,
1250 LONG
*pDestinationWidth
) {
1251 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1253 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationWidth
);
1255 *pDestinationWidth
= This
->DestRect
.right
- This
->DestRect
.left
;
1260 static HRESULT WINAPI
Basicvideo_put_DestinationTop(IBasicVideo
*iface
,
1261 LONG DestinationTop
) {
1262 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1264 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationTop
);
1266 This
->DestRect
.top
= DestinationTop
;
1271 static HRESULT WINAPI
Basicvideo_get_DestinationTop(IBasicVideo
*iface
,
1272 LONG
*pDestinationTop
) {
1273 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1275 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationTop
);
1277 *pDestinationTop
= This
->DestRect
.top
;
1282 static HRESULT WINAPI
Basicvideo_put_DestinationHeight(IBasicVideo
*iface
,
1283 LONG DestinationHeight
) {
1284 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1286 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationHeight
);
1288 This
->DestRect
.right
= This
->DestRect
.left
+ DestinationHeight
;
1293 static HRESULT WINAPI
Basicvideo_get_DestinationHeight(IBasicVideo
*iface
,
1294 LONG
*pDestinationHeight
) {
1295 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1297 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationHeight
);
1299 *pDestinationHeight
= This
->DestRect
.right
- This
->DestRect
.left
;
1304 static HRESULT WINAPI
Basicvideo_SetSourcePosition(IBasicVideo
*iface
,
1309 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1311 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This
, iface
, Left
, Top
, Width
, Height
);
1313 This
->SourceRect
.left
= Left
;
1314 This
->SourceRect
.top
= Top
;
1315 This
->SourceRect
.right
= Left
+ Width
;
1316 This
->SourceRect
.bottom
= Top
+ Height
;
1321 static HRESULT WINAPI
Basicvideo_GetSourcePosition(IBasicVideo
*iface
,
1326 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1328 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1330 *pLeft
= This
->SourceRect
.left
;
1331 *pTop
= This
->SourceRect
.top
;
1332 *pWidth
= This
->SourceRect
.right
- This
->SourceRect
.left
;
1333 *pHeight
= This
->SourceRect
.bottom
- This
->SourceRect
.top
;
1338 static HRESULT WINAPI
Basicvideo_SetDefaultSourcePosition(IBasicVideo
*iface
) {
1339 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1341 TRACE("(%p/%p)->()\n", This
, iface
);
1343 This
->SourceRect
.left
= 0;
1344 This
->SourceRect
.top
= 0;
1345 This
->SourceRect
.right
= This
->VideoWidth
;
1346 This
->SourceRect
.bottom
= This
->VideoHeight
;
1351 static HRESULT WINAPI
Basicvideo_SetDestinationPosition(IBasicVideo
*iface
,
1356 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1358 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This
, iface
, Left
, Top
, Width
, Height
);
1360 This
->DestRect
.left
= Left
;
1361 This
->DestRect
.top
= Top
;
1362 This
->DestRect
.right
= Left
+ Width
;
1363 This
->DestRect
.bottom
= Top
+ Height
;
1368 static HRESULT WINAPI
Basicvideo_GetDestinationPosition(IBasicVideo
*iface
,
1373 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1375 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1377 *pLeft
= This
->DestRect
.left
;
1378 *pTop
= This
->DestRect
.top
;
1379 *pWidth
= This
->DestRect
.right
- This
->DestRect
.left
;
1380 *pHeight
= This
->DestRect
.bottom
- This
->DestRect
.top
;
1385 static HRESULT WINAPI
Basicvideo_SetDefaultDestinationPosition(IBasicVideo
*iface
) {
1386 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1389 TRACE("(%p/%p)->()\n", This
, iface
);
1391 if (!GetClientRect(This
->hWnd
, &rect
))
1394 This
->SourceRect
.left
= 0;
1395 This
->SourceRect
.top
= 0;
1396 This
->SourceRect
.right
= rect
.right
;
1397 This
->SourceRect
.bottom
= rect
.bottom
;
1402 static HRESULT WINAPI
Basicvideo_GetVideoSize(IBasicVideo
*iface
,
1405 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1407 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pWidth
, pHeight
);
1409 *pWidth
= This
->VideoWidth
;
1410 *pHeight
= This
->VideoHeight
;
1415 static HRESULT WINAPI
Basicvideo_GetVideoPaletteEntries(IBasicVideo
*iface
,
1420 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1422 TRACE("(%p/%p)->(%d, %d, %p, %p)\n", This
, iface
, StartIndex
, Entries
, pRetrieved
, pPalette
);
1426 return VFW_E_NO_PALETTE_AVAILABLE
;
1429 static HRESULT WINAPI
Basicvideo_GetCurrentImage(IBasicVideo
*iface
,
1432 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1433 BITMAPINFOHEADER
*bmiHeader
;
1435 AM_MEDIA_TYPE
*amt
= &This
->pInputPin
->pin
.mtCurrent
;
1438 FIXME("(%p/%p)->(%p, %p): partial stub\n", This
, iface
, pBufferSize
, pDIBImage
);
1440 EnterCriticalSection(&This
->filter
.csFilter
);
1442 if (!This
->sample_held
)
1444 LeaveCriticalSection(&This
->filter
.csFilter
);
1445 return (This
->filter
.state
== State_Paused
? E_UNEXPECTED
: VFW_E_NOT_PAUSED
);
1448 if (IsEqualIID(&amt
->formattype
, &FORMAT_VideoInfo
))
1450 bmiHeader
= &((VIDEOINFOHEADER
*)amt
->pbFormat
)->bmiHeader
;
1452 else if (IsEqualIID(&amt
->formattype
, &FORMAT_VideoInfo2
))
1454 bmiHeader
= &((VIDEOINFOHEADER2
*)amt
->pbFormat
)->bmiHeader
;
1458 FIXME("Unknown type %s\n", debugstr_guid(&amt
->subtype
));
1459 LeaveCriticalSection(&This
->filter
.csFilter
);
1460 return VFW_E_RUNTIME_ERROR
;
1463 needed_size
= bmiHeader
->biSize
;
1464 needed_size
+= IMediaSample_GetActualDataLength(This
->sample_held
);
1468 *pBufferSize
= needed_size
;
1469 LeaveCriticalSection(&This
->filter
.csFilter
);
1473 if (needed_size
< *pBufferSize
)
1475 ERR("Buffer too small %u/%u\n", needed_size
, *pBufferSize
);
1476 LeaveCriticalSection(&This
->filter
.csFilter
);
1479 *pBufferSize
= needed_size
;
1481 memcpy(pDIBImage
, bmiHeader
, bmiHeader
->biSize
);
1482 IMediaSample_GetPointer(This
->sample_held
, (BYTE
**)&ptr
);
1483 memcpy((char *)pDIBImage
+ bmiHeader
->biSize
, ptr
, IMediaSample_GetActualDataLength(This
->sample_held
));
1485 LeaveCriticalSection(&This
->filter
.csFilter
);
1490 static HRESULT WINAPI
Basicvideo_IsUsingDefaultSource(IBasicVideo
*iface
) {
1491 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1493 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
1498 static HRESULT WINAPI
Basicvideo_IsUsingDefaultDestination(IBasicVideo
*iface
) {
1499 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1501 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
1507 static const IBasicVideoVtbl IBasicVideo_VTable
=
1509 Basicvideo_QueryInterface
,
1512 Basicvideo_GetTypeInfoCount
,
1513 Basicvideo_GetTypeInfo
,
1514 Basicvideo_GetIDsOfNames
,
1516 Basicvideo_get_AvgTimePerFrame
,
1517 Basicvideo_get_BitRate
,
1518 Basicvideo_get_BitErrorRate
,
1519 Basicvideo_get_VideoWidth
,
1520 Basicvideo_get_VideoHeight
,
1521 Basicvideo_put_SourceLeft
,
1522 Basicvideo_get_SourceLeft
,
1523 Basicvideo_put_SourceWidth
,
1524 Basicvideo_get_SourceWidth
,
1525 Basicvideo_put_SourceTop
,
1526 Basicvideo_get_SourceTop
,
1527 Basicvideo_put_SourceHeight
,
1528 Basicvideo_get_SourceHeight
,
1529 Basicvideo_put_DestinationLeft
,
1530 Basicvideo_get_DestinationLeft
,
1531 Basicvideo_put_DestinationWidth
,
1532 Basicvideo_get_DestinationWidth
,
1533 Basicvideo_put_DestinationTop
,
1534 Basicvideo_get_DestinationTop
,
1535 Basicvideo_put_DestinationHeight
,
1536 Basicvideo_get_DestinationHeight
,
1537 Basicvideo_SetSourcePosition
,
1538 Basicvideo_GetSourcePosition
,
1539 Basicvideo_SetDefaultSourcePosition
,
1540 Basicvideo_SetDestinationPosition
,
1541 Basicvideo_GetDestinationPosition
,
1542 Basicvideo_SetDefaultDestinationPosition
,
1543 Basicvideo_GetVideoSize
,
1544 Basicvideo_GetVideoPaletteEntries
,
1545 Basicvideo_GetCurrentImage
,
1546 Basicvideo_IsUsingDefaultSource
,
1547 Basicvideo_IsUsingDefaultDestination
1551 /*** IUnknown methods ***/
1552 static HRESULT WINAPI
Videowindow_QueryInterface(IVideoWindow
*iface
,
1555 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1557 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
1559 return VideoRenderer_QueryInterface((IBaseFilter
*)This
, riid
, ppvObj
);
1562 static ULONG WINAPI
Videowindow_AddRef(IVideoWindow
*iface
) {
1563 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1565 TRACE("(%p/%p)->()\n", This
, iface
);
1567 return VideoRenderer_AddRef((IBaseFilter
*)This
);
1570 static ULONG WINAPI
Videowindow_Release(IVideoWindow
*iface
) {
1571 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1573 TRACE("(%p/%p)->()\n", This
, iface
);
1575 return VideoRenderer_Release((IBaseFilter
*)This
);
1578 /*** IDispatch methods ***/
1579 static HRESULT WINAPI
Videowindow_GetTypeInfoCount(IVideoWindow
*iface
,
1581 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1583 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
1588 static HRESULT WINAPI
Videowindow_GetTypeInfo(IVideoWindow
*iface
,
1591 ITypeInfo
**ppTInfo
) {
1592 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1594 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
1599 static HRESULT WINAPI
Videowindow_GetIDsOfNames(IVideoWindow
*iface
,
1605 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1607 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1612 static HRESULT WINAPI
Videowindow_Invoke(IVideoWindow
*iface
,
1613 DISPID dispIdMember
,
1617 DISPPARAMS
*pDispParams
,
1619 EXCEPINFO
*pExepInfo
,
1621 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1623 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
);
1628 /*** IVideoWindow methods ***/
1629 static HRESULT WINAPI
Videowindow_put_Caption(IVideoWindow
*iface
,
1631 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1633 TRACE("(%p/%p)->(%s (%p))\n", This
, iface
, debugstr_w(strCaption
), strCaption
);
1635 if (!SetWindowTextW(This
->hWnd
, strCaption
))
1641 static HRESULT WINAPI
Videowindow_get_Caption(IVideoWindow
*iface
,
1643 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1645 TRACE("(%p/%p)->(%p)\n", This
, iface
, strCaption
);
1647 GetWindowTextW(This
->hWnd
, (LPWSTR
)strCaption
, 100);
1652 static HRESULT WINAPI
Videowindow_put_WindowStyle(IVideoWindow
*iface
,
1654 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1657 old
= GetWindowLongA(This
->hWnd
, GWL_STYLE
);
1659 TRACE("(%p/%p)->(%x -> %x)\n", This
, iface
, old
, WindowStyle
);
1661 if (WindowStyle
& (WS_DISABLED
|WS_HSCROLL
|WS_ICONIC
|WS_MAXIMIZE
|WS_MINIMIZE
|WS_VSCROLL
))
1662 return E_INVALIDARG
;
1664 SetWindowLongA(This
->hWnd
, GWL_STYLE
, WindowStyle
);
1665 SetWindowPos(This
->hWnd
,0,0,0,0,0,SWP_FRAMECHANGED
|SWP_NOSIZE
|SWP_NOZORDER
);
1666 This
->WindowStyle
= WindowStyle
;
1671 static HRESULT WINAPI
Videowindow_get_WindowStyle(IVideoWindow
*iface
,
1672 LONG
*WindowStyle
) {
1673 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1675 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyle
);
1677 *WindowStyle
= This
->WindowStyle
;
1682 static HRESULT WINAPI
Videowindow_put_WindowStyleEx(IVideoWindow
*iface
,
1683 LONG WindowStyleEx
) {
1684 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1686 TRACE("(%p/%p)->(%d)\n", This
, iface
, WindowStyleEx
);
1688 if (!SetWindowLongA(This
->hWnd
, GWL_EXSTYLE
, WindowStyleEx
))
1694 static HRESULT WINAPI
Videowindow_get_WindowStyleEx(IVideoWindow
*iface
,
1695 LONG
*WindowStyleEx
) {
1696 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1698 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyleEx
);
1700 *WindowStyleEx
= GetWindowLongA(This
->hWnd
, GWL_EXSTYLE
);
1705 static HRESULT WINAPI
Videowindow_put_AutoShow(IVideoWindow
*iface
,
1707 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1709 TRACE("(%p/%p)->(%d)\n", This
, iface
, AutoShow
);
1711 This
->AutoShow
= AutoShow
;
1716 static HRESULT WINAPI
Videowindow_get_AutoShow(IVideoWindow
*iface
,
1718 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1720 TRACE("(%p/%p)->(%p)\n", This
, iface
, AutoShow
);
1722 *AutoShow
= This
->AutoShow
;
1727 static HRESULT WINAPI
Videowindow_put_WindowState(IVideoWindow
*iface
,
1729 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1731 TRACE("(%p/%p)->(%d)\n", This
, iface
, WindowState
);
1732 ShowWindow(This
->hWnd
, WindowState
);
1736 static HRESULT WINAPI
Videowindow_get_WindowState(IVideoWindow
*iface
,
1737 LONG
*WindowState
) {
1738 WINDOWPLACEMENT place
;
1739 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1741 place
.length
= sizeof(place
);
1742 GetWindowPlacement(This
->hWnd
, &place
);
1743 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowState
);
1744 *WindowState
= place
.showCmd
;
1749 static HRESULT WINAPI
Videowindow_put_BackgroundPalette(IVideoWindow
*iface
,
1750 LONG BackgroundPalette
) {
1751 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1753 FIXME("(%p/%p)->(%d): stub !!!\n", This
, iface
, BackgroundPalette
);
1758 static HRESULT WINAPI
Videowindow_get_BackgroundPalette(IVideoWindow
*iface
,
1759 LONG
*pBackgroundPalette
) {
1760 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1762 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBackgroundPalette
);
1767 static HRESULT WINAPI
Videowindow_put_Visible(IVideoWindow
*iface
,
1769 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1771 TRACE("(%p/%p)->(%d)\n", This
, iface
, Visible
);
1773 ShowWindow(This
->hWnd
, Visible
? SW_SHOW
: SW_HIDE
);
1778 static HRESULT WINAPI
Videowindow_get_Visible(IVideoWindow
*iface
,
1780 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1782 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVisible
);
1784 *pVisible
= IsWindowVisible(This
->hWnd
);
1789 static HRESULT WINAPI
Videowindow_put_Left(IVideoWindow
*iface
,
1791 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1793 TRACE("(%p/%p)->(%d)\n", This
, iface
, Left
);
1795 if (!SetWindowPos(This
->hWnd
, NULL
, Left
, This
->WindowPos
.top
, 0, 0, SWP_NOZORDER
|SWP_NOSIZE
))
1798 This
->WindowPos
.left
= Left
;
1803 static HRESULT WINAPI
Videowindow_get_Left(IVideoWindow
*iface
,
1805 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1807 TRACE("(%p/%p)->(%p)\n", This
, iface
, pLeft
);
1809 *pLeft
= This
->WindowPos
.left
;
1814 static HRESULT WINAPI
Videowindow_put_Width(IVideoWindow
*iface
,
1816 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1818 TRACE("(%p/%p)->(%d)\n", This
, iface
, Width
);
1820 if (!SetWindowPos(This
->hWnd
, NULL
, 0, 0, Width
, This
->WindowPos
.bottom
-This
->WindowPos
.top
, SWP_NOZORDER
|SWP_NOMOVE
))
1823 This
->WindowPos
.right
= This
->WindowPos
.left
+ Width
;
1828 static HRESULT WINAPI
Videowindow_get_Width(IVideoWindow
*iface
,
1830 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1832 TRACE("(%p/%p)->(%p)\n", This
, iface
, pWidth
);
1834 *pWidth
= This
->WindowPos
.right
- This
->WindowPos
.left
;
1839 static HRESULT WINAPI
Videowindow_put_Top(IVideoWindow
*iface
,
1841 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1843 TRACE("(%p/%p)->(%d)\n", This
, iface
, Top
);
1845 if (!SetWindowPos(This
->hWnd
, NULL
, This
->WindowPos
.left
, Top
, 0, 0, SWP_NOZORDER
|SWP_NOSIZE
))
1848 This
->WindowPos
.top
= Top
;
1853 static HRESULT WINAPI
Videowindow_get_Top(IVideoWindow
*iface
,
1855 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1857 TRACE("(%p/%p)->(%p)\n", This
, iface
, pTop
);
1859 *pTop
= This
->WindowPos
.top
;
1864 static HRESULT WINAPI
Videowindow_put_Height(IVideoWindow
*iface
,
1866 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1868 TRACE("(%p/%p)->(%d)\n", This
, iface
, Height
);
1870 if (!SetWindowPos(This
->hWnd
, NULL
, 0, 0, This
->WindowPos
.right
-This
->WindowPos
.left
, Height
, SWP_NOZORDER
|SWP_NOMOVE
))
1873 This
->WindowPos
.bottom
= This
->WindowPos
.top
+ Height
;
1878 static HRESULT WINAPI
Videowindow_get_Height(IVideoWindow
*iface
,
1880 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1882 TRACE("(%p/%p)->(%p)\n", This
, iface
, pHeight
);
1884 *pHeight
= This
->WindowPos
.bottom
- This
->WindowPos
.top
;
1889 static HRESULT WINAPI
Videowindow_put_Owner(IVideoWindow
*iface
,
1891 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1893 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Owner
);
1895 SetParent(This
->hWnd
, (HWND
)Owner
);
1896 if (This
->WindowStyle
& WS_CHILD
)
1898 LONG old
= GetWindowLongA(This
->hWnd
, GWL_STYLE
);
1899 if (old
!= This
->WindowStyle
)
1901 SetWindowLongA(This
->hWnd
, GWL_STYLE
, This
->WindowStyle
);
1902 SetWindowPos(This
->hWnd
,0,0,0,0,0,SWP_FRAMECHANGED
|SWP_NOSIZE
|SWP_NOZORDER
);
1909 static HRESULT WINAPI
Videowindow_get_Owner(IVideoWindow
*iface
,
1911 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1913 TRACE("(%p/%p)->(%p)\n", This
, iface
, Owner
);
1915 *(HWND
*)Owner
= GetParent(This
->hWnd
);
1920 static HRESULT WINAPI
Videowindow_put_MessageDrain(IVideoWindow
*iface
,
1922 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1924 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Drain
);
1926 This
->hWndMsgDrain
= (HWND
)Drain
;
1931 static HRESULT WINAPI
Videowindow_get_MessageDrain(IVideoWindow
*iface
,
1933 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1935 TRACE("(%p/%p)->(%p)\n", This
, iface
, Drain
);
1937 *Drain
= (OAHWND
)This
->hWndMsgDrain
;
1942 static HRESULT WINAPI
Videowindow_get_BorderColor(IVideoWindow
*iface
,
1944 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1946 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, Color
);
1951 static HRESULT WINAPI
Videowindow_put_BorderColor(IVideoWindow
*iface
,
1953 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1955 FIXME("(%p/%p)->(%d): stub !!!\n", This
, iface
, Color
);
1960 static HRESULT WINAPI
Videowindow_get_FullScreenMode(IVideoWindow
*iface
,
1961 LONG
*FullScreenMode
) {
1962 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1964 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, FullScreenMode
);
1969 static HRESULT WINAPI
Videowindow_put_FullScreenMode(IVideoWindow
*iface
,
1970 LONG FullScreenMode
) {
1971 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1973 FIXME("(%p/%p)->(%d): stub !!!\n", This
, iface
, FullScreenMode
);
1978 static HRESULT WINAPI
Videowindow_SetWindowForeground(IVideoWindow
*iface
,
1980 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1985 TRACE("(%p/%p)->(%d)\n", This
, iface
, Focus
);
1987 if ((Focus
!= FALSE
) && (Focus
!= TRUE
))
1988 return E_INVALIDARG
;
1990 hr
= IPin_ConnectedTo((IPin
*)This
->pInputPin
, &pPin
);
1991 if ((hr
!= S_OK
) || !pPin
)
1992 return VFW_E_NOT_CONNECTED
;
1995 ret
= SetForegroundWindow(This
->hWnd
);
1997 ret
= SetWindowPos(This
->hWnd
, HWND_TOP
, 0, 0, 0, 0, SWP_NOMOVE
|SWP_NOSIZE
);
2005 static HRESULT WINAPI
Videowindow_NotifyOwnerMessage(IVideoWindow
*iface
,
2010 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2012 TRACE("(%p/%p)->(%08lx, %d, %08lx, %08lx)\n", This
, iface
, hwnd
, uMsg
, wParam
, lParam
);
2014 if (!PostMessageA(This
->hWnd
, uMsg
, wParam
, lParam
))
2020 static HRESULT WINAPI
Videowindow_SetWindowPosition(IVideoWindow
*iface
,
2025 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2027 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This
, iface
, Left
, Top
, Width
, Height
);
2029 if (!SetWindowPos(This
->hWnd
, NULL
, Left
, Top
, Width
, Height
, SWP_NOZORDER
))
2032 This
->WindowPos
.left
= Left
;
2033 This
->WindowPos
.top
= Top
;
2034 This
->WindowPos
.right
= Left
+ Width
;
2035 This
->WindowPos
.bottom
= Top
+ Height
;
2040 static HRESULT WINAPI
Videowindow_GetWindowPosition(IVideoWindow
*iface
,
2045 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2047 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
2049 *pLeft
= This
->WindowPos
.left
;
2050 *pTop
= This
->WindowPos
.top
;
2051 *pWidth
= This
->WindowPos
.right
- This
->WindowPos
.left
;
2052 *pHeight
= This
->WindowPos
.bottom
- This
->WindowPos
.top
;
2057 static HRESULT WINAPI
Videowindow_GetMinIdealImageSize(IVideoWindow
*iface
,
2060 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2062 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This
, iface
, pWidth
, pHeight
);
2064 *pWidth
= This
->VideoWidth
;
2065 *pHeight
= This
->VideoHeight
;
2070 static HRESULT WINAPI
Videowindow_GetMaxIdealImageSize(IVideoWindow
*iface
,
2073 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2075 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This
, iface
, pWidth
, pHeight
);
2077 *pWidth
= This
->VideoWidth
;
2078 *pHeight
= This
->VideoHeight
;
2083 static HRESULT WINAPI
Videowindow_GetRestorePosition(IVideoWindow
*iface
,
2088 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2090 FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
2095 static HRESULT WINAPI
Videowindow_HideCursor(IVideoWindow
*iface
,
2097 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2099 FIXME("(%p/%p)->(%d): stub !!!\n", This
, iface
, HideCursor
);
2104 static HRESULT WINAPI
Videowindow_IsCursorHidden(IVideoWindow
*iface
,
2105 LONG
*CursorHidden
) {
2106 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2108 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, CursorHidden
);
2113 static const IVideoWindowVtbl IVideoWindow_VTable
=
2115 Videowindow_QueryInterface
,
2117 Videowindow_Release
,
2118 Videowindow_GetTypeInfoCount
,
2119 Videowindow_GetTypeInfo
,
2120 Videowindow_GetIDsOfNames
,
2122 Videowindow_put_Caption
,
2123 Videowindow_get_Caption
,
2124 Videowindow_put_WindowStyle
,
2125 Videowindow_get_WindowStyle
,
2126 Videowindow_put_WindowStyleEx
,
2127 Videowindow_get_WindowStyleEx
,
2128 Videowindow_put_AutoShow
,
2129 Videowindow_get_AutoShow
,
2130 Videowindow_put_WindowState
,
2131 Videowindow_get_WindowState
,
2132 Videowindow_put_BackgroundPalette
,
2133 Videowindow_get_BackgroundPalette
,
2134 Videowindow_put_Visible
,
2135 Videowindow_get_Visible
,
2136 Videowindow_put_Left
,
2137 Videowindow_get_Left
,
2138 Videowindow_put_Width
,
2139 Videowindow_get_Width
,
2140 Videowindow_put_Top
,
2141 Videowindow_get_Top
,
2142 Videowindow_put_Height
,
2143 Videowindow_get_Height
,
2144 Videowindow_put_Owner
,
2145 Videowindow_get_Owner
,
2146 Videowindow_put_MessageDrain
,
2147 Videowindow_get_MessageDrain
,
2148 Videowindow_get_BorderColor
,
2149 Videowindow_put_BorderColor
,
2150 Videowindow_get_FullScreenMode
,
2151 Videowindow_put_FullScreenMode
,
2152 Videowindow_SetWindowForeground
,
2153 Videowindow_NotifyOwnerMessage
,
2154 Videowindow_SetWindowPosition
,
2155 Videowindow_GetWindowPosition
,
2156 Videowindow_GetMinIdealImageSize
,
2157 Videowindow_GetMaxIdealImageSize
,
2158 Videowindow_GetRestorePosition
,
2159 Videowindow_HideCursor
,
2160 Videowindow_IsCursorHidden
2163 static VideoRendererImpl
*from_IAMFilterMiscFlags(IAMFilterMiscFlags
*iface
) {
2164 return (VideoRendererImpl
*)((char*)iface
- offsetof(VideoRendererImpl
, IAMFilterMiscFlags_vtbl
));
2167 static HRESULT WINAPI
AMFilterMiscFlags_QueryInterface(IAMFilterMiscFlags
*iface
, const REFIID riid
, void **ppv
) {
2168 VideoRendererImpl
*This
= from_IAMFilterMiscFlags(iface
);
2169 return IUnknown_QueryInterface((IUnknown
*)This
, riid
, ppv
);
2172 static ULONG WINAPI
AMFilterMiscFlags_AddRef(IAMFilterMiscFlags
*iface
) {
2173 VideoRendererImpl
*This
= from_IAMFilterMiscFlags(iface
);
2174 return IUnknown_AddRef((IUnknown
*)This
);
2177 static ULONG WINAPI
AMFilterMiscFlags_Release(IAMFilterMiscFlags
*iface
) {
2178 VideoRendererImpl
*This
= from_IAMFilterMiscFlags(iface
);
2179 return IUnknown_Release((IUnknown
*)This
);
2182 static ULONG WINAPI
AMFilterMiscFlags_GetMiscFlags(IAMFilterMiscFlags
*iface
) {
2183 return AM_FILTER_MISC_FLAGS_IS_RENDERER
;
2186 static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl
= {
2187 AMFilterMiscFlags_QueryInterface
,
2188 AMFilterMiscFlags_AddRef
,
2189 AMFilterMiscFlags_Release
,
2190 AMFilterMiscFlags_GetMiscFlags