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
;
94 REFERENCE_TIME rtLastStop
;
97 /* During pause we can hold a single sample, for use in GetCurrentImage */
98 IMediaSample
*sample_held
;
101 static LRESULT CALLBACK
VideoWndProcA(HWND hwnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
103 VideoRendererImpl
* pVideoRenderer
= (VideoRendererImpl
*)GetWindowLongPtrW(hwnd
, 0);
104 LPRECT lprect
= (LPRECT
)lParam
;
106 if (pVideoRenderer
&& pVideoRenderer
->hWndMsgDrain
)
112 case WM_LBUTTONDBLCLK
:
115 case WM_MBUTTONDBLCLK
:
118 case WM_MOUSEACTIVATE
:
120 case WM_NCLBUTTONDBLCLK
:
121 case WM_NCLBUTTONDOWN
:
123 case WM_NCMBUTTONDBLCLK
:
124 case WM_NCMBUTTONDOWN
:
127 case WM_NCRBUTTONDBLCLK
:
128 case WM_NCRBUTTONDOWN
:
130 case WM_RBUTTONDBLCLK
:
133 PostMessageA(pVideoRenderer
->hWndMsgDrain
, uMsg
, wParam
, lParam
);
143 /* TRACE("WM_SIZING %d %d %d %d\n", lprect->left, lprect->top, lprect->right, lprect->bottom); */
144 SetWindowPos(hwnd
, NULL
, lprect
->left
, lprect
->top
, lprect
->right
- lprect
->left
, lprect
->bottom
- lprect
->top
, SWP_NOZORDER
);
145 GetClientRect(hwnd
, &pVideoRenderer
->DestRect
);
146 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
147 pVideoRenderer
->DestRect
.left
,
148 pVideoRenderer
->DestRect
.top
,
149 pVideoRenderer
->DestRect
.right
- pVideoRenderer
->DestRect
.left
,
150 pVideoRenderer
->DestRect
.bottom
- pVideoRenderer
->DestRect
.top
);
153 TRACE("WM_SIZE %d %d\n", LOWORD(lParam
), HIWORD(lParam
));
154 GetClientRect(hwnd
, &pVideoRenderer
->DestRect
);
155 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
156 pVideoRenderer
->DestRect
.left
,
157 pVideoRenderer
->DestRect
.top
,
158 pVideoRenderer
->DestRect
.right
- pVideoRenderer
->DestRect
.left
,
159 pVideoRenderer
->DestRect
.bottom
- pVideoRenderer
->DestRect
.top
);
162 return DefWindowProcA(hwnd
, uMsg
, wParam
, lParam
);
167 static BOOL
CreateRenderingWindow(VideoRendererImpl
* This
)
171 TRACE("(%p)->()\n", This
);
174 winclass
.lpfnWndProc
= VideoWndProcA
;
175 winclass
.cbClsExtra
= 0;
176 winclass
.cbWndExtra
= sizeof(VideoRendererImpl
*);
177 winclass
.hInstance
= NULL
;
178 winclass
.hIcon
= NULL
;
179 winclass
.hCursor
= NULL
;
180 winclass
.hbrBackground
= GetStockObject(BLACK_BRUSH
);
181 winclass
.lpszMenuName
= NULL
;
182 winclass
.lpszClassName
= "Wine ActiveMovie Class";
184 if (!wnd_class_registered
)
186 if (!RegisterClassA(&winclass
))
188 ERR("Unable to register window %u\n", GetLastError());
191 wnd_class_registered
= TRUE
;
194 This
->hWnd
= CreateWindowExA(0, "Wine ActiveMovie Class", "Wine ActiveMovie Window", WS_SIZEBOX
,
195 CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
, NULL
,
200 ERR("Unable to create window\n");
204 SetWindowLongPtrW(This
->hWnd
, 0, (LONG_PTR
)This
);
209 static DWORD WINAPI
MessageLoop(LPVOID lpParameter
)
211 VideoRendererImpl
* This
= lpParameter
;
215 TRACE("Starting message loop\n");
217 if (!CreateRenderingWindow(This
))
219 This
->ThreadResult
= FALSE
;
220 SetEvent(This
->hEvent
);
224 This
->ThreadResult
= TRUE
;
225 SetEvent(This
->hEvent
);
227 while ((fGotMessage
= GetMessageA(&msg
, NULL
, 0, 0)) != 0 && fGotMessage
!= -1)
229 TranslateMessage(&msg
);
230 DispatchMessageA(&msg
);
233 TRACE("End of message loop\n");
238 static BOOL
CreateRenderingSubsystem(VideoRendererImpl
* This
)
240 This
->hEvent
= CreateEventW(NULL
, TRUE
, FALSE
, NULL
);
244 This
->hThread
= CreateThread(NULL
, 0, MessageLoop
, This
, 0, &This
->ThreadID
);
247 CloseHandle(This
->hEvent
);
251 WaitForSingleObject(This
->hEvent
, INFINITE
);
253 if (!This
->ThreadResult
)
255 CloseHandle(This
->hEvent
);
256 CloseHandle(This
->hThread
);
263 static DWORD
VideoRenderer_SendSampleData(VideoRendererImpl
* This
, LPBYTE data
, DWORD size
)
269 BITMAPINFOHEADER
*bmiHeader
;
271 TRACE("(%p)->(%p, %d)\n", This
, data
, size
);
273 sdesc
.dwSize
= sizeof(sdesc
);
274 hr
= IPin_ConnectionMediaType((IPin
*)This
->pInputPin
, &amt
);
276 ERR("Unable to retrieve media type\n");
280 if (IsEqualIID(&amt
.formattype
, &FORMAT_VideoInfo
))
282 bmiHeader
= &((VIDEOINFOHEADER
*)amt
.pbFormat
)->bmiHeader
;
284 else if (IsEqualIID(&amt
.formattype
, &FORMAT_VideoInfo2
))
286 bmiHeader
= &((VIDEOINFOHEADER2
*)amt
.pbFormat
)->bmiHeader
;
290 FIXME("Unknown type %s\n", debugstr_guid(&amt
.subtype
));
291 return VFW_E_RUNTIME_ERROR
;
294 TRACE("biSize = %d\n", bmiHeader
->biSize
);
295 TRACE("biWidth = %d\n", bmiHeader
->biWidth
);
296 TRACE("biHeight = %d\n", bmiHeader
->biHeight
);
297 TRACE("biPlanes = %d\n", bmiHeader
->biPlanes
);
298 TRACE("biBitCount = %d\n", bmiHeader
->biBitCount
);
299 TRACE("biCompression = %s\n", debugstr_an((LPSTR
)&(bmiHeader
->biCompression
), 4));
300 TRACE("biSizeImage = %d\n", bmiHeader
->biSizeImage
);
304 if (!This
->WindowPos
.right
|| !This
->WindowPos
.top
)
306 DWORD style
= GetWindowLongW(This
->hWnd
, GWL_STYLE
);
307 DWORD style_ex
= GetWindowLongW(This
->hWnd
, GWL_EXSTYLE
);
309 if (!This
->WindowPos
.right
)
311 This
->WindowPos
.left
= This
->SourceRect
.left
;
312 This
->WindowPos
.right
= This
->SourceRect
.right
;
314 if (!This
->WindowPos
.bottom
)
316 This
->WindowPos
.top
= This
->SourceRect
.top
;
317 This
->WindowPos
.bottom
= This
->SourceRect
.bottom
;
320 AdjustWindowRectEx(&This
->WindowPos
, style
, TRUE
, style_ex
);
322 TRACE("WindowPos: %d %d %d %d\n", This
->WindowPos
.left
, This
->WindowPos
.top
, This
->WindowPos
.right
, This
->WindowPos
.bottom
);
323 SetWindowPos(This
->hWnd
, NULL
,
324 This
->WindowPos
.left
,
326 This
->WindowPos
.right
- This
->WindowPos
.left
,
327 This
->WindowPos
.bottom
- This
->WindowPos
.top
,
328 SWP_NOZORDER
|SWP_NOMOVE
|SWP_DEFERERASE
);
330 GetClientRect(This
->hWnd
, &This
->DestRect
);
333 This
->DestRect
= This
->WindowPos
;
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
);
354 ShowWindow(This
->hWnd
, SW_SHOW
);
359 static HRESULT WINAPI
VideoRenderer_Receive(BaseInputPin
* pin
, IMediaSample
* pSample
)
361 VideoRendererImpl
*This
= (VideoRendererImpl
*)pin
->pin
.pinInfo
.pFilter
;
362 LPBYTE pbSrcStream
= NULL
;
363 LONG cbSrcStream
= 0;
364 REFERENCE_TIME tStart
, tStop
;
367 TRACE("(%p)->(%p)\n", pin
, pSample
);
369 EnterCriticalSection(&This
->filter
.csFilter
);
371 if (This
->pInputPin
->flushing
|| This
->pInputPin
->end_of_stream
)
373 LeaveCriticalSection(&This
->filter
.csFilter
);
377 if (This
->filter
.state
== State_Stopped
)
379 LeaveCriticalSection(&This
->filter
.csFilter
);
380 return VFW_E_WRONG_STATE
;
383 hr
= IMediaSample_GetTime(pSample
, &tStart
, &tStop
);
385 ERR("Cannot get sample time (%x)\n", hr
);
387 MediaSeekingPassThru_RegisterMediaTime(This
->seekthru_unk
, tStart
);
389 if (This
->rtLastStop
!= tStart
&& This
->filter
.state
== State_Running
)
392 delta
= tStart
- This
->rtLastStop
;
393 if ((delta
< -100000 || delta
> 100000) &&
394 IMediaSample_IsDiscontinuity(pSample
) == S_FALSE
)
395 ERR("Unexpected discontinuity: Last: %u.%03u, tStart: %u.%03u\n",
396 (DWORD
)(This
->rtLastStop
/ 10000000),
397 (DWORD
)((This
->rtLastStop
/ 10000)%1000),
398 (DWORD
)(tStart
/ 10000000), (DWORD
)((tStart
/ 10000)%1000));
399 This
->rtLastStop
= tStart
;
402 /* Preroll means the sample isn't shown, this is used for key frames and things like that */
403 if (IMediaSample_IsPreroll(pSample
) == S_OK
)
405 This
->rtLastStop
= tStop
;
406 LeaveCriticalSection(&This
->filter
.csFilter
);
410 hr
= IMediaSample_GetPointer(pSample
, &pbSrcStream
);
413 ERR("Cannot get pointer to sample data (%x)\n", hr
);
414 LeaveCriticalSection(&This
->filter
.csFilter
);
418 cbSrcStream
= IMediaSample_GetActualDataLength(pSample
);
420 TRACE("val %p %d\n", pbSrcStream
, cbSrcStream
);
422 #if 0 /* For debugging purpose */
425 for(i
= 0; i
< cbSrcStream
; i
++)
427 if ((i
!=0) && !(i
%16))
429 TRACE("%02x ", pbSrcStream
[i
]);
435 SetEvent(This
->hEvent
);
436 if (This
->filter
.state
== State_Paused
)
438 This
->sample_held
= pSample
;
439 LeaveCriticalSection(&This
->filter
.csFilter
);
440 WaitForSingleObject(This
->blocked
, INFINITE
);
441 EnterCriticalSection(&This
->filter
.csFilter
);
442 This
->sample_held
= NULL
;
443 if (This
->filter
.state
== State_Paused
)
446 LeaveCriticalSection(&This
->filter
.csFilter
);
449 if (This
->filter
.state
== State_Stopped
)
451 LeaveCriticalSection(&This
->filter
.csFilter
);
452 return VFW_E_WRONG_STATE
;
456 if (This
->filter
.pClock
&& This
->filter
.state
== State_Running
)
458 REFERENCE_TIME time
, trefstart
, trefstop
;
461 /* Perhaps I <SHOULD> use the reference clock AdviseTime function here
462 * I'm not going to! When I tried, it seemed to generate lag and
463 * it caused instability.
465 IReferenceClock_GetTime(This
->filter
.pClock
, &time
);
467 trefstart
= This
->filter
.rtStreamStart
;
468 trefstop
= (REFERENCE_TIME
)((double)(tStop
- tStart
) / This
->pInputPin
->pin
.dRate
) + This
->filter
.rtStreamStart
;
469 delta
= (LONG
)((trefstart
-time
)/10000);
470 This
->filter
.rtStreamStart
= trefstop
;
471 This
->rtLastStop
= tStop
;
475 TRACE("Sleeping for %u ms\n", delta
);
478 else if (time
> trefstop
)
480 TRACE("Dropping sample: Time: %u.%03u ms trefstop: %u.%03u ms!\n",
481 (DWORD
)(time
/ 10000000), (DWORD
)((time
/ 10000)%1000),
482 (DWORD
)(trefstop
/ 10000000), (DWORD
)((trefstop
/ 10000)%1000) );
483 This
->rtLastStop
= tStop
;
484 LeaveCriticalSection(&This
->filter
.csFilter
);
488 This
->rtLastStop
= tStop
;
490 VideoRenderer_SendSampleData(This
, pbSrcStream
, cbSrcStream
);
492 LeaveCriticalSection(&This
->filter
.csFilter
);
496 static HRESULT WINAPI
VideoRenderer_CheckMediaType(BasePin
*iface
, const AM_MEDIA_TYPE
* pmt
)
498 BaseInputPin
* pin
= (BaseInputPin
*)iface
;
499 VideoRendererImpl
*This
= (VideoRendererImpl
*)pin
->pin
.pinInfo
.pFilter
;
501 if (!IsEqualIID(&pmt
->majortype
, &MEDIATYPE_Video
))
504 if (IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB32
) ||
505 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB24
) ||
506 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB565
) ||
507 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB8
))
511 if (IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo
))
513 VIDEOINFOHEADER
*format
= (VIDEOINFOHEADER
*)pmt
->pbFormat
;
514 This
->SourceRect
.left
= 0;
515 This
->SourceRect
.top
= 0;
516 This
->SourceRect
.right
= This
->VideoWidth
= format
->bmiHeader
.biWidth
;
517 height
= format
->bmiHeader
.biHeight
;
519 This
->SourceRect
.bottom
= This
->VideoHeight
= -height
;
521 This
->SourceRect
.bottom
= This
->VideoHeight
= height
;
523 else if (IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo2
))
525 VIDEOINFOHEADER2
*format2
= (VIDEOINFOHEADER2
*)pmt
->pbFormat
;
527 This
->SourceRect
.left
= 0;
528 This
->SourceRect
.top
= 0;
529 This
->SourceRect
.right
= This
->VideoWidth
= format2
->bmiHeader
.biWidth
;
530 height
= format2
->bmiHeader
.biHeight
;
532 This
->SourceRect
.bottom
= This
->VideoHeight
= -height
;
534 This
->SourceRect
.bottom
= This
->VideoHeight
= height
;
538 WARN("Format type %s not supported\n", debugstr_guid(&pmt
->formattype
));
546 static IPin
* WINAPI
VideoRenderer_GetPin(BaseFilter
*iface
, int pos
)
548 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
550 if (pos
>= 1 || pos
< 0)
553 IPin_AddRef((IPin
*)This
->pInputPin
);
554 return (IPin
*)This
->pInputPin
;
557 static LONG WINAPI
VideoRenderer_GetPinCount(BaseFilter
*iface
)
562 static const BaseFilterFuncTable BaseFuncTable
= {
563 VideoRenderer_GetPin
,
564 VideoRenderer_GetPinCount
567 static const BasePinFuncTable input_BaseFuncTable
= {
568 VideoRenderer_CheckMediaType
,
570 BasePinImpl_GetMediaTypeVersion
,
571 BasePinImpl_GetMediaType
574 static const BaseInputPinFuncTable input_BaseInputFuncTable
= {
575 VideoRenderer_Receive
578 HRESULT
VideoRenderer_create(IUnknown
* pUnkOuter
, LPVOID
* ppv
)
582 VideoRendererImpl
* pVideoRenderer
;
583 ISeekingPassThru
*passthru
;
585 TRACE("(%p, %p)\n", pUnkOuter
, ppv
);
589 pVideoRenderer
= CoTaskMemAlloc(sizeof(VideoRendererImpl
));
590 pVideoRenderer
->pUnkOuter
= pUnkOuter
;
591 pVideoRenderer
->bUnkOuterValid
= FALSE
;
592 pVideoRenderer
->bAggregatable
= FALSE
;
593 pVideoRenderer
->IInner_vtbl
= &IInner_VTable
;
594 pVideoRenderer
->IAMFilterMiscFlags_vtbl
= &IAMFilterMiscFlags_Vtbl
;
596 BaseFilter_Init(&pVideoRenderer
->filter
, &VideoRenderer_Vtbl
, &CLSID_VideoRenderer
, (DWORD_PTR
)(__FILE__
": VideoRendererImpl.csFilter"), &BaseFuncTable
);
598 pVideoRenderer
->IBasicVideo_vtbl
= &IBasicVideo_VTable
;
599 pVideoRenderer
->IVideoWindow_vtbl
= &IVideoWindow_VTable
;
601 pVideoRenderer
->init
= 0;
602 pVideoRenderer
->AutoShow
= 1;
603 pVideoRenderer
->rtLastStop
= -1;
604 ZeroMemory(&pVideoRenderer
->SourceRect
, sizeof(RECT
));
605 ZeroMemory(&pVideoRenderer
->DestRect
, sizeof(RECT
));
606 ZeroMemory(&pVideoRenderer
->WindowPos
, sizeof(RECT
));
607 pVideoRenderer
->hWndMsgDrain
= NULL
;
608 pVideoRenderer
->WindowStyle
= WS_OVERLAPPED
;
610 /* construct input pin */
611 piInput
.dir
= PINDIR_INPUT
;
612 piInput
.pFilter
= (IBaseFilter
*)pVideoRenderer
;
613 lstrcpynW(piInput
.achName
, wcsInputPinName
, sizeof(piInput
.achName
) / sizeof(piInput
.achName
[0]));
615 hr
= BaseInputPin_Construct(&VideoRenderer_InputPin_Vtbl
, &piInput
, &input_BaseFuncTable
, &input_BaseInputFuncTable
, &pVideoRenderer
->filter
.csFilter
, NULL
, (IPin
**)&pVideoRenderer
->pInputPin
);
619 hr
= CoCreateInstance(&CLSID_SeekingPassThru
, pUnkOuter
? pUnkOuter
: (IUnknown
*)&pVideoRenderer
->IInner_vtbl
, CLSCTX_INPROC_SERVER
, &IID_IUnknown
, (void**)&pVideoRenderer
->seekthru_unk
);
621 IPin_Release((IPin
*)pVideoRenderer
->pInputPin
);
624 IUnknown_QueryInterface(pVideoRenderer
->seekthru_unk
, &IID_ISeekingPassThru
, (void**)&passthru
);
625 ISeekingPassThru_Init(passthru
, TRUE
, (IPin
*)pVideoRenderer
->pInputPin
);
626 ISeekingPassThru_Release(passthru
);
627 pVideoRenderer
->sample_held
= NULL
;
628 *ppv
= pVideoRenderer
;
633 QualityControlImpl_init(&pVideoRenderer
->qcimpl
, (IPin
*)pVideoRenderer
->pInputPin
, (IBaseFilter
*)pVideoRenderer
);
634 pVideoRenderer
->qcimpl
.lpVtbl
= &VideoRenderer_QualityControl_Vtbl
;
636 if (!CreateRenderingSubsystem(pVideoRenderer
))
639 pVideoRenderer
->blocked
= CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
640 if (!pVideoRenderer
->blocked
)
642 hr
= HRESULT_FROM_WIN32(GetLastError());
643 IUnknown_Release((IUnknown
*)pVideoRenderer
);
648 BaseFilterImpl_Release((IBaseFilter
*)pVideoRenderer
);
649 CoTaskMemFree(pVideoRenderer
);
653 HRESULT
VideoRendererDefault_create(IUnknown
* pUnkOuter
, LPVOID
* ppv
)
655 /* TODO: Attempt to use the VMR-7 renderer instead when possible */
656 return VideoRenderer_create(pUnkOuter
, ppv
);
659 static HRESULT WINAPI
VideoRendererInner_QueryInterface(IUnknown
* iface
, REFIID riid
, LPVOID
* ppv
)
661 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
662 TRACE("(%p/%p)->(%s, %p)\n", This
, iface
, qzdebugstr_guid(riid
), ppv
);
664 if (This
->bAggregatable
)
665 This
->bUnkOuterValid
= TRUE
;
669 if (IsEqualIID(riid
, &IID_IUnknown
))
670 *ppv
= &This
->IInner_vtbl
;
671 else if (IsEqualIID(riid
, &IID_IPersist
))
673 else if (IsEqualIID(riid
, &IID_IMediaFilter
))
675 else if (IsEqualIID(riid
, &IID_IBaseFilter
))
677 else if (IsEqualIID(riid
, &IID_IBasicVideo
))
678 *ppv
= &This
->IBasicVideo_vtbl
;
679 else if (IsEqualIID(riid
, &IID_IVideoWindow
))
680 *ppv
= &This
->IVideoWindow_vtbl
;
681 else if (IsEqualIID(riid
, &IID_IMediaSeeking
))
682 return IUnknown_QueryInterface(This
->seekthru_unk
, riid
, ppv
);
683 else if (IsEqualIID(riid
, &IID_IAMFilterMiscFlags
))
684 *ppv
= &This
->IAMFilterMiscFlags_vtbl
;
685 else if (IsEqualIID(riid
, &IID_IQualityControl
))
686 *ppv
= &This
->qcimpl
;
690 IUnknown_AddRef((IUnknown
*)(*ppv
));
694 if (!IsEqualIID(riid
, &IID_IPin
))
695 FIXME("No interface for %s!\n", qzdebugstr_guid(riid
));
697 return E_NOINTERFACE
;
700 static ULONG WINAPI
VideoRendererInner_AddRef(IUnknown
* iface
)
702 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
703 ULONG refCount
= InterlockedIncrement(&This
->filter
.refCount
);
705 TRACE("(%p/%p)->() AddRef from %d\n", This
, iface
, refCount
- 1);
710 static ULONG WINAPI
VideoRendererInner_Release(IUnknown
* iface
)
712 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
713 ULONG refCount
= InterlockedDecrement(&This
->filter
.refCount
);
715 TRACE("(%p/%p)->() Release from %d\n", This
, iface
, refCount
+ 1);
721 DestroyWindow(This
->hWnd
);
722 PostThreadMessageA(This
->ThreadID
, WM_QUIT
, 0, 0);
723 WaitForSingleObject(This
->hThread
, INFINITE
);
724 CloseHandle(This
->hThread
);
725 CloseHandle(This
->hEvent
);
727 if (SUCCEEDED(IPin_ConnectedTo((IPin
*)This
->pInputPin
, &pConnectedTo
)))
729 IPin_Disconnect(pConnectedTo
);
730 IPin_Release(pConnectedTo
);
732 IPin_Disconnect((IPin
*)This
->pInputPin
);
734 IPin_Release((IPin
*)This
->pInputPin
);
736 This
->filter
.lpVtbl
= NULL
;
737 IUnknown_Release(This
->seekthru_unk
);
738 This
->filter
.csFilter
.DebugInfo
->Spare
[0] = 0;
739 DeleteCriticalSection(&This
->filter
.csFilter
);
741 TRACE("Destroying Video Renderer\n");
750 static const IUnknownVtbl IInner_VTable
=
752 VideoRendererInner_QueryInterface
,
753 VideoRendererInner_AddRef
,
754 VideoRendererInner_Release
757 static HRESULT WINAPI
VideoRenderer_QueryInterface(IBaseFilter
* iface
, REFIID riid
, LPVOID
* ppv
)
759 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
761 if (This
->bAggregatable
)
762 This
->bUnkOuterValid
= TRUE
;
766 if (This
->bAggregatable
)
767 return IUnknown_QueryInterface(This
->pUnkOuter
, riid
, ppv
);
769 if (IsEqualIID(riid
, &IID_IUnknown
))
773 IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
774 hr
= IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
775 IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
776 This
->bAggregatable
= TRUE
;
781 return E_NOINTERFACE
;
784 return IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
787 static ULONG WINAPI
VideoRenderer_AddRef(IBaseFilter
* iface
)
789 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
791 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
792 return IUnknown_AddRef(This
->pUnkOuter
);
793 return IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
796 static ULONG WINAPI
VideoRenderer_Release(IBaseFilter
* iface
)
798 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
800 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
801 return IUnknown_Release(This
->pUnkOuter
);
802 return IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
805 /** IMediaFilter methods **/
807 static HRESULT WINAPI
VideoRenderer_Stop(IBaseFilter
* iface
)
809 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
811 TRACE("(%p/%p)->()\n", This
, iface
);
813 EnterCriticalSection(&This
->filter
.csFilter
);
815 This
->filter
.state
= State_Stopped
;
816 SetEvent(This
->hEvent
);
817 SetEvent(This
->blocked
);
818 MediaSeekingPassThru_ResetMediaTime(This
->seekthru_unk
);
820 LeaveCriticalSection(&This
->filter
.csFilter
);
825 static HRESULT WINAPI
VideoRenderer_Pause(IBaseFilter
* iface
)
827 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
829 TRACE("(%p/%p)->()\n", This
, iface
);
831 EnterCriticalSection(&This
->filter
.csFilter
);
832 if (This
->filter
.state
!= State_Paused
)
834 if (This
->filter
.state
== State_Stopped
)
836 This
->pInputPin
->end_of_stream
= 0;
837 ResetEvent(This
->hEvent
);
840 This
->filter
.state
= State_Paused
;
841 ResetEvent(This
->blocked
);
843 LeaveCriticalSection(&This
->filter
.csFilter
);
848 static HRESULT WINAPI
VideoRenderer_Run(IBaseFilter
* iface
, REFERENCE_TIME tStart
)
851 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
853 TRACE("(%p/%p)->(%s)\n", This
, iface
, wine_dbgstr_longlong(tStart
));
855 EnterCriticalSection(&This
->filter
.csFilter
);
856 if (This
->filter
.state
== State_Running
)
858 if (This
->pInputPin
->pin
.pConnectedTo
)
860 if (This
->filter
.state
== State_Stopped
)
862 This
->pInputPin
->end_of_stream
= 0;
863 ResetEvent(This
->hEvent
);
865 SetEvent(This
->blocked
);
867 This
->filter
.rtStreamStart
= tStart
;
868 This
->filter
.state
= State_Running
;
869 } else if (This
->filter
.filterInfo
.pGraph
) {
870 IMediaEventSink
*pEventSink
;
871 hr
= IFilterGraph_QueryInterface(This
->filter
.filterInfo
.pGraph
, &IID_IMediaEventSink
, (LPVOID
*)&pEventSink
);
874 hr
= IMediaEventSink_Notify(pEventSink
, EC_COMPLETE
, S_OK
, (LONG_PTR
)This
);
875 IMediaEventSink_Release(pEventSink
);
880 This
->filter
.state
= State_Running
;
882 LeaveCriticalSection(&This
->filter
.csFilter
);
887 static HRESULT WINAPI
VideoRenderer_GetState(IBaseFilter
* iface
, DWORD dwMilliSecsTimeout
, FILTER_STATE
*pState
)
889 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
892 TRACE("(%p/%p)->(%d, %p)\n", This
, iface
, dwMilliSecsTimeout
, pState
);
894 if (WaitForSingleObject(This
->hEvent
, dwMilliSecsTimeout
) == WAIT_TIMEOUT
)
895 hr
= VFW_S_STATE_INTERMEDIATE
;
899 BaseFilterImpl_GetState(iface
, dwMilliSecsTimeout
, pState
);
904 /** IBaseFilter implementation **/
906 static HRESULT WINAPI
VideoRenderer_FindPin(IBaseFilter
* iface
, LPCWSTR Id
, IPin
**ppPin
)
908 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
910 FIXME("(%p/%p)->(%p,%p): stub !!!\n", This
, iface
, debugstr_w(Id
), ppPin
);
912 /* FIXME: critical section */
917 static const IBaseFilterVtbl VideoRenderer_Vtbl
=
919 VideoRenderer_QueryInterface
,
920 VideoRenderer_AddRef
,
921 VideoRenderer_Release
,
922 BaseFilterImpl_GetClassID
,
926 VideoRenderer_GetState
,
927 BaseFilterImpl_SetSyncSource
,
928 BaseFilterImpl_GetSyncSource
,
929 BaseFilterImpl_EnumPins
,
930 VideoRenderer_FindPin
,
931 BaseFilterImpl_QueryFilterInfo
,
932 BaseFilterImpl_JoinFilterGraph
,
933 BaseFilterImpl_QueryVendorInfo
936 static HRESULT WINAPI
VideoRenderer_InputPin_EndOfStream(IPin
* iface
)
938 BaseInputPin
* This
= (BaseInputPin
*)iface
;
939 VideoRendererImpl
*pFilter
;
940 IMediaEventSink
* pEventSink
;
943 TRACE("(%p/%p)->()\n", This
, iface
);
945 pFilter
= (VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
;
946 hr
= IFilterGraph_QueryInterface(pFilter
->filter
.filterInfo
.pGraph
, &IID_IMediaEventSink
, (LPVOID
*)&pEventSink
);
949 hr
= IMediaEventSink_Notify(pEventSink
, EC_COMPLETE
, S_OK
, (LONG_PTR
)pFilter
);
950 IMediaEventSink_Release(pEventSink
);
952 MediaSeekingPassThru_EOS(pFilter
->seekthru_unk
);
957 static HRESULT WINAPI
VideoRenderer_InputPin_BeginFlush(IPin
* iface
)
959 BaseInputPin
* This
= (BaseInputPin
*)iface
;
960 VideoRendererImpl
*pVideoRenderer
= (VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
;
963 TRACE("(%p/%p)->()\n", This
, iface
);
965 EnterCriticalSection(This
->pin
.pCritSec
);
966 if (pVideoRenderer
->filter
.state
== State_Paused
)
967 SetEvent(pVideoRenderer
->blocked
);
969 hr
= BaseInputPinImpl_BeginFlush(iface
);
970 LeaveCriticalSection(This
->pin
.pCritSec
);
975 static HRESULT WINAPI
VideoRenderer_InputPin_EndFlush(IPin
* iface
)
977 BaseInputPin
* This
= (BaseInputPin
*)iface
;
978 VideoRendererImpl
*pVideoRenderer
= (VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
;
981 TRACE("(%p/%p)->()\n", This
, iface
);
983 EnterCriticalSection(This
->pin
.pCritSec
);
984 if (pVideoRenderer
->filter
.state
== State_Paused
)
985 ResetEvent(pVideoRenderer
->blocked
);
987 hr
= BaseInputPinImpl_EndFlush(iface
);
988 LeaveCriticalSection(This
->pin
.pCritSec
);
989 MediaSeekingPassThru_ResetMediaTime(pVideoRenderer
->seekthru_unk
);
994 static const IPinVtbl VideoRenderer_InputPin_Vtbl
=
996 BaseInputPinImpl_QueryInterface
,
998 BaseInputPinImpl_Release
,
999 BaseInputPinImpl_Connect
,
1000 BaseInputPinImpl_ReceiveConnection
,
1001 BasePinImpl_Disconnect
,
1002 BasePinImpl_ConnectedTo
,
1003 BasePinImpl_ConnectionMediaType
,
1004 BasePinImpl_QueryPinInfo
,
1005 BasePinImpl_QueryDirection
,
1006 BasePinImpl_QueryId
,
1007 BaseInputPinImpl_QueryAccept
,
1008 BasePinImpl_EnumMediaTypes
,
1009 BasePinImpl_QueryInternalConnections
,
1010 VideoRenderer_InputPin_EndOfStream
,
1011 VideoRenderer_InputPin_BeginFlush
,
1012 VideoRenderer_InputPin_EndFlush
,
1013 BaseInputPinImpl_NewSegment
1016 /*** IUnknown methods ***/
1017 static HRESULT WINAPI
Basicvideo_QueryInterface(IBasicVideo
*iface
,
1020 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1022 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
1024 return VideoRenderer_QueryInterface((IBaseFilter
*)This
, riid
, ppvObj
);
1027 static ULONG WINAPI
Basicvideo_AddRef(IBasicVideo
*iface
) {
1028 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1030 TRACE("(%p/%p)->()\n", This
, iface
);
1032 return VideoRenderer_AddRef((IBaseFilter
*)This
);
1035 static ULONG WINAPI
Basicvideo_Release(IBasicVideo
*iface
) {
1036 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1038 TRACE("(%p/%p)->()\n", This
, iface
);
1040 return VideoRenderer_Release((IBaseFilter
*)This
);
1043 /*** IDispatch methods ***/
1044 static HRESULT WINAPI
Basicvideo_GetTypeInfoCount(IBasicVideo
*iface
,
1046 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1048 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
1053 static HRESULT WINAPI
Basicvideo_GetTypeInfo(IBasicVideo
*iface
,
1056 ITypeInfo
**ppTInfo
) {
1057 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1059 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
1064 static HRESULT WINAPI
Basicvideo_GetIDsOfNames(IBasicVideo
*iface
,
1070 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1072 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1077 static HRESULT WINAPI
Basicvideo_Invoke(IBasicVideo
*iface
,
1078 DISPID dispIdMember
,
1082 DISPPARAMS
*pDispParams
,
1084 EXCEPINFO
*pExepInfo
,
1086 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1088 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
);
1093 /*** IBasicVideo methods ***/
1094 static HRESULT WINAPI
Basicvideo_get_AvgTimePerFrame(IBasicVideo
*iface
,
1095 REFTIME
*pAvgTimePerFrame
) {
1097 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1099 if (!This
->pInputPin
->pin
.pConnectedTo
)
1100 return VFW_E_NOT_CONNECTED
;
1102 TRACE("(%p/%p)->(%p)\n", This
, iface
, pAvgTimePerFrame
);
1104 pmt
= &This
->pInputPin
->pin
.mtCurrent
;
1105 if (IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo
)) {
1106 VIDEOINFOHEADER
*vih
= (VIDEOINFOHEADER
*)pmt
->pbFormat
;
1107 *pAvgTimePerFrame
= vih
->AvgTimePerFrame
;
1108 } else if (IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo2
)) {
1109 VIDEOINFOHEADER2
*vih
= (VIDEOINFOHEADER2
*)pmt
->pbFormat
;
1110 *pAvgTimePerFrame
= vih
->AvgTimePerFrame
;
1112 ERR("Unknown format type %s\n", qzdebugstr_guid(&pmt
->formattype
));
1113 *pAvgTimePerFrame
= 0;
1118 static HRESULT WINAPI
Basicvideo_get_BitRate(IBasicVideo
*iface
,
1120 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1122 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBitRate
);
1127 static HRESULT WINAPI
Basicvideo_get_BitErrorRate(IBasicVideo
*iface
,
1128 LONG
*pBitErrorRate
) {
1129 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1131 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBitErrorRate
);
1136 static HRESULT WINAPI
Basicvideo_get_VideoWidth(IBasicVideo
*iface
,
1137 LONG
*pVideoWidth
) {
1138 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1140 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoWidth
);
1142 *pVideoWidth
= This
->VideoWidth
;
1147 static HRESULT WINAPI
Basicvideo_get_VideoHeight(IBasicVideo
*iface
,
1148 LONG
*pVideoHeight
) {
1149 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1151 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoHeight
);
1153 *pVideoHeight
= This
->VideoHeight
;
1158 static HRESULT WINAPI
Basicvideo_put_SourceLeft(IBasicVideo
*iface
,
1160 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1162 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceLeft
);
1164 This
->SourceRect
.left
= SourceLeft
;
1169 static HRESULT WINAPI
Basicvideo_get_SourceLeft(IBasicVideo
*iface
,
1170 LONG
*pSourceLeft
) {
1171 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1173 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceLeft
);
1175 *pSourceLeft
= This
->SourceRect
.left
;
1180 static HRESULT WINAPI
Basicvideo_put_SourceWidth(IBasicVideo
*iface
,
1182 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1184 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceWidth
);
1186 This
->SourceRect
.right
= This
->SourceRect
.left
+ SourceWidth
;
1191 static HRESULT WINAPI
Basicvideo_get_SourceWidth(IBasicVideo
*iface
,
1192 LONG
*pSourceWidth
) {
1193 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1195 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceWidth
);
1197 *pSourceWidth
= This
->SourceRect
.right
- This
->SourceRect
.left
;
1202 static HRESULT WINAPI
Basicvideo_put_SourceTop(IBasicVideo
*iface
,
1204 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1206 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceTop
);
1208 This
->SourceRect
.top
= SourceTop
;
1213 static HRESULT WINAPI
Basicvideo_get_SourceTop(IBasicVideo
*iface
,
1215 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1217 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceTop
);
1219 *pSourceTop
= This
->SourceRect
.top
;
1224 static HRESULT WINAPI
Basicvideo_put_SourceHeight(IBasicVideo
*iface
,
1225 LONG SourceHeight
) {
1226 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1228 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceHeight
);
1230 This
->SourceRect
.bottom
= This
->SourceRect
.top
+ SourceHeight
;
1235 static HRESULT WINAPI
Basicvideo_get_SourceHeight(IBasicVideo
*iface
,
1236 LONG
*pSourceHeight
) {
1237 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1239 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceHeight
);
1241 *pSourceHeight
= This
->SourceRect
.bottom
- This
->SourceRect
.top
;
1246 static HRESULT WINAPI
Basicvideo_put_DestinationLeft(IBasicVideo
*iface
,
1247 LONG DestinationLeft
) {
1248 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1250 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationLeft
);
1252 This
->DestRect
.left
= DestinationLeft
;
1257 static HRESULT WINAPI
Basicvideo_get_DestinationLeft(IBasicVideo
*iface
,
1258 LONG
*pDestinationLeft
) {
1259 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1261 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationLeft
);
1263 *pDestinationLeft
= This
->DestRect
.left
;
1268 static HRESULT WINAPI
Basicvideo_put_DestinationWidth(IBasicVideo
*iface
,
1269 LONG DestinationWidth
) {
1270 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1272 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationWidth
);
1274 This
->DestRect
.right
= This
->DestRect
.left
+ DestinationWidth
;
1279 static HRESULT WINAPI
Basicvideo_get_DestinationWidth(IBasicVideo
*iface
,
1280 LONG
*pDestinationWidth
) {
1281 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1283 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationWidth
);
1285 *pDestinationWidth
= This
->DestRect
.right
- This
->DestRect
.left
;
1290 static HRESULT WINAPI
Basicvideo_put_DestinationTop(IBasicVideo
*iface
,
1291 LONG DestinationTop
) {
1292 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1294 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationTop
);
1296 This
->DestRect
.top
= DestinationTop
;
1301 static HRESULT WINAPI
Basicvideo_get_DestinationTop(IBasicVideo
*iface
,
1302 LONG
*pDestinationTop
) {
1303 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1305 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationTop
);
1307 *pDestinationTop
= This
->DestRect
.top
;
1312 static HRESULT WINAPI
Basicvideo_put_DestinationHeight(IBasicVideo
*iface
,
1313 LONG DestinationHeight
) {
1314 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1316 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationHeight
);
1318 This
->DestRect
.right
= This
->DestRect
.left
+ DestinationHeight
;
1323 static HRESULT WINAPI
Basicvideo_get_DestinationHeight(IBasicVideo
*iface
,
1324 LONG
*pDestinationHeight
) {
1325 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1327 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationHeight
);
1329 *pDestinationHeight
= This
->DestRect
.right
- This
->DestRect
.left
;
1334 static HRESULT WINAPI
Basicvideo_SetSourcePosition(IBasicVideo
*iface
,
1339 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1341 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This
, iface
, Left
, Top
, Width
, Height
);
1343 This
->SourceRect
.left
= Left
;
1344 This
->SourceRect
.top
= Top
;
1345 This
->SourceRect
.right
= Left
+ Width
;
1346 This
->SourceRect
.bottom
= Top
+ Height
;
1351 static HRESULT WINAPI
Basicvideo_GetSourcePosition(IBasicVideo
*iface
,
1356 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1358 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1360 *pLeft
= This
->SourceRect
.left
;
1361 *pTop
= This
->SourceRect
.top
;
1362 *pWidth
= This
->SourceRect
.right
- This
->SourceRect
.left
;
1363 *pHeight
= This
->SourceRect
.bottom
- This
->SourceRect
.top
;
1368 static HRESULT WINAPI
Basicvideo_SetDefaultSourcePosition(IBasicVideo
*iface
) {
1369 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1371 TRACE("(%p/%p)->()\n", This
, iface
);
1373 This
->SourceRect
.left
= 0;
1374 This
->SourceRect
.top
= 0;
1375 This
->SourceRect
.right
= This
->VideoWidth
;
1376 This
->SourceRect
.bottom
= This
->VideoHeight
;
1381 static HRESULT WINAPI
Basicvideo_SetDestinationPosition(IBasicVideo
*iface
,
1386 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1388 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This
, iface
, Left
, Top
, Width
, Height
);
1390 This
->DestRect
.left
= Left
;
1391 This
->DestRect
.top
= Top
;
1392 This
->DestRect
.right
= Left
+ Width
;
1393 This
->DestRect
.bottom
= Top
+ Height
;
1398 static HRESULT WINAPI
Basicvideo_GetDestinationPosition(IBasicVideo
*iface
,
1403 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1405 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1407 *pLeft
= This
->DestRect
.left
;
1408 *pTop
= This
->DestRect
.top
;
1409 *pWidth
= This
->DestRect
.right
- This
->DestRect
.left
;
1410 *pHeight
= This
->DestRect
.bottom
- This
->DestRect
.top
;
1415 static HRESULT WINAPI
Basicvideo_SetDefaultDestinationPosition(IBasicVideo
*iface
) {
1416 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1419 TRACE("(%p/%p)->()\n", This
, iface
);
1421 if (!GetClientRect(This
->hWnd
, &rect
))
1424 This
->SourceRect
.left
= 0;
1425 This
->SourceRect
.top
= 0;
1426 This
->SourceRect
.right
= rect
.right
;
1427 This
->SourceRect
.bottom
= rect
.bottom
;
1432 static HRESULT WINAPI
Basicvideo_GetVideoSize(IBasicVideo
*iface
,
1435 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1437 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pWidth
, pHeight
);
1439 *pWidth
= This
->VideoWidth
;
1440 *pHeight
= This
->VideoHeight
;
1445 static HRESULT WINAPI
Basicvideo_GetVideoPaletteEntries(IBasicVideo
*iface
,
1450 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1452 FIXME("(%p/%p)->(%d, %d, %p, %p): stub !!!\n", This
, iface
, StartIndex
, Entries
, pRetrieved
, pPalette
);
1457 static HRESULT WINAPI
Basicvideo_GetCurrentImage(IBasicVideo
*iface
,
1460 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1461 BITMAPINFOHEADER
*bmiHeader
;
1463 AM_MEDIA_TYPE
*amt
= &This
->pInputPin
->pin
.mtCurrent
;
1466 FIXME("(%p/%p)->(%p, %p): partial stub\n", This
, iface
, pBufferSize
, pDIBImage
);
1468 EnterCriticalSection(&This
->filter
.csFilter
);
1470 if (!This
->sample_held
)
1472 LeaveCriticalSection(&This
->filter
.csFilter
);
1473 return (This
->filter
.state
== State_Paused
? E_UNEXPECTED
: VFW_E_NOT_PAUSED
);
1476 if (IsEqualIID(&amt
->formattype
, &FORMAT_VideoInfo
))
1478 bmiHeader
= &((VIDEOINFOHEADER
*)amt
->pbFormat
)->bmiHeader
;
1480 else if (IsEqualIID(&amt
->formattype
, &FORMAT_VideoInfo2
))
1482 bmiHeader
= &((VIDEOINFOHEADER2
*)amt
->pbFormat
)->bmiHeader
;
1486 FIXME("Unknown type %s\n", debugstr_guid(&amt
->subtype
));
1487 LeaveCriticalSection(&This
->filter
.csFilter
);
1488 return VFW_E_RUNTIME_ERROR
;
1491 needed_size
= bmiHeader
->biSize
;
1492 needed_size
+= IMediaSample_GetActualDataLength(This
->sample_held
);
1496 *pBufferSize
= needed_size
;
1497 LeaveCriticalSection(&This
->filter
.csFilter
);
1501 if (needed_size
< *pBufferSize
)
1503 ERR("Buffer too small %u/%u\n", needed_size
, *pBufferSize
);
1504 LeaveCriticalSection(&This
->filter
.csFilter
);
1507 *pBufferSize
= needed_size
;
1509 memcpy(pDIBImage
, bmiHeader
, bmiHeader
->biSize
);
1510 IMediaSample_GetPointer(This
->sample_held
, (BYTE
**)&ptr
);
1511 memcpy((char *)pDIBImage
+ bmiHeader
->biSize
, ptr
, IMediaSample_GetActualDataLength(This
->sample_held
));
1513 LeaveCriticalSection(&This
->filter
.csFilter
);
1518 static HRESULT WINAPI
Basicvideo_IsUsingDefaultSource(IBasicVideo
*iface
) {
1519 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1521 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
1526 static HRESULT WINAPI
Basicvideo_IsUsingDefaultDestination(IBasicVideo
*iface
) {
1527 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1529 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
1535 static const IBasicVideoVtbl IBasicVideo_VTable
=
1537 Basicvideo_QueryInterface
,
1540 Basicvideo_GetTypeInfoCount
,
1541 Basicvideo_GetTypeInfo
,
1542 Basicvideo_GetIDsOfNames
,
1544 Basicvideo_get_AvgTimePerFrame
,
1545 Basicvideo_get_BitRate
,
1546 Basicvideo_get_BitErrorRate
,
1547 Basicvideo_get_VideoWidth
,
1548 Basicvideo_get_VideoHeight
,
1549 Basicvideo_put_SourceLeft
,
1550 Basicvideo_get_SourceLeft
,
1551 Basicvideo_put_SourceWidth
,
1552 Basicvideo_get_SourceWidth
,
1553 Basicvideo_put_SourceTop
,
1554 Basicvideo_get_SourceTop
,
1555 Basicvideo_put_SourceHeight
,
1556 Basicvideo_get_SourceHeight
,
1557 Basicvideo_put_DestinationLeft
,
1558 Basicvideo_get_DestinationLeft
,
1559 Basicvideo_put_DestinationWidth
,
1560 Basicvideo_get_DestinationWidth
,
1561 Basicvideo_put_DestinationTop
,
1562 Basicvideo_get_DestinationTop
,
1563 Basicvideo_put_DestinationHeight
,
1564 Basicvideo_get_DestinationHeight
,
1565 Basicvideo_SetSourcePosition
,
1566 Basicvideo_GetSourcePosition
,
1567 Basicvideo_SetDefaultSourcePosition
,
1568 Basicvideo_SetDestinationPosition
,
1569 Basicvideo_GetDestinationPosition
,
1570 Basicvideo_SetDefaultDestinationPosition
,
1571 Basicvideo_GetVideoSize
,
1572 Basicvideo_GetVideoPaletteEntries
,
1573 Basicvideo_GetCurrentImage
,
1574 Basicvideo_IsUsingDefaultSource
,
1575 Basicvideo_IsUsingDefaultDestination
1579 /*** IUnknown methods ***/
1580 static HRESULT WINAPI
Videowindow_QueryInterface(IVideoWindow
*iface
,
1583 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1585 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
1587 return VideoRenderer_QueryInterface((IBaseFilter
*)This
, riid
, ppvObj
);
1590 static ULONG WINAPI
Videowindow_AddRef(IVideoWindow
*iface
) {
1591 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1593 TRACE("(%p/%p)->()\n", This
, iface
);
1595 return VideoRenderer_AddRef((IBaseFilter
*)This
);
1598 static ULONG WINAPI
Videowindow_Release(IVideoWindow
*iface
) {
1599 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1601 TRACE("(%p/%p)->()\n", This
, iface
);
1603 return VideoRenderer_Release((IBaseFilter
*)This
);
1606 /*** IDispatch methods ***/
1607 static HRESULT WINAPI
Videowindow_GetTypeInfoCount(IVideoWindow
*iface
,
1609 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1611 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
1616 static HRESULT WINAPI
Videowindow_GetTypeInfo(IVideoWindow
*iface
,
1619 ITypeInfo
**ppTInfo
) {
1620 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1622 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
1627 static HRESULT WINAPI
Videowindow_GetIDsOfNames(IVideoWindow
*iface
,
1633 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1635 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1640 static HRESULT WINAPI
Videowindow_Invoke(IVideoWindow
*iface
,
1641 DISPID dispIdMember
,
1645 DISPPARAMS
*pDispParams
,
1647 EXCEPINFO
*pExepInfo
,
1649 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1651 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
);
1656 /*** IVideoWindow methods ***/
1657 static HRESULT WINAPI
Videowindow_put_Caption(IVideoWindow
*iface
,
1659 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1661 TRACE("(%p/%p)->(%s (%p))\n", This
, iface
, debugstr_w(strCaption
), strCaption
);
1663 if (!SetWindowTextW(This
->hWnd
, strCaption
))
1669 static HRESULT WINAPI
Videowindow_get_Caption(IVideoWindow
*iface
,
1671 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1673 TRACE("(%p/%p)->(%p)\n", This
, iface
, strCaption
);
1675 GetWindowTextW(This
->hWnd
, (LPWSTR
)strCaption
, 100);
1680 static HRESULT WINAPI
Videowindow_put_WindowStyle(IVideoWindow
*iface
,
1682 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1685 old
= GetWindowLongA(This
->hWnd
, GWL_STYLE
);
1687 TRACE("(%p/%p)->(%x -> %x)\n", This
, iface
, old
, WindowStyle
);
1689 if (WindowStyle
& (WS_DISABLED
|WS_HSCROLL
|WS_ICONIC
|WS_MAXIMIZE
|WS_MINIMIZE
|WS_VSCROLL
))
1690 return E_INVALIDARG
;
1692 SetWindowLongA(This
->hWnd
, GWL_STYLE
, WindowStyle
);
1693 SetWindowPos(This
->hWnd
,0,0,0,0,0,SWP_FRAMECHANGED
|SWP_NOSIZE
|SWP_NOZORDER
);
1694 This
->WindowStyle
= WindowStyle
;
1699 static HRESULT WINAPI
Videowindow_get_WindowStyle(IVideoWindow
*iface
,
1700 LONG
*WindowStyle
) {
1701 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1703 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyle
);
1705 *WindowStyle
= This
->WindowStyle
;
1710 static HRESULT WINAPI
Videowindow_put_WindowStyleEx(IVideoWindow
*iface
,
1711 LONG WindowStyleEx
) {
1712 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1714 TRACE("(%p/%p)->(%d)\n", This
, iface
, WindowStyleEx
);
1716 if (!SetWindowLongA(This
->hWnd
, GWL_EXSTYLE
, WindowStyleEx
))
1722 static HRESULT WINAPI
Videowindow_get_WindowStyleEx(IVideoWindow
*iface
,
1723 LONG
*WindowStyleEx
) {
1724 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1726 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyleEx
);
1728 *WindowStyleEx
= GetWindowLongA(This
->hWnd
, GWL_EXSTYLE
);
1733 static HRESULT WINAPI
Videowindow_put_AutoShow(IVideoWindow
*iface
,
1735 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1737 TRACE("(%p/%p)->(%d)\n", This
, iface
, AutoShow
);
1739 This
->AutoShow
= AutoShow
;
1744 static HRESULT WINAPI
Videowindow_get_AutoShow(IVideoWindow
*iface
,
1746 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1748 TRACE("(%p/%p)->(%p)\n", This
, iface
, AutoShow
);
1750 *AutoShow
= This
->AutoShow
;
1755 static HRESULT WINAPI
Videowindow_put_WindowState(IVideoWindow
*iface
,
1757 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1759 TRACE("(%p/%p)->(%d)\n", This
, iface
, WindowState
);
1760 ShowWindow(This
->hWnd
, WindowState
);
1764 static HRESULT WINAPI
Videowindow_get_WindowState(IVideoWindow
*iface
,
1765 LONG
*WindowState
) {
1766 WINDOWPLACEMENT place
;
1767 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1769 place
.length
= sizeof(place
);
1770 GetWindowPlacement(This
->hWnd
, &place
);
1771 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowState
);
1772 *WindowState
= place
.showCmd
;
1777 static HRESULT WINAPI
Videowindow_put_BackgroundPalette(IVideoWindow
*iface
,
1778 LONG BackgroundPalette
) {
1779 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1781 FIXME("(%p/%p)->(%d): stub !!!\n", This
, iface
, BackgroundPalette
);
1786 static HRESULT WINAPI
Videowindow_get_BackgroundPalette(IVideoWindow
*iface
,
1787 LONG
*pBackgroundPalette
) {
1788 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1790 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBackgroundPalette
);
1795 static HRESULT WINAPI
Videowindow_put_Visible(IVideoWindow
*iface
,
1797 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1799 TRACE("(%p/%p)->(%d)\n", This
, iface
, Visible
);
1801 ShowWindow(This
->hWnd
, Visible
? SW_SHOW
: SW_HIDE
);
1806 static HRESULT WINAPI
Videowindow_get_Visible(IVideoWindow
*iface
,
1808 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1810 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVisible
);
1812 *pVisible
= IsWindowVisible(This
->hWnd
);
1817 static HRESULT WINAPI
Videowindow_put_Left(IVideoWindow
*iface
,
1819 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1821 TRACE("(%p/%p)->(%d)\n", This
, iface
, Left
);
1823 if (!SetWindowPos(This
->hWnd
, NULL
, Left
, This
->WindowPos
.top
, 0, 0, SWP_NOZORDER
|SWP_NOSIZE
))
1826 This
->WindowPos
.left
= Left
;
1831 static HRESULT WINAPI
Videowindow_get_Left(IVideoWindow
*iface
,
1833 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1835 TRACE("(%p/%p)->(%p)\n", This
, iface
, pLeft
);
1837 *pLeft
= This
->WindowPos
.left
;
1842 static HRESULT WINAPI
Videowindow_put_Width(IVideoWindow
*iface
,
1844 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1846 TRACE("(%p/%p)->(%d)\n", This
, iface
, Width
);
1848 if (!SetWindowPos(This
->hWnd
, NULL
, 0, 0, Width
, This
->WindowPos
.bottom
-This
->WindowPos
.top
, SWP_NOZORDER
|SWP_NOMOVE
))
1851 This
->WindowPos
.right
= This
->WindowPos
.left
+ Width
;
1856 static HRESULT WINAPI
Videowindow_get_Width(IVideoWindow
*iface
,
1858 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1860 TRACE("(%p/%p)->(%p)\n", This
, iface
, pWidth
);
1862 *pWidth
= This
->WindowPos
.right
- This
->WindowPos
.left
;
1867 static HRESULT WINAPI
Videowindow_put_Top(IVideoWindow
*iface
,
1869 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1871 TRACE("(%p/%p)->(%d)\n", This
, iface
, Top
);
1873 if (!SetWindowPos(This
->hWnd
, NULL
, This
->WindowPos
.left
, Top
, 0, 0, SWP_NOZORDER
|SWP_NOSIZE
))
1876 This
->WindowPos
.top
= Top
;
1881 static HRESULT WINAPI
Videowindow_get_Top(IVideoWindow
*iface
,
1883 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1885 TRACE("(%p/%p)->(%p)\n", This
, iface
, pTop
);
1887 *pTop
= This
->WindowPos
.top
;
1892 static HRESULT WINAPI
Videowindow_put_Height(IVideoWindow
*iface
,
1894 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1896 TRACE("(%p/%p)->(%d)\n", This
, iface
, Height
);
1898 if (!SetWindowPos(This
->hWnd
, NULL
, 0, 0, This
->WindowPos
.right
-This
->WindowPos
.left
, Height
, SWP_NOZORDER
|SWP_NOMOVE
))
1901 This
->WindowPos
.bottom
= This
->WindowPos
.top
+ Height
;
1906 static HRESULT WINAPI
Videowindow_get_Height(IVideoWindow
*iface
,
1908 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1910 TRACE("(%p/%p)->(%p)\n", This
, iface
, pHeight
);
1912 *pHeight
= This
->WindowPos
.bottom
- This
->WindowPos
.top
;
1917 static HRESULT WINAPI
Videowindow_put_Owner(IVideoWindow
*iface
,
1919 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1921 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Owner
);
1923 SetParent(This
->hWnd
, (HWND
)Owner
);
1924 if (This
->WindowStyle
& WS_CHILD
)
1926 LONG old
= GetWindowLongA(This
->hWnd
, GWL_STYLE
);
1927 if (old
!= This
->WindowStyle
)
1929 SetWindowLongA(This
->hWnd
, GWL_STYLE
, This
->WindowStyle
);
1930 SetWindowPos(This
->hWnd
,0,0,0,0,0,SWP_FRAMECHANGED
|SWP_NOSIZE
|SWP_NOZORDER
);
1937 static HRESULT WINAPI
Videowindow_get_Owner(IVideoWindow
*iface
,
1939 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1941 TRACE("(%p/%p)->(%p)\n", This
, iface
, Owner
);
1943 *(HWND
*)Owner
= GetParent(This
->hWnd
);
1948 static HRESULT WINAPI
Videowindow_put_MessageDrain(IVideoWindow
*iface
,
1950 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1952 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Drain
);
1954 This
->hWndMsgDrain
= (HWND
)Drain
;
1959 static HRESULT WINAPI
Videowindow_get_MessageDrain(IVideoWindow
*iface
,
1961 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1963 TRACE("(%p/%p)->(%p)\n", This
, iface
, Drain
);
1965 *Drain
= (OAHWND
)This
->hWndMsgDrain
;
1970 static HRESULT WINAPI
Videowindow_get_BorderColor(IVideoWindow
*iface
,
1972 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1974 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, Color
);
1979 static HRESULT WINAPI
Videowindow_put_BorderColor(IVideoWindow
*iface
,
1981 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1983 FIXME("(%p/%p)->(%d): stub !!!\n", This
, iface
, Color
);
1988 static HRESULT WINAPI
Videowindow_get_FullScreenMode(IVideoWindow
*iface
,
1989 LONG
*FullScreenMode
) {
1990 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1992 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, FullScreenMode
);
1997 static HRESULT WINAPI
Videowindow_put_FullScreenMode(IVideoWindow
*iface
,
1998 LONG FullScreenMode
) {
1999 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2001 FIXME("(%p/%p)->(%d): stub !!!\n", This
, iface
, FullScreenMode
);
2006 static HRESULT WINAPI
Videowindow_SetWindowForeground(IVideoWindow
*iface
,
2008 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2013 TRACE("(%p/%p)->(%d)\n", This
, iface
, Focus
);
2015 if ((Focus
!= FALSE
) && (Focus
!= TRUE
))
2016 return E_INVALIDARG
;
2018 hr
= IPin_ConnectedTo((IPin
*)This
->pInputPin
, &pPin
);
2019 if ((hr
!= S_OK
) || !pPin
)
2020 return VFW_E_NOT_CONNECTED
;
2023 ret
= SetForegroundWindow(This
->hWnd
);
2025 ret
= SetWindowPos(This
->hWnd
, HWND_TOP
, 0, 0, 0, 0, SWP_NOMOVE
|SWP_NOSIZE
);
2033 static HRESULT WINAPI
Videowindow_NotifyOwnerMessage(IVideoWindow
*iface
,
2038 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2040 TRACE("(%p/%p)->(%08lx, %d, %08lx, %08lx)\n", This
, iface
, hwnd
, uMsg
, wParam
, lParam
);
2042 if (!PostMessageA(This
->hWnd
, uMsg
, wParam
, lParam
))
2048 static HRESULT WINAPI
Videowindow_SetWindowPosition(IVideoWindow
*iface
,
2053 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2055 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This
, iface
, Left
, Top
, Width
, Height
);
2057 if (!SetWindowPos(This
->hWnd
, NULL
, Left
, Top
, Width
, Height
, SWP_NOZORDER
))
2060 This
->WindowPos
.left
= Left
;
2061 This
->WindowPos
.top
= Top
;
2062 This
->WindowPos
.right
= Left
+ Width
;
2063 This
->WindowPos
.bottom
= Top
+ Height
;
2068 static HRESULT WINAPI
Videowindow_GetWindowPosition(IVideoWindow
*iface
,
2073 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2075 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
2077 *pLeft
= This
->WindowPos
.left
;
2078 *pTop
= This
->WindowPos
.top
;
2079 *pWidth
= This
->WindowPos
.right
- This
->WindowPos
.left
;
2080 *pHeight
= This
->WindowPos
.bottom
- This
->WindowPos
.top
;
2085 static HRESULT WINAPI
Videowindow_GetMinIdealImageSize(IVideoWindow
*iface
,
2088 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2090 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This
, iface
, pWidth
, pHeight
);
2092 *pWidth
= This
->VideoWidth
;
2093 *pHeight
= This
->VideoHeight
;
2098 static HRESULT WINAPI
Videowindow_GetMaxIdealImageSize(IVideoWindow
*iface
,
2101 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2103 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This
, iface
, pWidth
, pHeight
);
2105 *pWidth
= This
->VideoWidth
;
2106 *pHeight
= This
->VideoHeight
;
2111 static HRESULT WINAPI
Videowindow_GetRestorePosition(IVideoWindow
*iface
,
2116 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2118 FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
2123 static HRESULT WINAPI
Videowindow_HideCursor(IVideoWindow
*iface
,
2125 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2127 FIXME("(%p/%p)->(%d): stub !!!\n", This
, iface
, HideCursor
);
2132 static HRESULT WINAPI
Videowindow_IsCursorHidden(IVideoWindow
*iface
,
2133 LONG
*CursorHidden
) {
2134 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2136 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, CursorHidden
);
2141 static const IVideoWindowVtbl IVideoWindow_VTable
=
2143 Videowindow_QueryInterface
,
2145 Videowindow_Release
,
2146 Videowindow_GetTypeInfoCount
,
2147 Videowindow_GetTypeInfo
,
2148 Videowindow_GetIDsOfNames
,
2150 Videowindow_put_Caption
,
2151 Videowindow_get_Caption
,
2152 Videowindow_put_WindowStyle
,
2153 Videowindow_get_WindowStyle
,
2154 Videowindow_put_WindowStyleEx
,
2155 Videowindow_get_WindowStyleEx
,
2156 Videowindow_put_AutoShow
,
2157 Videowindow_get_AutoShow
,
2158 Videowindow_put_WindowState
,
2159 Videowindow_get_WindowState
,
2160 Videowindow_put_BackgroundPalette
,
2161 Videowindow_get_BackgroundPalette
,
2162 Videowindow_put_Visible
,
2163 Videowindow_get_Visible
,
2164 Videowindow_put_Left
,
2165 Videowindow_get_Left
,
2166 Videowindow_put_Width
,
2167 Videowindow_get_Width
,
2168 Videowindow_put_Top
,
2169 Videowindow_get_Top
,
2170 Videowindow_put_Height
,
2171 Videowindow_get_Height
,
2172 Videowindow_put_Owner
,
2173 Videowindow_get_Owner
,
2174 Videowindow_put_MessageDrain
,
2175 Videowindow_get_MessageDrain
,
2176 Videowindow_get_BorderColor
,
2177 Videowindow_put_BorderColor
,
2178 Videowindow_get_FullScreenMode
,
2179 Videowindow_put_FullScreenMode
,
2180 Videowindow_SetWindowForeground
,
2181 Videowindow_NotifyOwnerMessage
,
2182 Videowindow_SetWindowPosition
,
2183 Videowindow_GetWindowPosition
,
2184 Videowindow_GetMinIdealImageSize
,
2185 Videowindow_GetMaxIdealImageSize
,
2186 Videowindow_GetRestorePosition
,
2187 Videowindow_HideCursor
,
2188 Videowindow_IsCursorHidden
2191 static VideoRendererImpl
*from_IAMFilterMiscFlags(IAMFilterMiscFlags
*iface
) {
2192 return (VideoRendererImpl
*)((char*)iface
- offsetof(VideoRendererImpl
, IAMFilterMiscFlags_vtbl
));
2195 static HRESULT WINAPI
AMFilterMiscFlags_QueryInterface(IAMFilterMiscFlags
*iface
, const REFIID riid
, void **ppv
) {
2196 VideoRendererImpl
*This
= from_IAMFilterMiscFlags(iface
);
2197 return IUnknown_QueryInterface((IUnknown
*)This
, riid
, ppv
);
2200 static ULONG WINAPI
AMFilterMiscFlags_AddRef(IAMFilterMiscFlags
*iface
) {
2201 VideoRendererImpl
*This
= from_IAMFilterMiscFlags(iface
);
2202 return IUnknown_AddRef((IUnknown
*)This
);
2205 static ULONG WINAPI
AMFilterMiscFlags_Release(IAMFilterMiscFlags
*iface
) {
2206 VideoRendererImpl
*This
= from_IAMFilterMiscFlags(iface
);
2207 return IUnknown_Release((IUnknown
*)This
);
2210 static ULONG WINAPI
AMFilterMiscFlags_GetMiscFlags(IAMFilterMiscFlags
*iface
) {
2211 return AM_FILTER_MISC_FLAGS_IS_RENDERER
;
2214 static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl
= {
2215 AMFilterMiscFlags_QueryInterface
,
2216 AMFilterMiscFlags_AddRef
,
2217 AMFilterMiscFlags_Release
,
2218 AMFilterMiscFlags_GetMiscFlags