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
;
88 REFERENCE_TIME rtLastStop
;
89 MediaSeekingImpl mediaSeeking
;
91 /* During pause we can hold a single sample, for use in GetCurrentImage */
92 IMediaSample
*sample_held
;
95 static LRESULT CALLBACK
VideoWndProcA(HWND hwnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
97 VideoRendererImpl
* pVideoRenderer
= (VideoRendererImpl
*)GetWindowLongA(hwnd
, 0);
98 LPRECT lprect
= (LPRECT
)lParam
;
100 if (pVideoRenderer
&& pVideoRenderer
->hWndMsgDrain
)
106 case WM_LBUTTONDBLCLK
:
109 case WM_MBUTTONDBLCLK
:
112 case WM_MOUSEACTIVATE
:
114 case WM_NCLBUTTONDBLCLK
:
115 case WM_NCLBUTTONDOWN
:
117 case WM_NCMBUTTONDBLCLK
:
118 case WM_NCMBUTTONDOWN
:
121 case WM_NCRBUTTONDBLCLK
:
122 case WM_NCRBUTTONDOWN
:
124 case WM_RBUTTONDBLCLK
:
127 PostMessageA(pVideoRenderer
->hWndMsgDrain
, uMsg
, wParam
, lParam
);
137 /* TRACE("WM_SIZING %d %d %d %d\n", lprect->left, lprect->top, lprect->right, lprect->bottom); */
138 SetWindowPos(hwnd
, NULL
, lprect
->left
, lprect
->top
, lprect
->right
- lprect
->left
, lprect
->bottom
- lprect
->top
, SWP_NOZORDER
);
139 GetClientRect(hwnd
, &pVideoRenderer
->DestRect
);
140 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
141 pVideoRenderer
->DestRect
.left
,
142 pVideoRenderer
->DestRect
.top
,
143 pVideoRenderer
->DestRect
.right
- pVideoRenderer
->DestRect
.left
,
144 pVideoRenderer
->DestRect
.bottom
- pVideoRenderer
->DestRect
.top
);
147 TRACE("WM_SIZE %d %d\n", LOWORD(lParam
), HIWORD(lParam
));
148 GetClientRect(hwnd
, &pVideoRenderer
->DestRect
);
149 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
150 pVideoRenderer
->DestRect
.left
,
151 pVideoRenderer
->DestRect
.top
,
152 pVideoRenderer
->DestRect
.right
- pVideoRenderer
->DestRect
.left
,
153 pVideoRenderer
->DestRect
.bottom
- pVideoRenderer
->DestRect
.top
);
156 return DefWindowProcA(hwnd
, uMsg
, wParam
, lParam
);
161 static BOOL
CreateRenderingWindow(VideoRendererImpl
* This
)
165 TRACE("(%p)->()\n", This
);
168 winclass
.lpfnWndProc
= VideoWndProcA
;
169 winclass
.cbClsExtra
= 0;
170 winclass
.cbWndExtra
= sizeof(VideoRendererImpl
*);
171 winclass
.hInstance
= NULL
;
172 winclass
.hIcon
= NULL
;
173 winclass
.hCursor
= NULL
;
174 winclass
.hbrBackground
= GetStockObject(BLACK_BRUSH
);
175 winclass
.lpszMenuName
= NULL
;
176 winclass
.lpszClassName
= "Wine ActiveMovie Class";
178 if (!wnd_class_registered
)
180 if (!RegisterClassA(&winclass
))
182 ERR("Unable to register window %u\n", GetLastError());
185 wnd_class_registered
= TRUE
;
188 This
->hWnd
= CreateWindowExA(0, "Wine ActiveMovie Class", "Wine ActiveMovie Window", WS_SIZEBOX
,
189 CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
, NULL
,
194 ERR("Unable to create window\n");
198 SetWindowLongA(This
->hWnd
, 0, (LONG
)This
);
203 static DWORD WINAPI
MessageLoop(LPVOID lpParameter
)
205 VideoRendererImpl
* This
= (VideoRendererImpl
*) lpParameter
;
209 TRACE("Starting message loop\n");
211 if (!CreateRenderingWindow(This
))
213 This
->ThreadResult
= FALSE
;
214 SetEvent(This
->hEvent
);
218 This
->ThreadResult
= TRUE
;
219 SetEvent(This
->hEvent
);
221 while ((fGotMessage
= GetMessageA(&msg
, NULL
, 0, 0)) != 0 && fGotMessage
!= -1)
223 TranslateMessage(&msg
);
224 DispatchMessageA(&msg
);
227 TRACE("End of message loop\n");
232 static BOOL
CreateRenderingSubsystem(VideoRendererImpl
* This
)
234 This
->hEvent
= CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
238 This
->hThread
= CreateThread(NULL
, 0, MessageLoop
, (LPVOID
)This
, 0, &This
->ThreadID
);
241 CloseHandle(This
->hEvent
);
245 WaitForSingleObject(This
->hEvent
, INFINITE
);
246 CloseHandle(This
->hEvent
);
248 if (!This
->ThreadResult
)
250 CloseHandle(This
->hThread
);
257 static const IMemInputPinVtbl MemInputPin_Vtbl
=
259 MemInputPin_QueryInterface
,
262 MemInputPin_GetAllocator
,
263 MemInputPin_NotifyAllocator
,
264 MemInputPin_GetAllocatorRequirements
,
266 MemInputPin_ReceiveMultiple
,
267 MemInputPin_ReceiveCanBlock
270 static DWORD
VideoRenderer_SendSampleData(VideoRendererImpl
* This
, LPBYTE data
, DWORD size
)
277 LPBYTE palette
= NULL
;
279 BITMAPINFOHEADER
*bmiHeader
;
281 TRACE("%p %p %d\n", This
, data
, size
);
283 sdesc
.dwSize
= sizeof(sdesc
);
284 hr
= IPin_ConnectionMediaType((IPin
*)This
->pInputPin
, &amt
);
286 ERR("Unable to retrieve media type\n");
290 if (IsEqualIID(&amt
.formattype
, &FORMAT_VideoInfo
))
292 bmiHeader
= &((VIDEOINFOHEADER
*)amt
.pbFormat
)->bmiHeader
;
294 else if (IsEqualIID(&amt
.formattype
, &FORMAT_VideoInfo2
))
296 bmiHeader
= &((VIDEOINFOHEADER2
*)amt
.pbFormat
)->bmiHeader
;
300 FIXME("Unknown type %s\n", debugstr_guid(&amt
.subtype
));
301 return VFW_E_RUNTIME_ERROR
;
305 TRACE("biSize = %d\n", bmiHeader
->biSize
);
306 TRACE("biWidth = %d\n", bmiHeader
->biWidth
);
307 TRACE("biHeight = %d\n", bmiHeader
->biHeight
);
308 TRACE("biPlanes = %d\n", bmiHeader
->biPlanes
);
309 TRACE("biBitCount = %d\n", bmiHeader
->biBitCount
);
310 TRACE("biCompression = %s\n", debugstr_an((LPSTR
)&(bmiHeader
->biCompression
), 4));
311 TRACE("biSizeImage = %d\n", bmiHeader
->biSizeImage
);
313 width
= bmiHeader
->biWidth
;
314 height
= bmiHeader
->biHeight
;
315 palette
= ((LPBYTE
)bmiHeader
) + bmiHeader
->biSize
;
319 if (!This
->WindowPos
.right
|| !This
->WindowPos
.bottom
)
320 This
->WindowPos
= This
->SourceRect
;
322 TRACE("WindowPos: %d %d %d %d\n", This
->WindowPos
.left
, This
->WindowPos
.top
, This
->WindowPos
.right
, This
->WindowPos
.bottom
);
323 SetWindowPos(This
->hWnd
, NULL
,
324 This
->WindowPos
.left
,
326 This
->WindowPos
.right
- This
->WindowPos
.left
,
327 This
->WindowPos
.bottom
- This
->WindowPos
.top
,
328 SWP_NOZORDER
|SWP_NOMOVE
);
330 GetClientRect(This
->hWnd
, &This
->DestRect
);
334 hDC
= GetDC(This
->hWnd
);
337 ERR("Cannot get DC from window!\n");
341 TRACE("Src Rect: %d %d %d %d\n", This
->SourceRect
.left
, This
->SourceRect
.top
, This
->SourceRect
.right
, This
->SourceRect
.bottom
);
342 TRACE("Dst Rect: %d %d %d %d\n", This
->DestRect
.left
, This
->DestRect
.top
, This
->DestRect
.right
, This
->DestRect
.bottom
);
344 StretchDIBits(hDC
, This
->DestRect
.left
, This
->DestRect
.top
, This
->DestRect
.right
-This
->DestRect
.left
,
345 This
->DestRect
.bottom
- This
->DestRect
.top
, This
->SourceRect
.left
, This
->SourceRect
.top
,
346 This
->SourceRect
.right
- This
->SourceRect
.left
, This
->SourceRect
.bottom
- This
->SourceRect
.top
,
347 data
, (BITMAPINFO
*)bmiHeader
, DIB_RGB_COLORS
, SRCCOPY
);
349 ReleaseDC(This
->hWnd
, hDC
);
351 ShowWindow(This
->hWnd
, SW_SHOW
);
356 static HRESULT
VideoRenderer_Sample(LPVOID iface
, IMediaSample
* pSample
)
358 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
359 LPBYTE pbSrcStream
= NULL
;
360 long cbSrcStream
= 0;
361 REFERENCE_TIME tStart
, tStop
;
364 if (This
->state
== State_Stopped
)
367 TRACE("%p %p\n", iface
, pSample
);
369 hr
= IMediaSample_GetTime(pSample
, &tStart
, &tStop
);
371 ERR("Cannot get sample time (%x)\n", hr
);
373 if (This
->rtLastStop
!= tStart
)
375 if (IMediaSample_IsDiscontinuity(pSample
) == S_FALSE
)
376 ERR("Unexpected discontinuity: Last: %u.%03u, tStart: %u.%03u\n",
377 (DWORD
)(This
->rtLastStop
/ 10000000),
378 (DWORD
)((This
->rtLastStop
/ 10000)%1000),
379 (DWORD
)(tStart
/ 10000000), (DWORD
)((tStart
/ 10000)%1000));
380 This
->rtLastStop
= tStart
;
383 /* Preroll means the sample isn't shown, this is used for key frames and things like that */
384 if (IMediaSample_IsPreroll(pSample
) == S_OK
)
386 This
->rtLastStop
= tStop
;
390 hr
= IMediaSample_GetPointer(pSample
, &pbSrcStream
);
393 ERR("Cannot get pointer to sample data (%x)\n", hr
);
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 if (This
->state
== State_Paused
)
416 if (This
->sample_held
)
417 IMediaSample_Release(This
->sample_held
);
419 This
->sample_held
= pSample
;
420 IMediaSample_AddRef(pSample
);
423 if (This
->pClock
&& This
->state
== State_Running
)
425 REFERENCE_TIME time
, trefstart
, trefstop
;
428 /* Perhaps I <SHOULD> use the reference clock AdviseTime function here
429 * I'm not going to! When I tried, it seemed to generate lag and
430 * it caused instability.
432 IReferenceClock_GetTime(This
->pClock
, &time
);
434 trefstart
= This
->rtStreamStart
;
435 trefstop
= (REFERENCE_TIME
)((double)(tStop
- tStart
) / This
->pInputPin
->dRate
) + This
->rtStreamStart
;
436 delta
= (LONG
)((trefstart
-time
)/10000);
437 This
->rtStreamStart
= trefstop
;
438 This
->rtLastStop
= tStop
;
442 TRACE("Sleeping for %u ms\n", delta
);
445 else if (time
> trefstop
)
447 TRACE("Dropping sample: Time: %u.%03u ms trefstop: %u.%03u ms!\n",
448 (DWORD
)(time
/ 10000000), (DWORD
)((time
/ 10000)%1000),
449 (DWORD
)(trefstop
/ 10000000), (DWORD
)((trefstop
/ 10000)%1000) );
450 This
->rtLastStop
= tStop
;
454 This
->rtLastStop
= tStop
;
456 VideoRenderer_SendSampleData(This
, pbSrcStream
, cbSrcStream
);
461 static HRESULT
VideoRenderer_QueryAccept(LPVOID iface
, const AM_MEDIA_TYPE
* pmt
)
463 if (!IsEqualIID(&pmt
->majortype
, &MEDIATYPE_Video
))
466 if (IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB32
) ||
467 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB24
) ||
468 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB565
) ||
469 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB8
))
471 VideoRendererImpl
* This
= (VideoRendererImpl
*) iface
;
473 if (IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo
))
475 VIDEOINFOHEADER
*format
= (VIDEOINFOHEADER
*)pmt
->pbFormat
;
476 This
->SourceRect
.left
= 0;
477 This
->SourceRect
.top
= 0;
478 This
->SourceRect
.right
= This
->VideoWidth
= format
->bmiHeader
.biWidth
;
479 This
->SourceRect
.bottom
= This
->VideoHeight
= format
->bmiHeader
.biHeight
;
481 else if (IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo2
))
483 VIDEOINFOHEADER2
*format2
= (VIDEOINFOHEADER2
*)pmt
->pbFormat
;
485 This
->SourceRect
.left
= 0;
486 This
->SourceRect
.top
= 0;
487 This
->SourceRect
.right
= This
->VideoWidth
= format2
->bmiHeader
.biWidth
;
488 This
->SourceRect
.bottom
= This
->VideoHeight
= format2
->bmiHeader
.biHeight
;
492 WARN("Format type %s not supported\n", debugstr_guid(&pmt
->formattype
));
500 static inline VideoRendererImpl
*impl_from_IMediaSeeking( IMediaSeeking
*iface
)
502 return (VideoRendererImpl
*)((char*)iface
- FIELD_OFFSET(VideoRendererImpl
, mediaSeeking
.lpVtbl
));
505 static HRESULT WINAPI
VideoRendererImpl_Seeking_QueryInterface(IMediaSeeking
* iface
, REFIID riid
, LPVOID
* ppv
)
507 VideoRendererImpl
*This
= impl_from_IMediaSeeking(iface
);
509 return IUnknown_QueryInterface((IUnknown
*)This
, riid
, ppv
);
512 static ULONG WINAPI
VideoRendererImpl_Seeking_AddRef(IMediaSeeking
* iface
)
514 VideoRendererImpl
*This
= impl_from_IMediaSeeking(iface
);
516 return IUnknown_AddRef((IUnknown
*)This
);
519 static ULONG WINAPI
VideoRendererImpl_Seeking_Release(IMediaSeeking
* iface
)
521 VideoRendererImpl
*This
= impl_from_IMediaSeeking(iface
);
523 return IUnknown_Release((IUnknown
*)This
);
526 static const IMediaSeekingVtbl VideoRendererImpl_Seeking_Vtbl
=
528 VideoRendererImpl_Seeking_QueryInterface
,
529 VideoRendererImpl_Seeking_AddRef
,
530 VideoRendererImpl_Seeking_Release
,
531 MediaSeekingImpl_GetCapabilities
,
532 MediaSeekingImpl_CheckCapabilities
,
533 MediaSeekingImpl_IsFormatSupported
,
534 MediaSeekingImpl_QueryPreferredFormat
,
535 MediaSeekingImpl_GetTimeFormat
,
536 MediaSeekingImpl_IsUsingTimeFormat
,
537 MediaSeekingImpl_SetTimeFormat
,
538 MediaSeekingImpl_GetDuration
,
539 MediaSeekingImpl_GetStopPosition
,
540 MediaSeekingImpl_GetCurrentPosition
,
541 MediaSeekingImpl_ConvertTimeFormat
,
542 MediaSeekingImpl_SetPositions
,
543 MediaSeekingImpl_GetPositions
,
544 MediaSeekingImpl_GetAvailable
,
545 MediaSeekingImpl_SetRate
,
546 MediaSeekingImpl_GetRate
,
547 MediaSeekingImpl_GetPreroll
550 static HRESULT
VideoRendererImpl_Change(IBaseFilter
*iface
)
552 TRACE("(%p)\n", iface
);
556 HRESULT
VideoRenderer_create(IUnknown
* pUnkOuter
, LPVOID
* ppv
)
560 VideoRendererImpl
* pVideoRenderer
;
562 TRACE("(%p, %p)\n", pUnkOuter
, ppv
);
566 pVideoRenderer
= CoTaskMemAlloc(sizeof(VideoRendererImpl
));
567 pVideoRenderer
->pUnkOuter
= pUnkOuter
;
568 pVideoRenderer
->bUnkOuterValid
= FALSE
;
569 pVideoRenderer
->bAggregatable
= FALSE
;
570 pVideoRenderer
->IInner_vtbl
= &IInner_VTable
;
572 pVideoRenderer
->lpVtbl
= &VideoRenderer_Vtbl
;
573 pVideoRenderer
->IBasicVideo_vtbl
= &IBasicVideo_VTable
;
574 pVideoRenderer
->IVideoWindow_vtbl
= &IVideoWindow_VTable
;
576 pVideoRenderer
->refCount
= 1;
577 InitializeCriticalSection(&pVideoRenderer
->csFilter
);
578 pVideoRenderer
->csFilter
.DebugInfo
->Spare
[0] = (DWORD_PTR
)(__FILE__
": VideoRendererImpl.csFilter");
579 pVideoRenderer
->state
= State_Stopped
;
580 pVideoRenderer
->pClock
= NULL
;
581 pVideoRenderer
->init
= 0;
582 pVideoRenderer
->AutoShow
= 1;
583 pVideoRenderer
->rtLastStop
= -1;
584 ZeroMemory(&pVideoRenderer
->filterInfo
, sizeof(FILTER_INFO
));
585 ZeroMemory(&pVideoRenderer
->SourceRect
, sizeof(RECT
));
586 ZeroMemory(&pVideoRenderer
->DestRect
, sizeof(RECT
));
587 ZeroMemory(&pVideoRenderer
->WindowPos
, sizeof(RECT
));
588 pVideoRenderer
->hWndMsgDrain
= NULL
;
590 /* construct input pin */
591 piInput
.dir
= PINDIR_INPUT
;
592 piInput
.pFilter
= (IBaseFilter
*)pVideoRenderer
;
593 lstrcpynW(piInput
.achName
, wcsInputPinName
, sizeof(piInput
.achName
) / sizeof(piInput
.achName
[0]));
595 hr
= InputPin_Construct(&VideoRenderer_InputPin_Vtbl
, &piInput
, VideoRenderer_Sample
, (LPVOID
)pVideoRenderer
, VideoRenderer_QueryAccept
, NULL
, &pVideoRenderer
->csFilter
, NULL
, (IPin
**)&pVideoRenderer
->pInputPin
);
599 MediaSeekingImpl_Init((IBaseFilter
*)pVideoRenderer
, VideoRendererImpl_Change
, VideoRendererImpl_Change
, VideoRendererImpl_Change
, &pVideoRenderer
->mediaSeeking
, &pVideoRenderer
->csFilter
);
600 pVideoRenderer
->mediaSeeking
.lpVtbl
= &VideoRendererImpl_Seeking_Vtbl
;
602 pVideoRenderer
->sample_held
= NULL
;
603 *ppv
= (LPVOID
)pVideoRenderer
;
607 pVideoRenderer
->csFilter
.DebugInfo
->Spare
[0] = 0;
608 DeleteCriticalSection(&pVideoRenderer
->csFilter
);
609 CoTaskMemFree(pVideoRenderer
);
612 if (!CreateRenderingSubsystem(pVideoRenderer
))
618 HRESULT
VideoRendererDefault_create(IUnknown
* pUnkOuter
, LPVOID
* ppv
)
620 /* TODO: Attempt to use the VMR-7 renderer instead when possible */
621 return VideoRenderer_create(pUnkOuter
, ppv
);
624 static HRESULT WINAPI
VideoRendererInner_QueryInterface(IUnknown
* iface
, REFIID riid
, LPVOID
* ppv
)
626 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
627 TRACE("(%p/%p)->(%s, %p)\n", This
, iface
, qzdebugstr_guid(riid
), ppv
);
629 if (This
->bAggregatable
)
630 This
->bUnkOuterValid
= TRUE
;
634 if (IsEqualIID(riid
, &IID_IUnknown
))
635 *ppv
= (LPVOID
)&(This
->IInner_vtbl
);
636 else if (IsEqualIID(riid
, &IID_IPersist
))
638 else if (IsEqualIID(riid
, &IID_IMediaFilter
))
640 else if (IsEqualIID(riid
, &IID_IBaseFilter
))
642 else if (IsEqualIID(riid
, &IID_IBasicVideo
))
643 *ppv
= (LPVOID
)&(This
->IBasicVideo_vtbl
);
644 else if (IsEqualIID(riid
, &IID_IVideoWindow
))
645 *ppv
= (LPVOID
)&(This
->IVideoWindow_vtbl
);
646 else if (IsEqualIID(riid
, &IID_IMediaSeeking
))
647 *ppv
= &This
->mediaSeeking
;
651 IUnknown_AddRef((IUnknown
*)(*ppv
));
655 if (!IsEqualIID(riid
, &IID_IPin
))
656 FIXME("No interface for %s!\n", qzdebugstr_guid(riid
));
658 return E_NOINTERFACE
;
661 static ULONG WINAPI
VideoRendererInner_AddRef(IUnknown
* iface
)
663 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
664 ULONG refCount
= InterlockedIncrement(&This
->refCount
);
666 TRACE("(%p/%p)->() AddRef from %d\n", This
, iface
, refCount
- 1);
671 static ULONG WINAPI
VideoRendererInner_Release(IUnknown
* iface
)
673 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
674 ULONG refCount
= InterlockedDecrement(&This
->refCount
);
676 TRACE("(%p/%p)->() Release from %d\n", This
, iface
, refCount
+ 1);
682 DestroyWindow(This
->hWnd
);
683 PostThreadMessageA(This
->ThreadID
, WM_QUIT
, 0, 0);
684 WaitForSingleObject(This
->hThread
, INFINITE
);
685 CloseHandle(This
->hThread
);
688 IReferenceClock_Release(This
->pClock
);
690 if (SUCCEEDED(IPin_ConnectedTo((IPin
*)This
->pInputPin
, &pConnectedTo
)))
692 IPin_Disconnect(pConnectedTo
);
693 IPin_Release(pConnectedTo
);
695 IPin_Disconnect((IPin
*)This
->pInputPin
);
697 IPin_Release((IPin
*)This
->pInputPin
);
701 This
->csFilter
.DebugInfo
->Spare
[0] = 0;
702 DeleteCriticalSection(&This
->csFilter
);
704 TRACE("Destroying Video Renderer\n");
713 static const IUnknownVtbl IInner_VTable
=
715 VideoRendererInner_QueryInterface
,
716 VideoRendererInner_AddRef
,
717 VideoRendererInner_Release
720 static HRESULT WINAPI
VideoRenderer_QueryInterface(IBaseFilter
* iface
, REFIID riid
, LPVOID
* ppv
)
722 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
724 if (This
->bAggregatable
)
725 This
->bUnkOuterValid
= TRUE
;
729 if (This
->bAggregatable
)
730 return IUnknown_QueryInterface(This
->pUnkOuter
, riid
, ppv
);
732 if (IsEqualIID(riid
, &IID_IUnknown
))
736 IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
737 hr
= IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
738 IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
739 This
->bAggregatable
= TRUE
;
744 return E_NOINTERFACE
;
747 return IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
750 static ULONG WINAPI
VideoRenderer_AddRef(IBaseFilter
* iface
)
752 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
754 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
755 return IUnknown_AddRef(This
->pUnkOuter
);
756 return IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
759 static ULONG WINAPI
VideoRenderer_Release(IBaseFilter
* iface
)
761 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
763 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
764 return IUnknown_Release(This
->pUnkOuter
);
765 return IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
768 /** IPersist methods **/
770 static HRESULT WINAPI
VideoRenderer_GetClassID(IBaseFilter
* iface
, CLSID
* pClsid
)
772 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
774 TRACE("(%p/%p)->(%p)\n", This
, iface
, pClsid
);
776 *pClsid
= CLSID_VideoRenderer
;
781 /** IMediaFilter methods **/
783 static HRESULT WINAPI
VideoRenderer_Stop(IBaseFilter
* iface
)
785 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
787 TRACE("(%p/%p)->()\n", This
, iface
);
789 EnterCriticalSection(&This
->csFilter
);
791 This
->state
= State_Stopped
;
793 if (This
->sample_held
)
795 IMediaSample_Release(This
->sample_held
);
796 This
->sample_held
= NULL
;
799 LeaveCriticalSection(&This
->csFilter
);
804 static HRESULT WINAPI
VideoRenderer_Pause(IBaseFilter
* iface
)
806 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
808 TRACE("(%p/%p)->()\n", This
, iface
);
810 EnterCriticalSection(&This
->csFilter
);
812 if (This
->state
== State_Stopped
)
813 This
->pInputPin
->end_of_stream
= 0;
815 This
->state
= State_Paused
;
817 LeaveCriticalSection(&This
->csFilter
);
822 static HRESULT WINAPI
VideoRenderer_Run(IBaseFilter
* iface
, REFERENCE_TIME tStart
)
824 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
826 TRACE("(%p/%p)->(%s)\n", This
, iface
, wine_dbgstr_longlong(tStart
));
828 EnterCriticalSection(&This
->csFilter
);
829 if (This
->state
!= State_Running
)
831 if (This
->state
== State_Stopped
)
832 This
->pInputPin
->end_of_stream
= 0;
834 This
->rtStreamStart
= tStart
;
835 This
->state
= State_Running
;
837 if (This
->sample_held
)
839 IMediaSample_Release(This
->sample_held
);
840 This
->sample_held
= NULL
;
843 LeaveCriticalSection(&This
->csFilter
);
848 static HRESULT WINAPI
VideoRenderer_GetState(IBaseFilter
* iface
, DWORD dwMilliSecsTimeout
, FILTER_STATE
*pState
)
850 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
852 TRACE("(%p/%p)->(%d, %p)\n", This
, iface
, dwMilliSecsTimeout
, pState
);
854 EnterCriticalSection(&This
->csFilter
);
856 *pState
= This
->state
;
858 LeaveCriticalSection(&This
->csFilter
);
863 static HRESULT WINAPI
VideoRenderer_SetSyncSource(IBaseFilter
* iface
, IReferenceClock
*pClock
)
865 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
867 TRACE("(%p/%p)->(%p)\n", This
, iface
, pClock
);
869 EnterCriticalSection(&This
->csFilter
);
872 IReferenceClock_Release(This
->pClock
);
873 This
->pClock
= pClock
;
875 IReferenceClock_AddRef(This
->pClock
);
877 LeaveCriticalSection(&This
->csFilter
);
882 static HRESULT WINAPI
VideoRenderer_GetSyncSource(IBaseFilter
* iface
, IReferenceClock
**ppClock
)
884 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
886 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppClock
);
888 EnterCriticalSection(&This
->csFilter
);
890 *ppClock
= This
->pClock
;
892 IReferenceClock_AddRef(This
->pClock
);
894 LeaveCriticalSection(&This
->csFilter
);
899 /** IBaseFilter implementation **/
901 static HRESULT
VideoRenderer_GetPin(IBaseFilter
*iface
, ULONG pos
, IPin
**pin
, DWORD
*lastsynctick
)
903 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
905 /* Our pins are static, not changing so setting static tick count is ok */
911 *pin
= (IPin
*)This
->pInputPin
;
916 static HRESULT WINAPI
VideoRenderer_EnumPins(IBaseFilter
* iface
, IEnumPins
**ppEnum
)
918 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
920 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppEnum
);
922 return IEnumPinsImpl_Construct(ppEnum
, VideoRenderer_GetPin
, iface
);
925 static HRESULT WINAPI
VideoRenderer_FindPin(IBaseFilter
* iface
, LPCWSTR Id
, IPin
**ppPin
)
927 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
929 TRACE("(%p/%p)->(%p,%p)\n", This
, iface
, debugstr_w(Id
), ppPin
);
931 FIXME("VideoRenderer::FindPin(...)\n");
933 /* FIXME: critical section */
938 static HRESULT WINAPI
VideoRenderer_QueryFilterInfo(IBaseFilter
* iface
, FILTER_INFO
*pInfo
)
940 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
942 TRACE("(%p/%p)->(%p)\n", This
, iface
, pInfo
);
944 strcpyW(pInfo
->achName
, This
->filterInfo
.achName
);
945 pInfo
->pGraph
= This
->filterInfo
.pGraph
;
948 IFilterGraph_AddRef(pInfo
->pGraph
);
953 static HRESULT WINAPI
VideoRenderer_JoinFilterGraph(IBaseFilter
* iface
, IFilterGraph
*pGraph
, LPCWSTR pName
)
955 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
957 TRACE("(%p/%p)->(%p, %s)\n", This
, iface
, pGraph
, debugstr_w(pName
));
959 EnterCriticalSection(&This
->csFilter
);
962 strcpyW(This
->filterInfo
.achName
, pName
);
964 *This
->filterInfo
.achName
= '\0';
965 This
->filterInfo
.pGraph
= pGraph
; /* NOTE: do NOT increase ref. count */
967 LeaveCriticalSection(&This
->csFilter
);
972 static HRESULT WINAPI
VideoRenderer_QueryVendorInfo(IBaseFilter
* iface
, LPWSTR
*pVendorInfo
)
974 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
975 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVendorInfo
);
979 static const IBaseFilterVtbl VideoRenderer_Vtbl
=
981 VideoRenderer_QueryInterface
,
982 VideoRenderer_AddRef
,
983 VideoRenderer_Release
,
984 VideoRenderer_GetClassID
,
988 VideoRenderer_GetState
,
989 VideoRenderer_SetSyncSource
,
990 VideoRenderer_GetSyncSource
,
991 VideoRenderer_EnumPins
,
992 VideoRenderer_FindPin
,
993 VideoRenderer_QueryFilterInfo
,
994 VideoRenderer_JoinFilterGraph
,
995 VideoRenderer_QueryVendorInfo
998 static HRESULT WINAPI
VideoRenderer_InputPin_EndOfStream(IPin
* iface
)
1000 InputPin
* This
= (InputPin
*)iface
;
1001 IMediaEventSink
* pEventSink
;
1004 TRACE("(%p/%p)->()\n", This
, iface
);
1006 hr
= IFilterGraph_QueryInterface(((VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
)->filterInfo
.pGraph
, &IID_IMediaEventSink
, (LPVOID
*)&pEventSink
);
1009 hr
= IMediaEventSink_Notify(pEventSink
, EC_COMPLETE
, S_OK
, 0);
1010 IMediaEventSink_Release(pEventSink
);
1016 static const IPinVtbl VideoRenderer_InputPin_Vtbl
=
1018 InputPin_QueryInterface
,
1022 InputPin_ReceiveConnection
,
1023 IPinImpl_Disconnect
,
1024 IPinImpl_ConnectedTo
,
1025 IPinImpl_ConnectionMediaType
,
1026 IPinImpl_QueryPinInfo
,
1027 IPinImpl_QueryDirection
,
1029 IPinImpl_QueryAccept
,
1030 IPinImpl_EnumMediaTypes
,
1031 IPinImpl_QueryInternalConnections
,
1032 VideoRenderer_InputPin_EndOfStream
,
1033 InputPin_BeginFlush
,
1038 /*** IUnknown methods ***/
1039 static HRESULT WINAPI
Basicvideo_QueryInterface(IBasicVideo
*iface
,
1042 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1044 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
1046 return VideoRenderer_QueryInterface((IBaseFilter
*)This
, riid
, ppvObj
);
1049 static ULONG WINAPI
Basicvideo_AddRef(IBasicVideo
*iface
) {
1050 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1052 TRACE("(%p/%p)->()\n", This
, iface
);
1054 return VideoRenderer_AddRef((IBaseFilter
*)This
);
1057 static ULONG WINAPI
Basicvideo_Release(IBasicVideo
*iface
) {
1058 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1060 TRACE("(%p/%p)->()\n", This
, iface
);
1062 return VideoRenderer_Release((IBaseFilter
*)This
);
1065 /*** IDispatch methods ***/
1066 static HRESULT WINAPI
Basicvideo_GetTypeInfoCount(IBasicVideo
*iface
,
1068 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1070 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
1075 static HRESULT WINAPI
Basicvideo_GetTypeInfo(IBasicVideo
*iface
,
1078 ITypeInfo
**ppTInfo
) {
1079 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1081 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
1086 static HRESULT WINAPI
Basicvideo_GetIDsOfNames(IBasicVideo
*iface
,
1092 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1094 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1099 static HRESULT WINAPI
Basicvideo_Invoke(IBasicVideo
*iface
,
1100 DISPID dispIdMember
,
1104 DISPPARAMS
*pDispParams
,
1106 EXCEPINFO
*pExepInfo
,
1108 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1110 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
);
1115 /*** IBasicVideo methods ***/
1116 static HRESULT WINAPI
Basicvideo_get_AvgTimePerFrame(IBasicVideo
*iface
,
1117 REFTIME
*pAvgTimePerFrame
) {
1118 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1120 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pAvgTimePerFrame
);
1125 static HRESULT WINAPI
Basicvideo_get_BitRate(IBasicVideo
*iface
,
1127 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1129 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBitRate
);
1134 static HRESULT WINAPI
Basicvideo_get_BitErrorRate(IBasicVideo
*iface
,
1135 long *pBitErrorRate
) {
1136 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1138 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBitErrorRate
);
1143 static HRESULT WINAPI
Basicvideo_get_VideoWidth(IBasicVideo
*iface
,
1144 long *pVideoWidth
) {
1145 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1147 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoWidth
);
1149 *pVideoWidth
= This
->VideoWidth
;
1154 static HRESULT WINAPI
Basicvideo_get_VideoHeight(IBasicVideo
*iface
,
1155 long *pVideoHeight
) {
1156 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1158 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoHeight
);
1160 *pVideoHeight
= This
->VideoHeight
;
1165 static HRESULT WINAPI
Basicvideo_put_SourceLeft(IBasicVideo
*iface
,
1167 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1169 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceLeft
);
1171 This
->SourceRect
.left
= SourceLeft
;
1176 static HRESULT WINAPI
Basicvideo_get_SourceLeft(IBasicVideo
*iface
,
1177 long *pSourceLeft
) {
1178 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1180 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceLeft
);
1182 *pSourceLeft
= This
->SourceRect
.left
;
1187 static HRESULT WINAPI
Basicvideo_put_SourceWidth(IBasicVideo
*iface
,
1189 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1191 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceWidth
);
1193 This
->SourceRect
.right
= This
->SourceRect
.left
+ SourceWidth
;
1198 static HRESULT WINAPI
Basicvideo_get_SourceWidth(IBasicVideo
*iface
,
1199 long *pSourceWidth
) {
1200 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1202 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceWidth
);
1204 *pSourceWidth
= This
->SourceRect
.right
- This
->SourceRect
.left
;
1209 static HRESULT WINAPI
Basicvideo_put_SourceTop(IBasicVideo
*iface
,
1211 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1213 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceTop
);
1215 This
->SourceRect
.top
= SourceTop
;
1220 static HRESULT WINAPI
Basicvideo_get_SourceTop(IBasicVideo
*iface
,
1222 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1224 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceTop
);
1226 *pSourceTop
= This
->SourceRect
.top
;
1231 static HRESULT WINAPI
Basicvideo_put_SourceHeight(IBasicVideo
*iface
,
1232 long SourceHeight
) {
1233 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1235 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceHeight
);
1237 This
->SourceRect
.bottom
= This
->SourceRect
.top
+ SourceHeight
;
1242 static HRESULT WINAPI
Basicvideo_get_SourceHeight(IBasicVideo
*iface
,
1243 long *pSourceHeight
) {
1244 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1246 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceHeight
);
1248 *pSourceHeight
= This
->SourceRect
.bottom
- This
->SourceRect
.top
;
1253 static HRESULT WINAPI
Basicvideo_put_DestinationLeft(IBasicVideo
*iface
,
1254 long DestinationLeft
) {
1255 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1257 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationLeft
);
1259 This
->DestRect
.left
= DestinationLeft
;
1264 static HRESULT WINAPI
Basicvideo_get_DestinationLeft(IBasicVideo
*iface
,
1265 long *pDestinationLeft
) {
1266 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1268 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationLeft
);
1270 *pDestinationLeft
= This
->DestRect
.left
;
1275 static HRESULT WINAPI
Basicvideo_put_DestinationWidth(IBasicVideo
*iface
,
1276 long DestinationWidth
) {
1277 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1279 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationWidth
);
1281 This
->DestRect
.right
= This
->DestRect
.left
+ DestinationWidth
;
1286 static HRESULT WINAPI
Basicvideo_get_DestinationWidth(IBasicVideo
*iface
,
1287 long *pDestinationWidth
) {
1288 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1290 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationWidth
);
1292 *pDestinationWidth
= This
->DestRect
.right
- This
->DestRect
.left
;
1297 static HRESULT WINAPI
Basicvideo_put_DestinationTop(IBasicVideo
*iface
,
1298 long DestinationTop
) {
1299 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1301 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationTop
);
1303 This
->DestRect
.top
= DestinationTop
;
1308 static HRESULT WINAPI
Basicvideo_get_DestinationTop(IBasicVideo
*iface
,
1309 long *pDestinationTop
) {
1310 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1312 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationTop
);
1314 *pDestinationTop
= This
->DestRect
.top
;
1319 static HRESULT WINAPI
Basicvideo_put_DestinationHeight(IBasicVideo
*iface
,
1320 long DestinationHeight
) {
1321 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1323 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationHeight
);
1325 This
->DestRect
.right
= This
->DestRect
.left
+ DestinationHeight
;
1330 static HRESULT WINAPI
Basicvideo_get_DestinationHeight(IBasicVideo
*iface
,
1331 long *pDestinationHeight
) {
1332 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1334 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationHeight
);
1336 *pDestinationHeight
= This
->DestRect
.right
- This
->DestRect
.left
;
1341 static HRESULT WINAPI
Basicvideo_SetSourcePosition(IBasicVideo
*iface
,
1346 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1348 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This
, iface
, Left
, Top
, Width
, Height
);
1350 This
->SourceRect
.left
= Left
;
1351 This
->SourceRect
.top
= Top
;
1352 This
->SourceRect
.right
= Left
+ Width
;
1353 This
->SourceRect
.bottom
= Top
+ Height
;
1358 static HRESULT WINAPI
Basicvideo_GetSourcePosition(IBasicVideo
*iface
,
1363 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1365 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1367 *pLeft
= This
->SourceRect
.left
;
1368 *pTop
= This
->SourceRect
.top
;
1369 *pWidth
= This
->SourceRect
.right
- This
->SourceRect
.left
;
1370 *pHeight
= This
->SourceRect
.bottom
- This
->SourceRect
.top
;
1375 static HRESULT WINAPI
Basicvideo_SetDefaultSourcePosition(IBasicVideo
*iface
) {
1376 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1378 TRACE("(%p/%p)->()\n", This
, iface
);
1380 This
->SourceRect
.left
= 0;
1381 This
->SourceRect
.top
= 0;
1382 This
->SourceRect
.right
= This
->VideoWidth
;
1383 This
->SourceRect
.bottom
= This
->VideoHeight
;
1388 static HRESULT WINAPI
Basicvideo_SetDestinationPosition(IBasicVideo
*iface
,
1393 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1395 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This
, iface
, Left
, Top
, Width
, Height
);
1397 This
->DestRect
.left
= Left
;
1398 This
->DestRect
.top
= Top
;
1399 This
->DestRect
.right
= Left
+ Width
;
1400 This
->DestRect
.bottom
= Top
+ Height
;
1405 static HRESULT WINAPI
Basicvideo_GetDestinationPosition(IBasicVideo
*iface
,
1410 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1412 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1414 *pLeft
= This
->DestRect
.left
;
1415 *pTop
= This
->DestRect
.top
;
1416 *pWidth
= This
->DestRect
.right
- This
->DestRect
.left
;
1417 *pHeight
= This
->DestRect
.bottom
- This
->DestRect
.top
;
1422 static HRESULT WINAPI
Basicvideo_SetDefaultDestinationPosition(IBasicVideo
*iface
) {
1423 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1426 TRACE("(%p/%p)->()\n", This
, iface
);
1428 if (!GetClientRect(This
->hWnd
, &rect
))
1431 This
->SourceRect
.left
= 0;
1432 This
->SourceRect
.top
= 0;
1433 This
->SourceRect
.right
= rect
.right
;
1434 This
->SourceRect
.bottom
= rect
.bottom
;
1439 static HRESULT WINAPI
Basicvideo_GetVideoSize(IBasicVideo
*iface
,
1442 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1444 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pWidth
, pHeight
);
1446 *pWidth
= This
->VideoWidth
;
1447 *pHeight
= This
->VideoHeight
;
1452 static HRESULT WINAPI
Basicvideo_GetVideoPaletteEntries(IBasicVideo
*iface
,
1457 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1459 FIXME("(%p/%p)->(%ld, %ld, %p, %p): stub !!!\n", This
, iface
, StartIndex
, Entries
, pRetrieved
, pPalette
);
1464 static HRESULT WINAPI
Basicvideo_GetCurrentImage(IBasicVideo
*iface
,
1467 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1468 BITMAPINFOHEADER
*bmiHeader
;
1470 AM_MEDIA_TYPE
*amt
= &This
->pInputPin
->pin
.mtCurrent
;
1473 EnterCriticalSection(&This
->csFilter
);
1475 if (!This
->sample_held
)
1477 LeaveCriticalSection(&This
->csFilter
);
1478 return (This
->state
== State_Paused
? E_UNEXPECTED
: VFW_E_NOT_PAUSED
);
1481 FIXME("(%p/%p)->(%p, %p): partial stub\n", This
, iface
, pBufferSize
, pDIBImage
);
1483 if (IsEqualIID(&amt
->formattype
, &FORMAT_VideoInfo
))
1485 bmiHeader
= &((VIDEOINFOHEADER
*)amt
->pbFormat
)->bmiHeader
;
1487 else if (IsEqualIID(&amt
->formattype
, &FORMAT_VideoInfo2
))
1489 bmiHeader
= &((VIDEOINFOHEADER2
*)amt
->pbFormat
)->bmiHeader
;
1493 FIXME("Unknown type %s\n", debugstr_guid(&amt
->subtype
));
1494 LeaveCriticalSection(&This
->csFilter
);
1495 return VFW_E_RUNTIME_ERROR
;
1498 needed_size
= bmiHeader
->biSize
;
1499 needed_size
+= IMediaSample_GetActualDataLength(This
->sample_held
);
1503 *pBufferSize
= needed_size
;
1504 LeaveCriticalSection(&This
->csFilter
);
1508 if (needed_size
< *pBufferSize
)
1510 ERR("Buffer too small %u/%lu\n", needed_size
, *pBufferSize
);
1511 LeaveCriticalSection(&This
->csFilter
);
1514 *pBufferSize
= needed_size
;
1516 memcpy(pDIBImage
, bmiHeader
, bmiHeader
->biSize
);
1517 IMediaSample_GetPointer(This
->sample_held
, (BYTE
**)&ptr
);
1518 memcpy((char *)pDIBImage
+ bmiHeader
->biSize
, ptr
, IMediaSample_GetActualDataLength(This
->sample_held
));
1520 LeaveCriticalSection(&This
->csFilter
);
1525 static HRESULT WINAPI
Basicvideo_IsUsingDefaultSource(IBasicVideo
*iface
) {
1526 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1528 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
1533 static HRESULT WINAPI
Basicvideo_IsUsingDefaultDestination(IBasicVideo
*iface
) {
1534 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1536 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
1542 static const IBasicVideoVtbl IBasicVideo_VTable
=
1544 Basicvideo_QueryInterface
,
1547 Basicvideo_GetTypeInfoCount
,
1548 Basicvideo_GetTypeInfo
,
1549 Basicvideo_GetIDsOfNames
,
1551 Basicvideo_get_AvgTimePerFrame
,
1552 Basicvideo_get_BitRate
,
1553 Basicvideo_get_BitErrorRate
,
1554 Basicvideo_get_VideoWidth
,
1555 Basicvideo_get_VideoHeight
,
1556 Basicvideo_put_SourceLeft
,
1557 Basicvideo_get_SourceLeft
,
1558 Basicvideo_put_SourceWidth
,
1559 Basicvideo_get_SourceWidth
,
1560 Basicvideo_put_SourceTop
,
1561 Basicvideo_get_SourceTop
,
1562 Basicvideo_put_SourceHeight
,
1563 Basicvideo_get_SourceHeight
,
1564 Basicvideo_put_DestinationLeft
,
1565 Basicvideo_get_DestinationLeft
,
1566 Basicvideo_put_DestinationWidth
,
1567 Basicvideo_get_DestinationWidth
,
1568 Basicvideo_put_DestinationTop
,
1569 Basicvideo_get_DestinationTop
,
1570 Basicvideo_put_DestinationHeight
,
1571 Basicvideo_get_DestinationHeight
,
1572 Basicvideo_SetSourcePosition
,
1573 Basicvideo_GetSourcePosition
,
1574 Basicvideo_SetDefaultSourcePosition
,
1575 Basicvideo_SetDestinationPosition
,
1576 Basicvideo_GetDestinationPosition
,
1577 Basicvideo_SetDefaultDestinationPosition
,
1578 Basicvideo_GetVideoSize
,
1579 Basicvideo_GetVideoPaletteEntries
,
1580 Basicvideo_GetCurrentImage
,
1581 Basicvideo_IsUsingDefaultSource
,
1582 Basicvideo_IsUsingDefaultDestination
1586 /*** IUnknown methods ***/
1587 static HRESULT WINAPI
Videowindow_QueryInterface(IVideoWindow
*iface
,
1590 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1592 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
1594 return VideoRenderer_QueryInterface((IBaseFilter
*)This
, riid
, ppvObj
);
1597 static ULONG WINAPI
Videowindow_AddRef(IVideoWindow
*iface
) {
1598 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1600 TRACE("(%p/%p)->()\n", This
, iface
);
1602 return VideoRenderer_AddRef((IBaseFilter
*)This
);
1605 static ULONG WINAPI
Videowindow_Release(IVideoWindow
*iface
) {
1606 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1608 TRACE("(%p/%p)->()\n", This
, iface
);
1610 return VideoRenderer_Release((IBaseFilter
*)This
);
1613 /*** IDispatch methods ***/
1614 static HRESULT WINAPI
Videowindow_GetTypeInfoCount(IVideoWindow
*iface
,
1616 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1618 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
1623 static HRESULT WINAPI
Videowindow_GetTypeInfo(IVideoWindow
*iface
,
1626 ITypeInfo
**ppTInfo
) {
1627 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1629 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
1634 static HRESULT WINAPI
Videowindow_GetIDsOfNames(IVideoWindow
*iface
,
1640 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1642 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1647 static HRESULT WINAPI
Videowindow_Invoke(IVideoWindow
*iface
,
1648 DISPID dispIdMember
,
1652 DISPPARAMS
*pDispParams
,
1654 EXCEPINFO
*pExepInfo
,
1656 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1658 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
);
1663 /*** IVideoWindow methods ***/
1664 static HRESULT WINAPI
Videowindow_put_Caption(IVideoWindow
*iface
,
1666 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1668 TRACE("(%p/%p)->(%s (%p))\n", This
, iface
, debugstr_w(strCaption
), strCaption
);
1670 if (!SetWindowTextW(This
->hWnd
, strCaption
))
1676 static HRESULT WINAPI
Videowindow_get_Caption(IVideoWindow
*iface
,
1678 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1680 TRACE("(%p/%p)->(%p)\n", This
, iface
, strCaption
);
1682 GetWindowTextW(This
->hWnd
, (LPWSTR
)strCaption
, 100);
1687 static HRESULT WINAPI
Videowindow_put_WindowStyle(IVideoWindow
*iface
,
1689 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1692 old
= GetWindowLongA(This
->hWnd
, GWL_STYLE
);
1694 TRACE("(%p/%p)->(%x -> %lx)\n", This
, iface
, old
, WindowStyle
);
1696 if (WindowStyle
& (WS_DISABLED
|WS_HSCROLL
|WS_ICONIC
|WS_MAXIMIZE
|WS_MINIMIZE
|WS_VSCROLL
))
1697 return E_INVALIDARG
;
1699 SetWindowLongA(This
->hWnd
, GWL_STYLE
, WindowStyle
);
1704 static HRESULT WINAPI
Videowindow_get_WindowStyle(IVideoWindow
*iface
,
1705 long *WindowStyle
) {
1706 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1708 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyle
);
1710 *WindowStyle
= GetWindowLongA(This
->hWnd
, GWL_STYLE
);
1715 static HRESULT WINAPI
Videowindow_put_WindowStyleEx(IVideoWindow
*iface
,
1716 long WindowStyleEx
) {
1717 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1719 TRACE("(%p/%p)->(%ld)\n", This
, iface
, WindowStyleEx
);
1721 if (WindowStyleEx
& (WS_DISABLED
|WS_HSCROLL
|WS_ICONIC
|WS_MAXIMIZE
|WS_MINIMIZE
|WS_VSCROLL
))
1722 return E_INVALIDARG
;
1724 if (!SetWindowLongA(This
->hWnd
, GWL_EXSTYLE
, WindowStyleEx
))
1730 static HRESULT WINAPI
Videowindow_get_WindowStyleEx(IVideoWindow
*iface
,
1731 long *WindowStyleEx
) {
1732 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1734 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyleEx
);
1736 *WindowStyleEx
= GetWindowLongA(This
->hWnd
, GWL_EXSTYLE
);
1741 static HRESULT WINAPI
Videowindow_put_AutoShow(IVideoWindow
*iface
,
1743 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1745 TRACE("(%p/%p)->(%ld)\n", This
, iface
, AutoShow
);
1747 This
->AutoShow
= 1; /* FXIME: Should be AutoShow */;
1752 static HRESULT WINAPI
Videowindow_get_AutoShow(IVideoWindow
*iface
,
1754 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1756 TRACE("(%p/%p)->(%p)\n", This
, iface
, AutoShow
);
1758 *AutoShow
= This
->AutoShow
;
1763 static HRESULT WINAPI
Videowindow_put_WindowState(IVideoWindow
*iface
,
1765 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1767 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, WindowState
);
1772 static HRESULT WINAPI
Videowindow_get_WindowState(IVideoWindow
*iface
,
1773 long *WindowState
) {
1774 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1776 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, WindowState
);
1781 static HRESULT WINAPI
Videowindow_put_BackgroundPalette(IVideoWindow
*iface
,
1782 long BackgroundPalette
) {
1783 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1785 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, BackgroundPalette
);
1790 static HRESULT WINAPI
Videowindow_get_BackgroundPalette(IVideoWindow
*iface
,
1791 long *pBackgroundPalette
) {
1792 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1794 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBackgroundPalette
);
1799 static HRESULT WINAPI
Videowindow_put_Visible(IVideoWindow
*iface
,
1801 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1803 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Visible
);
1805 ShowWindow(This
->hWnd
, Visible
? SW_SHOW
: SW_HIDE
);
1810 static HRESULT WINAPI
Videowindow_get_Visible(IVideoWindow
*iface
,
1812 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1814 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVisible
);
1816 *pVisible
= IsWindowVisible(This
->hWnd
);
1821 static HRESULT WINAPI
Videowindow_put_Left(IVideoWindow
*iface
,
1823 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1825 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Left
);
1827 if (!SetWindowPos(This
->hWnd
, NULL
, Left
, This
->WindowPos
.top
, 0, 0, SWP_NOZORDER
|SWP_NOSIZE
))
1830 This
->WindowPos
.left
= Left
;
1835 static HRESULT WINAPI
Videowindow_get_Left(IVideoWindow
*iface
,
1837 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1839 TRACE("(%p/%p)->(%p)\n", This
, iface
, pLeft
);
1841 *pLeft
= This
->WindowPos
.left
;
1846 static HRESULT WINAPI
Videowindow_put_Width(IVideoWindow
*iface
,
1848 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1850 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Width
);
1852 if (!SetWindowPos(This
->hWnd
, NULL
, 0, 0, Width
, This
->WindowPos
.bottom
-This
->WindowPos
.top
, SWP_NOZORDER
|SWP_NOMOVE
))
1855 This
->WindowPos
.right
= This
->WindowPos
.left
+ Width
;
1860 static HRESULT WINAPI
Videowindow_get_Width(IVideoWindow
*iface
,
1862 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1864 TRACE("(%p/%p)->(%p)\n", This
, iface
, pWidth
);
1866 *pWidth
= This
->WindowPos
.right
- This
->WindowPos
.left
;
1871 static HRESULT WINAPI
Videowindow_put_Top(IVideoWindow
*iface
,
1873 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1875 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Top
);
1877 if (!SetWindowPos(This
->hWnd
, NULL
, This
->WindowPos
.left
, Top
, 0, 0, SWP_NOZORDER
|SWP_NOSIZE
))
1880 This
->WindowPos
.top
= Top
;
1885 static HRESULT WINAPI
Videowindow_get_Top(IVideoWindow
*iface
,
1887 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1889 TRACE("(%p/%p)->(%p)\n", This
, iface
, pTop
);
1891 *pTop
= This
->WindowPos
.top
;
1896 static HRESULT WINAPI
Videowindow_put_Height(IVideoWindow
*iface
,
1898 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1900 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Height
);
1902 if (!SetWindowPos(This
->hWnd
, NULL
, 0, 0, This
->WindowPos
.right
-This
->WindowPos
.left
, Height
, SWP_NOZORDER
|SWP_NOMOVE
))
1905 This
->WindowPos
.bottom
= This
->WindowPos
.top
+ Height
;
1910 static HRESULT WINAPI
Videowindow_get_Height(IVideoWindow
*iface
,
1912 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1914 TRACE("(%p/%p)->(%p)\n", This
, iface
, pHeight
);
1916 *pHeight
= This
->WindowPos
.bottom
- This
->WindowPos
.top
;
1921 static HRESULT WINAPI
Videowindow_put_Owner(IVideoWindow
*iface
,
1923 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1925 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Owner
);
1927 SetParent(This
->hWnd
, (HWND
)Owner
);
1932 static HRESULT WINAPI
Videowindow_get_Owner(IVideoWindow
*iface
,
1934 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1936 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Owner
);
1938 *(HWND
*)Owner
= GetParent(This
->hWnd
);
1943 static HRESULT WINAPI
Videowindow_put_MessageDrain(IVideoWindow
*iface
,
1945 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1947 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Drain
);
1949 This
->hWndMsgDrain
= (HWND
)Drain
;
1954 static HRESULT WINAPI
Videowindow_get_MessageDrain(IVideoWindow
*iface
,
1956 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1958 TRACE("(%p/%p)->(%p)\n", This
, iface
, Drain
);
1960 *Drain
= (OAHWND
)This
->hWndMsgDrain
;
1965 static HRESULT WINAPI
Videowindow_get_BorderColor(IVideoWindow
*iface
,
1967 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1969 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, Color
);
1974 static HRESULT WINAPI
Videowindow_put_BorderColor(IVideoWindow
*iface
,
1976 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1978 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, Color
);
1983 static HRESULT WINAPI
Videowindow_get_FullScreenMode(IVideoWindow
*iface
,
1984 long *FullScreenMode
) {
1985 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1987 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, FullScreenMode
);
1992 static HRESULT WINAPI
Videowindow_put_FullScreenMode(IVideoWindow
*iface
,
1993 long FullScreenMode
) {
1994 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1996 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, FullScreenMode
);
2001 static HRESULT WINAPI
Videowindow_SetWindowForeground(IVideoWindow
*iface
,
2003 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2008 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Focus
);
2010 if ((Focus
!= FALSE
) && (Focus
!= TRUE
))
2011 return E_INVALIDARG
;
2013 hr
= IPin_ConnectedTo((IPin
*)This
->pInputPin
, &pPin
);
2014 if ((hr
!= S_OK
) || !pPin
)
2015 return VFW_E_NOT_CONNECTED
;
2018 ret
= SetForegroundWindow(This
->hWnd
);
2020 ret
= SetWindowPos(This
->hWnd
, HWND_TOP
, 0, 0, 0, 0, SWP_NOMOVE
|SWP_NOSIZE
);
2028 static HRESULT WINAPI
Videowindow_NotifyOwnerMessage(IVideoWindow
*iface
,
2033 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2035 TRACE("(%p/%p)->(%08x, %ld, %08lx, %08lx)\n", This
, iface
, (DWORD
) hwnd
, uMsg
, wParam
, lParam
);
2037 if (!PostMessageA(This
->hWnd
, uMsg
, wParam
, lParam
))
2043 static HRESULT WINAPI
Videowindow_SetWindowPosition(IVideoWindow
*iface
,
2048 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2050 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This
, iface
, Left
, Top
, Width
, Height
);
2052 if (!SetWindowPos(This
->hWnd
, NULL
, Left
, Top
, Width
, Height
, SWP_NOZORDER
))
2055 This
->WindowPos
.left
= Left
;
2056 This
->WindowPos
.top
= Top
;
2057 This
->WindowPos
.right
= Left
+ Width
;
2058 This
->WindowPos
.bottom
= Top
+ Height
;
2063 static HRESULT WINAPI
Videowindow_GetWindowPosition(IVideoWindow
*iface
,
2068 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2070 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
2072 *pLeft
= This
->WindowPos
.left
;
2073 *pTop
= This
->WindowPos
.top
;
2074 *pWidth
= This
->WindowPos
.right
- This
->WindowPos
.left
;
2075 *pHeight
= This
->WindowPos
.bottom
- This
->WindowPos
.top
;
2080 static HRESULT WINAPI
Videowindow_GetMinIdealImageSize(IVideoWindow
*iface
,
2083 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2085 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This
, iface
, pWidth
, pHeight
);
2087 *pWidth
= This
->VideoWidth
;
2088 *pHeight
= This
->VideoHeight
;
2093 static HRESULT WINAPI
Videowindow_GetMaxIdealImageSize(IVideoWindow
*iface
,
2096 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2098 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This
, iface
, pWidth
, pHeight
);
2100 *pWidth
= This
->VideoWidth
;
2101 *pHeight
= This
->VideoHeight
;
2106 static HRESULT WINAPI
Videowindow_GetRestorePosition(IVideoWindow
*iface
,
2111 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2113 FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
2118 static HRESULT WINAPI
Videowindow_HideCursor(IVideoWindow
*iface
,
2120 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2122 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, HideCursor
);
2127 static HRESULT WINAPI
Videowindow_IsCursorHidden(IVideoWindow
*iface
,
2128 long *CursorHidden
) {
2129 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2131 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, CursorHidden
);
2136 static const IVideoWindowVtbl IVideoWindow_VTable
=
2138 Videowindow_QueryInterface
,
2140 Videowindow_Release
,
2141 Videowindow_GetTypeInfoCount
,
2142 Videowindow_GetTypeInfo
,
2143 Videowindow_GetIDsOfNames
,
2145 Videowindow_put_Caption
,
2146 Videowindow_get_Caption
,
2147 Videowindow_put_WindowStyle
,
2148 Videowindow_get_WindowStyle
,
2149 Videowindow_put_WindowStyleEx
,
2150 Videowindow_get_WindowStyleEx
,
2151 Videowindow_put_AutoShow
,
2152 Videowindow_get_AutoShow
,
2153 Videowindow_put_WindowState
,
2154 Videowindow_get_WindowState
,
2155 Videowindow_put_BackgroundPalette
,
2156 Videowindow_get_BackgroundPalette
,
2157 Videowindow_put_Visible
,
2158 Videowindow_get_Visible
,
2159 Videowindow_put_Left
,
2160 Videowindow_get_Left
,
2161 Videowindow_put_Width
,
2162 Videowindow_get_Width
,
2163 Videowindow_put_Top
,
2164 Videowindow_get_Top
,
2165 Videowindow_put_Height
,
2166 Videowindow_get_Height
,
2167 Videowindow_put_Owner
,
2168 Videowindow_get_Owner
,
2169 Videowindow_put_MessageDrain
,
2170 Videowindow_get_MessageDrain
,
2171 Videowindow_get_BorderColor
,
2172 Videowindow_put_BorderColor
,
2173 Videowindow_get_FullScreenMode
,
2174 Videowindow_put_FullScreenMode
,
2175 Videowindow_SetWindowForeground
,
2176 Videowindow_NotifyOwnerMessage
,
2177 Videowindow_SetWindowPosition
,
2178 Videowindow_GetWindowPosition
,
2179 Videowindow_GetMinIdealImageSize
,
2180 Videowindow_GetMaxIdealImageSize
,
2181 Videowindow_GetRestorePosition
,
2182 Videowindow_HideCursor
,
2183 Videowindow_IsCursorHidden