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
;
291 TRACE("biSize = %d\n", bmiHeader
->biSize
);
292 TRACE("biWidth = %d\n", bmiHeader
->biWidth
);
293 TRACE("biHeight = %d\n", bmiHeader
->biHeight
);
294 TRACE("biPlanes = %d\n", bmiHeader
->biPlanes
);
295 TRACE("biBitCount = %d\n", bmiHeader
->biBitCount
);
296 TRACE("biCompression = %s\n", debugstr_an((LPSTR
)&(bmiHeader
->biCompression
), 4));
297 TRACE("biSizeImage = %d\n", bmiHeader
->biSizeImage
);
301 DWORD style
= GetWindowLongW(This
->hWnd
, GWL_STYLE
);
302 DWORD style_ex
= GetWindowLongW(This
->hWnd
, GWL_EXSTYLE
);
304 if (!This
->WindowPos
.right
|| !This
->WindowPos
.bottom
)
305 This
->WindowPos
= This
->SourceRect
;
307 AdjustWindowRectEx(&This
->WindowPos
, style
, TRUE
, style_ex
);
309 TRACE("WindowPos: %d %d %d %d\n", This
->WindowPos
.left
, This
->WindowPos
.top
, This
->WindowPos
.right
, This
->WindowPos
.bottom
);
310 SetWindowPos(This
->hWnd
, NULL
,
311 This
->WindowPos
.left
,
313 This
->WindowPos
.right
- This
->WindowPos
.left
,
314 This
->WindowPos
.bottom
- This
->WindowPos
.top
,
315 SWP_NOZORDER
|SWP_NOMOVE
);
317 GetClientRect(This
->hWnd
, &This
->DestRect
);
321 hDC
= GetDC(This
->hWnd
);
324 ERR("Cannot get DC from window!\n");
328 TRACE("Src Rect: %d %d %d %d\n", This
->SourceRect
.left
, This
->SourceRect
.top
, This
->SourceRect
.right
, This
->SourceRect
.bottom
);
329 TRACE("Dst Rect: %d %d %d %d\n", This
->DestRect
.left
, This
->DestRect
.top
, This
->DestRect
.right
, This
->DestRect
.bottom
);
331 StretchDIBits(hDC
, This
->DestRect
.left
, This
->DestRect
.top
, This
->DestRect
.right
-This
->DestRect
.left
,
332 This
->DestRect
.bottom
- This
->DestRect
.top
, This
->SourceRect
.left
, This
->SourceRect
.top
,
333 This
->SourceRect
.right
- This
->SourceRect
.left
, This
->SourceRect
.bottom
- This
->SourceRect
.top
,
334 data
, (BITMAPINFO
*)bmiHeader
, DIB_RGB_COLORS
, SRCCOPY
);
336 ReleaseDC(This
->hWnd
, hDC
);
338 ShowWindow(This
->hWnd
, SW_SHOW
);
343 static HRESULT
VideoRenderer_Sample(LPVOID iface
, IMediaSample
* pSample
)
345 VideoRendererImpl
*This
= iface
;
346 LPBYTE pbSrcStream
= NULL
;
347 long cbSrcStream
= 0;
348 REFERENCE_TIME tStart
, tStop
;
351 TRACE("(%p)->(%p)\n", iface
, pSample
);
353 EnterCriticalSection(&This
->csFilter
);
355 if (This
->pInputPin
->flushing
|| This
->pInputPin
->end_of_stream
)
357 LeaveCriticalSection(&This
->csFilter
);
361 if (This
->state
== State_Stopped
)
363 LeaveCriticalSection(&This
->csFilter
);
364 return VFW_E_WRONG_STATE
;
367 hr
= IMediaSample_GetTime(pSample
, &tStart
, &tStop
);
369 ERR("Cannot get sample time (%x)\n", hr
);
371 if (This
->rtLastStop
!= tStart
)
373 if (IMediaSample_IsDiscontinuity(pSample
) == S_FALSE
)
374 ERR("Unexpected discontinuity: Last: %u.%03u, tStart: %u.%03u\n",
375 (DWORD
)(This
->rtLastStop
/ 10000000),
376 (DWORD
)((This
->rtLastStop
/ 10000)%1000),
377 (DWORD
)(tStart
/ 10000000), (DWORD
)((tStart
/ 10000)%1000));
378 This
->rtLastStop
= tStart
;
381 /* Preroll means the sample isn't shown, this is used for key frames and things like that */
382 if (IMediaSample_IsPreroll(pSample
) == S_OK
)
384 This
->rtLastStop
= tStop
;
385 LeaveCriticalSection(&This
->csFilter
);
389 hr
= IMediaSample_GetPointer(pSample
, &pbSrcStream
);
392 ERR("Cannot get pointer to sample data (%x)\n", hr
);
393 LeaveCriticalSection(&This
->csFilter
);
397 cbSrcStream
= IMediaSample_GetActualDataLength(pSample
);
399 TRACE("val %p %ld\n", pbSrcStream
, cbSrcStream
);
401 #if 0 /* For debugging purpose */
404 for(i
= 0; i
< cbSrcStream
; i
++)
406 if ((i
!=0) && !(i
%16))
408 TRACE("%02x ", pbSrcStream
[i
]);
414 SetEvent(This
->hEvent
);
415 if (This
->state
== State_Paused
)
417 This
->sample_held
= pSample
;
418 LeaveCriticalSection(&This
->csFilter
);
419 WaitForSingleObject(This
->blocked
, INFINITE
);
420 EnterCriticalSection(&This
->csFilter
);
421 This
->sample_held
= NULL
;
422 if (This
->state
== State_Paused
)
425 LeaveCriticalSection(&This
->csFilter
);
428 if (This
->state
== State_Stopped
)
430 LeaveCriticalSection(&This
->csFilter
);
431 return VFW_E_WRONG_STATE
;
435 if (This
->pClock
&& This
->state
== State_Running
)
437 REFERENCE_TIME time
, trefstart
, trefstop
;
440 /* Perhaps I <SHOULD> use the reference clock AdviseTime function here
441 * I'm not going to! When I tried, it seemed to generate lag and
442 * it caused instability.
444 IReferenceClock_GetTime(This
->pClock
, &time
);
446 trefstart
= This
->rtStreamStart
;
447 trefstop
= (REFERENCE_TIME
)((double)(tStop
- tStart
) / This
->pInputPin
->dRate
) + This
->rtStreamStart
;
448 delta
= (LONG
)((trefstart
-time
)/10000);
449 This
->rtStreamStart
= trefstop
;
450 This
->rtLastStop
= tStop
;
454 TRACE("Sleeping for %u ms\n", delta
);
457 else if (time
> trefstop
)
459 TRACE("Dropping sample: Time: %u.%03u ms trefstop: %u.%03u ms!\n",
460 (DWORD
)(time
/ 10000000), (DWORD
)((time
/ 10000)%1000),
461 (DWORD
)(trefstop
/ 10000000), (DWORD
)((trefstop
/ 10000)%1000) );
462 This
->rtLastStop
= tStop
;
463 LeaveCriticalSection(&This
->csFilter
);
467 This
->rtLastStop
= tStop
;
469 VideoRenderer_SendSampleData(This
, pbSrcStream
, cbSrcStream
);
471 LeaveCriticalSection(&This
->csFilter
);
475 static HRESULT
VideoRenderer_QueryAccept(LPVOID iface
, const AM_MEDIA_TYPE
* pmt
)
477 if (!IsEqualIID(&pmt
->majortype
, &MEDIATYPE_Video
))
480 if (IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB32
) ||
481 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB24
) ||
482 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB565
) ||
483 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB8
))
485 VideoRendererImpl
* This
= iface
;
487 if (IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo
))
489 VIDEOINFOHEADER
*format
= (VIDEOINFOHEADER
*)pmt
->pbFormat
;
490 This
->SourceRect
.left
= 0;
491 This
->SourceRect
.top
= 0;
492 This
->SourceRect
.right
= This
->VideoWidth
= format
->bmiHeader
.biWidth
;
493 This
->SourceRect
.bottom
= This
->VideoHeight
= format
->bmiHeader
.biHeight
;
495 else if (IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo2
))
497 VIDEOINFOHEADER2
*format2
= (VIDEOINFOHEADER2
*)pmt
->pbFormat
;
499 This
->SourceRect
.left
= 0;
500 This
->SourceRect
.top
= 0;
501 This
->SourceRect
.right
= This
->VideoWidth
= format2
->bmiHeader
.biWidth
;
502 This
->SourceRect
.bottom
= This
->VideoHeight
= format2
->bmiHeader
.biHeight
;
506 WARN("Format type %s not supported\n", debugstr_guid(&pmt
->formattype
));
514 static inline VideoRendererImpl
*impl_from_IMediaSeeking( IMediaSeeking
*iface
)
516 return (VideoRendererImpl
*)((char*)iface
- FIELD_OFFSET(VideoRendererImpl
, mediaSeeking
.lpVtbl
));
519 static HRESULT WINAPI
VideoRendererImpl_Seeking_QueryInterface(IMediaSeeking
* iface
, REFIID riid
, LPVOID
* ppv
)
521 VideoRendererImpl
*This
= impl_from_IMediaSeeking(iface
);
523 return IUnknown_QueryInterface((IUnknown
*)This
, riid
, ppv
);
526 static ULONG WINAPI
VideoRendererImpl_Seeking_AddRef(IMediaSeeking
* iface
)
528 VideoRendererImpl
*This
= impl_from_IMediaSeeking(iface
);
530 return IUnknown_AddRef((IUnknown
*)This
);
533 static ULONG WINAPI
VideoRendererImpl_Seeking_Release(IMediaSeeking
* iface
)
535 VideoRendererImpl
*This
= impl_from_IMediaSeeking(iface
);
537 return IUnknown_Release((IUnknown
*)This
);
540 static const IMediaSeekingVtbl VideoRendererImpl_Seeking_Vtbl
=
542 VideoRendererImpl_Seeking_QueryInterface
,
543 VideoRendererImpl_Seeking_AddRef
,
544 VideoRendererImpl_Seeking_Release
,
545 MediaSeekingImpl_GetCapabilities
,
546 MediaSeekingImpl_CheckCapabilities
,
547 MediaSeekingImpl_IsFormatSupported
,
548 MediaSeekingImpl_QueryPreferredFormat
,
549 MediaSeekingImpl_GetTimeFormat
,
550 MediaSeekingImpl_IsUsingTimeFormat
,
551 MediaSeekingImpl_SetTimeFormat
,
552 MediaSeekingImpl_GetDuration
,
553 MediaSeekingImpl_GetStopPosition
,
554 MediaSeekingImpl_GetCurrentPosition
,
555 MediaSeekingImpl_ConvertTimeFormat
,
556 MediaSeekingImpl_SetPositions
,
557 MediaSeekingImpl_GetPositions
,
558 MediaSeekingImpl_GetAvailable
,
559 MediaSeekingImpl_SetRate
,
560 MediaSeekingImpl_GetRate
,
561 MediaSeekingImpl_GetPreroll
564 static HRESULT
VideoRendererImpl_Change(IBaseFilter
*iface
)
566 TRACE("(%p)->()\n", iface
);
570 HRESULT
VideoRenderer_create(IUnknown
* pUnkOuter
, LPVOID
* ppv
)
574 VideoRendererImpl
* pVideoRenderer
;
576 TRACE("(%p, %p)\n", pUnkOuter
, ppv
);
580 pVideoRenderer
= CoTaskMemAlloc(sizeof(VideoRendererImpl
));
581 pVideoRenderer
->pUnkOuter
= pUnkOuter
;
582 pVideoRenderer
->bUnkOuterValid
= FALSE
;
583 pVideoRenderer
->bAggregatable
= FALSE
;
584 pVideoRenderer
->IInner_vtbl
= &IInner_VTable
;
586 pVideoRenderer
->lpVtbl
= &VideoRenderer_Vtbl
;
587 pVideoRenderer
->IBasicVideo_vtbl
= &IBasicVideo_VTable
;
588 pVideoRenderer
->IVideoWindow_vtbl
= &IVideoWindow_VTable
;
590 pVideoRenderer
->refCount
= 1;
591 InitializeCriticalSection(&pVideoRenderer
->csFilter
);
592 pVideoRenderer
->csFilter
.DebugInfo
->Spare
[0] = (DWORD_PTR
)(__FILE__
": VideoRendererImpl.csFilter");
593 pVideoRenderer
->state
= State_Stopped
;
594 pVideoRenderer
->pClock
= NULL
;
595 pVideoRenderer
->init
= 0;
596 pVideoRenderer
->AutoShow
= 1;
597 pVideoRenderer
->rtLastStop
= -1;
598 ZeroMemory(&pVideoRenderer
->filterInfo
, sizeof(FILTER_INFO
));
599 ZeroMemory(&pVideoRenderer
->SourceRect
, sizeof(RECT
));
600 ZeroMemory(&pVideoRenderer
->DestRect
, sizeof(RECT
));
601 ZeroMemory(&pVideoRenderer
->WindowPos
, sizeof(RECT
));
602 pVideoRenderer
->hWndMsgDrain
= NULL
;
604 /* construct input pin */
605 piInput
.dir
= PINDIR_INPUT
;
606 piInput
.pFilter
= (IBaseFilter
*)pVideoRenderer
;
607 lstrcpynW(piInput
.achName
, wcsInputPinName
, sizeof(piInput
.achName
) / sizeof(piInput
.achName
[0]));
609 hr
= InputPin_Construct(&VideoRenderer_InputPin_Vtbl
, &piInput
, VideoRenderer_Sample
, (LPVOID
)pVideoRenderer
, VideoRenderer_QueryAccept
, NULL
, &pVideoRenderer
->csFilter
, NULL
, (IPin
**)&pVideoRenderer
->pInputPin
);
613 MediaSeekingImpl_Init((IBaseFilter
*)pVideoRenderer
, VideoRendererImpl_Change
, VideoRendererImpl_Change
, VideoRendererImpl_Change
, &pVideoRenderer
->mediaSeeking
, &pVideoRenderer
->csFilter
);
614 pVideoRenderer
->mediaSeeking
.lpVtbl
= &VideoRendererImpl_Seeking_Vtbl
;
616 pVideoRenderer
->sample_held
= NULL
;
617 *ppv
= pVideoRenderer
;
621 pVideoRenderer
->csFilter
.DebugInfo
->Spare
[0] = 0;
622 DeleteCriticalSection(&pVideoRenderer
->csFilter
);
623 CoTaskMemFree(pVideoRenderer
);
626 if (!CreateRenderingSubsystem(pVideoRenderer
))
629 pVideoRenderer
->blocked
= CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
630 if (!pVideoRenderer
->blocked
)
632 hr
= HRESULT_FROM_WIN32(GetLastError());
633 IUnknown_Release((IUnknown
*)pVideoRenderer
);
639 HRESULT
VideoRendererDefault_create(IUnknown
* pUnkOuter
, LPVOID
* ppv
)
641 /* TODO: Attempt to use the VMR-7 renderer instead when possible */
642 return VideoRenderer_create(pUnkOuter
, ppv
);
645 static HRESULT WINAPI
VideoRendererInner_QueryInterface(IUnknown
* iface
, REFIID riid
, LPVOID
* ppv
)
647 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
648 TRACE("(%p/%p)->(%s, %p)\n", This
, iface
, qzdebugstr_guid(riid
), ppv
);
650 if (This
->bAggregatable
)
651 This
->bUnkOuterValid
= TRUE
;
655 if (IsEqualIID(riid
, &IID_IUnknown
))
656 *ppv
= &This
->IInner_vtbl
;
657 else if (IsEqualIID(riid
, &IID_IPersist
))
659 else if (IsEqualIID(riid
, &IID_IMediaFilter
))
661 else if (IsEqualIID(riid
, &IID_IBaseFilter
))
663 else if (IsEqualIID(riid
, &IID_IBasicVideo
))
664 *ppv
= &This
->IBasicVideo_vtbl
;
665 else if (IsEqualIID(riid
, &IID_IVideoWindow
))
666 *ppv
= &This
->IVideoWindow_vtbl
;
667 else if (IsEqualIID(riid
, &IID_IMediaSeeking
))
668 *ppv
= &This
->mediaSeeking
;
672 IUnknown_AddRef((IUnknown
*)(*ppv
));
676 if (!IsEqualIID(riid
, &IID_IPin
))
677 FIXME("No interface for %s!\n", qzdebugstr_guid(riid
));
679 return E_NOINTERFACE
;
682 static ULONG WINAPI
VideoRendererInner_AddRef(IUnknown
* iface
)
684 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
685 ULONG refCount
= InterlockedIncrement(&This
->refCount
);
687 TRACE("(%p/%p)->() AddRef from %d\n", This
, iface
, refCount
- 1);
692 static ULONG WINAPI
VideoRendererInner_Release(IUnknown
* iface
)
694 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
695 ULONG refCount
= InterlockedDecrement(&This
->refCount
);
697 TRACE("(%p/%p)->() Release from %d\n", This
, iface
, refCount
+ 1);
703 DestroyWindow(This
->hWnd
);
704 PostThreadMessageA(This
->ThreadID
, WM_QUIT
, 0, 0);
705 WaitForSingleObject(This
->hThread
, INFINITE
);
706 CloseHandle(This
->hThread
);
707 CloseHandle(This
->hEvent
);
710 IReferenceClock_Release(This
->pClock
);
712 if (SUCCEEDED(IPin_ConnectedTo((IPin
*)This
->pInputPin
, &pConnectedTo
)))
714 IPin_Disconnect(pConnectedTo
);
715 IPin_Release(pConnectedTo
);
717 IPin_Disconnect((IPin
*)This
->pInputPin
);
719 IPin_Release((IPin
*)This
->pInputPin
);
723 This
->csFilter
.DebugInfo
->Spare
[0] = 0;
724 DeleteCriticalSection(&This
->csFilter
);
726 TRACE("Destroying Video Renderer\n");
735 static const IUnknownVtbl IInner_VTable
=
737 VideoRendererInner_QueryInterface
,
738 VideoRendererInner_AddRef
,
739 VideoRendererInner_Release
742 static HRESULT WINAPI
VideoRenderer_QueryInterface(IBaseFilter
* iface
, REFIID riid
, LPVOID
* ppv
)
744 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
746 if (This
->bAggregatable
)
747 This
->bUnkOuterValid
= TRUE
;
751 if (This
->bAggregatable
)
752 return IUnknown_QueryInterface(This
->pUnkOuter
, riid
, ppv
);
754 if (IsEqualIID(riid
, &IID_IUnknown
))
758 IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
759 hr
= IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
760 IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
761 This
->bAggregatable
= TRUE
;
766 return E_NOINTERFACE
;
769 return IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
772 static ULONG WINAPI
VideoRenderer_AddRef(IBaseFilter
* iface
)
774 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
776 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
777 return IUnknown_AddRef(This
->pUnkOuter
);
778 return IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
781 static ULONG WINAPI
VideoRenderer_Release(IBaseFilter
* iface
)
783 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
785 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
786 return IUnknown_Release(This
->pUnkOuter
);
787 return IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
790 /** IPersist methods **/
792 static HRESULT WINAPI
VideoRenderer_GetClassID(IBaseFilter
* iface
, CLSID
* pClsid
)
794 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
796 TRACE("(%p/%p)->(%p)\n", This
, iface
, pClsid
);
798 *pClsid
= CLSID_VideoRenderer
;
803 /** IMediaFilter methods **/
805 static HRESULT WINAPI
VideoRenderer_Stop(IBaseFilter
* iface
)
807 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
809 TRACE("(%p/%p)->()\n", This
, iface
);
811 EnterCriticalSection(&This
->csFilter
);
813 This
->state
= State_Stopped
;
814 SetEvent(This
->hEvent
);
815 SetEvent(This
->blocked
);
817 LeaveCriticalSection(&This
->csFilter
);
822 static HRESULT WINAPI
VideoRenderer_Pause(IBaseFilter
* iface
)
824 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
826 TRACE("(%p/%p)->()\n", This
, iface
);
828 EnterCriticalSection(&This
->csFilter
);
829 if (This
->state
!= State_Paused
)
831 if (This
->state
== State_Stopped
)
833 This
->pInputPin
->end_of_stream
= 0;
834 ResetEvent(This
->hEvent
);
837 This
->state
= State_Paused
;
838 ResetEvent(This
->blocked
);
840 LeaveCriticalSection(&This
->csFilter
);
845 static HRESULT WINAPI
VideoRenderer_Run(IBaseFilter
* iface
, REFERENCE_TIME tStart
)
847 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
849 TRACE("(%p/%p)->(%s)\n", This
, iface
, wine_dbgstr_longlong(tStart
));
851 EnterCriticalSection(&This
->csFilter
);
852 if (This
->state
!= State_Running
)
854 if (This
->state
== State_Stopped
)
856 This
->pInputPin
->end_of_stream
= 0;
857 ResetEvent(This
->hEvent
);
859 SetEvent(This
->blocked
);
861 This
->rtStreamStart
= tStart
;
862 This
->state
= State_Running
;
864 LeaveCriticalSection(&This
->csFilter
);
869 static HRESULT WINAPI
VideoRenderer_GetState(IBaseFilter
* iface
, DWORD dwMilliSecsTimeout
, FILTER_STATE
*pState
)
871 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
874 TRACE("(%p/%p)->(%d, %p)\n", This
, iface
, dwMilliSecsTimeout
, pState
);
876 if (WaitForSingleObject(This
->hEvent
, dwMilliSecsTimeout
) == WAIT_TIMEOUT
)
877 hr
= VFW_S_STATE_INTERMEDIATE
;
881 EnterCriticalSection(&This
->csFilter
);
883 *pState
= This
->state
;
885 LeaveCriticalSection(&This
->csFilter
);
890 static HRESULT WINAPI
VideoRenderer_SetSyncSource(IBaseFilter
* iface
, IReferenceClock
*pClock
)
892 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
894 TRACE("(%p/%p)->(%p)\n", This
, iface
, pClock
);
896 EnterCriticalSection(&This
->csFilter
);
899 IReferenceClock_Release(This
->pClock
);
900 This
->pClock
= pClock
;
902 IReferenceClock_AddRef(This
->pClock
);
904 LeaveCriticalSection(&This
->csFilter
);
909 static HRESULT WINAPI
VideoRenderer_GetSyncSource(IBaseFilter
* iface
, IReferenceClock
**ppClock
)
911 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
913 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppClock
);
915 EnterCriticalSection(&This
->csFilter
);
917 *ppClock
= This
->pClock
;
919 IReferenceClock_AddRef(This
->pClock
);
921 LeaveCriticalSection(&This
->csFilter
);
926 /** IBaseFilter implementation **/
928 static HRESULT
VideoRenderer_GetPin(IBaseFilter
*iface
, ULONG pos
, IPin
**pin
, DWORD
*lastsynctick
)
930 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
932 /* Our pins are static, not changing so setting static tick count is ok */
938 *pin
= (IPin
*)This
->pInputPin
;
943 static HRESULT WINAPI
VideoRenderer_EnumPins(IBaseFilter
* iface
, IEnumPins
**ppEnum
)
945 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
947 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppEnum
);
949 return IEnumPinsImpl_Construct(ppEnum
, VideoRenderer_GetPin
, iface
);
952 static HRESULT WINAPI
VideoRenderer_FindPin(IBaseFilter
* iface
, LPCWSTR Id
, IPin
**ppPin
)
954 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
956 FIXME("(%p/%p)->(%p,%p): stub !!!\n", This
, iface
, debugstr_w(Id
), ppPin
);
958 /* FIXME: critical section */
963 static HRESULT WINAPI
VideoRenderer_QueryFilterInfo(IBaseFilter
* iface
, FILTER_INFO
*pInfo
)
965 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
967 TRACE("(%p/%p)->(%p)\n", This
, iface
, pInfo
);
969 strcpyW(pInfo
->achName
, This
->filterInfo
.achName
);
970 pInfo
->pGraph
= This
->filterInfo
.pGraph
;
973 IFilterGraph_AddRef(pInfo
->pGraph
);
978 static HRESULT WINAPI
VideoRenderer_JoinFilterGraph(IBaseFilter
* iface
, IFilterGraph
*pGraph
, LPCWSTR pName
)
980 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
982 TRACE("(%p/%p)->(%p, %s)\n", This
, iface
, pGraph
, debugstr_w(pName
));
984 EnterCriticalSection(&This
->csFilter
);
987 strcpyW(This
->filterInfo
.achName
, pName
);
989 *This
->filterInfo
.achName
= '\0';
990 This
->filterInfo
.pGraph
= pGraph
; /* NOTE: do NOT increase ref. count */
992 LeaveCriticalSection(&This
->csFilter
);
997 static HRESULT WINAPI
VideoRenderer_QueryVendorInfo(IBaseFilter
* iface
, LPWSTR
*pVendorInfo
)
999 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
1000 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVendorInfo
);
1004 static const IBaseFilterVtbl VideoRenderer_Vtbl
=
1006 VideoRenderer_QueryInterface
,
1007 VideoRenderer_AddRef
,
1008 VideoRenderer_Release
,
1009 VideoRenderer_GetClassID
,
1011 VideoRenderer_Pause
,
1013 VideoRenderer_GetState
,
1014 VideoRenderer_SetSyncSource
,
1015 VideoRenderer_GetSyncSource
,
1016 VideoRenderer_EnumPins
,
1017 VideoRenderer_FindPin
,
1018 VideoRenderer_QueryFilterInfo
,
1019 VideoRenderer_JoinFilterGraph
,
1020 VideoRenderer_QueryVendorInfo
1023 static HRESULT WINAPI
VideoRenderer_InputPin_EndOfStream(IPin
* iface
)
1025 InputPin
* This
= (InputPin
*)iface
;
1026 IMediaEventSink
* pEventSink
;
1029 TRACE("(%p/%p)->()\n", This
, iface
);
1031 hr
= IFilterGraph_QueryInterface(((VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
)->filterInfo
.pGraph
, &IID_IMediaEventSink
, (LPVOID
*)&pEventSink
);
1034 hr
= IMediaEventSink_Notify(pEventSink
, EC_COMPLETE
, S_OK
, 0);
1035 IMediaEventSink_Release(pEventSink
);
1041 static HRESULT WINAPI
VideoRenderer_InputPin_BeginFlush(IPin
* iface
)
1043 InputPin
* This
= (InputPin
*)iface
;
1044 VideoRendererImpl
*pVideoRenderer
= (VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
;
1047 TRACE("(%p/%p)->()\n", This
, iface
);
1049 EnterCriticalSection(This
->pin
.pCritSec
);
1050 if (pVideoRenderer
->state
== State_Paused
)
1051 SetEvent(pVideoRenderer
->blocked
);
1053 hr
= InputPin_BeginFlush(iface
);
1054 LeaveCriticalSection(This
->pin
.pCritSec
);
1059 static HRESULT WINAPI
VideoRenderer_InputPin_EndFlush(IPin
* iface
)
1061 InputPin
* This
= (InputPin
*)iface
;
1062 VideoRendererImpl
*pVideoRenderer
= (VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
;
1065 TRACE("(%p/%p)->()\n", This
, iface
);
1067 EnterCriticalSection(This
->pin
.pCritSec
);
1068 if (pVideoRenderer
->state
== State_Paused
)
1069 ResetEvent(pVideoRenderer
->blocked
);
1071 hr
= InputPin_EndFlush(iface
);
1072 LeaveCriticalSection(This
->pin
.pCritSec
);
1077 static const IPinVtbl VideoRenderer_InputPin_Vtbl
=
1079 InputPin_QueryInterface
,
1083 InputPin_ReceiveConnection
,
1084 IPinImpl_Disconnect
,
1085 IPinImpl_ConnectedTo
,
1086 IPinImpl_ConnectionMediaType
,
1087 IPinImpl_QueryPinInfo
,
1088 IPinImpl_QueryDirection
,
1090 IPinImpl_QueryAccept
,
1091 IPinImpl_EnumMediaTypes
,
1092 IPinImpl_QueryInternalConnections
,
1093 VideoRenderer_InputPin_EndOfStream
,
1094 VideoRenderer_InputPin_BeginFlush
,
1095 VideoRenderer_InputPin_EndFlush
,
1099 /*** IUnknown methods ***/
1100 static HRESULT WINAPI
Basicvideo_QueryInterface(IBasicVideo
*iface
,
1103 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1105 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
1107 return VideoRenderer_QueryInterface((IBaseFilter
*)This
, riid
, ppvObj
);
1110 static ULONG WINAPI
Basicvideo_AddRef(IBasicVideo
*iface
) {
1111 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1113 TRACE("(%p/%p)->()\n", This
, iface
);
1115 return VideoRenderer_AddRef((IBaseFilter
*)This
);
1118 static ULONG WINAPI
Basicvideo_Release(IBasicVideo
*iface
) {
1119 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1121 TRACE("(%p/%p)->()\n", This
, iface
);
1123 return VideoRenderer_Release((IBaseFilter
*)This
);
1126 /*** IDispatch methods ***/
1127 static HRESULT WINAPI
Basicvideo_GetTypeInfoCount(IBasicVideo
*iface
,
1129 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1131 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
1136 static HRESULT WINAPI
Basicvideo_GetTypeInfo(IBasicVideo
*iface
,
1139 ITypeInfo
**ppTInfo
) {
1140 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1142 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
1147 static HRESULT WINAPI
Basicvideo_GetIDsOfNames(IBasicVideo
*iface
,
1153 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1155 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1160 static HRESULT WINAPI
Basicvideo_Invoke(IBasicVideo
*iface
,
1161 DISPID dispIdMember
,
1165 DISPPARAMS
*pDispParams
,
1167 EXCEPINFO
*pExepInfo
,
1169 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1171 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
);
1176 /*** IBasicVideo methods ***/
1177 static HRESULT WINAPI
Basicvideo_get_AvgTimePerFrame(IBasicVideo
*iface
,
1178 REFTIME
*pAvgTimePerFrame
) {
1179 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1181 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pAvgTimePerFrame
);
1186 static HRESULT WINAPI
Basicvideo_get_BitRate(IBasicVideo
*iface
,
1188 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1190 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBitRate
);
1195 static HRESULT WINAPI
Basicvideo_get_BitErrorRate(IBasicVideo
*iface
,
1196 LONG
*pBitErrorRate
) {
1197 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1199 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBitErrorRate
);
1204 static HRESULT WINAPI
Basicvideo_get_VideoWidth(IBasicVideo
*iface
,
1205 LONG
*pVideoWidth
) {
1206 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1208 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoWidth
);
1210 *pVideoWidth
= This
->VideoWidth
;
1215 static HRESULT WINAPI
Basicvideo_get_VideoHeight(IBasicVideo
*iface
,
1216 LONG
*pVideoHeight
) {
1217 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1219 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoHeight
);
1221 *pVideoHeight
= This
->VideoHeight
;
1226 static HRESULT WINAPI
Basicvideo_put_SourceLeft(IBasicVideo
*iface
,
1228 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1230 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceLeft
);
1232 This
->SourceRect
.left
= SourceLeft
;
1237 static HRESULT WINAPI
Basicvideo_get_SourceLeft(IBasicVideo
*iface
,
1238 LONG
*pSourceLeft
) {
1239 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1241 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceLeft
);
1243 *pSourceLeft
= This
->SourceRect
.left
;
1248 static HRESULT WINAPI
Basicvideo_put_SourceWidth(IBasicVideo
*iface
,
1250 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1252 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceWidth
);
1254 This
->SourceRect
.right
= This
->SourceRect
.left
+ SourceWidth
;
1259 static HRESULT WINAPI
Basicvideo_get_SourceWidth(IBasicVideo
*iface
,
1260 LONG
*pSourceWidth
) {
1261 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1263 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceWidth
);
1265 *pSourceWidth
= This
->SourceRect
.right
- This
->SourceRect
.left
;
1270 static HRESULT WINAPI
Basicvideo_put_SourceTop(IBasicVideo
*iface
,
1272 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1274 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceTop
);
1276 This
->SourceRect
.top
= SourceTop
;
1281 static HRESULT WINAPI
Basicvideo_get_SourceTop(IBasicVideo
*iface
,
1283 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1285 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceTop
);
1287 *pSourceTop
= This
->SourceRect
.top
;
1292 static HRESULT WINAPI
Basicvideo_put_SourceHeight(IBasicVideo
*iface
,
1293 LONG SourceHeight
) {
1294 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1296 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceHeight
);
1298 This
->SourceRect
.bottom
= This
->SourceRect
.top
+ SourceHeight
;
1303 static HRESULT WINAPI
Basicvideo_get_SourceHeight(IBasicVideo
*iface
,
1304 LONG
*pSourceHeight
) {
1305 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1307 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceHeight
);
1309 *pSourceHeight
= This
->SourceRect
.bottom
- This
->SourceRect
.top
;
1314 static HRESULT WINAPI
Basicvideo_put_DestinationLeft(IBasicVideo
*iface
,
1315 LONG DestinationLeft
) {
1316 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1318 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationLeft
);
1320 This
->DestRect
.left
= DestinationLeft
;
1325 static HRESULT WINAPI
Basicvideo_get_DestinationLeft(IBasicVideo
*iface
,
1326 LONG
*pDestinationLeft
) {
1327 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1329 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationLeft
);
1331 *pDestinationLeft
= This
->DestRect
.left
;
1336 static HRESULT WINAPI
Basicvideo_put_DestinationWidth(IBasicVideo
*iface
,
1337 LONG DestinationWidth
) {
1338 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1340 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationWidth
);
1342 This
->DestRect
.right
= This
->DestRect
.left
+ DestinationWidth
;
1347 static HRESULT WINAPI
Basicvideo_get_DestinationWidth(IBasicVideo
*iface
,
1348 LONG
*pDestinationWidth
) {
1349 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1351 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationWidth
);
1353 *pDestinationWidth
= This
->DestRect
.right
- This
->DestRect
.left
;
1358 static HRESULT WINAPI
Basicvideo_put_DestinationTop(IBasicVideo
*iface
,
1359 LONG DestinationTop
) {
1360 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1362 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationTop
);
1364 This
->DestRect
.top
= DestinationTop
;
1369 static HRESULT WINAPI
Basicvideo_get_DestinationTop(IBasicVideo
*iface
,
1370 LONG
*pDestinationTop
) {
1371 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1373 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationTop
);
1375 *pDestinationTop
= This
->DestRect
.top
;
1380 static HRESULT WINAPI
Basicvideo_put_DestinationHeight(IBasicVideo
*iface
,
1381 LONG DestinationHeight
) {
1382 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1384 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationHeight
);
1386 This
->DestRect
.right
= This
->DestRect
.left
+ DestinationHeight
;
1391 static HRESULT WINAPI
Basicvideo_get_DestinationHeight(IBasicVideo
*iface
,
1392 LONG
*pDestinationHeight
) {
1393 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1395 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationHeight
);
1397 *pDestinationHeight
= This
->DestRect
.right
- This
->DestRect
.left
;
1402 static HRESULT WINAPI
Basicvideo_SetSourcePosition(IBasicVideo
*iface
,
1407 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1409 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This
, iface
, Left
, Top
, Width
, Height
);
1411 This
->SourceRect
.left
= Left
;
1412 This
->SourceRect
.top
= Top
;
1413 This
->SourceRect
.right
= Left
+ Width
;
1414 This
->SourceRect
.bottom
= Top
+ Height
;
1419 static HRESULT WINAPI
Basicvideo_GetSourcePosition(IBasicVideo
*iface
,
1424 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1426 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1428 *pLeft
= This
->SourceRect
.left
;
1429 *pTop
= This
->SourceRect
.top
;
1430 *pWidth
= This
->SourceRect
.right
- This
->SourceRect
.left
;
1431 *pHeight
= This
->SourceRect
.bottom
- This
->SourceRect
.top
;
1436 static HRESULT WINAPI
Basicvideo_SetDefaultSourcePosition(IBasicVideo
*iface
) {
1437 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1439 TRACE("(%p/%p)->()\n", This
, iface
);
1441 This
->SourceRect
.left
= 0;
1442 This
->SourceRect
.top
= 0;
1443 This
->SourceRect
.right
= This
->VideoWidth
;
1444 This
->SourceRect
.bottom
= This
->VideoHeight
;
1449 static HRESULT WINAPI
Basicvideo_SetDestinationPosition(IBasicVideo
*iface
,
1454 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1456 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This
, iface
, Left
, Top
, Width
, Height
);
1458 This
->DestRect
.left
= Left
;
1459 This
->DestRect
.top
= Top
;
1460 This
->DestRect
.right
= Left
+ Width
;
1461 This
->DestRect
.bottom
= Top
+ Height
;
1466 static HRESULT WINAPI
Basicvideo_GetDestinationPosition(IBasicVideo
*iface
,
1471 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1473 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1475 *pLeft
= This
->DestRect
.left
;
1476 *pTop
= This
->DestRect
.top
;
1477 *pWidth
= This
->DestRect
.right
- This
->DestRect
.left
;
1478 *pHeight
= This
->DestRect
.bottom
- This
->DestRect
.top
;
1483 static HRESULT WINAPI
Basicvideo_SetDefaultDestinationPosition(IBasicVideo
*iface
) {
1484 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1487 TRACE("(%p/%p)->()\n", This
, iface
);
1489 if (!GetClientRect(This
->hWnd
, &rect
))
1492 This
->SourceRect
.left
= 0;
1493 This
->SourceRect
.top
= 0;
1494 This
->SourceRect
.right
= rect
.right
;
1495 This
->SourceRect
.bottom
= rect
.bottom
;
1500 static HRESULT WINAPI
Basicvideo_GetVideoSize(IBasicVideo
*iface
,
1503 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1505 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pWidth
, pHeight
);
1507 *pWidth
= This
->VideoWidth
;
1508 *pHeight
= This
->VideoHeight
;
1513 static HRESULT WINAPI
Basicvideo_GetVideoPaletteEntries(IBasicVideo
*iface
,
1518 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1520 FIXME("(%p/%p)->(%d, %d, %p, %p): stub !!!\n", This
, iface
, StartIndex
, Entries
, pRetrieved
, pPalette
);
1525 static HRESULT WINAPI
Basicvideo_GetCurrentImage(IBasicVideo
*iface
,
1528 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1529 BITMAPINFOHEADER
*bmiHeader
;
1531 AM_MEDIA_TYPE
*amt
= &This
->pInputPin
->pin
.mtCurrent
;
1534 FIXME("(%p/%p)->(%p, %p): partial stub\n", This
, iface
, pBufferSize
, pDIBImage
);
1536 EnterCriticalSection(&This
->csFilter
);
1538 if (!This
->sample_held
)
1540 LeaveCriticalSection(&This
->csFilter
);
1541 return (This
->state
== State_Paused
? E_UNEXPECTED
: VFW_E_NOT_PAUSED
);
1544 if (IsEqualIID(&amt
->formattype
, &FORMAT_VideoInfo
))
1546 bmiHeader
= &((VIDEOINFOHEADER
*)amt
->pbFormat
)->bmiHeader
;
1548 else if (IsEqualIID(&amt
->formattype
, &FORMAT_VideoInfo2
))
1550 bmiHeader
= &((VIDEOINFOHEADER2
*)amt
->pbFormat
)->bmiHeader
;
1554 FIXME("Unknown type %s\n", debugstr_guid(&amt
->subtype
));
1555 LeaveCriticalSection(&This
->csFilter
);
1556 return VFW_E_RUNTIME_ERROR
;
1559 needed_size
= bmiHeader
->biSize
;
1560 needed_size
+= IMediaSample_GetActualDataLength(This
->sample_held
);
1564 *pBufferSize
= needed_size
;
1565 LeaveCriticalSection(&This
->csFilter
);
1569 if (needed_size
< *pBufferSize
)
1571 ERR("Buffer too small %u/%u\n", needed_size
, *pBufferSize
);
1572 LeaveCriticalSection(&This
->csFilter
);
1575 *pBufferSize
= needed_size
;
1577 memcpy(pDIBImage
, bmiHeader
, bmiHeader
->biSize
);
1578 IMediaSample_GetPointer(This
->sample_held
, (BYTE
**)&ptr
);
1579 memcpy((char *)pDIBImage
+ bmiHeader
->biSize
, ptr
, IMediaSample_GetActualDataLength(This
->sample_held
));
1581 LeaveCriticalSection(&This
->csFilter
);
1586 static HRESULT WINAPI
Basicvideo_IsUsingDefaultSource(IBasicVideo
*iface
) {
1587 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1589 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
1594 static HRESULT WINAPI
Basicvideo_IsUsingDefaultDestination(IBasicVideo
*iface
) {
1595 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1597 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
1603 static const IBasicVideoVtbl IBasicVideo_VTable
=
1605 Basicvideo_QueryInterface
,
1608 Basicvideo_GetTypeInfoCount
,
1609 Basicvideo_GetTypeInfo
,
1610 Basicvideo_GetIDsOfNames
,
1612 Basicvideo_get_AvgTimePerFrame
,
1613 Basicvideo_get_BitRate
,
1614 Basicvideo_get_BitErrorRate
,
1615 Basicvideo_get_VideoWidth
,
1616 Basicvideo_get_VideoHeight
,
1617 Basicvideo_put_SourceLeft
,
1618 Basicvideo_get_SourceLeft
,
1619 Basicvideo_put_SourceWidth
,
1620 Basicvideo_get_SourceWidth
,
1621 Basicvideo_put_SourceTop
,
1622 Basicvideo_get_SourceTop
,
1623 Basicvideo_put_SourceHeight
,
1624 Basicvideo_get_SourceHeight
,
1625 Basicvideo_put_DestinationLeft
,
1626 Basicvideo_get_DestinationLeft
,
1627 Basicvideo_put_DestinationWidth
,
1628 Basicvideo_get_DestinationWidth
,
1629 Basicvideo_put_DestinationTop
,
1630 Basicvideo_get_DestinationTop
,
1631 Basicvideo_put_DestinationHeight
,
1632 Basicvideo_get_DestinationHeight
,
1633 Basicvideo_SetSourcePosition
,
1634 Basicvideo_GetSourcePosition
,
1635 Basicvideo_SetDefaultSourcePosition
,
1636 Basicvideo_SetDestinationPosition
,
1637 Basicvideo_GetDestinationPosition
,
1638 Basicvideo_SetDefaultDestinationPosition
,
1639 Basicvideo_GetVideoSize
,
1640 Basicvideo_GetVideoPaletteEntries
,
1641 Basicvideo_GetCurrentImage
,
1642 Basicvideo_IsUsingDefaultSource
,
1643 Basicvideo_IsUsingDefaultDestination
1647 /*** IUnknown methods ***/
1648 static HRESULT WINAPI
Videowindow_QueryInterface(IVideoWindow
*iface
,
1651 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1653 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
1655 return VideoRenderer_QueryInterface((IBaseFilter
*)This
, riid
, ppvObj
);
1658 static ULONG WINAPI
Videowindow_AddRef(IVideoWindow
*iface
) {
1659 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1661 TRACE("(%p/%p)->()\n", This
, iface
);
1663 return VideoRenderer_AddRef((IBaseFilter
*)This
);
1666 static ULONG WINAPI
Videowindow_Release(IVideoWindow
*iface
) {
1667 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1669 TRACE("(%p/%p)->()\n", This
, iface
);
1671 return VideoRenderer_Release((IBaseFilter
*)This
);
1674 /*** IDispatch methods ***/
1675 static HRESULT WINAPI
Videowindow_GetTypeInfoCount(IVideoWindow
*iface
,
1677 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1679 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
1684 static HRESULT WINAPI
Videowindow_GetTypeInfo(IVideoWindow
*iface
,
1687 ITypeInfo
**ppTInfo
) {
1688 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1690 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
1695 static HRESULT WINAPI
Videowindow_GetIDsOfNames(IVideoWindow
*iface
,
1701 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1703 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1708 static HRESULT WINAPI
Videowindow_Invoke(IVideoWindow
*iface
,
1709 DISPID dispIdMember
,
1713 DISPPARAMS
*pDispParams
,
1715 EXCEPINFO
*pExepInfo
,
1717 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1719 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
);
1724 /*** IVideoWindow methods ***/
1725 static HRESULT WINAPI
Videowindow_put_Caption(IVideoWindow
*iface
,
1727 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1729 TRACE("(%p/%p)->(%s (%p))\n", This
, iface
, debugstr_w(strCaption
), strCaption
);
1731 if (!SetWindowTextW(This
->hWnd
, strCaption
))
1737 static HRESULT WINAPI
Videowindow_get_Caption(IVideoWindow
*iface
,
1739 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1741 TRACE("(%p/%p)->(%p)\n", This
, iface
, strCaption
);
1743 GetWindowTextW(This
->hWnd
, (LPWSTR
)strCaption
, 100);
1748 static HRESULT WINAPI
Videowindow_put_WindowStyle(IVideoWindow
*iface
,
1750 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1753 old
= GetWindowLongA(This
->hWnd
, GWL_STYLE
);
1755 TRACE("(%p/%p)->(%x -> %x)\n", This
, iface
, old
, WindowStyle
);
1757 if (WindowStyle
& (WS_DISABLED
|WS_HSCROLL
|WS_ICONIC
|WS_MAXIMIZE
|WS_MINIMIZE
|WS_VSCROLL
))
1758 return E_INVALIDARG
;
1760 SetWindowLongA(This
->hWnd
, GWL_STYLE
, WindowStyle
);
1765 static HRESULT WINAPI
Videowindow_get_WindowStyle(IVideoWindow
*iface
,
1766 LONG
*WindowStyle
) {
1767 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1769 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyle
);
1771 *WindowStyle
= GetWindowLongA(This
->hWnd
, GWL_STYLE
);
1776 static HRESULT WINAPI
Videowindow_put_WindowStyleEx(IVideoWindow
*iface
,
1777 LONG WindowStyleEx
) {
1778 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1780 TRACE("(%p/%p)->(%d)\n", This
, iface
, WindowStyleEx
);
1782 if (WindowStyleEx
& (WS_DISABLED
|WS_HSCROLL
|WS_ICONIC
|WS_MAXIMIZE
|WS_MINIMIZE
|WS_VSCROLL
))
1783 return E_INVALIDARG
;
1785 if (!SetWindowLongA(This
->hWnd
, GWL_EXSTYLE
, WindowStyleEx
))
1791 static HRESULT WINAPI
Videowindow_get_WindowStyleEx(IVideoWindow
*iface
,
1792 LONG
*WindowStyleEx
) {
1793 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1795 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyleEx
);
1797 *WindowStyleEx
= GetWindowLongA(This
->hWnd
, GWL_EXSTYLE
);
1802 static HRESULT WINAPI
Videowindow_put_AutoShow(IVideoWindow
*iface
,
1804 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1806 TRACE("(%p/%p)->(%d)\n", This
, iface
, AutoShow
);
1808 This
->AutoShow
= 1; /* FIXME: Should be AutoShow */;
1813 static HRESULT WINAPI
Videowindow_get_AutoShow(IVideoWindow
*iface
,
1815 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1817 TRACE("(%p/%p)->(%p)\n", This
, iface
, AutoShow
);
1819 *AutoShow
= This
->AutoShow
;
1824 static HRESULT WINAPI
Videowindow_put_WindowState(IVideoWindow
*iface
,
1826 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1828 FIXME("(%p/%p)->(%d): stub !!!\n", This
, iface
, WindowState
);
1833 static HRESULT WINAPI
Videowindow_get_WindowState(IVideoWindow
*iface
,
1834 LONG
*WindowState
) {
1835 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1837 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, WindowState
);
1842 static HRESULT WINAPI
Videowindow_put_BackgroundPalette(IVideoWindow
*iface
,
1843 LONG BackgroundPalette
) {
1844 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1846 FIXME("(%p/%p)->(%d): stub !!!\n", This
, iface
, BackgroundPalette
);
1851 static HRESULT WINAPI
Videowindow_get_BackgroundPalette(IVideoWindow
*iface
,
1852 LONG
*pBackgroundPalette
) {
1853 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1855 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBackgroundPalette
);
1860 static HRESULT WINAPI
Videowindow_put_Visible(IVideoWindow
*iface
,
1862 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1864 TRACE("(%p/%p)->(%d)\n", This
, iface
, Visible
);
1866 ShowWindow(This
->hWnd
, Visible
? SW_SHOW
: SW_HIDE
);
1871 static HRESULT WINAPI
Videowindow_get_Visible(IVideoWindow
*iface
,
1873 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1875 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVisible
);
1877 *pVisible
= IsWindowVisible(This
->hWnd
);
1882 static HRESULT WINAPI
Videowindow_put_Left(IVideoWindow
*iface
,
1884 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1886 TRACE("(%p/%p)->(%d)\n", This
, iface
, Left
);
1888 if (!SetWindowPos(This
->hWnd
, NULL
, Left
, This
->WindowPos
.top
, 0, 0, SWP_NOZORDER
|SWP_NOSIZE
))
1891 This
->WindowPos
.left
= Left
;
1896 static HRESULT WINAPI
Videowindow_get_Left(IVideoWindow
*iface
,
1898 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1900 TRACE("(%p/%p)->(%p)\n", This
, iface
, pLeft
);
1902 *pLeft
= This
->WindowPos
.left
;
1907 static HRESULT WINAPI
Videowindow_put_Width(IVideoWindow
*iface
,
1909 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1911 TRACE("(%p/%p)->(%d)\n", This
, iface
, Width
);
1913 if (!SetWindowPos(This
->hWnd
, NULL
, 0, 0, Width
, This
->WindowPos
.bottom
-This
->WindowPos
.top
, SWP_NOZORDER
|SWP_NOMOVE
))
1916 This
->WindowPos
.right
= This
->WindowPos
.left
+ Width
;
1921 static HRESULT WINAPI
Videowindow_get_Width(IVideoWindow
*iface
,
1923 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1925 TRACE("(%p/%p)->(%p)\n", This
, iface
, pWidth
);
1927 *pWidth
= This
->WindowPos
.right
- This
->WindowPos
.left
;
1932 static HRESULT WINAPI
Videowindow_put_Top(IVideoWindow
*iface
,
1934 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1936 TRACE("(%p/%p)->(%d)\n", This
, iface
, Top
);
1938 if (!SetWindowPos(This
->hWnd
, NULL
, This
->WindowPos
.left
, Top
, 0, 0, SWP_NOZORDER
|SWP_NOSIZE
))
1941 This
->WindowPos
.top
= Top
;
1946 static HRESULT WINAPI
Videowindow_get_Top(IVideoWindow
*iface
,
1948 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1950 TRACE("(%p/%p)->(%p)\n", This
, iface
, pTop
);
1952 *pTop
= This
->WindowPos
.top
;
1957 static HRESULT WINAPI
Videowindow_put_Height(IVideoWindow
*iface
,
1959 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1961 TRACE("(%p/%p)->(%d)\n", This
, iface
, Height
);
1963 if (!SetWindowPos(This
->hWnd
, NULL
, 0, 0, This
->WindowPos
.right
-This
->WindowPos
.left
, Height
, SWP_NOZORDER
|SWP_NOMOVE
))
1966 This
->WindowPos
.bottom
= This
->WindowPos
.top
+ Height
;
1971 static HRESULT WINAPI
Videowindow_get_Height(IVideoWindow
*iface
,
1973 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1975 TRACE("(%p/%p)->(%p)\n", This
, iface
, pHeight
);
1977 *pHeight
= This
->WindowPos
.bottom
- This
->WindowPos
.top
;
1982 static HRESULT WINAPI
Videowindow_put_Owner(IVideoWindow
*iface
,
1984 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1986 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Owner
);
1988 SetParent(This
->hWnd
, (HWND
)Owner
);
1993 static HRESULT WINAPI
Videowindow_get_Owner(IVideoWindow
*iface
,
1995 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1997 TRACE("(%p/%p)->(%p)\n", This
, iface
, Owner
);
1999 *(HWND
*)Owner
= GetParent(This
->hWnd
);
2004 static HRESULT WINAPI
Videowindow_put_MessageDrain(IVideoWindow
*iface
,
2006 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2008 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Drain
);
2010 This
->hWndMsgDrain
= (HWND
)Drain
;
2015 static HRESULT WINAPI
Videowindow_get_MessageDrain(IVideoWindow
*iface
,
2017 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2019 TRACE("(%p/%p)->(%p)\n", This
, iface
, Drain
);
2021 *Drain
= (OAHWND
)This
->hWndMsgDrain
;
2026 static HRESULT WINAPI
Videowindow_get_BorderColor(IVideoWindow
*iface
,
2028 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2030 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, Color
);
2035 static HRESULT WINAPI
Videowindow_put_BorderColor(IVideoWindow
*iface
,
2037 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2039 FIXME("(%p/%p)->(%d): stub !!!\n", This
, iface
, Color
);
2044 static HRESULT WINAPI
Videowindow_get_FullScreenMode(IVideoWindow
*iface
,
2045 LONG
*FullScreenMode
) {
2046 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2048 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, FullScreenMode
);
2053 static HRESULT WINAPI
Videowindow_put_FullScreenMode(IVideoWindow
*iface
,
2054 LONG FullScreenMode
) {
2055 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2057 FIXME("(%p/%p)->(%d): stub !!!\n", This
, iface
, FullScreenMode
);
2062 static HRESULT WINAPI
Videowindow_SetWindowForeground(IVideoWindow
*iface
,
2064 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2069 TRACE("(%p/%p)->(%d)\n", This
, iface
, Focus
);
2071 if ((Focus
!= FALSE
) && (Focus
!= TRUE
))
2072 return E_INVALIDARG
;
2074 hr
= IPin_ConnectedTo((IPin
*)This
->pInputPin
, &pPin
);
2075 if ((hr
!= S_OK
) || !pPin
)
2076 return VFW_E_NOT_CONNECTED
;
2079 ret
= SetForegroundWindow(This
->hWnd
);
2081 ret
= SetWindowPos(This
->hWnd
, HWND_TOP
, 0, 0, 0, 0, SWP_NOMOVE
|SWP_NOSIZE
);
2089 static HRESULT WINAPI
Videowindow_NotifyOwnerMessage(IVideoWindow
*iface
,
2094 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2096 TRACE("(%p/%p)->(%08lx, %d, %08lx, %08lx)\n", This
, iface
, hwnd
, uMsg
, wParam
, lParam
);
2098 if (!PostMessageA(This
->hWnd
, uMsg
, wParam
, lParam
))
2104 static HRESULT WINAPI
Videowindow_SetWindowPosition(IVideoWindow
*iface
,
2109 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2111 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This
, iface
, Left
, Top
, Width
, Height
);
2113 if (!SetWindowPos(This
->hWnd
, NULL
, Left
, Top
, Width
, Height
, SWP_NOZORDER
))
2116 This
->WindowPos
.left
= Left
;
2117 This
->WindowPos
.top
= Top
;
2118 This
->WindowPos
.right
= Left
+ Width
;
2119 This
->WindowPos
.bottom
= Top
+ Height
;
2124 static HRESULT WINAPI
Videowindow_GetWindowPosition(IVideoWindow
*iface
,
2129 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2131 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
2133 *pLeft
= This
->WindowPos
.left
;
2134 *pTop
= This
->WindowPos
.top
;
2135 *pWidth
= This
->WindowPos
.right
- This
->WindowPos
.left
;
2136 *pHeight
= This
->WindowPos
.bottom
- This
->WindowPos
.top
;
2141 static HRESULT WINAPI
Videowindow_GetMinIdealImageSize(IVideoWindow
*iface
,
2144 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2146 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This
, iface
, pWidth
, pHeight
);
2148 *pWidth
= This
->VideoWidth
;
2149 *pHeight
= This
->VideoHeight
;
2154 static HRESULT WINAPI
Videowindow_GetMaxIdealImageSize(IVideoWindow
*iface
,
2157 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2159 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This
, iface
, pWidth
, pHeight
);
2161 *pWidth
= This
->VideoWidth
;
2162 *pHeight
= This
->VideoHeight
;
2167 static HRESULT WINAPI
Videowindow_GetRestorePosition(IVideoWindow
*iface
,
2172 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2174 FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
2179 static HRESULT WINAPI
Videowindow_HideCursor(IVideoWindow
*iface
,
2181 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2183 FIXME("(%p/%p)->(%d): stub !!!\n", This
, iface
, HideCursor
);
2188 static HRESULT WINAPI
Videowindow_IsCursorHidden(IVideoWindow
*iface
,
2189 LONG
*CursorHidden
) {
2190 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2192 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, CursorHidden
);
2197 static const IVideoWindowVtbl IVideoWindow_VTable
=
2199 Videowindow_QueryInterface
,
2201 Videowindow_Release
,
2202 Videowindow_GetTypeInfoCount
,
2203 Videowindow_GetTypeInfo
,
2204 Videowindow_GetIDsOfNames
,
2206 Videowindow_put_Caption
,
2207 Videowindow_get_Caption
,
2208 Videowindow_put_WindowStyle
,
2209 Videowindow_get_WindowStyle
,
2210 Videowindow_put_WindowStyleEx
,
2211 Videowindow_get_WindowStyleEx
,
2212 Videowindow_put_AutoShow
,
2213 Videowindow_get_AutoShow
,
2214 Videowindow_put_WindowState
,
2215 Videowindow_get_WindowState
,
2216 Videowindow_put_BackgroundPalette
,
2217 Videowindow_get_BackgroundPalette
,
2218 Videowindow_put_Visible
,
2219 Videowindow_get_Visible
,
2220 Videowindow_put_Left
,
2221 Videowindow_get_Left
,
2222 Videowindow_put_Width
,
2223 Videowindow_get_Width
,
2224 Videowindow_put_Top
,
2225 Videowindow_get_Top
,
2226 Videowindow_put_Height
,
2227 Videowindow_get_Height
,
2228 Videowindow_put_Owner
,
2229 Videowindow_get_Owner
,
2230 Videowindow_put_MessageDrain
,
2231 Videowindow_get_MessageDrain
,
2232 Videowindow_get_BorderColor
,
2233 Videowindow_put_BorderColor
,
2234 Videowindow_get_FullScreenMode
,
2235 Videowindow_put_FullScreenMode
,
2236 Videowindow_SetWindowForeground
,
2237 Videowindow_NotifyOwnerMessage
,
2238 Videowindow_SetWindowPosition
,
2239 Videowindow_GetWindowPosition
,
2240 Videowindow_GetMinIdealImageSize
,
2241 Videowindow_GetMaxIdealImageSize
,
2242 Videowindow_GetRestorePosition
,
2243 Videowindow_HideCursor
,
2244 Videowindow_IsCursorHidden