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
58 const IBaseFilterVtbl
* lpVtbl
;
59 const IBasicVideoVtbl
* IBasicVideo_vtbl
;
60 const IVideoWindowVtbl
* IVideoWindow_vtbl
;
61 const IUnknownVtbl
* IInner_vtbl
;
64 CRITICAL_SECTION csFilter
;
66 REFERENCE_TIME rtStreamStart
;
67 IReferenceClock
* pClock
;
68 FILTER_INFO filterInfo
;
90 REFERENCE_TIME rtLastStop
;
91 MediaSeekingImpl mediaSeeking
;
93 /* During pause we can hold a single sample, for use in GetCurrentImage */
94 IMediaSample
*sample_held
;
97 static LRESULT CALLBACK
VideoWndProcA(HWND hwnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
99 VideoRendererImpl
* pVideoRenderer
= (VideoRendererImpl
*)GetWindowLongPtrW(hwnd
, 0);
100 LPRECT lprect
= (LPRECT
)lParam
;
102 if (pVideoRenderer
&& pVideoRenderer
->hWndMsgDrain
)
108 case WM_LBUTTONDBLCLK
:
111 case WM_MBUTTONDBLCLK
:
114 case WM_MOUSEACTIVATE
:
116 case WM_NCLBUTTONDBLCLK
:
117 case WM_NCLBUTTONDOWN
:
119 case WM_NCMBUTTONDBLCLK
:
120 case WM_NCMBUTTONDOWN
:
123 case WM_NCRBUTTONDBLCLK
:
124 case WM_NCRBUTTONDOWN
:
126 case WM_RBUTTONDBLCLK
:
129 PostMessageA(pVideoRenderer
->hWndMsgDrain
, uMsg
, wParam
, lParam
);
139 /* TRACE("WM_SIZING %d %d %d %d\n", lprect->left, lprect->top, lprect->right, lprect->bottom); */
140 SetWindowPos(hwnd
, NULL
, lprect
->left
, lprect
->top
, lprect
->right
- lprect
->left
, lprect
->bottom
- lprect
->top
, SWP_NOZORDER
);
141 GetClientRect(hwnd
, &pVideoRenderer
->DestRect
);
142 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
143 pVideoRenderer
->DestRect
.left
,
144 pVideoRenderer
->DestRect
.top
,
145 pVideoRenderer
->DestRect
.right
- pVideoRenderer
->DestRect
.left
,
146 pVideoRenderer
->DestRect
.bottom
- pVideoRenderer
->DestRect
.top
);
149 TRACE("WM_SIZE %d %d\n", LOWORD(lParam
), HIWORD(lParam
));
150 GetClientRect(hwnd
, &pVideoRenderer
->DestRect
);
151 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
152 pVideoRenderer
->DestRect
.left
,
153 pVideoRenderer
->DestRect
.top
,
154 pVideoRenderer
->DestRect
.right
- pVideoRenderer
->DestRect
.left
,
155 pVideoRenderer
->DestRect
.bottom
- pVideoRenderer
->DestRect
.top
);
158 return DefWindowProcA(hwnd
, uMsg
, wParam
, lParam
);
163 static BOOL
CreateRenderingWindow(VideoRendererImpl
* This
)
167 TRACE("(%p)->()\n", This
);
170 winclass
.lpfnWndProc
= VideoWndProcA
;
171 winclass
.cbClsExtra
= 0;
172 winclass
.cbWndExtra
= sizeof(VideoRendererImpl
*);
173 winclass
.hInstance
= NULL
;
174 winclass
.hIcon
= NULL
;
175 winclass
.hCursor
= NULL
;
176 winclass
.hbrBackground
= GetStockObject(BLACK_BRUSH
);
177 winclass
.lpszMenuName
= NULL
;
178 winclass
.lpszClassName
= "Wine ActiveMovie Class";
180 if (!wnd_class_registered
)
182 if (!RegisterClassA(&winclass
))
184 ERR("Unable to register window %u\n", GetLastError());
187 wnd_class_registered
= TRUE
;
190 This
->hWnd
= CreateWindowExA(0, "Wine ActiveMovie Class", "Wine ActiveMovie Window", WS_SIZEBOX
,
191 CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
, NULL
,
196 ERR("Unable to create window\n");
200 SetWindowLongPtrW(This
->hWnd
, 0, (LONG_PTR
)This
);
205 static DWORD WINAPI
MessageLoop(LPVOID lpParameter
)
207 VideoRendererImpl
* This
= lpParameter
;
211 TRACE("Starting message loop\n");
213 if (!CreateRenderingWindow(This
))
215 This
->ThreadResult
= FALSE
;
216 SetEvent(This
->hEvent
);
220 This
->ThreadResult
= TRUE
;
221 SetEvent(This
->hEvent
);
223 while ((fGotMessage
= GetMessageA(&msg
, NULL
, 0, 0)) != 0 && fGotMessage
!= -1)
225 TranslateMessage(&msg
);
226 DispatchMessageA(&msg
);
229 TRACE("End of message loop\n");
234 static BOOL
CreateRenderingSubsystem(VideoRendererImpl
* This
)
236 This
->hEvent
= CreateEventW(NULL
, TRUE
, FALSE
, NULL
);
240 This
->hThread
= CreateThread(NULL
, 0, MessageLoop
, This
, 0, &This
->ThreadID
);
243 CloseHandle(This
->hEvent
);
247 WaitForSingleObject(This
->hEvent
, INFINITE
);
249 if (!This
->ThreadResult
)
251 CloseHandle(This
->hEvent
);
252 CloseHandle(This
->hThread
);
259 static DWORD
VideoRenderer_SendSampleData(VideoRendererImpl
* This
, LPBYTE data
, DWORD size
)
265 BITMAPINFOHEADER
*bmiHeader
;
267 TRACE("(%p)->(%p, %d)\n", This
, data
, size
);
269 sdesc
.dwSize
= sizeof(sdesc
);
270 hr
= IPin_ConnectionMediaType((IPin
*)This
->pInputPin
, &amt
);
272 ERR("Unable to retrieve media type\n");
276 if (IsEqualIID(&amt
.formattype
, &FORMAT_VideoInfo
))
278 bmiHeader
= &((VIDEOINFOHEADER
*)amt
.pbFormat
)->bmiHeader
;
280 else if (IsEqualIID(&amt
.formattype
, &FORMAT_VideoInfo2
))
282 bmiHeader
= &((VIDEOINFOHEADER2
*)amt
.pbFormat
)->bmiHeader
;
286 FIXME("Unknown type %s\n", debugstr_guid(&amt
.subtype
));
287 return VFW_E_RUNTIME_ERROR
;
290 TRACE("biSize = %d\n", bmiHeader
->biSize
);
291 TRACE("biWidth = %d\n", bmiHeader
->biWidth
);
292 TRACE("biHeight = %d\n", bmiHeader
->biHeight
);
293 TRACE("biPlanes = %d\n", bmiHeader
->biPlanes
);
294 TRACE("biBitCount = %d\n", bmiHeader
->biBitCount
);
295 TRACE("biCompression = %s\n", debugstr_an((LPSTR
)&(bmiHeader
->biCompression
), 4));
296 TRACE("biSizeImage = %d\n", bmiHeader
->biSizeImage
);
300 DWORD style
= GetWindowLongW(This
->hWnd
, GWL_STYLE
);
301 DWORD style_ex
= GetWindowLongW(This
->hWnd
, GWL_EXSTYLE
);
303 if (!This
->WindowPos
.right
|| !This
->WindowPos
.bottom
)
304 This
->WindowPos
= This
->SourceRect
;
306 AdjustWindowRectEx(&This
->WindowPos
, style
, TRUE
, style_ex
);
308 TRACE("WindowPos: %d %d %d %d\n", This
->WindowPos
.left
, This
->WindowPos
.top
, This
->WindowPos
.right
, This
->WindowPos
.bottom
);
309 SetWindowPos(This
->hWnd
, NULL
,
310 This
->WindowPos
.left
,
312 This
->WindowPos
.right
- This
->WindowPos
.left
,
313 This
->WindowPos
.bottom
- This
->WindowPos
.top
,
314 SWP_NOZORDER
|SWP_NOMOVE
);
316 GetClientRect(This
->hWnd
, &This
->DestRect
);
320 hDC
= GetDC(This
->hWnd
);
323 ERR("Cannot get DC from window!\n");
327 TRACE("Src Rect: %d %d %d %d\n", This
->SourceRect
.left
, This
->SourceRect
.top
, This
->SourceRect
.right
, This
->SourceRect
.bottom
);
328 TRACE("Dst Rect: %d %d %d %d\n", This
->DestRect
.left
, This
->DestRect
.top
, This
->DestRect
.right
, This
->DestRect
.bottom
);
330 StretchDIBits(hDC
, This
->DestRect
.left
, This
->DestRect
.top
, This
->DestRect
.right
-This
->DestRect
.left
,
331 This
->DestRect
.bottom
- This
->DestRect
.top
, This
->SourceRect
.left
, This
->SourceRect
.top
,
332 This
->SourceRect
.right
- This
->SourceRect
.left
, This
->SourceRect
.bottom
- This
->SourceRect
.top
,
333 data
, (BITMAPINFO
*)bmiHeader
, DIB_RGB_COLORS
, SRCCOPY
);
335 ReleaseDC(This
->hWnd
, hDC
);
337 ShowWindow(This
->hWnd
, SW_SHOW
);
342 static HRESULT
VideoRenderer_Sample(LPVOID iface
, IMediaSample
* pSample
)
344 VideoRendererImpl
*This
= iface
;
345 LPBYTE pbSrcStream
= NULL
;
346 LONG cbSrcStream
= 0;
347 REFERENCE_TIME tStart
, tStop
;
350 TRACE("(%p)->(%p)\n", iface
, pSample
);
352 EnterCriticalSection(&This
->csFilter
);
354 if (This
->pInputPin
->flushing
|| This
->pInputPin
->end_of_stream
)
356 LeaveCriticalSection(&This
->csFilter
);
360 if (This
->state
== State_Stopped
)
362 LeaveCriticalSection(&This
->csFilter
);
363 return VFW_E_WRONG_STATE
;
366 hr
= IMediaSample_GetTime(pSample
, &tStart
, &tStop
);
368 ERR("Cannot get sample time (%x)\n", hr
);
370 if (This
->rtLastStop
!= tStart
&& This
->state
== State_Running
)
373 delta
= tStart
- This
->rtLastStop
;
374 if ((delta
< -100000 || delta
> 100000) &&
375 IMediaSample_IsDiscontinuity(pSample
) == S_FALSE
)
376 ERR("Unexpected discontinuity: Last: %u.%03u, tStart: %u.%03u\n",
377 (DWORD
)(This
->rtLastStop
/ 10000000),
378 (DWORD
)((This
->rtLastStop
/ 10000)%1000),
379 (DWORD
)(tStart
/ 10000000), (DWORD
)((tStart
/ 10000)%1000));
380 This
->rtLastStop
= tStart
;
383 /* Preroll means the sample isn't shown, this is used for key frames and things like that */
384 if (IMediaSample_IsPreroll(pSample
) == S_OK
)
386 This
->rtLastStop
= tStop
;
387 LeaveCriticalSection(&This
->csFilter
);
391 hr
= IMediaSample_GetPointer(pSample
, &pbSrcStream
);
394 ERR("Cannot get pointer to sample data (%x)\n", hr
);
395 LeaveCriticalSection(&This
->csFilter
);
399 cbSrcStream
= IMediaSample_GetActualDataLength(pSample
);
401 TRACE("val %p %d\n", pbSrcStream
, cbSrcStream
);
403 #if 0 /* For debugging purpose */
406 for(i
= 0; i
< cbSrcStream
; i
++)
408 if ((i
!=0) && !(i
%16))
410 TRACE("%02x ", pbSrcStream
[i
]);
416 SetEvent(This
->hEvent
);
417 if (This
->state
== State_Paused
)
419 This
->sample_held
= pSample
;
420 LeaveCriticalSection(&This
->csFilter
);
421 WaitForSingleObject(This
->blocked
, INFINITE
);
422 EnterCriticalSection(&This
->csFilter
);
423 This
->sample_held
= NULL
;
424 if (This
->state
== State_Paused
)
427 LeaveCriticalSection(&This
->csFilter
);
430 if (This
->state
== State_Stopped
)
432 LeaveCriticalSection(&This
->csFilter
);
433 return VFW_E_WRONG_STATE
;
437 if (This
->pClock
&& This
->state
== State_Running
)
439 REFERENCE_TIME time
, trefstart
, trefstop
;
442 /* Perhaps I <SHOULD> use the reference clock AdviseTime function here
443 * I'm not going to! When I tried, it seemed to generate lag and
444 * it caused instability.
446 IReferenceClock_GetTime(This
->pClock
, &time
);
448 trefstart
= This
->rtStreamStart
;
449 trefstop
= (REFERENCE_TIME
)((double)(tStop
- tStart
) / This
->pInputPin
->dRate
) + This
->rtStreamStart
;
450 delta
= (LONG
)((trefstart
-time
)/10000);
451 This
->rtStreamStart
= trefstop
;
452 This
->rtLastStop
= tStop
;
456 TRACE("Sleeping for %u ms\n", delta
);
459 else if (time
> trefstop
)
461 TRACE("Dropping sample: Time: %u.%03u ms trefstop: %u.%03u ms!\n",
462 (DWORD
)(time
/ 10000000), (DWORD
)((time
/ 10000)%1000),
463 (DWORD
)(trefstop
/ 10000000), (DWORD
)((trefstop
/ 10000)%1000) );
464 This
->rtLastStop
= tStop
;
465 LeaveCriticalSection(&This
->csFilter
);
469 This
->rtLastStop
= tStop
;
471 VideoRenderer_SendSampleData(This
, pbSrcStream
, cbSrcStream
);
473 LeaveCriticalSection(&This
->csFilter
);
477 static HRESULT
VideoRenderer_QueryAccept(LPVOID iface
, const AM_MEDIA_TYPE
* pmt
)
479 if (!IsEqualIID(&pmt
->majortype
, &MEDIATYPE_Video
))
482 if (IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB32
) ||
483 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB24
) ||
484 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB565
) ||
485 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB8
))
487 VideoRendererImpl
* This
= iface
;
490 if (IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo
))
492 VIDEOINFOHEADER
*format
= (VIDEOINFOHEADER
*)pmt
->pbFormat
;
493 This
->SourceRect
.left
= 0;
494 This
->SourceRect
.top
= 0;
495 This
->SourceRect
.right
= This
->VideoWidth
= format
->bmiHeader
.biWidth
;
496 height
= format
->bmiHeader
.biHeight
;
498 This
->SourceRect
.bottom
= This
->VideoHeight
= -height
;
500 This
->SourceRect
.bottom
= This
->VideoHeight
= height
;
502 else if (IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo2
))
504 VIDEOINFOHEADER2
*format2
= (VIDEOINFOHEADER2
*)pmt
->pbFormat
;
506 This
->SourceRect
.left
= 0;
507 This
->SourceRect
.top
= 0;
508 This
->SourceRect
.right
= This
->VideoWidth
= format2
->bmiHeader
.biWidth
;
509 height
= format2
->bmiHeader
.biHeight
;
511 This
->SourceRect
.bottom
= This
->VideoHeight
= -height
;
513 This
->SourceRect
.bottom
= This
->VideoHeight
= height
;
517 WARN("Format type %s not supported\n", debugstr_guid(&pmt
->formattype
));
525 static inline VideoRendererImpl
*impl_from_IMediaSeeking( IMediaSeeking
*iface
)
527 return (VideoRendererImpl
*)((char*)iface
- FIELD_OFFSET(VideoRendererImpl
, mediaSeeking
.lpVtbl
));
530 static HRESULT WINAPI
VideoRendererImpl_Seeking_QueryInterface(IMediaSeeking
* iface
, REFIID riid
, LPVOID
* ppv
)
532 VideoRendererImpl
*This
= impl_from_IMediaSeeking(iface
);
534 return IUnknown_QueryInterface((IUnknown
*)This
, riid
, ppv
);
537 static ULONG WINAPI
VideoRendererImpl_Seeking_AddRef(IMediaSeeking
* iface
)
539 VideoRendererImpl
*This
= impl_from_IMediaSeeking(iface
);
541 return IUnknown_AddRef((IUnknown
*)This
);
544 static ULONG WINAPI
VideoRendererImpl_Seeking_Release(IMediaSeeking
* iface
)
546 VideoRendererImpl
*This
= impl_from_IMediaSeeking(iface
);
548 return IUnknown_Release((IUnknown
*)This
);
551 static const IMediaSeekingVtbl VideoRendererImpl_Seeking_Vtbl
=
553 VideoRendererImpl_Seeking_QueryInterface
,
554 VideoRendererImpl_Seeking_AddRef
,
555 VideoRendererImpl_Seeking_Release
,
556 MediaSeekingImpl_GetCapabilities
,
557 MediaSeekingImpl_CheckCapabilities
,
558 MediaSeekingImpl_IsFormatSupported
,
559 MediaSeekingImpl_QueryPreferredFormat
,
560 MediaSeekingImpl_GetTimeFormat
,
561 MediaSeekingImpl_IsUsingTimeFormat
,
562 MediaSeekingImpl_SetTimeFormat
,
563 MediaSeekingImpl_GetDuration
,
564 MediaSeekingImpl_GetStopPosition
,
565 MediaSeekingImpl_GetCurrentPosition
,
566 MediaSeekingImpl_ConvertTimeFormat
,
567 MediaSeekingImpl_SetPositions
,
568 MediaSeekingImpl_GetPositions
,
569 MediaSeekingImpl_GetAvailable
,
570 MediaSeekingImpl_SetRate
,
571 MediaSeekingImpl_GetRate
,
572 MediaSeekingImpl_GetPreroll
575 static HRESULT
VideoRendererImpl_Change(IBaseFilter
*iface
)
577 TRACE("(%p)->()\n", iface
);
581 HRESULT
VideoRenderer_create(IUnknown
* pUnkOuter
, LPVOID
* ppv
)
585 VideoRendererImpl
* pVideoRenderer
;
587 TRACE("(%p, %p)\n", pUnkOuter
, ppv
);
591 pVideoRenderer
= CoTaskMemAlloc(sizeof(VideoRendererImpl
));
592 pVideoRenderer
->pUnkOuter
= pUnkOuter
;
593 pVideoRenderer
->bUnkOuterValid
= FALSE
;
594 pVideoRenderer
->bAggregatable
= FALSE
;
595 pVideoRenderer
->IInner_vtbl
= &IInner_VTable
;
597 pVideoRenderer
->lpVtbl
= &VideoRenderer_Vtbl
;
598 pVideoRenderer
->IBasicVideo_vtbl
= &IBasicVideo_VTable
;
599 pVideoRenderer
->IVideoWindow_vtbl
= &IVideoWindow_VTable
;
601 pVideoRenderer
->refCount
= 1;
602 InitializeCriticalSection(&pVideoRenderer
->csFilter
);
603 pVideoRenderer
->csFilter
.DebugInfo
->Spare
[0] = (DWORD_PTR
)(__FILE__
": VideoRendererImpl.csFilter");
604 pVideoRenderer
->state
= State_Stopped
;
605 pVideoRenderer
->pClock
= NULL
;
606 pVideoRenderer
->init
= 0;
607 pVideoRenderer
->AutoShow
= 1;
608 pVideoRenderer
->rtLastStop
= -1;
609 ZeroMemory(&pVideoRenderer
->filterInfo
, sizeof(FILTER_INFO
));
610 ZeroMemory(&pVideoRenderer
->SourceRect
, sizeof(RECT
));
611 ZeroMemory(&pVideoRenderer
->DestRect
, sizeof(RECT
));
612 ZeroMemory(&pVideoRenderer
->WindowPos
, sizeof(RECT
));
613 pVideoRenderer
->hWndMsgDrain
= NULL
;
615 /* construct input pin */
616 piInput
.dir
= PINDIR_INPUT
;
617 piInput
.pFilter
= (IBaseFilter
*)pVideoRenderer
;
618 lstrcpynW(piInput
.achName
, wcsInputPinName
, sizeof(piInput
.achName
) / sizeof(piInput
.achName
[0]));
620 hr
= InputPin_Construct(&VideoRenderer_InputPin_Vtbl
, &piInput
, VideoRenderer_Sample
, (LPVOID
)pVideoRenderer
, VideoRenderer_QueryAccept
, NULL
, &pVideoRenderer
->csFilter
, NULL
, (IPin
**)&pVideoRenderer
->pInputPin
);
624 MediaSeekingImpl_Init((IBaseFilter
*)pVideoRenderer
, VideoRendererImpl_Change
, VideoRendererImpl_Change
, VideoRendererImpl_Change
, &pVideoRenderer
->mediaSeeking
, &pVideoRenderer
->csFilter
);
625 pVideoRenderer
->mediaSeeking
.lpVtbl
= &VideoRendererImpl_Seeking_Vtbl
;
627 pVideoRenderer
->sample_held
= NULL
;
628 *ppv
= pVideoRenderer
;
632 pVideoRenderer
->csFilter
.DebugInfo
->Spare
[0] = 0;
633 DeleteCriticalSection(&pVideoRenderer
->csFilter
);
634 CoTaskMemFree(pVideoRenderer
);
637 if (!CreateRenderingSubsystem(pVideoRenderer
))
640 pVideoRenderer
->blocked
= CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
641 if (!pVideoRenderer
->blocked
)
643 hr
= HRESULT_FROM_WIN32(GetLastError());
644 IUnknown_Release((IUnknown
*)pVideoRenderer
);
650 HRESULT
VideoRendererDefault_create(IUnknown
* pUnkOuter
, LPVOID
* ppv
)
652 /* TODO: Attempt to use the VMR-7 renderer instead when possible */
653 return VideoRenderer_create(pUnkOuter
, ppv
);
656 static HRESULT WINAPI
VideoRendererInner_QueryInterface(IUnknown
* iface
, REFIID riid
, LPVOID
* ppv
)
658 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
659 TRACE("(%p/%p)->(%s, %p)\n", This
, iface
, qzdebugstr_guid(riid
), ppv
);
661 if (This
->bAggregatable
)
662 This
->bUnkOuterValid
= TRUE
;
666 if (IsEqualIID(riid
, &IID_IUnknown
))
667 *ppv
= &This
->IInner_vtbl
;
668 else if (IsEqualIID(riid
, &IID_IPersist
))
670 else if (IsEqualIID(riid
, &IID_IMediaFilter
))
672 else if (IsEqualIID(riid
, &IID_IBaseFilter
))
674 else if (IsEqualIID(riid
, &IID_IBasicVideo
))
675 *ppv
= &This
->IBasicVideo_vtbl
;
676 else if (IsEqualIID(riid
, &IID_IVideoWindow
))
677 *ppv
= &This
->IVideoWindow_vtbl
;
678 else if (IsEqualIID(riid
, &IID_IMediaSeeking
))
679 *ppv
= &This
->mediaSeeking
;
683 IUnknown_AddRef((IUnknown
*)(*ppv
));
687 if (!IsEqualIID(riid
, &IID_IPin
))
688 FIXME("No interface for %s!\n", qzdebugstr_guid(riid
));
690 return E_NOINTERFACE
;
693 static ULONG WINAPI
VideoRendererInner_AddRef(IUnknown
* iface
)
695 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
696 ULONG refCount
= InterlockedIncrement(&This
->refCount
);
698 TRACE("(%p/%p)->() AddRef from %d\n", This
, iface
, refCount
- 1);
703 static ULONG WINAPI
VideoRendererInner_Release(IUnknown
* iface
)
705 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
706 ULONG refCount
= InterlockedDecrement(&This
->refCount
);
708 TRACE("(%p/%p)->() Release from %d\n", This
, iface
, refCount
+ 1);
714 DestroyWindow(This
->hWnd
);
715 PostThreadMessageA(This
->ThreadID
, WM_QUIT
, 0, 0);
716 WaitForSingleObject(This
->hThread
, INFINITE
);
717 CloseHandle(This
->hThread
);
718 CloseHandle(This
->hEvent
);
721 IReferenceClock_Release(This
->pClock
);
723 if (SUCCEEDED(IPin_ConnectedTo((IPin
*)This
->pInputPin
, &pConnectedTo
)))
725 IPin_Disconnect(pConnectedTo
);
726 IPin_Release(pConnectedTo
);
728 IPin_Disconnect((IPin
*)This
->pInputPin
);
730 IPin_Release((IPin
*)This
->pInputPin
);
734 This
->csFilter
.DebugInfo
->Spare
[0] = 0;
735 DeleteCriticalSection(&This
->csFilter
);
737 TRACE("Destroying Video Renderer\n");
746 static const IUnknownVtbl IInner_VTable
=
748 VideoRendererInner_QueryInterface
,
749 VideoRendererInner_AddRef
,
750 VideoRendererInner_Release
753 static HRESULT WINAPI
VideoRenderer_QueryInterface(IBaseFilter
* iface
, REFIID riid
, LPVOID
* ppv
)
755 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
757 if (This
->bAggregatable
)
758 This
->bUnkOuterValid
= TRUE
;
762 if (This
->bAggregatable
)
763 return IUnknown_QueryInterface(This
->pUnkOuter
, riid
, ppv
);
765 if (IsEqualIID(riid
, &IID_IUnknown
))
769 IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
770 hr
= IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
771 IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
772 This
->bAggregatable
= TRUE
;
777 return E_NOINTERFACE
;
780 return IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
783 static ULONG WINAPI
VideoRenderer_AddRef(IBaseFilter
* iface
)
785 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
787 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
788 return IUnknown_AddRef(This
->pUnkOuter
);
789 return IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
792 static ULONG WINAPI
VideoRenderer_Release(IBaseFilter
* iface
)
794 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
796 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
797 return IUnknown_Release(This
->pUnkOuter
);
798 return IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
801 /** IPersist methods **/
803 static HRESULT WINAPI
VideoRenderer_GetClassID(IBaseFilter
* iface
, CLSID
* pClsid
)
805 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
807 TRACE("(%p/%p)->(%p)\n", This
, iface
, pClsid
);
809 *pClsid
= CLSID_VideoRenderer
;
814 /** IMediaFilter methods **/
816 static HRESULT WINAPI
VideoRenderer_Stop(IBaseFilter
* iface
)
818 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
820 TRACE("(%p/%p)->()\n", This
, iface
);
822 EnterCriticalSection(&This
->csFilter
);
824 This
->state
= State_Stopped
;
825 SetEvent(This
->hEvent
);
826 SetEvent(This
->blocked
);
828 LeaveCriticalSection(&This
->csFilter
);
833 static HRESULT WINAPI
VideoRenderer_Pause(IBaseFilter
* iface
)
835 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
837 TRACE("(%p/%p)->()\n", This
, iface
);
839 EnterCriticalSection(&This
->csFilter
);
840 if (This
->state
!= State_Paused
)
842 if (This
->state
== State_Stopped
)
844 This
->pInputPin
->end_of_stream
= 0;
845 ResetEvent(This
->hEvent
);
848 This
->state
= State_Paused
;
849 ResetEvent(This
->blocked
);
851 LeaveCriticalSection(&This
->csFilter
);
856 static HRESULT WINAPI
VideoRenderer_Run(IBaseFilter
* iface
, REFERENCE_TIME tStart
)
858 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
860 TRACE("(%p/%p)->(%s)\n", This
, iface
, wine_dbgstr_longlong(tStart
));
862 EnterCriticalSection(&This
->csFilter
);
863 if (This
->state
!= State_Running
)
865 if (This
->state
== State_Stopped
)
867 This
->pInputPin
->end_of_stream
= 0;
868 ResetEvent(This
->hEvent
);
870 SetEvent(This
->blocked
);
872 This
->rtStreamStart
= tStart
;
873 This
->state
= State_Running
;
875 LeaveCriticalSection(&This
->csFilter
);
880 static HRESULT WINAPI
VideoRenderer_GetState(IBaseFilter
* iface
, DWORD dwMilliSecsTimeout
, FILTER_STATE
*pState
)
882 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
885 TRACE("(%p/%p)->(%d, %p)\n", This
, iface
, dwMilliSecsTimeout
, pState
);
887 if (WaitForSingleObject(This
->hEvent
, dwMilliSecsTimeout
) == WAIT_TIMEOUT
)
888 hr
= VFW_S_STATE_INTERMEDIATE
;
892 EnterCriticalSection(&This
->csFilter
);
894 *pState
= This
->state
;
896 LeaveCriticalSection(&This
->csFilter
);
901 static HRESULT WINAPI
VideoRenderer_SetSyncSource(IBaseFilter
* iface
, IReferenceClock
*pClock
)
903 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
905 TRACE("(%p/%p)->(%p)\n", This
, iface
, pClock
);
907 EnterCriticalSection(&This
->csFilter
);
910 IReferenceClock_Release(This
->pClock
);
911 This
->pClock
= pClock
;
913 IReferenceClock_AddRef(This
->pClock
);
915 LeaveCriticalSection(&This
->csFilter
);
920 static HRESULT WINAPI
VideoRenderer_GetSyncSource(IBaseFilter
* iface
, IReferenceClock
**ppClock
)
922 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
924 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppClock
);
926 EnterCriticalSection(&This
->csFilter
);
928 *ppClock
= This
->pClock
;
930 IReferenceClock_AddRef(This
->pClock
);
932 LeaveCriticalSection(&This
->csFilter
);
937 /** IBaseFilter implementation **/
939 static HRESULT
VideoRenderer_GetPin(IBaseFilter
*iface
, ULONG pos
, IPin
**pin
, DWORD
*lastsynctick
)
941 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
943 /* Our pins are static, not changing so setting static tick count is ok */
949 *pin
= (IPin
*)This
->pInputPin
;
954 static HRESULT WINAPI
VideoRenderer_EnumPins(IBaseFilter
* iface
, IEnumPins
**ppEnum
)
956 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
958 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppEnum
);
960 return IEnumPinsImpl_Construct(ppEnum
, VideoRenderer_GetPin
, iface
);
963 static HRESULT WINAPI
VideoRenderer_FindPin(IBaseFilter
* iface
, LPCWSTR Id
, IPin
**ppPin
)
965 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
967 FIXME("(%p/%p)->(%p,%p): stub !!!\n", This
, iface
, debugstr_w(Id
), ppPin
);
969 /* FIXME: critical section */
974 static HRESULT WINAPI
VideoRenderer_QueryFilterInfo(IBaseFilter
* iface
, FILTER_INFO
*pInfo
)
976 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
978 TRACE("(%p/%p)->(%p)\n", This
, iface
, pInfo
);
980 strcpyW(pInfo
->achName
, This
->filterInfo
.achName
);
981 pInfo
->pGraph
= This
->filterInfo
.pGraph
;
984 IFilterGraph_AddRef(pInfo
->pGraph
);
989 static HRESULT WINAPI
VideoRenderer_JoinFilterGraph(IBaseFilter
* iface
, IFilterGraph
*pGraph
, LPCWSTR pName
)
991 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
993 TRACE("(%p/%p)->(%p, %s)\n", This
, iface
, pGraph
, debugstr_w(pName
));
995 EnterCriticalSection(&This
->csFilter
);
998 strcpyW(This
->filterInfo
.achName
, pName
);
1000 *This
->filterInfo
.achName
= '\0';
1001 This
->filterInfo
.pGraph
= pGraph
; /* NOTE: do NOT increase ref. count */
1003 LeaveCriticalSection(&This
->csFilter
);
1008 static HRESULT WINAPI
VideoRenderer_QueryVendorInfo(IBaseFilter
* iface
, LPWSTR
*pVendorInfo
)
1010 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
1011 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVendorInfo
);
1015 static const IBaseFilterVtbl VideoRenderer_Vtbl
=
1017 VideoRenderer_QueryInterface
,
1018 VideoRenderer_AddRef
,
1019 VideoRenderer_Release
,
1020 VideoRenderer_GetClassID
,
1022 VideoRenderer_Pause
,
1024 VideoRenderer_GetState
,
1025 VideoRenderer_SetSyncSource
,
1026 VideoRenderer_GetSyncSource
,
1027 VideoRenderer_EnumPins
,
1028 VideoRenderer_FindPin
,
1029 VideoRenderer_QueryFilterInfo
,
1030 VideoRenderer_JoinFilterGraph
,
1031 VideoRenderer_QueryVendorInfo
1034 static HRESULT WINAPI
VideoRenderer_InputPin_EndOfStream(IPin
* iface
)
1036 InputPin
* This
= (InputPin
*)iface
;
1037 IMediaEventSink
* pEventSink
;
1040 TRACE("(%p/%p)->()\n", This
, iface
);
1042 hr
= IFilterGraph_QueryInterface(((VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
)->filterInfo
.pGraph
, &IID_IMediaEventSink
, (LPVOID
*)&pEventSink
);
1045 hr
= IMediaEventSink_Notify(pEventSink
, EC_COMPLETE
, S_OK
, 0);
1046 IMediaEventSink_Release(pEventSink
);
1052 static HRESULT WINAPI
VideoRenderer_InputPin_BeginFlush(IPin
* iface
)
1054 InputPin
* This
= (InputPin
*)iface
;
1055 VideoRendererImpl
*pVideoRenderer
= (VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
;
1058 TRACE("(%p/%p)->()\n", This
, iface
);
1060 EnterCriticalSection(This
->pin
.pCritSec
);
1061 if (pVideoRenderer
->state
== State_Paused
)
1062 SetEvent(pVideoRenderer
->blocked
);
1064 hr
= InputPin_BeginFlush(iface
);
1065 LeaveCriticalSection(This
->pin
.pCritSec
);
1070 static HRESULT WINAPI
VideoRenderer_InputPin_EndFlush(IPin
* iface
)
1072 InputPin
* This
= (InputPin
*)iface
;
1073 VideoRendererImpl
*pVideoRenderer
= (VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
;
1076 TRACE("(%p/%p)->()\n", This
, iface
);
1078 EnterCriticalSection(This
->pin
.pCritSec
);
1079 if (pVideoRenderer
->state
== State_Paused
)
1080 ResetEvent(pVideoRenderer
->blocked
);
1082 hr
= InputPin_EndFlush(iface
);
1083 LeaveCriticalSection(This
->pin
.pCritSec
);
1088 static const IPinVtbl VideoRenderer_InputPin_Vtbl
=
1090 InputPin_QueryInterface
,
1094 InputPin_ReceiveConnection
,
1095 IPinImpl_Disconnect
,
1096 IPinImpl_ConnectedTo
,
1097 IPinImpl_ConnectionMediaType
,
1098 IPinImpl_QueryPinInfo
,
1099 IPinImpl_QueryDirection
,
1101 IPinImpl_QueryAccept
,
1102 IPinImpl_EnumMediaTypes
,
1103 IPinImpl_QueryInternalConnections
,
1104 VideoRenderer_InputPin_EndOfStream
,
1105 VideoRenderer_InputPin_BeginFlush
,
1106 VideoRenderer_InputPin_EndFlush
,
1110 /*** IUnknown methods ***/
1111 static HRESULT WINAPI
Basicvideo_QueryInterface(IBasicVideo
*iface
,
1114 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1116 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
1118 return VideoRenderer_QueryInterface((IBaseFilter
*)This
, riid
, ppvObj
);
1121 static ULONG WINAPI
Basicvideo_AddRef(IBasicVideo
*iface
) {
1122 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1124 TRACE("(%p/%p)->()\n", This
, iface
);
1126 return VideoRenderer_AddRef((IBaseFilter
*)This
);
1129 static ULONG WINAPI
Basicvideo_Release(IBasicVideo
*iface
) {
1130 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1132 TRACE("(%p/%p)->()\n", This
, iface
);
1134 return VideoRenderer_Release((IBaseFilter
*)This
);
1137 /*** IDispatch methods ***/
1138 static HRESULT WINAPI
Basicvideo_GetTypeInfoCount(IBasicVideo
*iface
,
1140 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1142 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
1147 static HRESULT WINAPI
Basicvideo_GetTypeInfo(IBasicVideo
*iface
,
1150 ITypeInfo
**ppTInfo
) {
1151 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1153 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
1158 static HRESULT WINAPI
Basicvideo_GetIDsOfNames(IBasicVideo
*iface
,
1164 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1166 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1171 static HRESULT WINAPI
Basicvideo_Invoke(IBasicVideo
*iface
,
1172 DISPID dispIdMember
,
1176 DISPPARAMS
*pDispParams
,
1178 EXCEPINFO
*pExepInfo
,
1180 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1182 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
);
1187 /*** IBasicVideo methods ***/
1188 static HRESULT WINAPI
Basicvideo_get_AvgTimePerFrame(IBasicVideo
*iface
,
1189 REFTIME
*pAvgTimePerFrame
) {
1191 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1193 if (!This
->pInputPin
->pin
.pConnectedTo
)
1194 return VFW_E_NOT_CONNECTED
;
1196 TRACE("(%p/%p)->(%p)\n", This
, iface
, pAvgTimePerFrame
);
1198 pmt
= &This
->pInputPin
->pin
.mtCurrent
;
1199 if (IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo
)) {
1200 VIDEOINFOHEADER
*vih
= (VIDEOINFOHEADER
*)pmt
->pbFormat
;
1201 *pAvgTimePerFrame
= vih
->AvgTimePerFrame
;
1202 } else if (IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo2
)) {
1203 VIDEOINFOHEADER2
*vih
= (VIDEOINFOHEADER2
*)pmt
->pbFormat
;
1204 *pAvgTimePerFrame
= vih
->AvgTimePerFrame
;
1206 ERR("Unknown format type %s\n", qzdebugstr_guid(&pmt
->formattype
));
1207 *pAvgTimePerFrame
= 0;
1212 static HRESULT WINAPI
Basicvideo_get_BitRate(IBasicVideo
*iface
,
1214 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1216 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBitRate
);
1221 static HRESULT WINAPI
Basicvideo_get_BitErrorRate(IBasicVideo
*iface
,
1222 LONG
*pBitErrorRate
) {
1223 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1225 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBitErrorRate
);
1230 static HRESULT WINAPI
Basicvideo_get_VideoWidth(IBasicVideo
*iface
,
1231 LONG
*pVideoWidth
) {
1232 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1234 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoWidth
);
1236 *pVideoWidth
= This
->VideoWidth
;
1241 static HRESULT WINAPI
Basicvideo_get_VideoHeight(IBasicVideo
*iface
,
1242 LONG
*pVideoHeight
) {
1243 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1245 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoHeight
);
1247 *pVideoHeight
= This
->VideoHeight
;
1252 static HRESULT WINAPI
Basicvideo_put_SourceLeft(IBasicVideo
*iface
,
1254 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1256 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceLeft
);
1258 This
->SourceRect
.left
= SourceLeft
;
1263 static HRESULT WINAPI
Basicvideo_get_SourceLeft(IBasicVideo
*iface
,
1264 LONG
*pSourceLeft
) {
1265 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1267 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceLeft
);
1269 *pSourceLeft
= This
->SourceRect
.left
;
1274 static HRESULT WINAPI
Basicvideo_put_SourceWidth(IBasicVideo
*iface
,
1276 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1278 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceWidth
);
1280 This
->SourceRect
.right
= This
->SourceRect
.left
+ SourceWidth
;
1285 static HRESULT WINAPI
Basicvideo_get_SourceWidth(IBasicVideo
*iface
,
1286 LONG
*pSourceWidth
) {
1287 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1289 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceWidth
);
1291 *pSourceWidth
= This
->SourceRect
.right
- This
->SourceRect
.left
;
1296 static HRESULT WINAPI
Basicvideo_put_SourceTop(IBasicVideo
*iface
,
1298 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1300 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceTop
);
1302 This
->SourceRect
.top
= SourceTop
;
1307 static HRESULT WINAPI
Basicvideo_get_SourceTop(IBasicVideo
*iface
,
1309 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1311 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceTop
);
1313 *pSourceTop
= This
->SourceRect
.top
;
1318 static HRESULT WINAPI
Basicvideo_put_SourceHeight(IBasicVideo
*iface
,
1319 LONG SourceHeight
) {
1320 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1322 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceHeight
);
1324 This
->SourceRect
.bottom
= This
->SourceRect
.top
+ SourceHeight
;
1329 static HRESULT WINAPI
Basicvideo_get_SourceHeight(IBasicVideo
*iface
,
1330 LONG
*pSourceHeight
) {
1331 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1333 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceHeight
);
1335 *pSourceHeight
= This
->SourceRect
.bottom
- This
->SourceRect
.top
;
1340 static HRESULT WINAPI
Basicvideo_put_DestinationLeft(IBasicVideo
*iface
,
1341 LONG DestinationLeft
) {
1342 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1344 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationLeft
);
1346 This
->DestRect
.left
= DestinationLeft
;
1351 static HRESULT WINAPI
Basicvideo_get_DestinationLeft(IBasicVideo
*iface
,
1352 LONG
*pDestinationLeft
) {
1353 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1355 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationLeft
);
1357 *pDestinationLeft
= This
->DestRect
.left
;
1362 static HRESULT WINAPI
Basicvideo_put_DestinationWidth(IBasicVideo
*iface
,
1363 LONG DestinationWidth
) {
1364 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1366 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationWidth
);
1368 This
->DestRect
.right
= This
->DestRect
.left
+ DestinationWidth
;
1373 static HRESULT WINAPI
Basicvideo_get_DestinationWidth(IBasicVideo
*iface
,
1374 LONG
*pDestinationWidth
) {
1375 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1377 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationWidth
);
1379 *pDestinationWidth
= This
->DestRect
.right
- This
->DestRect
.left
;
1384 static HRESULT WINAPI
Basicvideo_put_DestinationTop(IBasicVideo
*iface
,
1385 LONG DestinationTop
) {
1386 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1388 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationTop
);
1390 This
->DestRect
.top
= DestinationTop
;
1395 static HRESULT WINAPI
Basicvideo_get_DestinationTop(IBasicVideo
*iface
,
1396 LONG
*pDestinationTop
) {
1397 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1399 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationTop
);
1401 *pDestinationTop
= This
->DestRect
.top
;
1406 static HRESULT WINAPI
Basicvideo_put_DestinationHeight(IBasicVideo
*iface
,
1407 LONG DestinationHeight
) {
1408 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1410 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationHeight
);
1412 This
->DestRect
.right
= This
->DestRect
.left
+ DestinationHeight
;
1417 static HRESULT WINAPI
Basicvideo_get_DestinationHeight(IBasicVideo
*iface
,
1418 LONG
*pDestinationHeight
) {
1419 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1421 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationHeight
);
1423 *pDestinationHeight
= This
->DestRect
.right
- This
->DestRect
.left
;
1428 static HRESULT WINAPI
Basicvideo_SetSourcePosition(IBasicVideo
*iface
,
1433 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1435 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This
, iface
, Left
, Top
, Width
, Height
);
1437 This
->SourceRect
.left
= Left
;
1438 This
->SourceRect
.top
= Top
;
1439 This
->SourceRect
.right
= Left
+ Width
;
1440 This
->SourceRect
.bottom
= Top
+ Height
;
1445 static HRESULT WINAPI
Basicvideo_GetSourcePosition(IBasicVideo
*iface
,
1450 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1452 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1454 *pLeft
= This
->SourceRect
.left
;
1455 *pTop
= This
->SourceRect
.top
;
1456 *pWidth
= This
->SourceRect
.right
- This
->SourceRect
.left
;
1457 *pHeight
= This
->SourceRect
.bottom
- This
->SourceRect
.top
;
1462 static HRESULT WINAPI
Basicvideo_SetDefaultSourcePosition(IBasicVideo
*iface
) {
1463 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1465 TRACE("(%p/%p)->()\n", This
, iface
);
1467 This
->SourceRect
.left
= 0;
1468 This
->SourceRect
.top
= 0;
1469 This
->SourceRect
.right
= This
->VideoWidth
;
1470 This
->SourceRect
.bottom
= This
->VideoHeight
;
1475 static HRESULT WINAPI
Basicvideo_SetDestinationPosition(IBasicVideo
*iface
,
1480 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1482 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This
, iface
, Left
, Top
, Width
, Height
);
1484 This
->DestRect
.left
= Left
;
1485 This
->DestRect
.top
= Top
;
1486 This
->DestRect
.right
= Left
+ Width
;
1487 This
->DestRect
.bottom
= Top
+ Height
;
1492 static HRESULT WINAPI
Basicvideo_GetDestinationPosition(IBasicVideo
*iface
,
1497 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1499 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1501 *pLeft
= This
->DestRect
.left
;
1502 *pTop
= This
->DestRect
.top
;
1503 *pWidth
= This
->DestRect
.right
- This
->DestRect
.left
;
1504 *pHeight
= This
->DestRect
.bottom
- This
->DestRect
.top
;
1509 static HRESULT WINAPI
Basicvideo_SetDefaultDestinationPosition(IBasicVideo
*iface
) {
1510 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1513 TRACE("(%p/%p)->()\n", This
, iface
);
1515 if (!GetClientRect(This
->hWnd
, &rect
))
1518 This
->SourceRect
.left
= 0;
1519 This
->SourceRect
.top
= 0;
1520 This
->SourceRect
.right
= rect
.right
;
1521 This
->SourceRect
.bottom
= rect
.bottom
;
1526 static HRESULT WINAPI
Basicvideo_GetVideoSize(IBasicVideo
*iface
,
1529 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1531 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pWidth
, pHeight
);
1533 *pWidth
= This
->VideoWidth
;
1534 *pHeight
= This
->VideoHeight
;
1539 static HRESULT WINAPI
Basicvideo_GetVideoPaletteEntries(IBasicVideo
*iface
,
1544 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1546 FIXME("(%p/%p)->(%d, %d, %p, %p): stub !!!\n", This
, iface
, StartIndex
, Entries
, pRetrieved
, pPalette
);
1551 static HRESULT WINAPI
Basicvideo_GetCurrentImage(IBasicVideo
*iface
,
1554 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1555 BITMAPINFOHEADER
*bmiHeader
;
1557 AM_MEDIA_TYPE
*amt
= &This
->pInputPin
->pin
.mtCurrent
;
1560 FIXME("(%p/%p)->(%p, %p): partial stub\n", This
, iface
, pBufferSize
, pDIBImage
);
1562 EnterCriticalSection(&This
->csFilter
);
1564 if (!This
->sample_held
)
1566 LeaveCriticalSection(&This
->csFilter
);
1567 return (This
->state
== State_Paused
? E_UNEXPECTED
: VFW_E_NOT_PAUSED
);
1570 if (IsEqualIID(&amt
->formattype
, &FORMAT_VideoInfo
))
1572 bmiHeader
= &((VIDEOINFOHEADER
*)amt
->pbFormat
)->bmiHeader
;
1574 else if (IsEqualIID(&amt
->formattype
, &FORMAT_VideoInfo2
))
1576 bmiHeader
= &((VIDEOINFOHEADER2
*)amt
->pbFormat
)->bmiHeader
;
1580 FIXME("Unknown type %s\n", debugstr_guid(&amt
->subtype
));
1581 LeaveCriticalSection(&This
->csFilter
);
1582 return VFW_E_RUNTIME_ERROR
;
1585 needed_size
= bmiHeader
->biSize
;
1586 needed_size
+= IMediaSample_GetActualDataLength(This
->sample_held
);
1590 *pBufferSize
= needed_size
;
1591 LeaveCriticalSection(&This
->csFilter
);
1595 if (needed_size
< *pBufferSize
)
1597 ERR("Buffer too small %u/%u\n", needed_size
, *pBufferSize
);
1598 LeaveCriticalSection(&This
->csFilter
);
1601 *pBufferSize
= needed_size
;
1603 memcpy(pDIBImage
, bmiHeader
, bmiHeader
->biSize
);
1604 IMediaSample_GetPointer(This
->sample_held
, (BYTE
**)&ptr
);
1605 memcpy((char *)pDIBImage
+ bmiHeader
->biSize
, ptr
, IMediaSample_GetActualDataLength(This
->sample_held
));
1607 LeaveCriticalSection(&This
->csFilter
);
1612 static HRESULT WINAPI
Basicvideo_IsUsingDefaultSource(IBasicVideo
*iface
) {
1613 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1615 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
1620 static HRESULT WINAPI
Basicvideo_IsUsingDefaultDestination(IBasicVideo
*iface
) {
1621 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1623 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
1629 static const IBasicVideoVtbl IBasicVideo_VTable
=
1631 Basicvideo_QueryInterface
,
1634 Basicvideo_GetTypeInfoCount
,
1635 Basicvideo_GetTypeInfo
,
1636 Basicvideo_GetIDsOfNames
,
1638 Basicvideo_get_AvgTimePerFrame
,
1639 Basicvideo_get_BitRate
,
1640 Basicvideo_get_BitErrorRate
,
1641 Basicvideo_get_VideoWidth
,
1642 Basicvideo_get_VideoHeight
,
1643 Basicvideo_put_SourceLeft
,
1644 Basicvideo_get_SourceLeft
,
1645 Basicvideo_put_SourceWidth
,
1646 Basicvideo_get_SourceWidth
,
1647 Basicvideo_put_SourceTop
,
1648 Basicvideo_get_SourceTop
,
1649 Basicvideo_put_SourceHeight
,
1650 Basicvideo_get_SourceHeight
,
1651 Basicvideo_put_DestinationLeft
,
1652 Basicvideo_get_DestinationLeft
,
1653 Basicvideo_put_DestinationWidth
,
1654 Basicvideo_get_DestinationWidth
,
1655 Basicvideo_put_DestinationTop
,
1656 Basicvideo_get_DestinationTop
,
1657 Basicvideo_put_DestinationHeight
,
1658 Basicvideo_get_DestinationHeight
,
1659 Basicvideo_SetSourcePosition
,
1660 Basicvideo_GetSourcePosition
,
1661 Basicvideo_SetDefaultSourcePosition
,
1662 Basicvideo_SetDestinationPosition
,
1663 Basicvideo_GetDestinationPosition
,
1664 Basicvideo_SetDefaultDestinationPosition
,
1665 Basicvideo_GetVideoSize
,
1666 Basicvideo_GetVideoPaletteEntries
,
1667 Basicvideo_GetCurrentImage
,
1668 Basicvideo_IsUsingDefaultSource
,
1669 Basicvideo_IsUsingDefaultDestination
1673 /*** IUnknown methods ***/
1674 static HRESULT WINAPI
Videowindow_QueryInterface(IVideoWindow
*iface
,
1677 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1679 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
1681 return VideoRenderer_QueryInterface((IBaseFilter
*)This
, riid
, ppvObj
);
1684 static ULONG WINAPI
Videowindow_AddRef(IVideoWindow
*iface
) {
1685 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1687 TRACE("(%p/%p)->()\n", This
, iface
);
1689 return VideoRenderer_AddRef((IBaseFilter
*)This
);
1692 static ULONG WINAPI
Videowindow_Release(IVideoWindow
*iface
) {
1693 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1695 TRACE("(%p/%p)->()\n", This
, iface
);
1697 return VideoRenderer_Release((IBaseFilter
*)This
);
1700 /*** IDispatch methods ***/
1701 static HRESULT WINAPI
Videowindow_GetTypeInfoCount(IVideoWindow
*iface
,
1703 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1705 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
1710 static HRESULT WINAPI
Videowindow_GetTypeInfo(IVideoWindow
*iface
,
1713 ITypeInfo
**ppTInfo
) {
1714 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1716 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
1721 static HRESULT WINAPI
Videowindow_GetIDsOfNames(IVideoWindow
*iface
,
1727 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1729 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1734 static HRESULT WINAPI
Videowindow_Invoke(IVideoWindow
*iface
,
1735 DISPID dispIdMember
,
1739 DISPPARAMS
*pDispParams
,
1741 EXCEPINFO
*pExepInfo
,
1743 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1745 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
);
1750 /*** IVideoWindow methods ***/
1751 static HRESULT WINAPI
Videowindow_put_Caption(IVideoWindow
*iface
,
1753 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1755 TRACE("(%p/%p)->(%s (%p))\n", This
, iface
, debugstr_w(strCaption
), strCaption
);
1757 if (!SetWindowTextW(This
->hWnd
, strCaption
))
1763 static HRESULT WINAPI
Videowindow_get_Caption(IVideoWindow
*iface
,
1765 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1767 TRACE("(%p/%p)->(%p)\n", This
, iface
, strCaption
);
1769 GetWindowTextW(This
->hWnd
, (LPWSTR
)strCaption
, 100);
1774 static HRESULT WINAPI
Videowindow_put_WindowStyle(IVideoWindow
*iface
,
1776 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1779 old
= GetWindowLongA(This
->hWnd
, GWL_STYLE
);
1781 TRACE("(%p/%p)->(%x -> %x)\n", This
, iface
, old
, WindowStyle
);
1783 if (WindowStyle
& (WS_DISABLED
|WS_HSCROLL
|WS_ICONIC
|WS_MAXIMIZE
|WS_MINIMIZE
|WS_VSCROLL
))
1784 return E_INVALIDARG
;
1786 SetWindowLongA(This
->hWnd
, GWL_STYLE
, WindowStyle
);
1791 static HRESULT WINAPI
Videowindow_get_WindowStyle(IVideoWindow
*iface
,
1792 LONG
*WindowStyle
) {
1793 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1795 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyle
);
1797 *WindowStyle
= GetWindowLongA(This
->hWnd
, GWL_STYLE
);
1802 static HRESULT WINAPI
Videowindow_put_WindowStyleEx(IVideoWindow
*iface
,
1803 LONG WindowStyleEx
) {
1804 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1806 TRACE("(%p/%p)->(%d)\n", This
, iface
, WindowStyleEx
);
1808 if (!SetWindowLongA(This
->hWnd
, GWL_EXSTYLE
, WindowStyleEx
))
1814 static HRESULT WINAPI
Videowindow_get_WindowStyleEx(IVideoWindow
*iface
,
1815 LONG
*WindowStyleEx
) {
1816 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1818 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyleEx
);
1820 *WindowStyleEx
= GetWindowLongA(This
->hWnd
, GWL_EXSTYLE
);
1825 static HRESULT WINAPI
Videowindow_put_AutoShow(IVideoWindow
*iface
,
1827 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1829 TRACE("(%p/%p)->(%d)\n", This
, iface
, AutoShow
);
1831 This
->AutoShow
= AutoShow
;
1836 static HRESULT WINAPI
Videowindow_get_AutoShow(IVideoWindow
*iface
,
1838 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1840 TRACE("(%p/%p)->(%p)\n", This
, iface
, AutoShow
);
1842 *AutoShow
= This
->AutoShow
;
1847 static HRESULT WINAPI
Videowindow_put_WindowState(IVideoWindow
*iface
,
1849 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1851 TRACE("(%p/%p)->(%d)\n", This
, iface
, WindowState
);
1852 ShowWindow(This
->hWnd
, WindowState
);
1856 static HRESULT WINAPI
Videowindow_get_WindowState(IVideoWindow
*iface
,
1857 LONG
*WindowState
) {
1858 WINDOWPLACEMENT place
;
1859 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1861 place
.length
= sizeof(place
);
1862 GetWindowPlacement(This
->hWnd
, &place
);
1863 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowState
);
1864 *WindowState
= place
.showCmd
;
1869 static HRESULT WINAPI
Videowindow_put_BackgroundPalette(IVideoWindow
*iface
,
1870 LONG BackgroundPalette
) {
1871 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1873 FIXME("(%p/%p)->(%d): stub !!!\n", This
, iface
, BackgroundPalette
);
1878 static HRESULT WINAPI
Videowindow_get_BackgroundPalette(IVideoWindow
*iface
,
1879 LONG
*pBackgroundPalette
) {
1880 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1882 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBackgroundPalette
);
1887 static HRESULT WINAPI
Videowindow_put_Visible(IVideoWindow
*iface
,
1889 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1891 TRACE("(%p/%p)->(%d)\n", This
, iface
, Visible
);
1893 ShowWindow(This
->hWnd
, Visible
? SW_SHOW
: SW_HIDE
);
1898 static HRESULT WINAPI
Videowindow_get_Visible(IVideoWindow
*iface
,
1900 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1902 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVisible
);
1904 *pVisible
= IsWindowVisible(This
->hWnd
);
1909 static HRESULT WINAPI
Videowindow_put_Left(IVideoWindow
*iface
,
1911 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1913 TRACE("(%p/%p)->(%d)\n", This
, iface
, Left
);
1915 if (!SetWindowPos(This
->hWnd
, NULL
, Left
, This
->WindowPos
.top
, 0, 0, SWP_NOZORDER
|SWP_NOSIZE
))
1918 This
->WindowPos
.left
= Left
;
1923 static HRESULT WINAPI
Videowindow_get_Left(IVideoWindow
*iface
,
1925 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1927 TRACE("(%p/%p)->(%p)\n", This
, iface
, pLeft
);
1929 *pLeft
= This
->WindowPos
.left
;
1934 static HRESULT WINAPI
Videowindow_put_Width(IVideoWindow
*iface
,
1936 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1938 TRACE("(%p/%p)->(%d)\n", This
, iface
, Width
);
1940 if (!SetWindowPos(This
->hWnd
, NULL
, 0, 0, Width
, This
->WindowPos
.bottom
-This
->WindowPos
.top
, SWP_NOZORDER
|SWP_NOMOVE
))
1943 This
->WindowPos
.right
= This
->WindowPos
.left
+ Width
;
1948 static HRESULT WINAPI
Videowindow_get_Width(IVideoWindow
*iface
,
1950 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1952 TRACE("(%p/%p)->(%p)\n", This
, iface
, pWidth
);
1954 *pWidth
= This
->WindowPos
.right
- This
->WindowPos
.left
;
1959 static HRESULT WINAPI
Videowindow_put_Top(IVideoWindow
*iface
,
1961 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1963 TRACE("(%p/%p)->(%d)\n", This
, iface
, Top
);
1965 if (!SetWindowPos(This
->hWnd
, NULL
, This
->WindowPos
.left
, Top
, 0, 0, SWP_NOZORDER
|SWP_NOSIZE
))
1968 This
->WindowPos
.top
= Top
;
1973 static HRESULT WINAPI
Videowindow_get_Top(IVideoWindow
*iface
,
1975 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1977 TRACE("(%p/%p)->(%p)\n", This
, iface
, pTop
);
1979 *pTop
= This
->WindowPos
.top
;
1984 static HRESULT WINAPI
Videowindow_put_Height(IVideoWindow
*iface
,
1986 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1988 TRACE("(%p/%p)->(%d)\n", This
, iface
, Height
);
1990 if (!SetWindowPos(This
->hWnd
, NULL
, 0, 0, This
->WindowPos
.right
-This
->WindowPos
.left
, Height
, SWP_NOZORDER
|SWP_NOMOVE
))
1993 This
->WindowPos
.bottom
= This
->WindowPos
.top
+ Height
;
1998 static HRESULT WINAPI
Videowindow_get_Height(IVideoWindow
*iface
,
2000 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2002 TRACE("(%p/%p)->(%p)\n", This
, iface
, pHeight
);
2004 *pHeight
= This
->WindowPos
.bottom
- This
->WindowPos
.top
;
2009 static HRESULT WINAPI
Videowindow_put_Owner(IVideoWindow
*iface
,
2011 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2013 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Owner
);
2015 SetParent(This
->hWnd
, (HWND
)Owner
);
2020 static HRESULT WINAPI
Videowindow_get_Owner(IVideoWindow
*iface
,
2022 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2024 TRACE("(%p/%p)->(%p)\n", This
, iface
, Owner
);
2026 *(HWND
*)Owner
= GetParent(This
->hWnd
);
2031 static HRESULT WINAPI
Videowindow_put_MessageDrain(IVideoWindow
*iface
,
2033 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2035 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Drain
);
2037 This
->hWndMsgDrain
= (HWND
)Drain
;
2042 static HRESULT WINAPI
Videowindow_get_MessageDrain(IVideoWindow
*iface
,
2044 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2046 TRACE("(%p/%p)->(%p)\n", This
, iface
, Drain
);
2048 *Drain
= (OAHWND
)This
->hWndMsgDrain
;
2053 static HRESULT WINAPI
Videowindow_get_BorderColor(IVideoWindow
*iface
,
2055 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2057 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, Color
);
2062 static HRESULT WINAPI
Videowindow_put_BorderColor(IVideoWindow
*iface
,
2064 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2066 FIXME("(%p/%p)->(%d): stub !!!\n", This
, iface
, Color
);
2071 static HRESULT WINAPI
Videowindow_get_FullScreenMode(IVideoWindow
*iface
,
2072 LONG
*FullScreenMode
) {
2073 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2075 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, FullScreenMode
);
2080 static HRESULT WINAPI
Videowindow_put_FullScreenMode(IVideoWindow
*iface
,
2081 LONG FullScreenMode
) {
2082 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2084 FIXME("(%p/%p)->(%d): stub !!!\n", This
, iface
, FullScreenMode
);
2089 static HRESULT WINAPI
Videowindow_SetWindowForeground(IVideoWindow
*iface
,
2091 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2096 TRACE("(%p/%p)->(%d)\n", This
, iface
, Focus
);
2098 if ((Focus
!= FALSE
) && (Focus
!= TRUE
))
2099 return E_INVALIDARG
;
2101 hr
= IPin_ConnectedTo((IPin
*)This
->pInputPin
, &pPin
);
2102 if ((hr
!= S_OK
) || !pPin
)
2103 return VFW_E_NOT_CONNECTED
;
2106 ret
= SetForegroundWindow(This
->hWnd
);
2108 ret
= SetWindowPos(This
->hWnd
, HWND_TOP
, 0, 0, 0, 0, SWP_NOMOVE
|SWP_NOSIZE
);
2116 static HRESULT WINAPI
Videowindow_NotifyOwnerMessage(IVideoWindow
*iface
,
2121 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2123 TRACE("(%p/%p)->(%08lx, %d, %08lx, %08lx)\n", This
, iface
, hwnd
, uMsg
, wParam
, lParam
);
2125 if (!PostMessageA(This
->hWnd
, uMsg
, wParam
, lParam
))
2131 static HRESULT WINAPI
Videowindow_SetWindowPosition(IVideoWindow
*iface
,
2136 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2138 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This
, iface
, Left
, Top
, Width
, Height
);
2140 if (!SetWindowPos(This
->hWnd
, NULL
, Left
, Top
, Width
, Height
, SWP_NOZORDER
))
2143 This
->WindowPos
.left
= Left
;
2144 This
->WindowPos
.top
= Top
;
2145 This
->WindowPos
.right
= Left
+ Width
;
2146 This
->WindowPos
.bottom
= Top
+ Height
;
2151 static HRESULT WINAPI
Videowindow_GetWindowPosition(IVideoWindow
*iface
,
2156 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2158 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
2160 *pLeft
= This
->WindowPos
.left
;
2161 *pTop
= This
->WindowPos
.top
;
2162 *pWidth
= This
->WindowPos
.right
- This
->WindowPos
.left
;
2163 *pHeight
= This
->WindowPos
.bottom
- This
->WindowPos
.top
;
2168 static HRESULT WINAPI
Videowindow_GetMinIdealImageSize(IVideoWindow
*iface
,
2171 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2173 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This
, iface
, pWidth
, pHeight
);
2175 *pWidth
= This
->VideoWidth
;
2176 *pHeight
= This
->VideoHeight
;
2181 static HRESULT WINAPI
Videowindow_GetMaxIdealImageSize(IVideoWindow
*iface
,
2184 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2186 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This
, iface
, pWidth
, pHeight
);
2188 *pWidth
= This
->VideoWidth
;
2189 *pHeight
= This
->VideoHeight
;
2194 static HRESULT WINAPI
Videowindow_GetRestorePosition(IVideoWindow
*iface
,
2199 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2201 FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
2206 static HRESULT WINAPI
Videowindow_HideCursor(IVideoWindow
*iface
,
2208 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2210 FIXME("(%p/%p)->(%d): stub !!!\n", This
, iface
, HideCursor
);
2215 static HRESULT WINAPI
Videowindow_IsCursorHidden(IVideoWindow
*iface
,
2216 LONG
*CursorHidden
) {
2217 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2219 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, CursorHidden
);
2224 static const IVideoWindowVtbl IVideoWindow_VTable
=
2226 Videowindow_QueryInterface
,
2228 Videowindow_Release
,
2229 Videowindow_GetTypeInfoCount
,
2230 Videowindow_GetTypeInfo
,
2231 Videowindow_GetIDsOfNames
,
2233 Videowindow_put_Caption
,
2234 Videowindow_get_Caption
,
2235 Videowindow_put_WindowStyle
,
2236 Videowindow_get_WindowStyle
,
2237 Videowindow_put_WindowStyleEx
,
2238 Videowindow_get_WindowStyleEx
,
2239 Videowindow_put_AutoShow
,
2240 Videowindow_get_AutoShow
,
2241 Videowindow_put_WindowState
,
2242 Videowindow_get_WindowState
,
2243 Videowindow_put_BackgroundPalette
,
2244 Videowindow_get_BackgroundPalette
,
2245 Videowindow_put_Visible
,
2246 Videowindow_get_Visible
,
2247 Videowindow_put_Left
,
2248 Videowindow_get_Left
,
2249 Videowindow_put_Width
,
2250 Videowindow_get_Width
,
2251 Videowindow_put_Top
,
2252 Videowindow_get_Top
,
2253 Videowindow_put_Height
,
2254 Videowindow_get_Height
,
2255 Videowindow_put_Owner
,
2256 Videowindow_get_Owner
,
2257 Videowindow_put_MessageDrain
,
2258 Videowindow_get_MessageDrain
,
2259 Videowindow_get_BorderColor
,
2260 Videowindow_put_BorderColor
,
2261 Videowindow_get_FullScreenMode
,
2262 Videowindow_put_FullScreenMode
,
2263 Videowindow_SetWindowForeground
,
2264 Videowindow_NotifyOwnerMessage
,
2265 Videowindow_SetWindowPosition
,
2266 Videowindow_GetWindowPosition
,
2267 Videowindow_GetMinIdealImageSize
,
2268 Videowindow_GetMaxIdealImageSize
,
2269 Videowindow_GetRestorePosition
,
2270 Videowindow_HideCursor
,
2271 Videowindow_IsCursorHidden