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
;
56 typedef struct VideoRendererImpl
59 const IBasicVideoVtbl
* IBasicVideo_vtbl
;
60 const IVideoWindowVtbl
* IVideoWindow_vtbl
;
61 const IUnknownVtbl
* IInner_vtbl
;
62 IUnknown
*seekthru_unk
;
64 BaseInputPin
*pInputPin
;
84 REFERENCE_TIME rtLastStop
;
87 /* During pause we can hold a single sample, for use in GetCurrentImage */
88 IMediaSample
*sample_held
;
91 static LRESULT CALLBACK
VideoWndProcA(HWND hwnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
93 VideoRendererImpl
* pVideoRenderer
= (VideoRendererImpl
*)GetWindowLongPtrW(hwnd
, 0);
94 LPRECT lprect
= (LPRECT
)lParam
;
96 if (pVideoRenderer
&& pVideoRenderer
->hWndMsgDrain
)
102 case WM_LBUTTONDBLCLK
:
105 case WM_MBUTTONDBLCLK
:
108 case WM_MOUSEACTIVATE
:
110 case WM_NCLBUTTONDBLCLK
:
111 case WM_NCLBUTTONDOWN
:
113 case WM_NCMBUTTONDBLCLK
:
114 case WM_NCMBUTTONDOWN
:
117 case WM_NCRBUTTONDBLCLK
:
118 case WM_NCRBUTTONDOWN
:
120 case WM_RBUTTONDBLCLK
:
123 PostMessageA(pVideoRenderer
->hWndMsgDrain
, uMsg
, wParam
, lParam
);
133 /* TRACE("WM_SIZING %d %d %d %d\n", lprect->left, lprect->top, lprect->right, lprect->bottom); */
134 SetWindowPos(hwnd
, NULL
, lprect
->left
, lprect
->top
, lprect
->right
- lprect
->left
, lprect
->bottom
- lprect
->top
, SWP_NOZORDER
);
135 GetClientRect(hwnd
, &pVideoRenderer
->DestRect
);
136 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
137 pVideoRenderer
->DestRect
.left
,
138 pVideoRenderer
->DestRect
.top
,
139 pVideoRenderer
->DestRect
.right
- pVideoRenderer
->DestRect
.left
,
140 pVideoRenderer
->DestRect
.bottom
- pVideoRenderer
->DestRect
.top
);
143 TRACE("WM_SIZE %d %d\n", LOWORD(lParam
), HIWORD(lParam
));
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 return DefWindowProcA(hwnd
, uMsg
, wParam
, lParam
);
157 static BOOL
CreateRenderingWindow(VideoRendererImpl
* This
)
161 TRACE("(%p)->()\n", This
);
164 winclass
.lpfnWndProc
= VideoWndProcA
;
165 winclass
.cbClsExtra
= 0;
166 winclass
.cbWndExtra
= sizeof(VideoRendererImpl
*);
167 winclass
.hInstance
= NULL
;
168 winclass
.hIcon
= NULL
;
169 winclass
.hCursor
= NULL
;
170 winclass
.hbrBackground
= GetStockObject(BLACK_BRUSH
);
171 winclass
.lpszMenuName
= NULL
;
172 winclass
.lpszClassName
= "Wine ActiveMovie Class";
174 if (!wnd_class_registered
)
176 if (!RegisterClassA(&winclass
))
178 ERR("Unable to register window %u\n", GetLastError());
181 wnd_class_registered
= TRUE
;
184 This
->hWnd
= CreateWindowExA(0, "Wine ActiveMovie Class", "Wine ActiveMovie Window", WS_SIZEBOX
,
185 CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
, NULL
,
190 ERR("Unable to create window\n");
194 SetWindowLongPtrW(This
->hWnd
, 0, (LONG_PTR
)This
);
199 static DWORD WINAPI
MessageLoop(LPVOID lpParameter
)
201 VideoRendererImpl
* This
= lpParameter
;
205 TRACE("Starting message loop\n");
207 if (!CreateRenderingWindow(This
))
209 This
->ThreadResult
= FALSE
;
210 SetEvent(This
->hEvent
);
214 This
->ThreadResult
= TRUE
;
215 SetEvent(This
->hEvent
);
217 while ((fGotMessage
= GetMessageA(&msg
, NULL
, 0, 0)) != 0 && fGotMessage
!= -1)
219 TranslateMessage(&msg
);
220 DispatchMessageA(&msg
);
223 TRACE("End of message loop\n");
228 static BOOL
CreateRenderingSubsystem(VideoRendererImpl
* This
)
230 This
->hEvent
= CreateEventW(NULL
, TRUE
, FALSE
, NULL
);
234 This
->hThread
= CreateThread(NULL
, 0, MessageLoop
, This
, 0, &This
->ThreadID
);
237 CloseHandle(This
->hEvent
);
241 WaitForSingleObject(This
->hEvent
, INFINITE
);
243 if (!This
->ThreadResult
)
245 CloseHandle(This
->hEvent
);
246 CloseHandle(This
->hThread
);
253 static DWORD
VideoRenderer_SendSampleData(VideoRendererImpl
* This
, LPBYTE data
, DWORD size
)
259 BITMAPINFOHEADER
*bmiHeader
;
261 TRACE("(%p)->(%p, %d)\n", This
, data
, size
);
263 sdesc
.dwSize
= sizeof(sdesc
);
264 hr
= IPin_ConnectionMediaType((IPin
*)This
->pInputPin
, &amt
);
266 ERR("Unable to retrieve media type\n");
270 if (IsEqualIID(&amt
.formattype
, &FORMAT_VideoInfo
))
272 bmiHeader
= &((VIDEOINFOHEADER
*)amt
.pbFormat
)->bmiHeader
;
274 else if (IsEqualIID(&amt
.formattype
, &FORMAT_VideoInfo2
))
276 bmiHeader
= &((VIDEOINFOHEADER2
*)amt
.pbFormat
)->bmiHeader
;
280 FIXME("Unknown type %s\n", debugstr_guid(&amt
.subtype
));
281 return VFW_E_RUNTIME_ERROR
;
284 TRACE("biSize = %d\n", bmiHeader
->biSize
);
285 TRACE("biWidth = %d\n", bmiHeader
->biWidth
);
286 TRACE("biHeight = %d\n", bmiHeader
->biHeight
);
287 TRACE("biPlanes = %d\n", bmiHeader
->biPlanes
);
288 TRACE("biBitCount = %d\n", bmiHeader
->biBitCount
);
289 TRACE("biCompression = %s\n", debugstr_an((LPSTR
)&(bmiHeader
->biCompression
), 4));
290 TRACE("biSizeImage = %d\n", bmiHeader
->biSizeImage
);
294 if (!This
->WindowPos
.right
|| !This
->WindowPos
.top
)
296 DWORD style
= GetWindowLongW(This
->hWnd
, GWL_STYLE
);
297 DWORD style_ex
= GetWindowLongW(This
->hWnd
, GWL_EXSTYLE
);
299 if (!This
->WindowPos
.right
)
301 This
->WindowPos
.left
= This
->SourceRect
.left
;
302 This
->WindowPos
.right
= This
->SourceRect
.right
;
304 if (!This
->WindowPos
.bottom
)
306 This
->WindowPos
.top
= This
->SourceRect
.top
;
307 This
->WindowPos
.bottom
= This
->SourceRect
.bottom
;
310 AdjustWindowRectEx(&This
->WindowPos
, style
, TRUE
, style_ex
);
312 TRACE("WindowPos: %d %d %d %d\n", This
->WindowPos
.left
, This
->WindowPos
.top
, This
->WindowPos
.right
, This
->WindowPos
.bottom
);
313 SetWindowPos(This
->hWnd
, NULL
,
314 This
->WindowPos
.left
,
316 This
->WindowPos
.right
- This
->WindowPos
.left
,
317 This
->WindowPos
.bottom
- This
->WindowPos
.top
,
318 SWP_NOZORDER
|SWP_NOMOVE
|SWP_DEFERERASE
);
320 GetClientRect(This
->hWnd
, &This
->DestRect
);
323 This
->DestRect
= This
->WindowPos
;
327 hDC
= GetDC(This
->hWnd
);
330 ERR("Cannot get DC from window!\n");
334 TRACE("Src Rect: %d %d %d %d\n", This
->SourceRect
.left
, This
->SourceRect
.top
, This
->SourceRect
.right
, This
->SourceRect
.bottom
);
335 TRACE("Dst Rect: %d %d %d %d\n", This
->DestRect
.left
, This
->DestRect
.top
, This
->DestRect
.right
, This
->DestRect
.bottom
);
337 StretchDIBits(hDC
, This
->DestRect
.left
, This
->DestRect
.top
, This
->DestRect
.right
-This
->DestRect
.left
,
338 This
->DestRect
.bottom
- This
->DestRect
.top
, This
->SourceRect
.left
, This
->SourceRect
.top
,
339 This
->SourceRect
.right
- This
->SourceRect
.left
, This
->SourceRect
.bottom
- This
->SourceRect
.top
,
340 data
, (BITMAPINFO
*)bmiHeader
, DIB_RGB_COLORS
, SRCCOPY
);
342 ReleaseDC(This
->hWnd
, hDC
);
344 ShowWindow(This
->hWnd
, SW_SHOW
);
349 static HRESULT WINAPI
VideoRenderer_Receive(BaseInputPin
* pin
, IMediaSample
* pSample
)
351 VideoRendererImpl
*This
= (VideoRendererImpl
*)pin
->pin
.pinInfo
.pFilter
;
352 LPBYTE pbSrcStream
= NULL
;
353 LONG cbSrcStream
= 0;
354 REFERENCE_TIME tStart
, tStop
;
357 TRACE("(%p)->(%p)\n", pin
, pSample
);
359 EnterCriticalSection(&This
->filter
.csFilter
);
361 if (This
->pInputPin
->flushing
|| This
->pInputPin
->end_of_stream
)
363 LeaveCriticalSection(&This
->filter
.csFilter
);
367 if (This
->filter
.state
== State_Stopped
)
369 LeaveCriticalSection(&This
->filter
.csFilter
);
370 return VFW_E_WRONG_STATE
;
373 hr
= IMediaSample_GetTime(pSample
, &tStart
, &tStop
);
375 ERR("Cannot get sample time (%x)\n", hr
);
377 MediaSeekingPassThru_RegisterMediaTime(This
->seekthru_unk
, tStart
);
379 if (This
->rtLastStop
!= tStart
&& This
->filter
.state
== State_Running
)
382 delta
= tStart
- This
->rtLastStop
;
383 if ((delta
< -100000 || delta
> 100000) &&
384 IMediaSample_IsDiscontinuity(pSample
) == S_FALSE
)
385 ERR("Unexpected discontinuity: Last: %u.%03u, tStart: %u.%03u\n",
386 (DWORD
)(This
->rtLastStop
/ 10000000),
387 (DWORD
)((This
->rtLastStop
/ 10000)%1000),
388 (DWORD
)(tStart
/ 10000000), (DWORD
)((tStart
/ 10000)%1000));
389 This
->rtLastStop
= tStart
;
392 /* Preroll means the sample isn't shown, this is used for key frames and things like that */
393 if (IMediaSample_IsPreroll(pSample
) == S_OK
)
395 This
->rtLastStop
= tStop
;
396 LeaveCriticalSection(&This
->filter
.csFilter
);
400 hr
= IMediaSample_GetPointer(pSample
, &pbSrcStream
);
403 ERR("Cannot get pointer to sample data (%x)\n", hr
);
404 LeaveCriticalSection(&This
->filter
.csFilter
);
408 cbSrcStream
= IMediaSample_GetActualDataLength(pSample
);
410 TRACE("val %p %d\n", pbSrcStream
, cbSrcStream
);
412 #if 0 /* For debugging purpose */
415 for(i
= 0; i
< cbSrcStream
; i
++)
417 if ((i
!=0) && !(i
%16))
419 TRACE("%02x ", pbSrcStream
[i
]);
425 SetEvent(This
->hEvent
);
426 if (This
->filter
.state
== State_Paused
)
428 This
->sample_held
= pSample
;
429 LeaveCriticalSection(&This
->filter
.csFilter
);
430 WaitForSingleObject(This
->blocked
, INFINITE
);
431 EnterCriticalSection(&This
->filter
.csFilter
);
432 This
->sample_held
= NULL
;
433 if (This
->filter
.state
== State_Paused
)
436 LeaveCriticalSection(&This
->filter
.csFilter
);
439 if (This
->filter
.state
== State_Stopped
)
441 LeaveCriticalSection(&This
->filter
.csFilter
);
442 return VFW_E_WRONG_STATE
;
446 if (This
->filter
.pClock
&& This
->filter
.state
== State_Running
)
448 REFERENCE_TIME time
, trefstart
, trefstop
;
451 /* Perhaps I <SHOULD> use the reference clock AdviseTime function here
452 * I'm not going to! When I tried, it seemed to generate lag and
453 * it caused instability.
455 IReferenceClock_GetTime(This
->filter
.pClock
, &time
);
457 trefstart
= This
->filter
.rtStreamStart
;
458 trefstop
= (REFERENCE_TIME
)((double)(tStop
- tStart
) / This
->pInputPin
->dRate
) + This
->filter
.rtStreamStart
;
459 delta
= (LONG
)((trefstart
-time
)/10000);
460 This
->filter
.rtStreamStart
= trefstop
;
461 This
->rtLastStop
= tStop
;
465 TRACE("Sleeping for %u ms\n", delta
);
468 else if (time
> trefstop
)
470 TRACE("Dropping sample: Time: %u.%03u ms trefstop: %u.%03u ms!\n",
471 (DWORD
)(time
/ 10000000), (DWORD
)((time
/ 10000)%1000),
472 (DWORD
)(trefstop
/ 10000000), (DWORD
)((trefstop
/ 10000)%1000) );
473 This
->rtLastStop
= tStop
;
474 LeaveCriticalSection(&This
->filter
.csFilter
);
478 This
->rtLastStop
= tStop
;
480 VideoRenderer_SendSampleData(This
, pbSrcStream
, cbSrcStream
);
482 LeaveCriticalSection(&This
->filter
.csFilter
);
486 static HRESULT WINAPI
VideoRenderer_CheckMediaType(BasePin
*iface
, const AM_MEDIA_TYPE
* pmt
)
488 BaseInputPin
* pin
= (BaseInputPin
*)iface
;
489 VideoRendererImpl
*This
= (VideoRendererImpl
*)pin
->pin
.pinInfo
.pFilter
;
491 if (!IsEqualIID(&pmt
->majortype
, &MEDIATYPE_Video
))
494 if (IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB32
) ||
495 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB24
) ||
496 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB565
) ||
497 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB8
))
501 if (IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo
))
503 VIDEOINFOHEADER
*format
= (VIDEOINFOHEADER
*)pmt
->pbFormat
;
504 This
->SourceRect
.left
= 0;
505 This
->SourceRect
.top
= 0;
506 This
->SourceRect
.right
= This
->VideoWidth
= format
->bmiHeader
.biWidth
;
507 height
= format
->bmiHeader
.biHeight
;
509 This
->SourceRect
.bottom
= This
->VideoHeight
= -height
;
511 This
->SourceRect
.bottom
= This
->VideoHeight
= height
;
513 else if (IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo2
))
515 VIDEOINFOHEADER2
*format2
= (VIDEOINFOHEADER2
*)pmt
->pbFormat
;
517 This
->SourceRect
.left
= 0;
518 This
->SourceRect
.top
= 0;
519 This
->SourceRect
.right
= This
->VideoWidth
= format2
->bmiHeader
.biWidth
;
520 height
= format2
->bmiHeader
.biHeight
;
522 This
->SourceRect
.bottom
= This
->VideoHeight
= -height
;
524 This
->SourceRect
.bottom
= This
->VideoHeight
= height
;
528 WARN("Format type %s not supported\n", debugstr_guid(&pmt
->formattype
));
536 static IPin
* WINAPI
VideoRenderer_GetPin(BaseFilter
*iface
, int pos
)
538 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
540 if (pos
>= 1 || pos
< 0)
543 IPin_AddRef((IPin
*)This
->pInputPin
);
544 return (IPin
*)This
->pInputPin
;
547 static LONG WINAPI
VideoRenderer_GetPinCount(BaseFilter
*iface
)
552 static const BaseFilterFuncTable BaseFuncTable
= {
553 VideoRenderer_GetPin
,
554 VideoRenderer_GetPinCount
557 static const BasePinFuncTable input_BaseFuncTable
= {
558 VideoRenderer_CheckMediaType
,
560 BasePinImpl_GetMediaTypeVersion
,
561 BasePinImpl_GetMediaType
564 static const BaseInputPinFuncTable input_BaseInputFuncTable
= {
565 VideoRenderer_Receive
568 HRESULT
VideoRenderer_create(IUnknown
* pUnkOuter
, LPVOID
* ppv
)
572 VideoRendererImpl
* pVideoRenderer
;
573 ISeekingPassThru
*passthru
;
575 TRACE("(%p, %p)\n", pUnkOuter
, ppv
);
579 pVideoRenderer
= CoTaskMemAlloc(sizeof(VideoRendererImpl
));
580 pVideoRenderer
->pUnkOuter
= pUnkOuter
;
581 pVideoRenderer
->bUnkOuterValid
= FALSE
;
582 pVideoRenderer
->bAggregatable
= FALSE
;
583 pVideoRenderer
->IInner_vtbl
= &IInner_VTable
;
585 BaseFilter_Init(&pVideoRenderer
->filter
, &VideoRenderer_Vtbl
, &CLSID_VideoRenderer
, (DWORD_PTR
)(__FILE__
": VideoRendererImpl.csFilter"), &BaseFuncTable
);
587 pVideoRenderer
->IBasicVideo_vtbl
= &IBasicVideo_VTable
;
588 pVideoRenderer
->IVideoWindow_vtbl
= &IVideoWindow_VTable
;
590 pVideoRenderer
->init
= 0;
591 pVideoRenderer
->AutoShow
= 1;
592 pVideoRenderer
->rtLastStop
= -1;
593 ZeroMemory(&pVideoRenderer
->SourceRect
, sizeof(RECT
));
594 ZeroMemory(&pVideoRenderer
->DestRect
, sizeof(RECT
));
595 ZeroMemory(&pVideoRenderer
->WindowPos
, sizeof(RECT
));
596 pVideoRenderer
->hWndMsgDrain
= NULL
;
597 pVideoRenderer
->WindowStyle
= WS_OVERLAPPED
;
599 /* construct input pin */
600 piInput
.dir
= PINDIR_INPUT
;
601 piInput
.pFilter
= (IBaseFilter
*)pVideoRenderer
;
602 lstrcpynW(piInput
.achName
, wcsInputPinName
, sizeof(piInput
.achName
) / sizeof(piInput
.achName
[0]));
604 hr
= BaseInputPin_Construct(&VideoRenderer_InputPin_Vtbl
, &piInput
, &input_BaseFuncTable
, &input_BaseInputFuncTable
, &pVideoRenderer
->filter
.csFilter
, NULL
, (IPin
**)&pVideoRenderer
->pInputPin
);
608 hr
= CoCreateInstance(&CLSID_SeekingPassThru
, pUnkOuter
? pUnkOuter
: (IUnknown
*)&pVideoRenderer
->IInner_vtbl
, CLSCTX_INPROC_SERVER
, &IID_IUnknown
, (void**)&pVideoRenderer
->seekthru_unk
);
610 IPin_Release((IPin
*)pVideoRenderer
->pInputPin
);
613 IUnknown_QueryInterface(pVideoRenderer
->seekthru_unk
, &IID_ISeekingPassThru
, (void**)&passthru
);
614 ISeekingPassThru_Init(passthru
, TRUE
, (IPin
*)pVideoRenderer
->pInputPin
);
615 ISeekingPassThru_Release(passthru
);
616 pVideoRenderer
->sample_held
= NULL
;
617 *ppv
= pVideoRenderer
;
622 if (!CreateRenderingSubsystem(pVideoRenderer
))
625 pVideoRenderer
->blocked
= CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
626 if (!pVideoRenderer
->blocked
)
628 hr
= HRESULT_FROM_WIN32(GetLastError());
629 IUnknown_Release((IUnknown
*)pVideoRenderer
);
634 BaseFilterImpl_Release((IBaseFilter
*)pVideoRenderer
);
635 CoTaskMemFree(pVideoRenderer
);
639 HRESULT
VideoRendererDefault_create(IUnknown
* pUnkOuter
, LPVOID
* ppv
)
641 /* TODO: Attempt to use the VMR-7 renderer instead when possible */
642 return VideoRenderer_create(pUnkOuter
, ppv
);
645 static HRESULT WINAPI
VideoRendererInner_QueryInterface(IUnknown
* iface
, REFIID riid
, LPVOID
* ppv
)
647 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
648 TRACE("(%p/%p)->(%s, %p)\n", This
, iface
, qzdebugstr_guid(riid
), ppv
);
650 if (This
->bAggregatable
)
651 This
->bUnkOuterValid
= TRUE
;
655 if (IsEqualIID(riid
, &IID_IUnknown
))
656 *ppv
= &This
->IInner_vtbl
;
657 else if (IsEqualIID(riid
, &IID_IPersist
))
659 else if (IsEqualIID(riid
, &IID_IMediaFilter
))
661 else if (IsEqualIID(riid
, &IID_IBaseFilter
))
663 else if (IsEqualIID(riid
, &IID_IBasicVideo
))
664 *ppv
= &This
->IBasicVideo_vtbl
;
665 else if (IsEqualIID(riid
, &IID_IVideoWindow
))
666 *ppv
= &This
->IVideoWindow_vtbl
;
667 else if (IsEqualIID(riid
, &IID_IMediaSeeking
))
668 return IUnknown_QueryInterface(This
->seekthru_unk
, riid
, ppv
);
672 IUnknown_AddRef((IUnknown
*)(*ppv
));
676 if (!IsEqualIID(riid
, &IID_IPin
))
677 FIXME("No interface for %s!\n", qzdebugstr_guid(riid
));
679 return E_NOINTERFACE
;
682 static ULONG WINAPI
VideoRendererInner_AddRef(IUnknown
* iface
)
684 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
685 ULONG refCount
= InterlockedIncrement(&This
->filter
.refCount
);
687 TRACE("(%p/%p)->() AddRef from %d\n", This
, iface
, refCount
- 1);
692 static ULONG WINAPI
VideoRendererInner_Release(IUnknown
* iface
)
694 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
695 ULONG refCount
= InterlockedDecrement(&This
->filter
.refCount
);
697 TRACE("(%p/%p)->() Release from %d\n", This
, iface
, refCount
+ 1);
703 DestroyWindow(This
->hWnd
);
704 PostThreadMessageA(This
->ThreadID
, WM_QUIT
, 0, 0);
705 WaitForSingleObject(This
->hThread
, INFINITE
);
706 CloseHandle(This
->hThread
);
707 CloseHandle(This
->hEvent
);
709 if (SUCCEEDED(IPin_ConnectedTo((IPin
*)This
->pInputPin
, &pConnectedTo
)))
711 IPin_Disconnect(pConnectedTo
);
712 IPin_Release(pConnectedTo
);
714 IPin_Disconnect((IPin
*)This
->pInputPin
);
716 IPin_Release((IPin
*)This
->pInputPin
);
718 This
->filter
.lpVtbl
= NULL
;
719 IUnknown_Release(This
->seekthru_unk
);
720 This
->filter
.csFilter
.DebugInfo
->Spare
[0] = 0;
721 DeleteCriticalSection(&This
->filter
.csFilter
);
723 TRACE("Destroying Video Renderer\n");
732 static const IUnknownVtbl IInner_VTable
=
734 VideoRendererInner_QueryInterface
,
735 VideoRendererInner_AddRef
,
736 VideoRendererInner_Release
739 static HRESULT WINAPI
VideoRenderer_QueryInterface(IBaseFilter
* iface
, REFIID riid
, LPVOID
* ppv
)
741 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
743 if (This
->bAggregatable
)
744 This
->bUnkOuterValid
= TRUE
;
748 if (This
->bAggregatable
)
749 return IUnknown_QueryInterface(This
->pUnkOuter
, riid
, ppv
);
751 if (IsEqualIID(riid
, &IID_IUnknown
))
755 IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
756 hr
= IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
757 IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
758 This
->bAggregatable
= TRUE
;
763 return E_NOINTERFACE
;
766 return IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
769 static ULONG WINAPI
VideoRenderer_AddRef(IBaseFilter
* iface
)
771 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
773 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
774 return IUnknown_AddRef(This
->pUnkOuter
);
775 return IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
778 static ULONG WINAPI
VideoRenderer_Release(IBaseFilter
* iface
)
780 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
782 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
783 return IUnknown_Release(This
->pUnkOuter
);
784 return IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
787 /** IMediaFilter methods **/
789 static HRESULT WINAPI
VideoRenderer_Stop(IBaseFilter
* iface
)
791 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
793 TRACE("(%p/%p)->()\n", This
, iface
);
795 EnterCriticalSection(&This
->filter
.csFilter
);
797 This
->filter
.state
= State_Stopped
;
798 SetEvent(This
->hEvent
);
799 SetEvent(This
->blocked
);
800 MediaSeekingPassThru_ResetMediaTime(This
->seekthru_unk
);
802 LeaveCriticalSection(&This
->filter
.csFilter
);
807 static HRESULT WINAPI
VideoRenderer_Pause(IBaseFilter
* iface
)
809 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
811 TRACE("(%p/%p)->()\n", This
, iface
);
813 EnterCriticalSection(&This
->filter
.csFilter
);
814 if (This
->filter
.state
!= State_Paused
)
816 if (This
->filter
.state
== State_Stopped
)
818 This
->pInputPin
->end_of_stream
= 0;
819 ResetEvent(This
->hEvent
);
822 This
->filter
.state
= State_Paused
;
823 ResetEvent(This
->blocked
);
825 LeaveCriticalSection(&This
->filter
.csFilter
);
830 static HRESULT WINAPI
VideoRenderer_Run(IBaseFilter
* iface
, REFERENCE_TIME tStart
)
832 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
834 TRACE("(%p/%p)->(%s)\n", This
, iface
, wine_dbgstr_longlong(tStart
));
836 EnterCriticalSection(&This
->filter
.csFilter
);
837 if (This
->filter
.state
!= State_Running
)
839 if (This
->filter
.state
== State_Stopped
)
841 This
->pInputPin
->end_of_stream
= 0;
842 ResetEvent(This
->hEvent
);
844 SetEvent(This
->blocked
);
846 This
->filter
.rtStreamStart
= tStart
;
847 This
->filter
.state
= State_Running
;
849 LeaveCriticalSection(&This
->filter
.csFilter
);
854 static HRESULT WINAPI
VideoRenderer_GetState(IBaseFilter
* iface
, DWORD dwMilliSecsTimeout
, FILTER_STATE
*pState
)
856 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
859 TRACE("(%p/%p)->(%d, %p)\n", This
, iface
, dwMilliSecsTimeout
, pState
);
861 if (WaitForSingleObject(This
->hEvent
, dwMilliSecsTimeout
) == WAIT_TIMEOUT
)
862 hr
= VFW_S_STATE_INTERMEDIATE
;
866 BaseFilterImpl_GetState(iface
, dwMilliSecsTimeout
, pState
);
871 /** IBaseFilter implementation **/
873 static HRESULT WINAPI
VideoRenderer_FindPin(IBaseFilter
* iface
, LPCWSTR Id
, IPin
**ppPin
)
875 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
877 FIXME("(%p/%p)->(%p,%p): stub !!!\n", This
, iface
, debugstr_w(Id
), ppPin
);
879 /* FIXME: critical section */
884 static const IBaseFilterVtbl VideoRenderer_Vtbl
=
886 VideoRenderer_QueryInterface
,
887 VideoRenderer_AddRef
,
888 VideoRenderer_Release
,
889 BaseFilterImpl_GetClassID
,
893 VideoRenderer_GetState
,
894 BaseFilterImpl_SetSyncSource
,
895 BaseFilterImpl_GetSyncSource
,
896 BaseFilterImpl_EnumPins
,
897 VideoRenderer_FindPin
,
898 BaseFilterImpl_QueryFilterInfo
,
899 BaseFilterImpl_JoinFilterGraph
,
900 BaseFilterImpl_QueryVendorInfo
903 static HRESULT WINAPI
VideoRenderer_InputPin_EndOfStream(IPin
* iface
)
905 BaseInputPin
* This
= (BaseInputPin
*)iface
;
906 VideoRendererImpl
*pFilter
;
907 IMediaEventSink
* pEventSink
;
910 TRACE("(%p/%p)->()\n", This
, iface
);
912 pFilter
= (VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
;
913 hr
= IFilterGraph_QueryInterface(pFilter
->filter
.filterInfo
.pGraph
, &IID_IMediaEventSink
, (LPVOID
*)&pEventSink
);
916 hr
= IMediaEventSink_Notify(pEventSink
, EC_COMPLETE
, S_OK
, 0);
917 IMediaEventSink_Release(pEventSink
);
919 MediaSeekingPassThru_EOS(pFilter
->seekthru_unk
);
924 static HRESULT WINAPI
VideoRenderer_InputPin_BeginFlush(IPin
* iface
)
926 BaseInputPin
* This
= (BaseInputPin
*)iface
;
927 VideoRendererImpl
*pVideoRenderer
= (VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
;
930 TRACE("(%p/%p)->()\n", This
, iface
);
932 EnterCriticalSection(This
->pin
.pCritSec
);
933 if (pVideoRenderer
->filter
.state
== State_Paused
)
934 SetEvent(pVideoRenderer
->blocked
);
936 hr
= BaseInputPinImpl_BeginFlush(iface
);
937 LeaveCriticalSection(This
->pin
.pCritSec
);
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
);
954 hr
= BaseInputPinImpl_EndFlush(iface
);
955 LeaveCriticalSection(This
->pin
.pCritSec
);
956 MediaSeekingPassThru_ResetMediaTime(pVideoRenderer
->seekthru_unk
);
961 static const IPinVtbl VideoRenderer_InputPin_Vtbl
=
963 BaseInputPinImpl_QueryInterface
,
965 BaseInputPinImpl_Release
,
966 BaseInputPinImpl_Connect
,
967 BaseInputPinImpl_ReceiveConnection
,
968 BasePinImpl_Disconnect
,
969 BasePinImpl_ConnectedTo
,
970 BasePinImpl_ConnectionMediaType
,
971 BasePinImpl_QueryPinInfo
,
972 BasePinImpl_QueryDirection
,
974 BaseInputPinImpl_QueryAccept
,
975 BasePinImpl_EnumMediaTypes
,
976 BasePinImpl_QueryInternalConnections
,
977 VideoRenderer_InputPin_EndOfStream
,
978 VideoRenderer_InputPin_BeginFlush
,
979 VideoRenderer_InputPin_EndFlush
,
980 BaseInputPinImpl_NewSegment
983 /*** IUnknown methods ***/
984 static HRESULT WINAPI
Basicvideo_QueryInterface(IBasicVideo
*iface
,
987 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
989 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
991 return VideoRenderer_QueryInterface((IBaseFilter
*)This
, riid
, ppvObj
);
994 static ULONG WINAPI
Basicvideo_AddRef(IBasicVideo
*iface
) {
995 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
997 TRACE("(%p/%p)->()\n", This
, iface
);
999 return VideoRenderer_AddRef((IBaseFilter
*)This
);
1002 static ULONG WINAPI
Basicvideo_Release(IBasicVideo
*iface
) {
1003 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1005 TRACE("(%p/%p)->()\n", This
, iface
);
1007 return VideoRenderer_Release((IBaseFilter
*)This
);
1010 /*** IDispatch methods ***/
1011 static HRESULT WINAPI
Basicvideo_GetTypeInfoCount(IBasicVideo
*iface
,
1013 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1015 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
1020 static HRESULT WINAPI
Basicvideo_GetTypeInfo(IBasicVideo
*iface
,
1023 ITypeInfo
**ppTInfo
) {
1024 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1026 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
1031 static HRESULT WINAPI
Basicvideo_GetIDsOfNames(IBasicVideo
*iface
,
1037 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1039 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1044 static HRESULT WINAPI
Basicvideo_Invoke(IBasicVideo
*iface
,
1045 DISPID dispIdMember
,
1049 DISPPARAMS
*pDispParams
,
1051 EXCEPINFO
*pExepInfo
,
1053 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1055 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
);
1060 /*** IBasicVideo methods ***/
1061 static HRESULT WINAPI
Basicvideo_get_AvgTimePerFrame(IBasicVideo
*iface
,
1062 REFTIME
*pAvgTimePerFrame
) {
1064 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1066 if (!This
->pInputPin
->pin
.pConnectedTo
)
1067 return VFW_E_NOT_CONNECTED
;
1069 TRACE("(%p/%p)->(%p)\n", This
, iface
, pAvgTimePerFrame
);
1071 pmt
= &This
->pInputPin
->pin
.mtCurrent
;
1072 if (IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo
)) {
1073 VIDEOINFOHEADER
*vih
= (VIDEOINFOHEADER
*)pmt
->pbFormat
;
1074 *pAvgTimePerFrame
= vih
->AvgTimePerFrame
;
1075 } else if (IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo2
)) {
1076 VIDEOINFOHEADER2
*vih
= (VIDEOINFOHEADER2
*)pmt
->pbFormat
;
1077 *pAvgTimePerFrame
= vih
->AvgTimePerFrame
;
1079 ERR("Unknown format type %s\n", qzdebugstr_guid(&pmt
->formattype
));
1080 *pAvgTimePerFrame
= 0;
1085 static HRESULT WINAPI
Basicvideo_get_BitRate(IBasicVideo
*iface
,
1087 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1089 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBitRate
);
1094 static HRESULT WINAPI
Basicvideo_get_BitErrorRate(IBasicVideo
*iface
,
1095 LONG
*pBitErrorRate
) {
1096 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1098 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBitErrorRate
);
1103 static HRESULT WINAPI
Basicvideo_get_VideoWidth(IBasicVideo
*iface
,
1104 LONG
*pVideoWidth
) {
1105 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1107 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoWidth
);
1109 *pVideoWidth
= This
->VideoWidth
;
1114 static HRESULT WINAPI
Basicvideo_get_VideoHeight(IBasicVideo
*iface
,
1115 LONG
*pVideoHeight
) {
1116 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1118 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoHeight
);
1120 *pVideoHeight
= This
->VideoHeight
;
1125 static HRESULT WINAPI
Basicvideo_put_SourceLeft(IBasicVideo
*iface
,
1127 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1129 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceLeft
);
1131 This
->SourceRect
.left
= SourceLeft
;
1136 static HRESULT WINAPI
Basicvideo_get_SourceLeft(IBasicVideo
*iface
,
1137 LONG
*pSourceLeft
) {
1138 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1140 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceLeft
);
1142 *pSourceLeft
= This
->SourceRect
.left
;
1147 static HRESULT WINAPI
Basicvideo_put_SourceWidth(IBasicVideo
*iface
,
1149 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1151 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceWidth
);
1153 This
->SourceRect
.right
= This
->SourceRect
.left
+ SourceWidth
;
1158 static HRESULT WINAPI
Basicvideo_get_SourceWidth(IBasicVideo
*iface
,
1159 LONG
*pSourceWidth
) {
1160 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1162 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceWidth
);
1164 *pSourceWidth
= This
->SourceRect
.right
- This
->SourceRect
.left
;
1169 static HRESULT WINAPI
Basicvideo_put_SourceTop(IBasicVideo
*iface
,
1171 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1173 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceTop
);
1175 This
->SourceRect
.top
= SourceTop
;
1180 static HRESULT WINAPI
Basicvideo_get_SourceTop(IBasicVideo
*iface
,
1182 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1184 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceTop
);
1186 *pSourceTop
= This
->SourceRect
.top
;
1191 static HRESULT WINAPI
Basicvideo_put_SourceHeight(IBasicVideo
*iface
,
1192 LONG SourceHeight
) {
1193 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1195 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceHeight
);
1197 This
->SourceRect
.bottom
= This
->SourceRect
.top
+ SourceHeight
;
1202 static HRESULT WINAPI
Basicvideo_get_SourceHeight(IBasicVideo
*iface
,
1203 LONG
*pSourceHeight
) {
1204 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1206 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceHeight
);
1208 *pSourceHeight
= This
->SourceRect
.bottom
- This
->SourceRect
.top
;
1213 static HRESULT WINAPI
Basicvideo_put_DestinationLeft(IBasicVideo
*iface
,
1214 LONG DestinationLeft
) {
1215 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1217 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationLeft
);
1219 This
->DestRect
.left
= DestinationLeft
;
1224 static HRESULT WINAPI
Basicvideo_get_DestinationLeft(IBasicVideo
*iface
,
1225 LONG
*pDestinationLeft
) {
1226 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1228 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationLeft
);
1230 *pDestinationLeft
= This
->DestRect
.left
;
1235 static HRESULT WINAPI
Basicvideo_put_DestinationWidth(IBasicVideo
*iface
,
1236 LONG DestinationWidth
) {
1237 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1239 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationWidth
);
1241 This
->DestRect
.right
= This
->DestRect
.left
+ DestinationWidth
;
1246 static HRESULT WINAPI
Basicvideo_get_DestinationWidth(IBasicVideo
*iface
,
1247 LONG
*pDestinationWidth
) {
1248 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1250 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationWidth
);
1252 *pDestinationWidth
= This
->DestRect
.right
- This
->DestRect
.left
;
1257 static HRESULT WINAPI
Basicvideo_put_DestinationTop(IBasicVideo
*iface
,
1258 LONG DestinationTop
) {
1259 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1261 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationTop
);
1263 This
->DestRect
.top
= DestinationTop
;
1268 static HRESULT WINAPI
Basicvideo_get_DestinationTop(IBasicVideo
*iface
,
1269 LONG
*pDestinationTop
) {
1270 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1272 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationTop
);
1274 *pDestinationTop
= This
->DestRect
.top
;
1279 static HRESULT WINAPI
Basicvideo_put_DestinationHeight(IBasicVideo
*iface
,
1280 LONG DestinationHeight
) {
1281 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1283 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationHeight
);
1285 This
->DestRect
.right
= This
->DestRect
.left
+ DestinationHeight
;
1290 static HRESULT WINAPI
Basicvideo_get_DestinationHeight(IBasicVideo
*iface
,
1291 LONG
*pDestinationHeight
) {
1292 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1294 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationHeight
);
1296 *pDestinationHeight
= This
->DestRect
.right
- This
->DestRect
.left
;
1301 static HRESULT WINAPI
Basicvideo_SetSourcePosition(IBasicVideo
*iface
,
1306 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1308 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This
, iface
, Left
, Top
, Width
, Height
);
1310 This
->SourceRect
.left
= Left
;
1311 This
->SourceRect
.top
= Top
;
1312 This
->SourceRect
.right
= Left
+ Width
;
1313 This
->SourceRect
.bottom
= Top
+ Height
;
1318 static HRESULT WINAPI
Basicvideo_GetSourcePosition(IBasicVideo
*iface
,
1323 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1325 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1327 *pLeft
= This
->SourceRect
.left
;
1328 *pTop
= This
->SourceRect
.top
;
1329 *pWidth
= This
->SourceRect
.right
- This
->SourceRect
.left
;
1330 *pHeight
= This
->SourceRect
.bottom
- This
->SourceRect
.top
;
1335 static HRESULT WINAPI
Basicvideo_SetDefaultSourcePosition(IBasicVideo
*iface
) {
1336 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1338 TRACE("(%p/%p)->()\n", This
, iface
);
1340 This
->SourceRect
.left
= 0;
1341 This
->SourceRect
.top
= 0;
1342 This
->SourceRect
.right
= This
->VideoWidth
;
1343 This
->SourceRect
.bottom
= This
->VideoHeight
;
1348 static HRESULT WINAPI
Basicvideo_SetDestinationPosition(IBasicVideo
*iface
,
1353 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1355 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This
, iface
, Left
, Top
, Width
, Height
);
1357 This
->DestRect
.left
= Left
;
1358 This
->DestRect
.top
= Top
;
1359 This
->DestRect
.right
= Left
+ Width
;
1360 This
->DestRect
.bottom
= Top
+ Height
;
1365 static HRESULT WINAPI
Basicvideo_GetDestinationPosition(IBasicVideo
*iface
,
1370 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1372 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1374 *pLeft
= This
->DestRect
.left
;
1375 *pTop
= This
->DestRect
.top
;
1376 *pWidth
= This
->DestRect
.right
- This
->DestRect
.left
;
1377 *pHeight
= This
->DestRect
.bottom
- This
->DestRect
.top
;
1382 static HRESULT WINAPI
Basicvideo_SetDefaultDestinationPosition(IBasicVideo
*iface
) {
1383 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1386 TRACE("(%p/%p)->()\n", This
, iface
);
1388 if (!GetClientRect(This
->hWnd
, &rect
))
1391 This
->SourceRect
.left
= 0;
1392 This
->SourceRect
.top
= 0;
1393 This
->SourceRect
.right
= rect
.right
;
1394 This
->SourceRect
.bottom
= rect
.bottom
;
1399 static HRESULT WINAPI
Basicvideo_GetVideoSize(IBasicVideo
*iface
,
1402 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1404 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pWidth
, pHeight
);
1406 *pWidth
= This
->VideoWidth
;
1407 *pHeight
= This
->VideoHeight
;
1412 static HRESULT WINAPI
Basicvideo_GetVideoPaletteEntries(IBasicVideo
*iface
,
1417 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1419 FIXME("(%p/%p)->(%d, %d, %p, %p): stub !!!\n", This
, iface
, StartIndex
, Entries
, pRetrieved
, pPalette
);
1424 static HRESULT WINAPI
Basicvideo_GetCurrentImage(IBasicVideo
*iface
,
1427 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1428 BITMAPINFOHEADER
*bmiHeader
;
1430 AM_MEDIA_TYPE
*amt
= &This
->pInputPin
->pin
.mtCurrent
;
1433 FIXME("(%p/%p)->(%p, %p): partial stub\n", This
, iface
, pBufferSize
, pDIBImage
);
1435 EnterCriticalSection(&This
->filter
.csFilter
);
1437 if (!This
->sample_held
)
1439 LeaveCriticalSection(&This
->filter
.csFilter
);
1440 return (This
->filter
.state
== State_Paused
? E_UNEXPECTED
: VFW_E_NOT_PAUSED
);
1443 if (IsEqualIID(&amt
->formattype
, &FORMAT_VideoInfo
))
1445 bmiHeader
= &((VIDEOINFOHEADER
*)amt
->pbFormat
)->bmiHeader
;
1447 else if (IsEqualIID(&amt
->formattype
, &FORMAT_VideoInfo2
))
1449 bmiHeader
= &((VIDEOINFOHEADER2
*)amt
->pbFormat
)->bmiHeader
;
1453 FIXME("Unknown type %s\n", debugstr_guid(&amt
->subtype
));
1454 LeaveCriticalSection(&This
->filter
.csFilter
);
1455 return VFW_E_RUNTIME_ERROR
;
1458 needed_size
= bmiHeader
->biSize
;
1459 needed_size
+= IMediaSample_GetActualDataLength(This
->sample_held
);
1463 *pBufferSize
= needed_size
;
1464 LeaveCriticalSection(&This
->filter
.csFilter
);
1468 if (needed_size
< *pBufferSize
)
1470 ERR("Buffer too small %u/%u\n", needed_size
, *pBufferSize
);
1471 LeaveCriticalSection(&This
->filter
.csFilter
);
1474 *pBufferSize
= needed_size
;
1476 memcpy(pDIBImage
, bmiHeader
, bmiHeader
->biSize
);
1477 IMediaSample_GetPointer(This
->sample_held
, (BYTE
**)&ptr
);
1478 memcpy((char *)pDIBImage
+ bmiHeader
->biSize
, ptr
, IMediaSample_GetActualDataLength(This
->sample_held
));
1480 LeaveCriticalSection(&This
->filter
.csFilter
);
1485 static HRESULT WINAPI
Basicvideo_IsUsingDefaultSource(IBasicVideo
*iface
) {
1486 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1488 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
1493 static HRESULT WINAPI
Basicvideo_IsUsingDefaultDestination(IBasicVideo
*iface
) {
1494 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1496 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
1502 static const IBasicVideoVtbl IBasicVideo_VTable
=
1504 Basicvideo_QueryInterface
,
1507 Basicvideo_GetTypeInfoCount
,
1508 Basicvideo_GetTypeInfo
,
1509 Basicvideo_GetIDsOfNames
,
1511 Basicvideo_get_AvgTimePerFrame
,
1512 Basicvideo_get_BitRate
,
1513 Basicvideo_get_BitErrorRate
,
1514 Basicvideo_get_VideoWidth
,
1515 Basicvideo_get_VideoHeight
,
1516 Basicvideo_put_SourceLeft
,
1517 Basicvideo_get_SourceLeft
,
1518 Basicvideo_put_SourceWidth
,
1519 Basicvideo_get_SourceWidth
,
1520 Basicvideo_put_SourceTop
,
1521 Basicvideo_get_SourceTop
,
1522 Basicvideo_put_SourceHeight
,
1523 Basicvideo_get_SourceHeight
,
1524 Basicvideo_put_DestinationLeft
,
1525 Basicvideo_get_DestinationLeft
,
1526 Basicvideo_put_DestinationWidth
,
1527 Basicvideo_get_DestinationWidth
,
1528 Basicvideo_put_DestinationTop
,
1529 Basicvideo_get_DestinationTop
,
1530 Basicvideo_put_DestinationHeight
,
1531 Basicvideo_get_DestinationHeight
,
1532 Basicvideo_SetSourcePosition
,
1533 Basicvideo_GetSourcePosition
,
1534 Basicvideo_SetDefaultSourcePosition
,
1535 Basicvideo_SetDestinationPosition
,
1536 Basicvideo_GetDestinationPosition
,
1537 Basicvideo_SetDefaultDestinationPosition
,
1538 Basicvideo_GetVideoSize
,
1539 Basicvideo_GetVideoPaletteEntries
,
1540 Basicvideo_GetCurrentImage
,
1541 Basicvideo_IsUsingDefaultSource
,
1542 Basicvideo_IsUsingDefaultDestination
1546 /*** IUnknown methods ***/
1547 static HRESULT WINAPI
Videowindow_QueryInterface(IVideoWindow
*iface
,
1550 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1552 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
1554 return VideoRenderer_QueryInterface((IBaseFilter
*)This
, riid
, ppvObj
);
1557 static ULONG WINAPI
Videowindow_AddRef(IVideoWindow
*iface
) {
1558 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1560 TRACE("(%p/%p)->()\n", This
, iface
);
1562 return VideoRenderer_AddRef((IBaseFilter
*)This
);
1565 static ULONG WINAPI
Videowindow_Release(IVideoWindow
*iface
) {
1566 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1568 TRACE("(%p/%p)->()\n", This
, iface
);
1570 return VideoRenderer_Release((IBaseFilter
*)This
);
1573 /*** IDispatch methods ***/
1574 static HRESULT WINAPI
Videowindow_GetTypeInfoCount(IVideoWindow
*iface
,
1576 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1578 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
1583 static HRESULT WINAPI
Videowindow_GetTypeInfo(IVideoWindow
*iface
,
1586 ITypeInfo
**ppTInfo
) {
1587 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1589 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
1594 static HRESULT WINAPI
Videowindow_GetIDsOfNames(IVideoWindow
*iface
,
1600 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1602 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1607 static HRESULT WINAPI
Videowindow_Invoke(IVideoWindow
*iface
,
1608 DISPID dispIdMember
,
1612 DISPPARAMS
*pDispParams
,
1614 EXCEPINFO
*pExepInfo
,
1616 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1618 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
);
1623 /*** IVideoWindow methods ***/
1624 static HRESULT WINAPI
Videowindow_put_Caption(IVideoWindow
*iface
,
1626 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1628 TRACE("(%p/%p)->(%s (%p))\n", This
, iface
, debugstr_w(strCaption
), strCaption
);
1630 if (!SetWindowTextW(This
->hWnd
, strCaption
))
1636 static HRESULT WINAPI
Videowindow_get_Caption(IVideoWindow
*iface
,
1638 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1640 TRACE("(%p/%p)->(%p)\n", This
, iface
, strCaption
);
1642 GetWindowTextW(This
->hWnd
, (LPWSTR
)strCaption
, 100);
1647 static HRESULT WINAPI
Videowindow_put_WindowStyle(IVideoWindow
*iface
,
1649 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1652 old
= GetWindowLongA(This
->hWnd
, GWL_STYLE
);
1654 TRACE("(%p/%p)->(%x -> %x)\n", This
, iface
, old
, WindowStyle
);
1656 if (WindowStyle
& (WS_DISABLED
|WS_HSCROLL
|WS_ICONIC
|WS_MAXIMIZE
|WS_MINIMIZE
|WS_VSCROLL
))
1657 return E_INVALIDARG
;
1659 SetWindowLongA(This
->hWnd
, GWL_STYLE
, WindowStyle
);
1660 SetWindowPos(This
->hWnd
,0,0,0,0,0,SWP_FRAMECHANGED
|SWP_NOSIZE
|SWP_NOZORDER
);
1661 This
->WindowStyle
= WindowStyle
;
1666 static HRESULT WINAPI
Videowindow_get_WindowStyle(IVideoWindow
*iface
,
1667 LONG
*WindowStyle
) {
1668 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1670 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyle
);
1672 *WindowStyle
= This
->WindowStyle
;
1677 static HRESULT WINAPI
Videowindow_put_WindowStyleEx(IVideoWindow
*iface
,
1678 LONG WindowStyleEx
) {
1679 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1681 TRACE("(%p/%p)->(%d)\n", This
, iface
, WindowStyleEx
);
1683 if (!SetWindowLongA(This
->hWnd
, GWL_EXSTYLE
, WindowStyleEx
))
1689 static HRESULT WINAPI
Videowindow_get_WindowStyleEx(IVideoWindow
*iface
,
1690 LONG
*WindowStyleEx
) {
1691 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1693 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyleEx
);
1695 *WindowStyleEx
= GetWindowLongA(This
->hWnd
, GWL_EXSTYLE
);
1700 static HRESULT WINAPI
Videowindow_put_AutoShow(IVideoWindow
*iface
,
1702 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1704 TRACE("(%p/%p)->(%d)\n", This
, iface
, AutoShow
);
1706 This
->AutoShow
= AutoShow
;
1711 static HRESULT WINAPI
Videowindow_get_AutoShow(IVideoWindow
*iface
,
1713 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1715 TRACE("(%p/%p)->(%p)\n", This
, iface
, AutoShow
);
1717 *AutoShow
= This
->AutoShow
;
1722 static HRESULT WINAPI
Videowindow_put_WindowState(IVideoWindow
*iface
,
1724 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1726 TRACE("(%p/%p)->(%d)\n", This
, iface
, WindowState
);
1727 ShowWindow(This
->hWnd
, WindowState
);
1731 static HRESULT WINAPI
Videowindow_get_WindowState(IVideoWindow
*iface
,
1732 LONG
*WindowState
) {
1733 WINDOWPLACEMENT place
;
1734 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1736 place
.length
= sizeof(place
);
1737 GetWindowPlacement(This
->hWnd
, &place
);
1738 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowState
);
1739 *WindowState
= place
.showCmd
;
1744 static HRESULT WINAPI
Videowindow_put_BackgroundPalette(IVideoWindow
*iface
,
1745 LONG BackgroundPalette
) {
1746 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1748 FIXME("(%p/%p)->(%d): stub !!!\n", This
, iface
, BackgroundPalette
);
1753 static HRESULT WINAPI
Videowindow_get_BackgroundPalette(IVideoWindow
*iface
,
1754 LONG
*pBackgroundPalette
) {
1755 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1757 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBackgroundPalette
);
1762 static HRESULT WINAPI
Videowindow_put_Visible(IVideoWindow
*iface
,
1764 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1766 TRACE("(%p/%p)->(%d)\n", This
, iface
, Visible
);
1768 ShowWindow(This
->hWnd
, Visible
? SW_SHOW
: SW_HIDE
);
1773 static HRESULT WINAPI
Videowindow_get_Visible(IVideoWindow
*iface
,
1775 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1777 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVisible
);
1779 *pVisible
= IsWindowVisible(This
->hWnd
);
1784 static HRESULT WINAPI
Videowindow_put_Left(IVideoWindow
*iface
,
1786 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1788 TRACE("(%p/%p)->(%d)\n", This
, iface
, Left
);
1790 if (!SetWindowPos(This
->hWnd
, NULL
, Left
, This
->WindowPos
.top
, 0, 0, SWP_NOZORDER
|SWP_NOSIZE
))
1793 This
->WindowPos
.left
= Left
;
1798 static HRESULT WINAPI
Videowindow_get_Left(IVideoWindow
*iface
,
1800 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1802 TRACE("(%p/%p)->(%p)\n", This
, iface
, pLeft
);
1804 *pLeft
= This
->WindowPos
.left
;
1809 static HRESULT WINAPI
Videowindow_put_Width(IVideoWindow
*iface
,
1811 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1813 TRACE("(%p/%p)->(%d)\n", This
, iface
, Width
);
1815 if (!SetWindowPos(This
->hWnd
, NULL
, 0, 0, Width
, This
->WindowPos
.bottom
-This
->WindowPos
.top
, SWP_NOZORDER
|SWP_NOMOVE
))
1818 This
->WindowPos
.right
= This
->WindowPos
.left
+ Width
;
1823 static HRESULT WINAPI
Videowindow_get_Width(IVideoWindow
*iface
,
1825 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1827 TRACE("(%p/%p)->(%p)\n", This
, iface
, pWidth
);
1829 *pWidth
= This
->WindowPos
.right
- This
->WindowPos
.left
;
1834 static HRESULT WINAPI
Videowindow_put_Top(IVideoWindow
*iface
,
1836 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1838 TRACE("(%p/%p)->(%d)\n", This
, iface
, Top
);
1840 if (!SetWindowPos(This
->hWnd
, NULL
, This
->WindowPos
.left
, Top
, 0, 0, SWP_NOZORDER
|SWP_NOSIZE
))
1843 This
->WindowPos
.top
= Top
;
1848 static HRESULT WINAPI
Videowindow_get_Top(IVideoWindow
*iface
,
1850 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1852 TRACE("(%p/%p)->(%p)\n", This
, iface
, pTop
);
1854 *pTop
= This
->WindowPos
.top
;
1859 static HRESULT WINAPI
Videowindow_put_Height(IVideoWindow
*iface
,
1861 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1863 TRACE("(%p/%p)->(%d)\n", This
, iface
, Height
);
1865 if (!SetWindowPos(This
->hWnd
, NULL
, 0, 0, This
->WindowPos
.right
-This
->WindowPos
.left
, Height
, SWP_NOZORDER
|SWP_NOMOVE
))
1868 This
->WindowPos
.bottom
= This
->WindowPos
.top
+ Height
;
1873 static HRESULT WINAPI
Videowindow_get_Height(IVideoWindow
*iface
,
1875 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1877 TRACE("(%p/%p)->(%p)\n", This
, iface
, pHeight
);
1879 *pHeight
= This
->WindowPos
.bottom
- This
->WindowPos
.top
;
1884 static HRESULT WINAPI
Videowindow_put_Owner(IVideoWindow
*iface
,
1886 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1888 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Owner
);
1890 SetParent(This
->hWnd
, (HWND
)Owner
);
1891 if (This
->WindowStyle
& WS_CHILD
)
1893 LONG old
= GetWindowLongA(This
->hWnd
, GWL_STYLE
);
1894 if (old
!= This
->WindowStyle
)
1896 SetWindowLongA(This
->hWnd
, GWL_STYLE
, This
->WindowStyle
);
1897 SetWindowPos(This
->hWnd
,0,0,0,0,0,SWP_FRAMECHANGED
|SWP_NOSIZE
|SWP_NOZORDER
);
1904 static HRESULT WINAPI
Videowindow_get_Owner(IVideoWindow
*iface
,
1906 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1908 TRACE("(%p/%p)->(%p)\n", This
, iface
, Owner
);
1910 *(HWND
*)Owner
= GetParent(This
->hWnd
);
1915 static HRESULT WINAPI
Videowindow_put_MessageDrain(IVideoWindow
*iface
,
1917 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1919 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Drain
);
1921 This
->hWndMsgDrain
= (HWND
)Drain
;
1926 static HRESULT WINAPI
Videowindow_get_MessageDrain(IVideoWindow
*iface
,
1928 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1930 TRACE("(%p/%p)->(%p)\n", This
, iface
, Drain
);
1932 *Drain
= (OAHWND
)This
->hWndMsgDrain
;
1937 static HRESULT WINAPI
Videowindow_get_BorderColor(IVideoWindow
*iface
,
1939 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1941 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, Color
);
1946 static HRESULT WINAPI
Videowindow_put_BorderColor(IVideoWindow
*iface
,
1948 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1950 FIXME("(%p/%p)->(%d): stub !!!\n", This
, iface
, Color
);
1955 static HRESULT WINAPI
Videowindow_get_FullScreenMode(IVideoWindow
*iface
,
1956 LONG
*FullScreenMode
) {
1957 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1959 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, FullScreenMode
);
1964 static HRESULT WINAPI
Videowindow_put_FullScreenMode(IVideoWindow
*iface
,
1965 LONG FullScreenMode
) {
1966 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1968 FIXME("(%p/%p)->(%d): stub !!!\n", This
, iface
, FullScreenMode
);
1973 static HRESULT WINAPI
Videowindow_SetWindowForeground(IVideoWindow
*iface
,
1975 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1980 TRACE("(%p/%p)->(%d)\n", This
, iface
, Focus
);
1982 if ((Focus
!= FALSE
) && (Focus
!= TRUE
))
1983 return E_INVALIDARG
;
1985 hr
= IPin_ConnectedTo((IPin
*)This
->pInputPin
, &pPin
);
1986 if ((hr
!= S_OK
) || !pPin
)
1987 return VFW_E_NOT_CONNECTED
;
1990 ret
= SetForegroundWindow(This
->hWnd
);
1992 ret
= SetWindowPos(This
->hWnd
, HWND_TOP
, 0, 0, 0, 0, SWP_NOMOVE
|SWP_NOSIZE
);
2000 static HRESULT WINAPI
Videowindow_NotifyOwnerMessage(IVideoWindow
*iface
,
2005 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2007 TRACE("(%p/%p)->(%08lx, %d, %08lx, %08lx)\n", This
, iface
, hwnd
, uMsg
, wParam
, lParam
);
2009 if (!PostMessageA(This
->hWnd
, uMsg
, wParam
, lParam
))
2015 static HRESULT WINAPI
Videowindow_SetWindowPosition(IVideoWindow
*iface
,
2020 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2022 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This
, iface
, Left
, Top
, Width
, Height
);
2024 if (!SetWindowPos(This
->hWnd
, NULL
, Left
, Top
, Width
, Height
, SWP_NOZORDER
))
2027 This
->WindowPos
.left
= Left
;
2028 This
->WindowPos
.top
= Top
;
2029 This
->WindowPos
.right
= Left
+ Width
;
2030 This
->WindowPos
.bottom
= Top
+ Height
;
2035 static HRESULT WINAPI
Videowindow_GetWindowPosition(IVideoWindow
*iface
,
2040 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2042 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
2044 *pLeft
= This
->WindowPos
.left
;
2045 *pTop
= This
->WindowPos
.top
;
2046 *pWidth
= This
->WindowPos
.right
- This
->WindowPos
.left
;
2047 *pHeight
= This
->WindowPos
.bottom
- This
->WindowPos
.top
;
2052 static HRESULT WINAPI
Videowindow_GetMinIdealImageSize(IVideoWindow
*iface
,
2055 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2057 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This
, iface
, pWidth
, pHeight
);
2059 *pWidth
= This
->VideoWidth
;
2060 *pHeight
= This
->VideoHeight
;
2065 static HRESULT WINAPI
Videowindow_GetMaxIdealImageSize(IVideoWindow
*iface
,
2068 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2070 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This
, iface
, pWidth
, pHeight
);
2072 *pWidth
= This
->VideoWidth
;
2073 *pHeight
= This
->VideoHeight
;
2078 static HRESULT WINAPI
Videowindow_GetRestorePosition(IVideoWindow
*iface
,
2083 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2085 FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
2090 static HRESULT WINAPI
Videowindow_HideCursor(IVideoWindow
*iface
,
2092 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2094 FIXME("(%p/%p)->(%d): stub !!!\n", This
, iface
, HideCursor
);
2099 static HRESULT WINAPI
Videowindow_IsCursorHidden(IVideoWindow
*iface
,
2100 LONG
*CursorHidden
) {
2101 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2103 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, CursorHidden
);
2108 static const IVideoWindowVtbl IVideoWindow_VTable
=
2110 Videowindow_QueryInterface
,
2112 Videowindow_Release
,
2113 Videowindow_GetTypeInfoCount
,
2114 Videowindow_GetTypeInfo
,
2115 Videowindow_GetIDsOfNames
,
2117 Videowindow_put_Caption
,
2118 Videowindow_get_Caption
,
2119 Videowindow_put_WindowStyle
,
2120 Videowindow_get_WindowStyle
,
2121 Videowindow_put_WindowStyleEx
,
2122 Videowindow_get_WindowStyleEx
,
2123 Videowindow_put_AutoShow
,
2124 Videowindow_get_AutoShow
,
2125 Videowindow_put_WindowState
,
2126 Videowindow_get_WindowState
,
2127 Videowindow_put_BackgroundPalette
,
2128 Videowindow_get_BackgroundPalette
,
2129 Videowindow_put_Visible
,
2130 Videowindow_get_Visible
,
2131 Videowindow_put_Left
,
2132 Videowindow_get_Left
,
2133 Videowindow_put_Width
,
2134 Videowindow_get_Width
,
2135 Videowindow_put_Top
,
2136 Videowindow_get_Top
,
2137 Videowindow_put_Height
,
2138 Videowindow_get_Height
,
2139 Videowindow_put_Owner
,
2140 Videowindow_get_Owner
,
2141 Videowindow_put_MessageDrain
,
2142 Videowindow_get_MessageDrain
,
2143 Videowindow_get_BorderColor
,
2144 Videowindow_put_BorderColor
,
2145 Videowindow_get_FullScreenMode
,
2146 Videowindow_put_FullScreenMode
,
2147 Videowindow_SetWindowForeground
,
2148 Videowindow_NotifyOwnerMessage
,
2149 Videowindow_SetWindowPosition
,
2150 Videowindow_GetWindowPosition
,
2151 Videowindow_GetMinIdealImageSize
,
2152 Videowindow_GetMaxIdealImageSize
,
2153 Videowindow_GetRestorePosition
,
2154 Videowindow_HideCursor
,
2155 Videowindow_IsCursorHidden