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
*)GetWindowLongA(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 SetWindowLongA(This
->hWnd
, 0, (LONG
)This
);
205 static DWORD WINAPI
MessageLoop(LPVOID lpParameter
)
207 VideoRendererImpl
* This
= (VideoRendererImpl
*) 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
, (LPVOID
)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 const IMemInputPinVtbl MemInputPin_Vtbl
=
261 MemInputPin_QueryInterface
,
264 MemInputPin_GetAllocator
,
265 MemInputPin_NotifyAllocator
,
266 MemInputPin_GetAllocatorRequirements
,
268 MemInputPin_ReceiveMultiple
,
269 MemInputPin_ReceiveCanBlock
272 static DWORD
VideoRenderer_SendSampleData(VideoRendererImpl
* This
, LPBYTE data
, DWORD size
)
279 LPBYTE palette
= NULL
;
281 BITMAPINFOHEADER
*bmiHeader
;
283 TRACE("%p %p %d\n", This
, data
, size
);
285 sdesc
.dwSize
= sizeof(sdesc
);
286 hr
= IPin_ConnectionMediaType((IPin
*)This
->pInputPin
, &amt
);
288 ERR("Unable to retrieve media type\n");
292 if (IsEqualIID(&amt
.formattype
, &FORMAT_VideoInfo
))
294 bmiHeader
= &((VIDEOINFOHEADER
*)amt
.pbFormat
)->bmiHeader
;
296 else if (IsEqualIID(&amt
.formattype
, &FORMAT_VideoInfo2
))
298 bmiHeader
= &((VIDEOINFOHEADER2
*)amt
.pbFormat
)->bmiHeader
;
302 FIXME("Unknown type %s\n", debugstr_guid(&amt
.subtype
));
303 return VFW_E_RUNTIME_ERROR
;
307 TRACE("biSize = %d\n", bmiHeader
->biSize
);
308 TRACE("biWidth = %d\n", bmiHeader
->biWidth
);
309 TRACE("biHeight = %d\n", bmiHeader
->biHeight
);
310 TRACE("biPlanes = %d\n", bmiHeader
->biPlanes
);
311 TRACE("biBitCount = %d\n", bmiHeader
->biBitCount
);
312 TRACE("biCompression = %s\n", debugstr_an((LPSTR
)&(bmiHeader
->biCompression
), 4));
313 TRACE("biSizeImage = %d\n", bmiHeader
->biSizeImage
);
315 width
= bmiHeader
->biWidth
;
316 height
= bmiHeader
->biHeight
;
317 palette
= ((LPBYTE
)bmiHeader
) + bmiHeader
->biSize
;
321 if (!This
->WindowPos
.right
|| !This
->WindowPos
.bottom
)
322 This
->WindowPos
= This
->SourceRect
;
324 TRACE("WindowPos: %d %d %d %d\n", This
->WindowPos
.left
, This
->WindowPos
.top
, This
->WindowPos
.right
, This
->WindowPos
.bottom
);
325 SetWindowPos(This
->hWnd
, NULL
,
326 This
->WindowPos
.left
,
328 This
->WindowPos
.right
- This
->WindowPos
.left
,
329 This
->WindowPos
.bottom
- This
->WindowPos
.top
,
330 SWP_NOZORDER
|SWP_NOMOVE
);
332 GetClientRect(This
->hWnd
, &This
->DestRect
);
336 hDC
= GetDC(This
->hWnd
);
339 ERR("Cannot get DC from window!\n");
343 TRACE("Src Rect: %d %d %d %d\n", This
->SourceRect
.left
, This
->SourceRect
.top
, This
->SourceRect
.right
, This
->SourceRect
.bottom
);
344 TRACE("Dst Rect: %d %d %d %d\n", This
->DestRect
.left
, This
->DestRect
.top
, This
->DestRect
.right
, This
->DestRect
.bottom
);
346 StretchDIBits(hDC
, This
->DestRect
.left
, This
->DestRect
.top
, This
->DestRect
.right
-This
->DestRect
.left
,
347 This
->DestRect
.bottom
- This
->DestRect
.top
, This
->SourceRect
.left
, This
->SourceRect
.top
,
348 This
->SourceRect
.right
- This
->SourceRect
.left
, This
->SourceRect
.bottom
- This
->SourceRect
.top
,
349 data
, (BITMAPINFO
*)bmiHeader
, DIB_RGB_COLORS
, SRCCOPY
);
351 ReleaseDC(This
->hWnd
, hDC
);
353 ShowWindow(This
->hWnd
, SW_SHOW
);
358 static HRESULT
VideoRenderer_Sample(LPVOID iface
, IMediaSample
* pSample
)
360 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
361 LPBYTE pbSrcStream
= NULL
;
362 long cbSrcStream
= 0;
363 REFERENCE_TIME tStart
, tStop
;
365 EnterCriticalSection(&This
->csFilter
);
366 if (This
->pInputPin
->flushing
|| This
->pInputPin
->end_of_stream
)
369 if (This
->state
== State_Stopped
)
371 LeaveCriticalSection(&This
->csFilter
);
372 return VFW_E_WRONG_STATE
;
375 TRACE("%p %p\n", iface
, pSample
);
377 hr
= IMediaSample_GetTime(pSample
, &tStart
, &tStop
);
379 ERR("Cannot get sample time (%x)\n", hr
);
381 if (This
->rtLastStop
!= tStart
)
383 if (IMediaSample_IsDiscontinuity(pSample
) == S_FALSE
)
384 ERR("Unexpected discontinuity: Last: %u.%03u, tStart: %u.%03u\n",
385 (DWORD
)(This
->rtLastStop
/ 10000000),
386 (DWORD
)((This
->rtLastStop
/ 10000)%1000),
387 (DWORD
)(tStart
/ 10000000), (DWORD
)((tStart
/ 10000)%1000));
388 This
->rtLastStop
= tStart
;
391 /* Preroll means the sample isn't shown, this is used for key frames and things like that */
392 if (IMediaSample_IsPreroll(pSample
) == S_OK
)
394 This
->rtLastStop
= tStop
;
395 LeaveCriticalSection(&This
->csFilter
);
399 hr
= IMediaSample_GetPointer(pSample
, &pbSrcStream
);
402 ERR("Cannot get pointer to sample data (%x)\n", hr
);
403 LeaveCriticalSection(&This
->csFilter
);
407 cbSrcStream
= IMediaSample_GetActualDataLength(pSample
);
409 TRACE("val %p %ld\n", pbSrcStream
, cbSrcStream
);
411 #if 0 /* For debugging purpose */
414 for(i
= 0; i
< cbSrcStream
; i
++)
416 if ((i
!=0) && !(i
%16))
418 TRACE("%02x ", pbSrcStream
[i
]);
424 SetEvent(This
->hEvent
);
425 if (This
->state
== State_Paused
)
427 This
->sample_held
= pSample
;
428 LeaveCriticalSection(&This
->csFilter
);
429 WaitForSingleObject(This
->blocked
, INFINITE
);
430 EnterCriticalSection(&This
->csFilter
);
431 This
->sample_held
= NULL
;
432 if (This
->state
== State_Paused
)
435 LeaveCriticalSection(&This
->csFilter
);
438 if (This
->state
== State_Stopped
)
440 LeaveCriticalSection(&This
->csFilter
);
441 return VFW_E_WRONG_STATE
;
445 if (This
->pClock
&& This
->state
== State_Running
)
447 REFERENCE_TIME time
, trefstart
, trefstop
;
450 /* Perhaps I <SHOULD> use the reference clock AdviseTime function here
451 * I'm not going to! When I tried, it seemed to generate lag and
452 * it caused instability.
454 IReferenceClock_GetTime(This
->pClock
, &time
);
456 trefstart
= This
->rtStreamStart
;
457 trefstop
= (REFERENCE_TIME
)((double)(tStop
- tStart
) / This
->pInputPin
->dRate
) + This
->rtStreamStart
;
458 delta
= (LONG
)((trefstart
-time
)/10000);
459 This
->rtStreamStart
= trefstop
;
460 This
->rtLastStop
= tStop
;
464 TRACE("Sleeping for %u ms\n", delta
);
467 else if (time
> trefstop
)
469 TRACE("Dropping sample: Time: %u.%03u ms trefstop: %u.%03u ms!\n",
470 (DWORD
)(time
/ 10000000), (DWORD
)((time
/ 10000)%1000),
471 (DWORD
)(trefstop
/ 10000000), (DWORD
)((trefstop
/ 10000)%1000) );
472 This
->rtLastStop
= tStop
;
473 LeaveCriticalSection(&This
->csFilter
);
477 This
->rtLastStop
= tStop
;
479 VideoRenderer_SendSampleData(This
, pbSrcStream
, cbSrcStream
);
481 LeaveCriticalSection(&This
->csFilter
);
485 static HRESULT
VideoRenderer_QueryAccept(LPVOID iface
, const AM_MEDIA_TYPE
* pmt
)
487 if (!IsEqualIID(&pmt
->majortype
, &MEDIATYPE_Video
))
490 if (IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB32
) ||
491 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB24
) ||
492 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB565
) ||
493 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB8
))
495 VideoRendererImpl
* This
= (VideoRendererImpl
*) iface
;
497 if (IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo
))
499 VIDEOINFOHEADER
*format
= (VIDEOINFOHEADER
*)pmt
->pbFormat
;
500 This
->SourceRect
.left
= 0;
501 This
->SourceRect
.top
= 0;
502 This
->SourceRect
.right
= This
->VideoWidth
= format
->bmiHeader
.biWidth
;
503 This
->SourceRect
.bottom
= This
->VideoHeight
= format
->bmiHeader
.biHeight
;
505 else if (IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo2
))
507 VIDEOINFOHEADER2
*format2
= (VIDEOINFOHEADER2
*)pmt
->pbFormat
;
509 This
->SourceRect
.left
= 0;
510 This
->SourceRect
.top
= 0;
511 This
->SourceRect
.right
= This
->VideoWidth
= format2
->bmiHeader
.biWidth
;
512 This
->SourceRect
.bottom
= This
->VideoHeight
= format2
->bmiHeader
.biHeight
;
516 WARN("Format type %s not supported\n", debugstr_guid(&pmt
->formattype
));
524 static inline VideoRendererImpl
*impl_from_IMediaSeeking( IMediaSeeking
*iface
)
526 return (VideoRendererImpl
*)((char*)iface
- FIELD_OFFSET(VideoRendererImpl
, mediaSeeking
.lpVtbl
));
529 static HRESULT WINAPI
VideoRendererImpl_Seeking_QueryInterface(IMediaSeeking
* iface
, REFIID riid
, LPVOID
* ppv
)
531 VideoRendererImpl
*This
= impl_from_IMediaSeeking(iface
);
533 return IUnknown_QueryInterface((IUnknown
*)This
, riid
, ppv
);
536 static ULONG WINAPI
VideoRendererImpl_Seeking_AddRef(IMediaSeeking
* iface
)
538 VideoRendererImpl
*This
= impl_from_IMediaSeeking(iface
);
540 return IUnknown_AddRef((IUnknown
*)This
);
543 static ULONG WINAPI
VideoRendererImpl_Seeking_Release(IMediaSeeking
* iface
)
545 VideoRendererImpl
*This
= impl_from_IMediaSeeking(iface
);
547 return IUnknown_Release((IUnknown
*)This
);
550 static const IMediaSeekingVtbl VideoRendererImpl_Seeking_Vtbl
=
552 VideoRendererImpl_Seeking_QueryInterface
,
553 VideoRendererImpl_Seeking_AddRef
,
554 VideoRendererImpl_Seeking_Release
,
555 MediaSeekingImpl_GetCapabilities
,
556 MediaSeekingImpl_CheckCapabilities
,
557 MediaSeekingImpl_IsFormatSupported
,
558 MediaSeekingImpl_QueryPreferredFormat
,
559 MediaSeekingImpl_GetTimeFormat
,
560 MediaSeekingImpl_IsUsingTimeFormat
,
561 MediaSeekingImpl_SetTimeFormat
,
562 MediaSeekingImpl_GetDuration
,
563 MediaSeekingImpl_GetStopPosition
,
564 MediaSeekingImpl_GetCurrentPosition
,
565 MediaSeekingImpl_ConvertTimeFormat
,
566 MediaSeekingImpl_SetPositions
,
567 MediaSeekingImpl_GetPositions
,
568 MediaSeekingImpl_GetAvailable
,
569 MediaSeekingImpl_SetRate
,
570 MediaSeekingImpl_GetRate
,
571 MediaSeekingImpl_GetPreroll
574 static HRESULT
VideoRendererImpl_Change(IBaseFilter
*iface
)
576 TRACE("(%p)\n", iface
);
580 HRESULT
VideoRenderer_create(IUnknown
* pUnkOuter
, LPVOID
* ppv
)
584 VideoRendererImpl
* pVideoRenderer
;
586 TRACE("(%p, %p)\n", pUnkOuter
, ppv
);
590 pVideoRenderer
= CoTaskMemAlloc(sizeof(VideoRendererImpl
));
591 pVideoRenderer
->pUnkOuter
= pUnkOuter
;
592 pVideoRenderer
->bUnkOuterValid
= FALSE
;
593 pVideoRenderer
->bAggregatable
= FALSE
;
594 pVideoRenderer
->IInner_vtbl
= &IInner_VTable
;
596 pVideoRenderer
->lpVtbl
= &VideoRenderer_Vtbl
;
597 pVideoRenderer
->IBasicVideo_vtbl
= &IBasicVideo_VTable
;
598 pVideoRenderer
->IVideoWindow_vtbl
= &IVideoWindow_VTable
;
600 pVideoRenderer
->refCount
= 1;
601 InitializeCriticalSection(&pVideoRenderer
->csFilter
);
602 pVideoRenderer
->csFilter
.DebugInfo
->Spare
[0] = (DWORD_PTR
)(__FILE__
": VideoRendererImpl.csFilter");
603 pVideoRenderer
->state
= State_Stopped
;
604 pVideoRenderer
->pClock
= NULL
;
605 pVideoRenderer
->init
= 0;
606 pVideoRenderer
->AutoShow
= 1;
607 pVideoRenderer
->rtLastStop
= -1;
608 ZeroMemory(&pVideoRenderer
->filterInfo
, sizeof(FILTER_INFO
));
609 ZeroMemory(&pVideoRenderer
->SourceRect
, sizeof(RECT
));
610 ZeroMemory(&pVideoRenderer
->DestRect
, sizeof(RECT
));
611 ZeroMemory(&pVideoRenderer
->WindowPos
, sizeof(RECT
));
612 pVideoRenderer
->hWndMsgDrain
= NULL
;
614 /* construct input pin */
615 piInput
.dir
= PINDIR_INPUT
;
616 piInput
.pFilter
= (IBaseFilter
*)pVideoRenderer
;
617 lstrcpynW(piInput
.achName
, wcsInputPinName
, sizeof(piInput
.achName
) / sizeof(piInput
.achName
[0]));
619 hr
= InputPin_Construct(&VideoRenderer_InputPin_Vtbl
, &piInput
, VideoRenderer_Sample
, (LPVOID
)pVideoRenderer
, VideoRenderer_QueryAccept
, NULL
, &pVideoRenderer
->csFilter
, NULL
, (IPin
**)&pVideoRenderer
->pInputPin
);
623 MediaSeekingImpl_Init((IBaseFilter
*)pVideoRenderer
, VideoRendererImpl_Change
, VideoRendererImpl_Change
, VideoRendererImpl_Change
, &pVideoRenderer
->mediaSeeking
, &pVideoRenderer
->csFilter
);
624 pVideoRenderer
->mediaSeeking
.lpVtbl
= &VideoRendererImpl_Seeking_Vtbl
;
626 pVideoRenderer
->sample_held
= NULL
;
627 *ppv
= (LPVOID
)pVideoRenderer
;
631 pVideoRenderer
->csFilter
.DebugInfo
->Spare
[0] = 0;
632 DeleteCriticalSection(&pVideoRenderer
->csFilter
);
633 CoTaskMemFree(pVideoRenderer
);
636 if (!CreateRenderingSubsystem(pVideoRenderer
))
639 pVideoRenderer
->blocked
= CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
640 if (!pVideoRenderer
->blocked
)
642 hr
= HRESULT_FROM_WIN32(GetLastError());
643 IUnknown_Release((IUnknown
*)pVideoRenderer
);
649 HRESULT
VideoRendererDefault_create(IUnknown
* pUnkOuter
, LPVOID
* ppv
)
651 /* TODO: Attempt to use the VMR-7 renderer instead when possible */
652 return VideoRenderer_create(pUnkOuter
, ppv
);
655 static HRESULT WINAPI
VideoRendererInner_QueryInterface(IUnknown
* iface
, REFIID riid
, LPVOID
* ppv
)
657 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
658 TRACE("(%p/%p)->(%s, %p)\n", This
, iface
, qzdebugstr_guid(riid
), ppv
);
660 if (This
->bAggregatable
)
661 This
->bUnkOuterValid
= TRUE
;
665 if (IsEqualIID(riid
, &IID_IUnknown
))
666 *ppv
= (LPVOID
)&(This
->IInner_vtbl
);
667 else if (IsEqualIID(riid
, &IID_IPersist
))
669 else if (IsEqualIID(riid
, &IID_IMediaFilter
))
671 else if (IsEqualIID(riid
, &IID_IBaseFilter
))
673 else if (IsEqualIID(riid
, &IID_IBasicVideo
))
674 *ppv
= (LPVOID
)&(This
->IBasicVideo_vtbl
);
675 else if (IsEqualIID(riid
, &IID_IVideoWindow
))
676 *ppv
= (LPVOID
)&(This
->IVideoWindow_vtbl
);
677 else if (IsEqualIID(riid
, &IID_IMediaSeeking
))
678 *ppv
= &This
->mediaSeeking
;
682 IUnknown_AddRef((IUnknown
*)(*ppv
));
686 if (!IsEqualIID(riid
, &IID_IPin
))
687 FIXME("No interface for %s!\n", qzdebugstr_guid(riid
));
689 return E_NOINTERFACE
;
692 static ULONG WINAPI
VideoRendererInner_AddRef(IUnknown
* iface
)
694 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
695 ULONG refCount
= InterlockedIncrement(&This
->refCount
);
697 TRACE("(%p/%p)->() AddRef from %d\n", This
, iface
, refCount
- 1);
702 static ULONG WINAPI
VideoRendererInner_Release(IUnknown
* iface
)
704 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
705 ULONG refCount
= InterlockedDecrement(&This
->refCount
);
707 TRACE("(%p/%p)->() Release from %d\n", This
, iface
, refCount
+ 1);
713 DestroyWindow(This
->hWnd
);
714 PostThreadMessageA(This
->ThreadID
, WM_QUIT
, 0, 0);
715 WaitForSingleObject(This
->hThread
, INFINITE
);
716 CloseHandle(This
->hThread
);
717 CloseHandle(This
->hEvent
);
720 IReferenceClock_Release(This
->pClock
);
722 if (SUCCEEDED(IPin_ConnectedTo((IPin
*)This
->pInputPin
, &pConnectedTo
)))
724 IPin_Disconnect(pConnectedTo
);
725 IPin_Release(pConnectedTo
);
727 IPin_Disconnect((IPin
*)This
->pInputPin
);
729 IPin_Release((IPin
*)This
->pInputPin
);
733 This
->csFilter
.DebugInfo
->Spare
[0] = 0;
734 DeleteCriticalSection(&This
->csFilter
);
736 TRACE("Destroying Video Renderer\n");
745 static const IUnknownVtbl IInner_VTable
=
747 VideoRendererInner_QueryInterface
,
748 VideoRendererInner_AddRef
,
749 VideoRendererInner_Release
752 static HRESULT WINAPI
VideoRenderer_QueryInterface(IBaseFilter
* iface
, REFIID riid
, LPVOID
* ppv
)
754 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
756 if (This
->bAggregatable
)
757 This
->bUnkOuterValid
= TRUE
;
761 if (This
->bAggregatable
)
762 return IUnknown_QueryInterface(This
->pUnkOuter
, riid
, ppv
);
764 if (IsEqualIID(riid
, &IID_IUnknown
))
768 IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
769 hr
= IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
770 IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
771 This
->bAggregatable
= TRUE
;
776 return E_NOINTERFACE
;
779 return IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
782 static ULONG WINAPI
VideoRenderer_AddRef(IBaseFilter
* iface
)
784 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
786 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
787 return IUnknown_AddRef(This
->pUnkOuter
);
788 return IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
791 static ULONG WINAPI
VideoRenderer_Release(IBaseFilter
* iface
)
793 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
795 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
796 return IUnknown_Release(This
->pUnkOuter
);
797 return IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
800 /** IPersist methods **/
802 static HRESULT WINAPI
VideoRenderer_GetClassID(IBaseFilter
* iface
, CLSID
* pClsid
)
804 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
806 TRACE("(%p/%p)->(%p)\n", This
, iface
, pClsid
);
808 *pClsid
= CLSID_VideoRenderer
;
813 /** IMediaFilter methods **/
815 static HRESULT WINAPI
VideoRenderer_Stop(IBaseFilter
* iface
)
817 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
819 TRACE("(%p/%p)->()\n", This
, iface
);
821 EnterCriticalSection(&This
->csFilter
);
823 This
->state
= State_Stopped
;
824 SetEvent(This
->hEvent
);
825 SetEvent(This
->blocked
);
827 LeaveCriticalSection(&This
->csFilter
);
832 static HRESULT WINAPI
VideoRenderer_Pause(IBaseFilter
* iface
)
834 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
836 TRACE("(%p/%p)->()\n", This
, iface
);
838 EnterCriticalSection(&This
->csFilter
);
839 if (This
->state
!= State_Paused
)
841 if (This
->state
== State_Stopped
)
843 This
->pInputPin
->end_of_stream
= 0;
844 ResetEvent(This
->hEvent
);
847 This
->state
= State_Paused
;
848 ResetEvent(This
->blocked
);
850 LeaveCriticalSection(&This
->csFilter
);
855 static HRESULT WINAPI
VideoRenderer_Run(IBaseFilter
* iface
, REFERENCE_TIME tStart
)
857 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
859 TRACE("(%p/%p)->(%s)\n", This
, iface
, wine_dbgstr_longlong(tStart
));
861 EnterCriticalSection(&This
->csFilter
);
862 if (This
->state
!= State_Running
)
864 if (This
->state
== State_Stopped
)
866 This
->pInputPin
->end_of_stream
= 0;
867 ResetEvent(This
->hEvent
);
869 SetEvent(This
->blocked
);
871 This
->rtStreamStart
= tStart
;
872 This
->state
= State_Running
;
874 LeaveCriticalSection(&This
->csFilter
);
879 static HRESULT WINAPI
VideoRenderer_GetState(IBaseFilter
* iface
, DWORD dwMilliSecsTimeout
, FILTER_STATE
*pState
)
881 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
884 TRACE("(%p/%p)->(%d, %p)\n", This
, iface
, dwMilliSecsTimeout
, pState
);
886 if (WaitForSingleObject(This
->hEvent
, dwMilliSecsTimeout
) == WAIT_TIMEOUT
)
887 hr
= VFW_S_STATE_INTERMEDIATE
;
891 EnterCriticalSection(&This
->csFilter
);
893 *pState
= This
->state
;
895 LeaveCriticalSection(&This
->csFilter
);
900 static HRESULT WINAPI
VideoRenderer_SetSyncSource(IBaseFilter
* iface
, IReferenceClock
*pClock
)
902 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
904 TRACE("(%p/%p)->(%p)\n", This
, iface
, pClock
);
906 EnterCriticalSection(&This
->csFilter
);
909 IReferenceClock_Release(This
->pClock
);
910 This
->pClock
= pClock
;
912 IReferenceClock_AddRef(This
->pClock
);
914 LeaveCriticalSection(&This
->csFilter
);
919 static HRESULT WINAPI
VideoRenderer_GetSyncSource(IBaseFilter
* iface
, IReferenceClock
**ppClock
)
921 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
923 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppClock
);
925 EnterCriticalSection(&This
->csFilter
);
927 *ppClock
= This
->pClock
;
929 IReferenceClock_AddRef(This
->pClock
);
931 LeaveCriticalSection(&This
->csFilter
);
936 /** IBaseFilter implementation **/
938 static HRESULT
VideoRenderer_GetPin(IBaseFilter
*iface
, ULONG pos
, IPin
**pin
, DWORD
*lastsynctick
)
940 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
942 /* Our pins are static, not changing so setting static tick count is ok */
948 *pin
= (IPin
*)This
->pInputPin
;
953 static HRESULT WINAPI
VideoRenderer_EnumPins(IBaseFilter
* iface
, IEnumPins
**ppEnum
)
955 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
957 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppEnum
);
959 return IEnumPinsImpl_Construct(ppEnum
, VideoRenderer_GetPin
, iface
);
962 static HRESULT WINAPI
VideoRenderer_FindPin(IBaseFilter
* iface
, LPCWSTR Id
, IPin
**ppPin
)
964 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
966 TRACE("(%p/%p)->(%p,%p)\n", This
, iface
, debugstr_w(Id
), ppPin
);
968 FIXME("VideoRenderer::FindPin(...)\n");
970 /* FIXME: critical section */
975 static HRESULT WINAPI
VideoRenderer_QueryFilterInfo(IBaseFilter
* iface
, FILTER_INFO
*pInfo
)
977 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
979 TRACE("(%p/%p)->(%p)\n", This
, iface
, pInfo
);
981 strcpyW(pInfo
->achName
, This
->filterInfo
.achName
);
982 pInfo
->pGraph
= This
->filterInfo
.pGraph
;
985 IFilterGraph_AddRef(pInfo
->pGraph
);
990 static HRESULT WINAPI
VideoRenderer_JoinFilterGraph(IBaseFilter
* iface
, IFilterGraph
*pGraph
, LPCWSTR pName
)
992 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
994 TRACE("(%p/%p)->(%p, %s)\n", This
, iface
, pGraph
, debugstr_w(pName
));
996 EnterCriticalSection(&This
->csFilter
);
999 strcpyW(This
->filterInfo
.achName
, pName
);
1001 *This
->filterInfo
.achName
= '\0';
1002 This
->filterInfo
.pGraph
= pGraph
; /* NOTE: do NOT increase ref. count */
1004 LeaveCriticalSection(&This
->csFilter
);
1009 static HRESULT WINAPI
VideoRenderer_QueryVendorInfo(IBaseFilter
* iface
, LPWSTR
*pVendorInfo
)
1011 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
1012 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVendorInfo
);
1016 static const IBaseFilterVtbl VideoRenderer_Vtbl
=
1018 VideoRenderer_QueryInterface
,
1019 VideoRenderer_AddRef
,
1020 VideoRenderer_Release
,
1021 VideoRenderer_GetClassID
,
1023 VideoRenderer_Pause
,
1025 VideoRenderer_GetState
,
1026 VideoRenderer_SetSyncSource
,
1027 VideoRenderer_GetSyncSource
,
1028 VideoRenderer_EnumPins
,
1029 VideoRenderer_FindPin
,
1030 VideoRenderer_QueryFilterInfo
,
1031 VideoRenderer_JoinFilterGraph
,
1032 VideoRenderer_QueryVendorInfo
1035 static HRESULT WINAPI
VideoRenderer_InputPin_EndOfStream(IPin
* iface
)
1037 InputPin
* This
= (InputPin
*)iface
;
1038 IMediaEventSink
* pEventSink
;
1041 TRACE("(%p/%p)->()\n", This
, iface
);
1043 hr
= IFilterGraph_QueryInterface(((VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
)->filterInfo
.pGraph
, &IID_IMediaEventSink
, (LPVOID
*)&pEventSink
);
1046 hr
= IMediaEventSink_Notify(pEventSink
, EC_COMPLETE
, S_OK
, 0);
1047 IMediaEventSink_Release(pEventSink
);
1053 static HRESULT WINAPI
VideoRenderer_InputPin_BeginFlush(IPin
* iface
)
1055 InputPin
* This
= (InputPin
*)iface
;
1056 VideoRendererImpl
*pVideoRenderer
= (VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
;
1059 TRACE("(%p/%p)->()\n", This
, iface
);
1061 EnterCriticalSection(This
->pin
.pCritSec
);
1062 if (pVideoRenderer
->state
== State_Paused
)
1063 SetEvent(pVideoRenderer
->blocked
);
1065 hr
= InputPin_BeginFlush(iface
);
1066 LeaveCriticalSection(This
->pin
.pCritSec
);
1071 static HRESULT WINAPI
VideoRenderer_InputPin_EndFlush(IPin
* iface
)
1073 InputPin
* This
= (InputPin
*)iface
;
1074 VideoRendererImpl
*pVideoRenderer
= (VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
;
1077 TRACE("(%p/%p)->()\n", This
, iface
);
1079 EnterCriticalSection(This
->pin
.pCritSec
);
1080 if (pVideoRenderer
->state
== State_Paused
)
1081 ResetEvent(pVideoRenderer
->blocked
);
1083 hr
= InputPin_EndFlush(iface
);
1084 LeaveCriticalSection(This
->pin
.pCritSec
);
1089 static const IPinVtbl VideoRenderer_InputPin_Vtbl
=
1091 InputPin_QueryInterface
,
1095 InputPin_ReceiveConnection
,
1096 IPinImpl_Disconnect
,
1097 IPinImpl_ConnectedTo
,
1098 IPinImpl_ConnectionMediaType
,
1099 IPinImpl_QueryPinInfo
,
1100 IPinImpl_QueryDirection
,
1102 IPinImpl_QueryAccept
,
1103 IPinImpl_EnumMediaTypes
,
1104 IPinImpl_QueryInternalConnections
,
1105 VideoRenderer_InputPin_EndOfStream
,
1106 VideoRenderer_InputPin_BeginFlush
,
1107 VideoRenderer_InputPin_EndFlush
,
1111 /*** IUnknown methods ***/
1112 static HRESULT WINAPI
Basicvideo_QueryInterface(IBasicVideo
*iface
,
1115 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1117 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
1119 return VideoRenderer_QueryInterface((IBaseFilter
*)This
, riid
, ppvObj
);
1122 static ULONG WINAPI
Basicvideo_AddRef(IBasicVideo
*iface
) {
1123 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1125 TRACE("(%p/%p)->()\n", This
, iface
);
1127 return VideoRenderer_AddRef((IBaseFilter
*)This
);
1130 static ULONG WINAPI
Basicvideo_Release(IBasicVideo
*iface
) {
1131 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1133 TRACE("(%p/%p)->()\n", This
, iface
);
1135 return VideoRenderer_Release((IBaseFilter
*)This
);
1138 /*** IDispatch methods ***/
1139 static HRESULT WINAPI
Basicvideo_GetTypeInfoCount(IBasicVideo
*iface
,
1141 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1143 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
1148 static HRESULT WINAPI
Basicvideo_GetTypeInfo(IBasicVideo
*iface
,
1151 ITypeInfo
**ppTInfo
) {
1152 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1154 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
1159 static HRESULT WINAPI
Basicvideo_GetIDsOfNames(IBasicVideo
*iface
,
1165 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1167 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1172 static HRESULT WINAPI
Basicvideo_Invoke(IBasicVideo
*iface
,
1173 DISPID dispIdMember
,
1177 DISPPARAMS
*pDispParams
,
1179 EXCEPINFO
*pExepInfo
,
1181 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1183 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
);
1188 /*** IBasicVideo methods ***/
1189 static HRESULT WINAPI
Basicvideo_get_AvgTimePerFrame(IBasicVideo
*iface
,
1190 REFTIME
*pAvgTimePerFrame
) {
1191 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1193 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pAvgTimePerFrame
);
1198 static HRESULT WINAPI
Basicvideo_get_BitRate(IBasicVideo
*iface
,
1200 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1202 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBitRate
);
1207 static HRESULT WINAPI
Basicvideo_get_BitErrorRate(IBasicVideo
*iface
,
1208 long *pBitErrorRate
) {
1209 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1211 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBitErrorRate
);
1216 static HRESULT WINAPI
Basicvideo_get_VideoWidth(IBasicVideo
*iface
,
1217 long *pVideoWidth
) {
1218 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1220 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoWidth
);
1222 *pVideoWidth
= This
->VideoWidth
;
1227 static HRESULT WINAPI
Basicvideo_get_VideoHeight(IBasicVideo
*iface
,
1228 long *pVideoHeight
) {
1229 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1231 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoHeight
);
1233 *pVideoHeight
= This
->VideoHeight
;
1238 static HRESULT WINAPI
Basicvideo_put_SourceLeft(IBasicVideo
*iface
,
1240 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1242 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceLeft
);
1244 This
->SourceRect
.left
= SourceLeft
;
1249 static HRESULT WINAPI
Basicvideo_get_SourceLeft(IBasicVideo
*iface
,
1250 long *pSourceLeft
) {
1251 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1253 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceLeft
);
1255 *pSourceLeft
= This
->SourceRect
.left
;
1260 static HRESULT WINAPI
Basicvideo_put_SourceWidth(IBasicVideo
*iface
,
1262 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1264 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceWidth
);
1266 This
->SourceRect
.right
= This
->SourceRect
.left
+ SourceWidth
;
1271 static HRESULT WINAPI
Basicvideo_get_SourceWidth(IBasicVideo
*iface
,
1272 long *pSourceWidth
) {
1273 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1275 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceWidth
);
1277 *pSourceWidth
= This
->SourceRect
.right
- This
->SourceRect
.left
;
1282 static HRESULT WINAPI
Basicvideo_put_SourceTop(IBasicVideo
*iface
,
1284 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1286 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceTop
);
1288 This
->SourceRect
.top
= SourceTop
;
1293 static HRESULT WINAPI
Basicvideo_get_SourceTop(IBasicVideo
*iface
,
1295 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1297 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceTop
);
1299 *pSourceTop
= This
->SourceRect
.top
;
1304 static HRESULT WINAPI
Basicvideo_put_SourceHeight(IBasicVideo
*iface
,
1305 long SourceHeight
) {
1306 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1308 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceHeight
);
1310 This
->SourceRect
.bottom
= This
->SourceRect
.top
+ SourceHeight
;
1315 static HRESULT WINAPI
Basicvideo_get_SourceHeight(IBasicVideo
*iface
,
1316 long *pSourceHeight
) {
1317 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1319 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceHeight
);
1321 *pSourceHeight
= This
->SourceRect
.bottom
- This
->SourceRect
.top
;
1326 static HRESULT WINAPI
Basicvideo_put_DestinationLeft(IBasicVideo
*iface
,
1327 long DestinationLeft
) {
1328 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1330 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationLeft
);
1332 This
->DestRect
.left
= DestinationLeft
;
1337 static HRESULT WINAPI
Basicvideo_get_DestinationLeft(IBasicVideo
*iface
,
1338 long *pDestinationLeft
) {
1339 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1341 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationLeft
);
1343 *pDestinationLeft
= This
->DestRect
.left
;
1348 static HRESULT WINAPI
Basicvideo_put_DestinationWidth(IBasicVideo
*iface
,
1349 long DestinationWidth
) {
1350 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1352 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationWidth
);
1354 This
->DestRect
.right
= This
->DestRect
.left
+ DestinationWidth
;
1359 static HRESULT WINAPI
Basicvideo_get_DestinationWidth(IBasicVideo
*iface
,
1360 long *pDestinationWidth
) {
1361 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1363 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationWidth
);
1365 *pDestinationWidth
= This
->DestRect
.right
- This
->DestRect
.left
;
1370 static HRESULT WINAPI
Basicvideo_put_DestinationTop(IBasicVideo
*iface
,
1371 long DestinationTop
) {
1372 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1374 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationTop
);
1376 This
->DestRect
.top
= DestinationTop
;
1381 static HRESULT WINAPI
Basicvideo_get_DestinationTop(IBasicVideo
*iface
,
1382 long *pDestinationTop
) {
1383 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1385 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationTop
);
1387 *pDestinationTop
= This
->DestRect
.top
;
1392 static HRESULT WINAPI
Basicvideo_put_DestinationHeight(IBasicVideo
*iface
,
1393 long DestinationHeight
) {
1394 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1396 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationHeight
);
1398 This
->DestRect
.right
= This
->DestRect
.left
+ DestinationHeight
;
1403 static HRESULT WINAPI
Basicvideo_get_DestinationHeight(IBasicVideo
*iface
,
1404 long *pDestinationHeight
) {
1405 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1407 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationHeight
);
1409 *pDestinationHeight
= This
->DestRect
.right
- This
->DestRect
.left
;
1414 static HRESULT WINAPI
Basicvideo_SetSourcePosition(IBasicVideo
*iface
,
1419 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1421 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This
, iface
, Left
, Top
, Width
, Height
);
1423 This
->SourceRect
.left
= Left
;
1424 This
->SourceRect
.top
= Top
;
1425 This
->SourceRect
.right
= Left
+ Width
;
1426 This
->SourceRect
.bottom
= Top
+ Height
;
1431 static HRESULT WINAPI
Basicvideo_GetSourcePosition(IBasicVideo
*iface
,
1436 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1438 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1440 *pLeft
= This
->SourceRect
.left
;
1441 *pTop
= This
->SourceRect
.top
;
1442 *pWidth
= This
->SourceRect
.right
- This
->SourceRect
.left
;
1443 *pHeight
= This
->SourceRect
.bottom
- This
->SourceRect
.top
;
1448 static HRESULT WINAPI
Basicvideo_SetDefaultSourcePosition(IBasicVideo
*iface
) {
1449 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1451 TRACE("(%p/%p)->()\n", This
, iface
);
1453 This
->SourceRect
.left
= 0;
1454 This
->SourceRect
.top
= 0;
1455 This
->SourceRect
.right
= This
->VideoWidth
;
1456 This
->SourceRect
.bottom
= This
->VideoHeight
;
1461 static HRESULT WINAPI
Basicvideo_SetDestinationPosition(IBasicVideo
*iface
,
1466 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1468 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This
, iface
, Left
, Top
, Width
, Height
);
1470 This
->DestRect
.left
= Left
;
1471 This
->DestRect
.top
= Top
;
1472 This
->DestRect
.right
= Left
+ Width
;
1473 This
->DestRect
.bottom
= Top
+ Height
;
1478 static HRESULT WINAPI
Basicvideo_GetDestinationPosition(IBasicVideo
*iface
,
1483 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1485 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1487 *pLeft
= This
->DestRect
.left
;
1488 *pTop
= This
->DestRect
.top
;
1489 *pWidth
= This
->DestRect
.right
- This
->DestRect
.left
;
1490 *pHeight
= This
->DestRect
.bottom
- This
->DestRect
.top
;
1495 static HRESULT WINAPI
Basicvideo_SetDefaultDestinationPosition(IBasicVideo
*iface
) {
1496 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1499 TRACE("(%p/%p)->()\n", This
, iface
);
1501 if (!GetClientRect(This
->hWnd
, &rect
))
1504 This
->SourceRect
.left
= 0;
1505 This
->SourceRect
.top
= 0;
1506 This
->SourceRect
.right
= rect
.right
;
1507 This
->SourceRect
.bottom
= rect
.bottom
;
1512 static HRESULT WINAPI
Basicvideo_GetVideoSize(IBasicVideo
*iface
,
1515 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1517 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pWidth
, pHeight
);
1519 *pWidth
= This
->VideoWidth
;
1520 *pHeight
= This
->VideoHeight
;
1525 static HRESULT WINAPI
Basicvideo_GetVideoPaletteEntries(IBasicVideo
*iface
,
1530 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1532 FIXME("(%p/%p)->(%ld, %ld, %p, %p): stub !!!\n", This
, iface
, StartIndex
, Entries
, pRetrieved
, pPalette
);
1537 static HRESULT WINAPI
Basicvideo_GetCurrentImage(IBasicVideo
*iface
,
1540 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1541 BITMAPINFOHEADER
*bmiHeader
;
1543 AM_MEDIA_TYPE
*amt
= &This
->pInputPin
->pin
.mtCurrent
;
1546 EnterCriticalSection(&This
->csFilter
);
1548 if (!This
->sample_held
)
1550 LeaveCriticalSection(&This
->csFilter
);
1551 return (This
->state
== State_Paused
? E_UNEXPECTED
: VFW_E_NOT_PAUSED
);
1554 FIXME("(%p/%p)->(%p, %p): partial stub\n", This
, iface
, pBufferSize
, pDIBImage
);
1556 if (IsEqualIID(&amt
->formattype
, &FORMAT_VideoInfo
))
1558 bmiHeader
= &((VIDEOINFOHEADER
*)amt
->pbFormat
)->bmiHeader
;
1560 else if (IsEqualIID(&amt
->formattype
, &FORMAT_VideoInfo2
))
1562 bmiHeader
= &((VIDEOINFOHEADER2
*)amt
->pbFormat
)->bmiHeader
;
1566 FIXME("Unknown type %s\n", debugstr_guid(&amt
->subtype
));
1567 LeaveCriticalSection(&This
->csFilter
);
1568 return VFW_E_RUNTIME_ERROR
;
1571 needed_size
= bmiHeader
->biSize
;
1572 needed_size
+= IMediaSample_GetActualDataLength(This
->sample_held
);
1576 *pBufferSize
= needed_size
;
1577 LeaveCriticalSection(&This
->csFilter
);
1581 if (needed_size
< *pBufferSize
)
1583 ERR("Buffer too small %u/%lu\n", needed_size
, *pBufferSize
);
1584 LeaveCriticalSection(&This
->csFilter
);
1587 *pBufferSize
= needed_size
;
1589 memcpy(pDIBImage
, bmiHeader
, bmiHeader
->biSize
);
1590 IMediaSample_GetPointer(This
->sample_held
, (BYTE
**)&ptr
);
1591 memcpy((char *)pDIBImage
+ bmiHeader
->biSize
, ptr
, IMediaSample_GetActualDataLength(This
->sample_held
));
1593 LeaveCriticalSection(&This
->csFilter
);
1598 static HRESULT WINAPI
Basicvideo_IsUsingDefaultSource(IBasicVideo
*iface
) {
1599 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1601 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
1606 static HRESULT WINAPI
Basicvideo_IsUsingDefaultDestination(IBasicVideo
*iface
) {
1607 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1609 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
1615 static const IBasicVideoVtbl IBasicVideo_VTable
=
1617 Basicvideo_QueryInterface
,
1620 Basicvideo_GetTypeInfoCount
,
1621 Basicvideo_GetTypeInfo
,
1622 Basicvideo_GetIDsOfNames
,
1624 Basicvideo_get_AvgTimePerFrame
,
1625 Basicvideo_get_BitRate
,
1626 Basicvideo_get_BitErrorRate
,
1627 Basicvideo_get_VideoWidth
,
1628 Basicvideo_get_VideoHeight
,
1629 Basicvideo_put_SourceLeft
,
1630 Basicvideo_get_SourceLeft
,
1631 Basicvideo_put_SourceWidth
,
1632 Basicvideo_get_SourceWidth
,
1633 Basicvideo_put_SourceTop
,
1634 Basicvideo_get_SourceTop
,
1635 Basicvideo_put_SourceHeight
,
1636 Basicvideo_get_SourceHeight
,
1637 Basicvideo_put_DestinationLeft
,
1638 Basicvideo_get_DestinationLeft
,
1639 Basicvideo_put_DestinationWidth
,
1640 Basicvideo_get_DestinationWidth
,
1641 Basicvideo_put_DestinationTop
,
1642 Basicvideo_get_DestinationTop
,
1643 Basicvideo_put_DestinationHeight
,
1644 Basicvideo_get_DestinationHeight
,
1645 Basicvideo_SetSourcePosition
,
1646 Basicvideo_GetSourcePosition
,
1647 Basicvideo_SetDefaultSourcePosition
,
1648 Basicvideo_SetDestinationPosition
,
1649 Basicvideo_GetDestinationPosition
,
1650 Basicvideo_SetDefaultDestinationPosition
,
1651 Basicvideo_GetVideoSize
,
1652 Basicvideo_GetVideoPaletteEntries
,
1653 Basicvideo_GetCurrentImage
,
1654 Basicvideo_IsUsingDefaultSource
,
1655 Basicvideo_IsUsingDefaultDestination
1659 /*** IUnknown methods ***/
1660 static HRESULT WINAPI
Videowindow_QueryInterface(IVideoWindow
*iface
,
1663 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1665 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
1667 return VideoRenderer_QueryInterface((IBaseFilter
*)This
, riid
, ppvObj
);
1670 static ULONG WINAPI
Videowindow_AddRef(IVideoWindow
*iface
) {
1671 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1673 TRACE("(%p/%p)->()\n", This
, iface
);
1675 return VideoRenderer_AddRef((IBaseFilter
*)This
);
1678 static ULONG WINAPI
Videowindow_Release(IVideoWindow
*iface
) {
1679 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1681 TRACE("(%p/%p)->()\n", This
, iface
);
1683 return VideoRenderer_Release((IBaseFilter
*)This
);
1686 /*** IDispatch methods ***/
1687 static HRESULT WINAPI
Videowindow_GetTypeInfoCount(IVideoWindow
*iface
,
1689 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1691 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
1696 static HRESULT WINAPI
Videowindow_GetTypeInfo(IVideoWindow
*iface
,
1699 ITypeInfo
**ppTInfo
) {
1700 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1702 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
1707 static HRESULT WINAPI
Videowindow_GetIDsOfNames(IVideoWindow
*iface
,
1713 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1715 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1720 static HRESULT WINAPI
Videowindow_Invoke(IVideoWindow
*iface
,
1721 DISPID dispIdMember
,
1725 DISPPARAMS
*pDispParams
,
1727 EXCEPINFO
*pExepInfo
,
1729 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1731 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
);
1736 /*** IVideoWindow methods ***/
1737 static HRESULT WINAPI
Videowindow_put_Caption(IVideoWindow
*iface
,
1739 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1741 TRACE("(%p/%p)->(%s (%p))\n", This
, iface
, debugstr_w(strCaption
), strCaption
);
1743 if (!SetWindowTextW(This
->hWnd
, strCaption
))
1749 static HRESULT WINAPI
Videowindow_get_Caption(IVideoWindow
*iface
,
1751 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1753 TRACE("(%p/%p)->(%p)\n", This
, iface
, strCaption
);
1755 GetWindowTextW(This
->hWnd
, (LPWSTR
)strCaption
, 100);
1760 static HRESULT WINAPI
Videowindow_put_WindowStyle(IVideoWindow
*iface
,
1762 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1765 old
= GetWindowLongA(This
->hWnd
, GWL_STYLE
);
1767 TRACE("(%p/%p)->(%x -> %lx)\n", This
, iface
, old
, WindowStyle
);
1769 if (WindowStyle
& (WS_DISABLED
|WS_HSCROLL
|WS_ICONIC
|WS_MAXIMIZE
|WS_MINIMIZE
|WS_VSCROLL
))
1770 return E_INVALIDARG
;
1772 SetWindowLongA(This
->hWnd
, GWL_STYLE
, WindowStyle
);
1777 static HRESULT WINAPI
Videowindow_get_WindowStyle(IVideoWindow
*iface
,
1778 long *WindowStyle
) {
1779 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1781 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyle
);
1783 *WindowStyle
= GetWindowLongA(This
->hWnd
, GWL_STYLE
);
1788 static HRESULT WINAPI
Videowindow_put_WindowStyleEx(IVideoWindow
*iface
,
1789 long WindowStyleEx
) {
1790 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1792 TRACE("(%p/%p)->(%ld)\n", This
, iface
, WindowStyleEx
);
1794 if (WindowStyleEx
& (WS_DISABLED
|WS_HSCROLL
|WS_ICONIC
|WS_MAXIMIZE
|WS_MINIMIZE
|WS_VSCROLL
))
1795 return E_INVALIDARG
;
1797 if (!SetWindowLongA(This
->hWnd
, GWL_EXSTYLE
, WindowStyleEx
))
1803 static HRESULT WINAPI
Videowindow_get_WindowStyleEx(IVideoWindow
*iface
,
1804 long *WindowStyleEx
) {
1805 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1807 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyleEx
);
1809 *WindowStyleEx
= GetWindowLongA(This
->hWnd
, GWL_EXSTYLE
);
1814 static HRESULT WINAPI
Videowindow_put_AutoShow(IVideoWindow
*iface
,
1816 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1818 TRACE("(%p/%p)->(%ld)\n", This
, iface
, AutoShow
);
1820 This
->AutoShow
= 1; /* FXIME: Should be AutoShow */;
1825 static HRESULT WINAPI
Videowindow_get_AutoShow(IVideoWindow
*iface
,
1827 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1829 TRACE("(%p/%p)->(%p)\n", This
, iface
, AutoShow
);
1831 *AutoShow
= This
->AutoShow
;
1836 static HRESULT WINAPI
Videowindow_put_WindowState(IVideoWindow
*iface
,
1838 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1840 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, WindowState
);
1845 static HRESULT WINAPI
Videowindow_get_WindowState(IVideoWindow
*iface
,
1846 long *WindowState
) {
1847 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1849 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, WindowState
);
1854 static HRESULT WINAPI
Videowindow_put_BackgroundPalette(IVideoWindow
*iface
,
1855 long BackgroundPalette
) {
1856 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1858 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, BackgroundPalette
);
1863 static HRESULT WINAPI
Videowindow_get_BackgroundPalette(IVideoWindow
*iface
,
1864 long *pBackgroundPalette
) {
1865 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1867 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBackgroundPalette
);
1872 static HRESULT WINAPI
Videowindow_put_Visible(IVideoWindow
*iface
,
1874 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1876 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Visible
);
1878 ShowWindow(This
->hWnd
, Visible
? SW_SHOW
: SW_HIDE
);
1883 static HRESULT WINAPI
Videowindow_get_Visible(IVideoWindow
*iface
,
1885 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1887 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVisible
);
1889 *pVisible
= IsWindowVisible(This
->hWnd
);
1894 static HRESULT WINAPI
Videowindow_put_Left(IVideoWindow
*iface
,
1896 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1898 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Left
);
1900 if (!SetWindowPos(This
->hWnd
, NULL
, Left
, This
->WindowPos
.top
, 0, 0, SWP_NOZORDER
|SWP_NOSIZE
))
1903 This
->WindowPos
.left
= Left
;
1908 static HRESULT WINAPI
Videowindow_get_Left(IVideoWindow
*iface
,
1910 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1912 TRACE("(%p/%p)->(%p)\n", This
, iface
, pLeft
);
1914 *pLeft
= This
->WindowPos
.left
;
1919 static HRESULT WINAPI
Videowindow_put_Width(IVideoWindow
*iface
,
1921 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1923 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Width
);
1925 if (!SetWindowPos(This
->hWnd
, NULL
, 0, 0, Width
, This
->WindowPos
.bottom
-This
->WindowPos
.top
, SWP_NOZORDER
|SWP_NOMOVE
))
1928 This
->WindowPos
.right
= This
->WindowPos
.left
+ Width
;
1933 static HRESULT WINAPI
Videowindow_get_Width(IVideoWindow
*iface
,
1935 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1937 TRACE("(%p/%p)->(%p)\n", This
, iface
, pWidth
);
1939 *pWidth
= This
->WindowPos
.right
- This
->WindowPos
.left
;
1944 static HRESULT WINAPI
Videowindow_put_Top(IVideoWindow
*iface
,
1946 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1948 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Top
);
1950 if (!SetWindowPos(This
->hWnd
, NULL
, This
->WindowPos
.left
, Top
, 0, 0, SWP_NOZORDER
|SWP_NOSIZE
))
1953 This
->WindowPos
.top
= Top
;
1958 static HRESULT WINAPI
Videowindow_get_Top(IVideoWindow
*iface
,
1960 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1962 TRACE("(%p/%p)->(%p)\n", This
, iface
, pTop
);
1964 *pTop
= This
->WindowPos
.top
;
1969 static HRESULT WINAPI
Videowindow_put_Height(IVideoWindow
*iface
,
1971 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1973 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Height
);
1975 if (!SetWindowPos(This
->hWnd
, NULL
, 0, 0, This
->WindowPos
.right
-This
->WindowPos
.left
, Height
, SWP_NOZORDER
|SWP_NOMOVE
))
1978 This
->WindowPos
.bottom
= This
->WindowPos
.top
+ Height
;
1983 static HRESULT WINAPI
Videowindow_get_Height(IVideoWindow
*iface
,
1985 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1987 TRACE("(%p/%p)->(%p)\n", This
, iface
, pHeight
);
1989 *pHeight
= This
->WindowPos
.bottom
- This
->WindowPos
.top
;
1994 static HRESULT WINAPI
Videowindow_put_Owner(IVideoWindow
*iface
,
1996 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1998 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Owner
);
2000 SetParent(This
->hWnd
, (HWND
)Owner
);
2005 static HRESULT WINAPI
Videowindow_get_Owner(IVideoWindow
*iface
,
2007 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2009 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Owner
);
2011 *(HWND
*)Owner
= GetParent(This
->hWnd
);
2016 static HRESULT WINAPI
Videowindow_put_MessageDrain(IVideoWindow
*iface
,
2018 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2020 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Drain
);
2022 This
->hWndMsgDrain
= (HWND
)Drain
;
2027 static HRESULT WINAPI
Videowindow_get_MessageDrain(IVideoWindow
*iface
,
2029 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2031 TRACE("(%p/%p)->(%p)\n", This
, iface
, Drain
);
2033 *Drain
= (OAHWND
)This
->hWndMsgDrain
;
2038 static HRESULT WINAPI
Videowindow_get_BorderColor(IVideoWindow
*iface
,
2040 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2042 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, Color
);
2047 static HRESULT WINAPI
Videowindow_put_BorderColor(IVideoWindow
*iface
,
2049 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2051 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, Color
);
2056 static HRESULT WINAPI
Videowindow_get_FullScreenMode(IVideoWindow
*iface
,
2057 long *FullScreenMode
) {
2058 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2060 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, FullScreenMode
);
2065 static HRESULT WINAPI
Videowindow_put_FullScreenMode(IVideoWindow
*iface
,
2066 long FullScreenMode
) {
2067 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2069 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, FullScreenMode
);
2074 static HRESULT WINAPI
Videowindow_SetWindowForeground(IVideoWindow
*iface
,
2076 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2081 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Focus
);
2083 if ((Focus
!= FALSE
) && (Focus
!= TRUE
))
2084 return E_INVALIDARG
;
2086 hr
= IPin_ConnectedTo((IPin
*)This
->pInputPin
, &pPin
);
2087 if ((hr
!= S_OK
) || !pPin
)
2088 return VFW_E_NOT_CONNECTED
;
2091 ret
= SetForegroundWindow(This
->hWnd
);
2093 ret
= SetWindowPos(This
->hWnd
, HWND_TOP
, 0, 0, 0, 0, SWP_NOMOVE
|SWP_NOSIZE
);
2101 static HRESULT WINAPI
Videowindow_NotifyOwnerMessage(IVideoWindow
*iface
,
2106 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2108 TRACE("(%p/%p)->(%08x, %ld, %08lx, %08lx)\n", This
, iface
, (DWORD
) hwnd
, uMsg
, wParam
, lParam
);
2110 if (!PostMessageA(This
->hWnd
, uMsg
, wParam
, lParam
))
2116 static HRESULT WINAPI
Videowindow_SetWindowPosition(IVideoWindow
*iface
,
2121 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2123 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This
, iface
, Left
, Top
, Width
, Height
);
2125 if (!SetWindowPos(This
->hWnd
, NULL
, Left
, Top
, Width
, Height
, SWP_NOZORDER
))
2128 This
->WindowPos
.left
= Left
;
2129 This
->WindowPos
.top
= Top
;
2130 This
->WindowPos
.right
= Left
+ Width
;
2131 This
->WindowPos
.bottom
= Top
+ Height
;
2136 static HRESULT WINAPI
Videowindow_GetWindowPosition(IVideoWindow
*iface
,
2141 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2143 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
2145 *pLeft
= This
->WindowPos
.left
;
2146 *pTop
= This
->WindowPos
.top
;
2147 *pWidth
= This
->WindowPos
.right
- This
->WindowPos
.left
;
2148 *pHeight
= This
->WindowPos
.bottom
- This
->WindowPos
.top
;
2153 static HRESULT WINAPI
Videowindow_GetMinIdealImageSize(IVideoWindow
*iface
,
2156 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2158 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This
, iface
, pWidth
, pHeight
);
2160 *pWidth
= This
->VideoWidth
;
2161 *pHeight
= This
->VideoHeight
;
2166 static HRESULT WINAPI
Videowindow_GetMaxIdealImageSize(IVideoWindow
*iface
,
2169 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2171 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This
, iface
, pWidth
, pHeight
);
2173 *pWidth
= This
->VideoWidth
;
2174 *pHeight
= This
->VideoHeight
;
2179 static HRESULT WINAPI
Videowindow_GetRestorePosition(IVideoWindow
*iface
,
2184 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2186 FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
2191 static HRESULT WINAPI
Videowindow_HideCursor(IVideoWindow
*iface
,
2193 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2195 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, HideCursor
);
2200 static HRESULT WINAPI
Videowindow_IsCursorHidden(IVideoWindow
*iface
,
2201 long *CursorHidden
) {
2202 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2204 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, CursorHidden
);
2209 static const IVideoWindowVtbl IVideoWindow_VTable
=
2211 Videowindow_QueryInterface
,
2213 Videowindow_Release
,
2214 Videowindow_GetTypeInfoCount
,
2215 Videowindow_GetTypeInfo
,
2216 Videowindow_GetIDsOfNames
,
2218 Videowindow_put_Caption
,
2219 Videowindow_get_Caption
,
2220 Videowindow_put_WindowStyle
,
2221 Videowindow_get_WindowStyle
,
2222 Videowindow_put_WindowStyleEx
,
2223 Videowindow_get_WindowStyleEx
,
2224 Videowindow_put_AutoShow
,
2225 Videowindow_get_AutoShow
,
2226 Videowindow_put_WindowState
,
2227 Videowindow_get_WindowState
,
2228 Videowindow_put_BackgroundPalette
,
2229 Videowindow_get_BackgroundPalette
,
2230 Videowindow_put_Visible
,
2231 Videowindow_get_Visible
,
2232 Videowindow_put_Left
,
2233 Videowindow_get_Left
,
2234 Videowindow_put_Width
,
2235 Videowindow_get_Width
,
2236 Videowindow_put_Top
,
2237 Videowindow_get_Top
,
2238 Videowindow_put_Height
,
2239 Videowindow_get_Height
,
2240 Videowindow_put_Owner
,
2241 Videowindow_get_Owner
,
2242 Videowindow_put_MessageDrain
,
2243 Videowindow_get_MessageDrain
,
2244 Videowindow_get_BorderColor
,
2245 Videowindow_put_BorderColor
,
2246 Videowindow_get_FullScreenMode
,
2247 Videowindow_put_FullScreenMode
,
2248 Videowindow_SetWindowForeground
,
2249 Videowindow_NotifyOwnerMessage
,
2250 Videowindow_SetWindowPosition
,
2251 Videowindow_GetWindowPosition
,
2252 Videowindow_GetMinIdealImageSize
,
2253 Videowindow_GetMaxIdealImageSize
,
2254 Videowindow_GetRestorePosition
,
2255 Videowindow_HideCursor
,
2256 Videowindow_IsCursorHidden