2 * Video Renderer (Fullscreen and Windowed using Direct Draw)
4 * Copyright 2004 Christian Costa
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #define NONAMELESSSTRUCT
24 #define NONAMELESSUNION
25 #include "quartz_private.h"
26 #include "control_private.h"
41 #include "wine/unicode.h"
42 #include "wine/debug.h"
44 WINE_DEFAULT_DEBUG_CHANNEL(quartz
);
46 static BOOL wnd_class_registered
= FALSE
;
48 static const WCHAR wcsInputPinName
[] = {'i','n','p','u','t',' ','p','i','n',0};
50 static const IBaseFilterVtbl VideoRenderer_Vtbl
;
51 static const IUnknownVtbl IInner_VTable
;
52 static const IBasicVideoVtbl IBasicVideo_VTable
;
53 static const IVideoWindowVtbl IVideoWindow_VTable
;
54 static const IPinVtbl VideoRenderer_InputPin_Vtbl
;
56 typedef struct VideoRendererImpl
58 const IBaseFilterVtbl
* lpVtbl
;
59 const IBasicVideoVtbl
* IBasicVideo_vtbl
;
60 const IVideoWindowVtbl
* IVideoWindow_vtbl
;
61 const IUnknownVtbl
* IInner_vtbl
;
64 CRITICAL_SECTION csFilter
;
66 REFERENCE_TIME rtStreamStart
;
67 IReferenceClock
* pClock
;
68 FILTER_INFO filterInfo
;
90 REFERENCE_TIME rtLastStop
;
91 MediaSeekingImpl mediaSeeking
;
93 /* During pause we can hold a single sample, for use in GetCurrentImage */
94 IMediaSample
*sample_held
;
97 static LRESULT CALLBACK
VideoWndProcA(HWND hwnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
99 VideoRendererImpl
* pVideoRenderer
= (VideoRendererImpl
*)GetWindowLongA(hwnd
, 0);
100 LPRECT lprect
= (LPRECT
)lParam
;
102 if (pVideoRenderer
&& pVideoRenderer
->hWndMsgDrain
)
108 case WM_LBUTTONDBLCLK
:
111 case WM_MBUTTONDBLCLK
:
114 case WM_MOUSEACTIVATE
:
116 case WM_NCLBUTTONDBLCLK
:
117 case WM_NCLBUTTONDOWN
:
119 case WM_NCMBUTTONDBLCLK
:
120 case WM_NCMBUTTONDOWN
:
123 case WM_NCRBUTTONDBLCLK
:
124 case WM_NCRBUTTONDOWN
:
126 case WM_RBUTTONDBLCLK
:
129 PostMessageA(pVideoRenderer
->hWndMsgDrain
, uMsg
, wParam
, lParam
);
139 /* TRACE("WM_SIZING %d %d %d %d\n", lprect->left, lprect->top, lprect->right, lprect->bottom); */
140 SetWindowPos(hwnd
, NULL
, lprect
->left
, lprect
->top
, lprect
->right
- lprect
->left
, lprect
->bottom
- lprect
->top
, SWP_NOZORDER
);
141 GetClientRect(hwnd
, &pVideoRenderer
->DestRect
);
142 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
143 pVideoRenderer
->DestRect
.left
,
144 pVideoRenderer
->DestRect
.top
,
145 pVideoRenderer
->DestRect
.right
- pVideoRenderer
->DestRect
.left
,
146 pVideoRenderer
->DestRect
.bottom
- pVideoRenderer
->DestRect
.top
);
149 TRACE("WM_SIZE %d %d\n", LOWORD(lParam
), HIWORD(lParam
));
150 GetClientRect(hwnd
, &pVideoRenderer
->DestRect
);
151 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
152 pVideoRenderer
->DestRect
.left
,
153 pVideoRenderer
->DestRect
.top
,
154 pVideoRenderer
->DestRect
.right
- pVideoRenderer
->DestRect
.left
,
155 pVideoRenderer
->DestRect
.bottom
- pVideoRenderer
->DestRect
.top
);
158 return DefWindowProcA(hwnd
, uMsg
, wParam
, lParam
);
163 static BOOL
CreateRenderingWindow(VideoRendererImpl
* This
)
167 TRACE("(%p)->()\n", This
);
170 winclass
.lpfnWndProc
= VideoWndProcA
;
171 winclass
.cbClsExtra
= 0;
172 winclass
.cbWndExtra
= sizeof(VideoRendererImpl
*);
173 winclass
.hInstance
= NULL
;
174 winclass
.hIcon
= NULL
;
175 winclass
.hCursor
= NULL
;
176 winclass
.hbrBackground
= GetStockObject(BLACK_BRUSH
);
177 winclass
.lpszMenuName
= NULL
;
178 winclass
.lpszClassName
= "Wine ActiveMovie Class";
180 if (!wnd_class_registered
)
182 if (!RegisterClassA(&winclass
))
184 ERR("Unable to register window %u\n", GetLastError());
187 wnd_class_registered
= TRUE
;
190 This
->hWnd
= CreateWindowExA(0, "Wine ActiveMovie Class", "Wine ActiveMovie Window", WS_SIZEBOX
,
191 CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
, NULL
,
196 ERR("Unable to create window\n");
200 SetWindowLongA(This
->hWnd
, 0, (LONG
)This
);
205 static DWORD WINAPI
MessageLoop(LPVOID lpParameter
)
207 VideoRendererImpl
* This
= (VideoRendererImpl
*) lpParameter
;
211 TRACE("Starting message loop\n");
213 if (!CreateRenderingWindow(This
))
215 This
->ThreadResult
= FALSE
;
216 SetEvent(This
->hEvent
);
220 This
->ThreadResult
= TRUE
;
221 SetEvent(This
->hEvent
);
223 while ((fGotMessage
= GetMessageA(&msg
, NULL
, 0, 0)) != 0 && fGotMessage
!= -1)
225 TranslateMessage(&msg
);
226 DispatchMessageA(&msg
);
229 TRACE("End of message loop\n");
234 static BOOL
CreateRenderingSubsystem(VideoRendererImpl
* This
)
236 This
->hEvent
= CreateEventW(NULL
, TRUE
, FALSE
, NULL
);
240 This
->hThread
= CreateThread(NULL
, 0, MessageLoop
, (LPVOID
)This
, 0, &This
->ThreadID
);
243 CloseHandle(This
->hEvent
);
247 WaitForSingleObject(This
->hEvent
, INFINITE
);
249 if (!This
->ThreadResult
)
251 CloseHandle(This
->hEvent
);
252 CloseHandle(This
->hThread
);
259 static const IMemInputPinVtbl MemInputPin_Vtbl
=
261 MemInputPin_QueryInterface
,
264 MemInputPin_GetAllocator
,
265 MemInputPin_NotifyAllocator
,
266 MemInputPin_GetAllocatorRequirements
,
268 MemInputPin_ReceiveMultiple
,
269 MemInputPin_ReceiveCanBlock
272 static DWORD
VideoRenderer_SendSampleData(VideoRendererImpl
* This
, LPBYTE data
, DWORD size
)
279 LPBYTE palette
= NULL
;
281 BITMAPINFOHEADER
*bmiHeader
;
283 TRACE("%p %p %d\n", This
, data
, size
);
285 sdesc
.dwSize
= sizeof(sdesc
);
286 hr
= IPin_ConnectionMediaType((IPin
*)This
->pInputPin
, &amt
);
288 ERR("Unable to retrieve media type\n");
292 if (IsEqualIID(&amt
.formattype
, &FORMAT_VideoInfo
))
294 bmiHeader
= &((VIDEOINFOHEADER
*)amt
.pbFormat
)->bmiHeader
;
296 else if (IsEqualIID(&amt
.formattype
, &FORMAT_VideoInfo2
))
298 bmiHeader
= &((VIDEOINFOHEADER2
*)amt
.pbFormat
)->bmiHeader
;
302 FIXME("Unknown type %s\n", debugstr_guid(&amt
.subtype
));
303 return VFW_E_RUNTIME_ERROR
;
307 TRACE("biSize = %d\n", bmiHeader
->biSize
);
308 TRACE("biWidth = %d\n", bmiHeader
->biWidth
);
309 TRACE("biHeight = %d\n", bmiHeader
->biHeight
);
310 TRACE("biPlanes = %d\n", bmiHeader
->biPlanes
);
311 TRACE("biBitCount = %d\n", bmiHeader
->biBitCount
);
312 TRACE("biCompression = %s\n", debugstr_an((LPSTR
)&(bmiHeader
->biCompression
), 4));
313 TRACE("biSizeImage = %d\n", bmiHeader
->biSizeImage
);
315 width
= bmiHeader
->biWidth
;
316 height
= bmiHeader
->biHeight
;
317 palette
= ((LPBYTE
)bmiHeader
) + bmiHeader
->biSize
;
321 if (!This
->WindowPos
.right
|| !This
->WindowPos
.bottom
)
322 This
->WindowPos
= This
->SourceRect
;
324 TRACE("WindowPos: %d %d %d %d\n", This
->WindowPos
.left
, This
->WindowPos
.top
, This
->WindowPos
.right
, This
->WindowPos
.bottom
);
325 SetWindowPos(This
->hWnd
, NULL
,
326 This
->WindowPos
.left
,
328 This
->WindowPos
.right
- This
->WindowPos
.left
,
329 This
->WindowPos
.bottom
- This
->WindowPos
.top
,
330 SWP_NOZORDER
|SWP_NOMOVE
);
332 GetClientRect(This
->hWnd
, &This
->DestRect
);
336 hDC
= GetDC(This
->hWnd
);
339 ERR("Cannot get DC from window!\n");
343 TRACE("Src Rect: %d %d %d %d\n", This
->SourceRect
.left
, This
->SourceRect
.top
, This
->SourceRect
.right
, This
->SourceRect
.bottom
);
344 TRACE("Dst Rect: %d %d %d %d\n", This
->DestRect
.left
, This
->DestRect
.top
, This
->DestRect
.right
, This
->DestRect
.bottom
);
346 StretchDIBits(hDC
, This
->DestRect
.left
, This
->DestRect
.top
, This
->DestRect
.right
-This
->DestRect
.left
,
347 This
->DestRect
.bottom
- This
->DestRect
.top
, This
->SourceRect
.left
, This
->SourceRect
.top
,
348 This
->SourceRect
.right
- This
->SourceRect
.left
, This
->SourceRect
.bottom
- This
->SourceRect
.top
,
349 data
, (BITMAPINFO
*)bmiHeader
, DIB_RGB_COLORS
, SRCCOPY
);
351 ReleaseDC(This
->hWnd
, hDC
);
353 ShowWindow(This
->hWnd
, SW_SHOW
);
358 static HRESULT
VideoRenderer_Sample(LPVOID iface
, IMediaSample
* pSample
)
360 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
361 LPBYTE pbSrcStream
= NULL
;
362 long cbSrcStream
= 0;
363 REFERENCE_TIME tStart
, tStop
;
366 if (This
->state
== State_Stopped
)
367 return VFW_E_WRONG_STATE
;
369 TRACE("%p %p\n", iface
, pSample
);
371 hr
= IMediaSample_GetTime(pSample
, &tStart
, &tStop
);
373 ERR("Cannot get sample time (%x)\n", hr
);
375 if (This
->rtLastStop
!= tStart
)
377 if (IMediaSample_IsDiscontinuity(pSample
) == S_FALSE
)
378 ERR("Unexpected discontinuity: Last: %u.%03u, tStart: %u.%03u\n",
379 (DWORD
)(This
->rtLastStop
/ 10000000),
380 (DWORD
)((This
->rtLastStop
/ 10000)%1000),
381 (DWORD
)(tStart
/ 10000000), (DWORD
)((tStart
/ 10000)%1000));
382 This
->rtLastStop
= tStart
;
385 /* Preroll means the sample isn't shown, this is used for key frames and things like that */
386 if (IMediaSample_IsPreroll(pSample
) == S_OK
)
388 This
->rtLastStop
= tStop
;
392 hr
= IMediaSample_GetPointer(pSample
, &pbSrcStream
);
395 ERR("Cannot get pointer to sample data (%x)\n", hr
);
399 cbSrcStream
= IMediaSample_GetActualDataLength(pSample
);
401 TRACE("val %p %ld\n", pbSrcStream
, cbSrcStream
);
403 #if 0 /* For debugging purpose */
406 for(i
= 0; i
< cbSrcStream
; i
++)
408 if ((i
!=0) && !(i
%16))
410 TRACE("%02x ", pbSrcStream
[i
]);
416 SetEvent(This
->hEvent
);
417 if (This
->state
== State_Paused
)
419 This
->sample_held
= pSample
;
420 LeaveCriticalSection(&This
->csFilter
);
421 WaitForSingleObject(This
->blocked
, INFINITE
);
422 EnterCriticalSection(&This
->csFilter
);
423 This
->sample_held
= NULL
;
424 if (This
->state
== State_Paused
)
427 if (This
->state
== State_Stopped
)
428 return VFW_E_WRONG_STATE
;
431 if (This
->pClock
&& This
->state
== State_Running
)
433 REFERENCE_TIME time
, trefstart
, trefstop
;
436 /* Perhaps I <SHOULD> use the reference clock AdviseTime function here
437 * I'm not going to! When I tried, it seemed to generate lag and
438 * it caused instability.
440 IReferenceClock_GetTime(This
->pClock
, &time
);
442 trefstart
= This
->rtStreamStart
;
443 trefstop
= (REFERENCE_TIME
)((double)(tStop
- tStart
) / This
->pInputPin
->dRate
) + This
->rtStreamStart
;
444 delta
= (LONG
)((trefstart
-time
)/10000);
445 This
->rtStreamStart
= trefstop
;
446 This
->rtLastStop
= tStop
;
450 TRACE("Sleeping for %u ms\n", delta
);
453 else if (time
> trefstop
)
455 TRACE("Dropping sample: Time: %u.%03u ms trefstop: %u.%03u ms!\n",
456 (DWORD
)(time
/ 10000000), (DWORD
)((time
/ 10000)%1000),
457 (DWORD
)(trefstop
/ 10000000), (DWORD
)((trefstop
/ 10000)%1000) );
458 This
->rtLastStop
= tStop
;
462 This
->rtLastStop
= tStop
;
464 VideoRenderer_SendSampleData(This
, pbSrcStream
, cbSrcStream
);
469 static HRESULT
VideoRenderer_QueryAccept(LPVOID iface
, const AM_MEDIA_TYPE
* pmt
)
471 if (!IsEqualIID(&pmt
->majortype
, &MEDIATYPE_Video
))
474 if (IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB32
) ||
475 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB24
) ||
476 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB565
) ||
477 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB8
))
479 VideoRendererImpl
* This
= (VideoRendererImpl
*) iface
;
481 if (IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo
))
483 VIDEOINFOHEADER
*format
= (VIDEOINFOHEADER
*)pmt
->pbFormat
;
484 This
->SourceRect
.left
= 0;
485 This
->SourceRect
.top
= 0;
486 This
->SourceRect
.right
= This
->VideoWidth
= format
->bmiHeader
.biWidth
;
487 This
->SourceRect
.bottom
= This
->VideoHeight
= format
->bmiHeader
.biHeight
;
489 else if (IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo2
))
491 VIDEOINFOHEADER2
*format2
= (VIDEOINFOHEADER2
*)pmt
->pbFormat
;
493 This
->SourceRect
.left
= 0;
494 This
->SourceRect
.top
= 0;
495 This
->SourceRect
.right
= This
->VideoWidth
= format2
->bmiHeader
.biWidth
;
496 This
->SourceRect
.bottom
= This
->VideoHeight
= format2
->bmiHeader
.biHeight
;
500 WARN("Format type %s not supported\n", debugstr_guid(&pmt
->formattype
));
508 static inline VideoRendererImpl
*impl_from_IMediaSeeking( IMediaSeeking
*iface
)
510 return (VideoRendererImpl
*)((char*)iface
- FIELD_OFFSET(VideoRendererImpl
, mediaSeeking
.lpVtbl
));
513 static HRESULT WINAPI
VideoRendererImpl_Seeking_QueryInterface(IMediaSeeking
* iface
, REFIID riid
, LPVOID
* ppv
)
515 VideoRendererImpl
*This
= impl_from_IMediaSeeking(iface
);
517 return IUnknown_QueryInterface((IUnknown
*)This
, riid
, ppv
);
520 static ULONG WINAPI
VideoRendererImpl_Seeking_AddRef(IMediaSeeking
* iface
)
522 VideoRendererImpl
*This
= impl_from_IMediaSeeking(iface
);
524 return IUnknown_AddRef((IUnknown
*)This
);
527 static ULONG WINAPI
VideoRendererImpl_Seeking_Release(IMediaSeeking
* iface
)
529 VideoRendererImpl
*This
= impl_from_IMediaSeeking(iface
);
531 return IUnknown_Release((IUnknown
*)This
);
534 static const IMediaSeekingVtbl VideoRendererImpl_Seeking_Vtbl
=
536 VideoRendererImpl_Seeking_QueryInterface
,
537 VideoRendererImpl_Seeking_AddRef
,
538 VideoRendererImpl_Seeking_Release
,
539 MediaSeekingImpl_GetCapabilities
,
540 MediaSeekingImpl_CheckCapabilities
,
541 MediaSeekingImpl_IsFormatSupported
,
542 MediaSeekingImpl_QueryPreferredFormat
,
543 MediaSeekingImpl_GetTimeFormat
,
544 MediaSeekingImpl_IsUsingTimeFormat
,
545 MediaSeekingImpl_SetTimeFormat
,
546 MediaSeekingImpl_GetDuration
,
547 MediaSeekingImpl_GetStopPosition
,
548 MediaSeekingImpl_GetCurrentPosition
,
549 MediaSeekingImpl_ConvertTimeFormat
,
550 MediaSeekingImpl_SetPositions
,
551 MediaSeekingImpl_GetPositions
,
552 MediaSeekingImpl_GetAvailable
,
553 MediaSeekingImpl_SetRate
,
554 MediaSeekingImpl_GetRate
,
555 MediaSeekingImpl_GetPreroll
558 static HRESULT
VideoRendererImpl_Change(IBaseFilter
*iface
)
560 TRACE("(%p)\n", iface
);
564 HRESULT
VideoRenderer_create(IUnknown
* pUnkOuter
, LPVOID
* ppv
)
568 VideoRendererImpl
* pVideoRenderer
;
570 TRACE("(%p, %p)\n", pUnkOuter
, ppv
);
574 pVideoRenderer
= CoTaskMemAlloc(sizeof(VideoRendererImpl
));
575 pVideoRenderer
->pUnkOuter
= pUnkOuter
;
576 pVideoRenderer
->bUnkOuterValid
= FALSE
;
577 pVideoRenderer
->bAggregatable
= FALSE
;
578 pVideoRenderer
->IInner_vtbl
= &IInner_VTable
;
580 pVideoRenderer
->lpVtbl
= &VideoRenderer_Vtbl
;
581 pVideoRenderer
->IBasicVideo_vtbl
= &IBasicVideo_VTable
;
582 pVideoRenderer
->IVideoWindow_vtbl
= &IVideoWindow_VTable
;
584 pVideoRenderer
->refCount
= 1;
585 InitializeCriticalSection(&pVideoRenderer
->csFilter
);
586 pVideoRenderer
->csFilter
.DebugInfo
->Spare
[0] = (DWORD_PTR
)(__FILE__
": VideoRendererImpl.csFilter");
587 pVideoRenderer
->state
= State_Stopped
;
588 pVideoRenderer
->pClock
= NULL
;
589 pVideoRenderer
->init
= 0;
590 pVideoRenderer
->AutoShow
= 1;
591 pVideoRenderer
->rtLastStop
= -1;
592 ZeroMemory(&pVideoRenderer
->filterInfo
, sizeof(FILTER_INFO
));
593 ZeroMemory(&pVideoRenderer
->SourceRect
, sizeof(RECT
));
594 ZeroMemory(&pVideoRenderer
->DestRect
, sizeof(RECT
));
595 ZeroMemory(&pVideoRenderer
->WindowPos
, sizeof(RECT
));
596 pVideoRenderer
->hWndMsgDrain
= NULL
;
598 /* construct input pin */
599 piInput
.dir
= PINDIR_INPUT
;
600 piInput
.pFilter
= (IBaseFilter
*)pVideoRenderer
;
601 lstrcpynW(piInput
.achName
, wcsInputPinName
, sizeof(piInput
.achName
) / sizeof(piInput
.achName
[0]));
603 hr
= InputPin_Construct(&VideoRenderer_InputPin_Vtbl
, &piInput
, VideoRenderer_Sample
, (LPVOID
)pVideoRenderer
, VideoRenderer_QueryAccept
, NULL
, &pVideoRenderer
->csFilter
, NULL
, (IPin
**)&pVideoRenderer
->pInputPin
);
607 MediaSeekingImpl_Init((IBaseFilter
*)pVideoRenderer
, VideoRendererImpl_Change
, VideoRendererImpl_Change
, VideoRendererImpl_Change
, &pVideoRenderer
->mediaSeeking
, &pVideoRenderer
->csFilter
);
608 pVideoRenderer
->mediaSeeking
.lpVtbl
= &VideoRendererImpl_Seeking_Vtbl
;
610 pVideoRenderer
->sample_held
= NULL
;
611 *ppv
= (LPVOID
)pVideoRenderer
;
615 pVideoRenderer
->csFilter
.DebugInfo
->Spare
[0] = 0;
616 DeleteCriticalSection(&pVideoRenderer
->csFilter
);
617 CoTaskMemFree(pVideoRenderer
);
620 if (!CreateRenderingSubsystem(pVideoRenderer
))
623 pVideoRenderer
->blocked
= CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
624 if (!pVideoRenderer
->blocked
)
626 hr
= HRESULT_FROM_WIN32(GetLastError());
627 IUnknown_Release((IUnknown
*)pVideoRenderer
);
633 HRESULT
VideoRendererDefault_create(IUnknown
* pUnkOuter
, LPVOID
* ppv
)
635 /* TODO: Attempt to use the VMR-7 renderer instead when possible */
636 return VideoRenderer_create(pUnkOuter
, ppv
);
639 static HRESULT WINAPI
VideoRendererInner_QueryInterface(IUnknown
* iface
, REFIID riid
, LPVOID
* ppv
)
641 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
642 TRACE("(%p/%p)->(%s, %p)\n", This
, iface
, qzdebugstr_guid(riid
), ppv
);
644 if (This
->bAggregatable
)
645 This
->bUnkOuterValid
= TRUE
;
649 if (IsEqualIID(riid
, &IID_IUnknown
))
650 *ppv
= (LPVOID
)&(This
->IInner_vtbl
);
651 else if (IsEqualIID(riid
, &IID_IPersist
))
653 else if (IsEqualIID(riid
, &IID_IMediaFilter
))
655 else if (IsEqualIID(riid
, &IID_IBaseFilter
))
657 else if (IsEqualIID(riid
, &IID_IBasicVideo
))
658 *ppv
= (LPVOID
)&(This
->IBasicVideo_vtbl
);
659 else if (IsEqualIID(riid
, &IID_IVideoWindow
))
660 *ppv
= (LPVOID
)&(This
->IVideoWindow_vtbl
);
661 else if (IsEqualIID(riid
, &IID_IMediaSeeking
))
662 *ppv
= &This
->mediaSeeking
;
666 IUnknown_AddRef((IUnknown
*)(*ppv
));
670 if (!IsEqualIID(riid
, &IID_IPin
))
671 FIXME("No interface for %s!\n", qzdebugstr_guid(riid
));
673 return E_NOINTERFACE
;
676 static ULONG WINAPI
VideoRendererInner_AddRef(IUnknown
* iface
)
678 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
679 ULONG refCount
= InterlockedIncrement(&This
->refCount
);
681 TRACE("(%p/%p)->() AddRef from %d\n", This
, iface
, refCount
- 1);
686 static ULONG WINAPI
VideoRendererInner_Release(IUnknown
* iface
)
688 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
689 ULONG refCount
= InterlockedDecrement(&This
->refCount
);
691 TRACE("(%p/%p)->() Release from %d\n", This
, iface
, refCount
+ 1);
697 DestroyWindow(This
->hWnd
);
698 PostThreadMessageA(This
->ThreadID
, WM_QUIT
, 0, 0);
699 WaitForSingleObject(This
->hThread
, INFINITE
);
700 CloseHandle(This
->hThread
);
701 CloseHandle(This
->hEvent
);
704 IReferenceClock_Release(This
->pClock
);
706 if (SUCCEEDED(IPin_ConnectedTo((IPin
*)This
->pInputPin
, &pConnectedTo
)))
708 IPin_Disconnect(pConnectedTo
);
709 IPin_Release(pConnectedTo
);
711 IPin_Disconnect((IPin
*)This
->pInputPin
);
713 IPin_Release((IPin
*)This
->pInputPin
);
717 This
->csFilter
.DebugInfo
->Spare
[0] = 0;
718 DeleteCriticalSection(&This
->csFilter
);
720 TRACE("Destroying Video Renderer\n");
729 static const IUnknownVtbl IInner_VTable
=
731 VideoRendererInner_QueryInterface
,
732 VideoRendererInner_AddRef
,
733 VideoRendererInner_Release
736 static HRESULT WINAPI
VideoRenderer_QueryInterface(IBaseFilter
* iface
, REFIID riid
, LPVOID
* ppv
)
738 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
740 if (This
->bAggregatable
)
741 This
->bUnkOuterValid
= TRUE
;
745 if (This
->bAggregatable
)
746 return IUnknown_QueryInterface(This
->pUnkOuter
, riid
, ppv
);
748 if (IsEqualIID(riid
, &IID_IUnknown
))
752 IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
753 hr
= IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
754 IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
755 This
->bAggregatable
= TRUE
;
760 return E_NOINTERFACE
;
763 return IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
766 static ULONG WINAPI
VideoRenderer_AddRef(IBaseFilter
* iface
)
768 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
770 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
771 return IUnknown_AddRef(This
->pUnkOuter
);
772 return IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
775 static ULONG WINAPI
VideoRenderer_Release(IBaseFilter
* iface
)
777 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
779 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
780 return IUnknown_Release(This
->pUnkOuter
);
781 return IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
784 /** IPersist methods **/
786 static HRESULT WINAPI
VideoRenderer_GetClassID(IBaseFilter
* iface
, CLSID
* pClsid
)
788 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
790 TRACE("(%p/%p)->(%p)\n", This
, iface
, pClsid
);
792 *pClsid
= CLSID_VideoRenderer
;
797 /** IMediaFilter methods **/
799 static HRESULT WINAPI
VideoRenderer_Stop(IBaseFilter
* iface
)
801 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
803 TRACE("(%p/%p)->()\n", This
, iface
);
805 EnterCriticalSection(&This
->csFilter
);
807 This
->state
= State_Stopped
;
808 SetEvent(This
->hEvent
);
809 SetEvent(This
->blocked
);
811 LeaveCriticalSection(&This
->csFilter
);
816 static HRESULT WINAPI
VideoRenderer_Pause(IBaseFilter
* iface
)
818 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
820 TRACE("(%p/%p)->()\n", This
, iface
);
822 EnterCriticalSection(&This
->csFilter
);
823 if (This
->state
!= State_Paused
)
825 if (This
->state
== State_Stopped
)
827 This
->pInputPin
->end_of_stream
= 0;
828 ResetEvent(This
->hEvent
);
831 This
->state
= State_Paused
;
832 ResetEvent(This
->blocked
);
834 LeaveCriticalSection(&This
->csFilter
);
839 static HRESULT WINAPI
VideoRenderer_Run(IBaseFilter
* iface
, REFERENCE_TIME tStart
)
841 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
843 TRACE("(%p/%p)->(%s)\n", This
, iface
, wine_dbgstr_longlong(tStart
));
845 EnterCriticalSection(&This
->csFilter
);
846 if (This
->state
!= State_Running
)
848 if (This
->state
== State_Stopped
)
850 This
->pInputPin
->end_of_stream
= 0;
851 ResetEvent(This
->hEvent
);
853 SetEvent(This
->blocked
);
855 This
->rtStreamStart
= tStart
;
856 This
->state
= State_Running
;
858 LeaveCriticalSection(&This
->csFilter
);
863 static HRESULT WINAPI
VideoRenderer_GetState(IBaseFilter
* iface
, DWORD dwMilliSecsTimeout
, FILTER_STATE
*pState
)
865 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
868 TRACE("(%p/%p)->(%d, %p)\n", This
, iface
, dwMilliSecsTimeout
, pState
);
870 if (WaitForSingleObject(This
->hEvent
, dwMilliSecsTimeout
) == WAIT_TIMEOUT
)
871 hr
= VFW_S_STATE_INTERMEDIATE
;
875 EnterCriticalSection(&This
->csFilter
);
877 *pState
= This
->state
;
879 LeaveCriticalSection(&This
->csFilter
);
884 static HRESULT WINAPI
VideoRenderer_SetSyncSource(IBaseFilter
* iface
, IReferenceClock
*pClock
)
886 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
888 TRACE("(%p/%p)->(%p)\n", This
, iface
, pClock
);
890 EnterCriticalSection(&This
->csFilter
);
893 IReferenceClock_Release(This
->pClock
);
894 This
->pClock
= pClock
;
896 IReferenceClock_AddRef(This
->pClock
);
898 LeaveCriticalSection(&This
->csFilter
);
903 static HRESULT WINAPI
VideoRenderer_GetSyncSource(IBaseFilter
* iface
, IReferenceClock
**ppClock
)
905 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
907 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppClock
);
909 EnterCriticalSection(&This
->csFilter
);
911 *ppClock
= This
->pClock
;
913 IReferenceClock_AddRef(This
->pClock
);
915 LeaveCriticalSection(&This
->csFilter
);
920 /** IBaseFilter implementation **/
922 static HRESULT
VideoRenderer_GetPin(IBaseFilter
*iface
, ULONG pos
, IPin
**pin
, DWORD
*lastsynctick
)
924 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
926 /* Our pins are static, not changing so setting static tick count is ok */
932 *pin
= (IPin
*)This
->pInputPin
;
937 static HRESULT WINAPI
VideoRenderer_EnumPins(IBaseFilter
* iface
, IEnumPins
**ppEnum
)
939 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
941 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppEnum
);
943 return IEnumPinsImpl_Construct(ppEnum
, VideoRenderer_GetPin
, iface
);
946 static HRESULT WINAPI
VideoRenderer_FindPin(IBaseFilter
* iface
, LPCWSTR Id
, IPin
**ppPin
)
948 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
950 TRACE("(%p/%p)->(%p,%p)\n", This
, iface
, debugstr_w(Id
), ppPin
);
952 FIXME("VideoRenderer::FindPin(...)\n");
954 /* FIXME: critical section */
959 static HRESULT WINAPI
VideoRenderer_QueryFilterInfo(IBaseFilter
* iface
, FILTER_INFO
*pInfo
)
961 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
963 TRACE("(%p/%p)->(%p)\n", This
, iface
, pInfo
);
965 strcpyW(pInfo
->achName
, This
->filterInfo
.achName
);
966 pInfo
->pGraph
= This
->filterInfo
.pGraph
;
969 IFilterGraph_AddRef(pInfo
->pGraph
);
974 static HRESULT WINAPI
VideoRenderer_JoinFilterGraph(IBaseFilter
* iface
, IFilterGraph
*pGraph
, LPCWSTR pName
)
976 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
978 TRACE("(%p/%p)->(%p, %s)\n", This
, iface
, pGraph
, debugstr_w(pName
));
980 EnterCriticalSection(&This
->csFilter
);
983 strcpyW(This
->filterInfo
.achName
, pName
);
985 *This
->filterInfo
.achName
= '\0';
986 This
->filterInfo
.pGraph
= pGraph
; /* NOTE: do NOT increase ref. count */
988 LeaveCriticalSection(&This
->csFilter
);
993 static HRESULT WINAPI
VideoRenderer_QueryVendorInfo(IBaseFilter
* iface
, LPWSTR
*pVendorInfo
)
995 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
996 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVendorInfo
);
1000 static const IBaseFilterVtbl VideoRenderer_Vtbl
=
1002 VideoRenderer_QueryInterface
,
1003 VideoRenderer_AddRef
,
1004 VideoRenderer_Release
,
1005 VideoRenderer_GetClassID
,
1007 VideoRenderer_Pause
,
1009 VideoRenderer_GetState
,
1010 VideoRenderer_SetSyncSource
,
1011 VideoRenderer_GetSyncSource
,
1012 VideoRenderer_EnumPins
,
1013 VideoRenderer_FindPin
,
1014 VideoRenderer_QueryFilterInfo
,
1015 VideoRenderer_JoinFilterGraph
,
1016 VideoRenderer_QueryVendorInfo
1019 static HRESULT WINAPI
VideoRenderer_InputPin_EndOfStream(IPin
* iface
)
1021 InputPin
* This
= (InputPin
*)iface
;
1022 IMediaEventSink
* pEventSink
;
1025 TRACE("(%p/%p)->()\n", This
, iface
);
1027 hr
= IFilterGraph_QueryInterface(((VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
)->filterInfo
.pGraph
, &IID_IMediaEventSink
, (LPVOID
*)&pEventSink
);
1030 hr
= IMediaEventSink_Notify(pEventSink
, EC_COMPLETE
, S_OK
, 0);
1031 IMediaEventSink_Release(pEventSink
);
1037 static HRESULT WINAPI
VideoRenderer_InputPin_BeginFlush(IPin
* iface
)
1039 InputPin
* This
= (InputPin
*)iface
;
1040 VideoRendererImpl
*pVideoRenderer
= (VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
;
1043 TRACE("(%p/%p)->()\n", This
, iface
);
1045 EnterCriticalSection(This
->pin
.pCritSec
);
1046 if (pVideoRenderer
->state
== State_Paused
)
1047 SetEvent(pVideoRenderer
->blocked
);
1049 hr
= InputPin_BeginFlush(iface
);
1050 LeaveCriticalSection(This
->pin
.pCritSec
);
1055 static HRESULT WINAPI
VideoRenderer_InputPin_EndFlush(IPin
* iface
)
1057 InputPin
* This
= (InputPin
*)iface
;
1058 VideoRendererImpl
*pVideoRenderer
= (VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
;
1061 TRACE("(%p/%p)->()\n", This
, iface
);
1063 EnterCriticalSection(This
->pin
.pCritSec
);
1064 if (pVideoRenderer
->state
== State_Paused
)
1065 ResetEvent(pVideoRenderer
->blocked
);
1067 hr
= InputPin_EndFlush(iface
);
1068 LeaveCriticalSection(This
->pin
.pCritSec
);
1073 static const IPinVtbl VideoRenderer_InputPin_Vtbl
=
1075 InputPin_QueryInterface
,
1079 InputPin_ReceiveConnection
,
1080 IPinImpl_Disconnect
,
1081 IPinImpl_ConnectedTo
,
1082 IPinImpl_ConnectionMediaType
,
1083 IPinImpl_QueryPinInfo
,
1084 IPinImpl_QueryDirection
,
1086 IPinImpl_QueryAccept
,
1087 IPinImpl_EnumMediaTypes
,
1088 IPinImpl_QueryInternalConnections
,
1089 VideoRenderer_InputPin_EndOfStream
,
1090 VideoRenderer_InputPin_BeginFlush
,
1091 VideoRenderer_InputPin_EndFlush
,
1095 /*** IUnknown methods ***/
1096 static HRESULT WINAPI
Basicvideo_QueryInterface(IBasicVideo
*iface
,
1099 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1101 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
1103 return VideoRenderer_QueryInterface((IBaseFilter
*)This
, riid
, ppvObj
);
1106 static ULONG WINAPI
Basicvideo_AddRef(IBasicVideo
*iface
) {
1107 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1109 TRACE("(%p/%p)->()\n", This
, iface
);
1111 return VideoRenderer_AddRef((IBaseFilter
*)This
);
1114 static ULONG WINAPI
Basicvideo_Release(IBasicVideo
*iface
) {
1115 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1117 TRACE("(%p/%p)->()\n", This
, iface
);
1119 return VideoRenderer_Release((IBaseFilter
*)This
);
1122 /*** IDispatch methods ***/
1123 static HRESULT WINAPI
Basicvideo_GetTypeInfoCount(IBasicVideo
*iface
,
1125 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1127 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
1132 static HRESULT WINAPI
Basicvideo_GetTypeInfo(IBasicVideo
*iface
,
1135 ITypeInfo
**ppTInfo
) {
1136 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1138 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
1143 static HRESULT WINAPI
Basicvideo_GetIDsOfNames(IBasicVideo
*iface
,
1149 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1151 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1156 static HRESULT WINAPI
Basicvideo_Invoke(IBasicVideo
*iface
,
1157 DISPID dispIdMember
,
1161 DISPPARAMS
*pDispParams
,
1163 EXCEPINFO
*pExepInfo
,
1165 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1167 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
);
1172 /*** IBasicVideo methods ***/
1173 static HRESULT WINAPI
Basicvideo_get_AvgTimePerFrame(IBasicVideo
*iface
,
1174 REFTIME
*pAvgTimePerFrame
) {
1175 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1177 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pAvgTimePerFrame
);
1182 static HRESULT WINAPI
Basicvideo_get_BitRate(IBasicVideo
*iface
,
1184 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1186 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBitRate
);
1191 static HRESULT WINAPI
Basicvideo_get_BitErrorRate(IBasicVideo
*iface
,
1192 long *pBitErrorRate
) {
1193 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1195 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBitErrorRate
);
1200 static HRESULT WINAPI
Basicvideo_get_VideoWidth(IBasicVideo
*iface
,
1201 long *pVideoWidth
) {
1202 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1204 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoWidth
);
1206 *pVideoWidth
= This
->VideoWidth
;
1211 static HRESULT WINAPI
Basicvideo_get_VideoHeight(IBasicVideo
*iface
,
1212 long *pVideoHeight
) {
1213 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1215 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoHeight
);
1217 *pVideoHeight
= This
->VideoHeight
;
1222 static HRESULT WINAPI
Basicvideo_put_SourceLeft(IBasicVideo
*iface
,
1224 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1226 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceLeft
);
1228 This
->SourceRect
.left
= SourceLeft
;
1233 static HRESULT WINAPI
Basicvideo_get_SourceLeft(IBasicVideo
*iface
,
1234 long *pSourceLeft
) {
1235 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1237 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceLeft
);
1239 *pSourceLeft
= This
->SourceRect
.left
;
1244 static HRESULT WINAPI
Basicvideo_put_SourceWidth(IBasicVideo
*iface
,
1246 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1248 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceWidth
);
1250 This
->SourceRect
.right
= This
->SourceRect
.left
+ SourceWidth
;
1255 static HRESULT WINAPI
Basicvideo_get_SourceWidth(IBasicVideo
*iface
,
1256 long *pSourceWidth
) {
1257 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1259 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceWidth
);
1261 *pSourceWidth
= This
->SourceRect
.right
- This
->SourceRect
.left
;
1266 static HRESULT WINAPI
Basicvideo_put_SourceTop(IBasicVideo
*iface
,
1268 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1270 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceTop
);
1272 This
->SourceRect
.top
= SourceTop
;
1277 static HRESULT WINAPI
Basicvideo_get_SourceTop(IBasicVideo
*iface
,
1279 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1281 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceTop
);
1283 *pSourceTop
= This
->SourceRect
.top
;
1288 static HRESULT WINAPI
Basicvideo_put_SourceHeight(IBasicVideo
*iface
,
1289 long SourceHeight
) {
1290 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1292 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceHeight
);
1294 This
->SourceRect
.bottom
= This
->SourceRect
.top
+ SourceHeight
;
1299 static HRESULT WINAPI
Basicvideo_get_SourceHeight(IBasicVideo
*iface
,
1300 long *pSourceHeight
) {
1301 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1303 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceHeight
);
1305 *pSourceHeight
= This
->SourceRect
.bottom
- This
->SourceRect
.top
;
1310 static HRESULT WINAPI
Basicvideo_put_DestinationLeft(IBasicVideo
*iface
,
1311 long DestinationLeft
) {
1312 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1314 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationLeft
);
1316 This
->DestRect
.left
= DestinationLeft
;
1321 static HRESULT WINAPI
Basicvideo_get_DestinationLeft(IBasicVideo
*iface
,
1322 long *pDestinationLeft
) {
1323 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1325 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationLeft
);
1327 *pDestinationLeft
= This
->DestRect
.left
;
1332 static HRESULT WINAPI
Basicvideo_put_DestinationWidth(IBasicVideo
*iface
,
1333 long DestinationWidth
) {
1334 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1336 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationWidth
);
1338 This
->DestRect
.right
= This
->DestRect
.left
+ DestinationWidth
;
1343 static HRESULT WINAPI
Basicvideo_get_DestinationWidth(IBasicVideo
*iface
,
1344 long *pDestinationWidth
) {
1345 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1347 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationWidth
);
1349 *pDestinationWidth
= This
->DestRect
.right
- This
->DestRect
.left
;
1354 static HRESULT WINAPI
Basicvideo_put_DestinationTop(IBasicVideo
*iface
,
1355 long DestinationTop
) {
1356 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1358 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationTop
);
1360 This
->DestRect
.top
= DestinationTop
;
1365 static HRESULT WINAPI
Basicvideo_get_DestinationTop(IBasicVideo
*iface
,
1366 long *pDestinationTop
) {
1367 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1369 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationTop
);
1371 *pDestinationTop
= This
->DestRect
.top
;
1376 static HRESULT WINAPI
Basicvideo_put_DestinationHeight(IBasicVideo
*iface
,
1377 long DestinationHeight
) {
1378 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1380 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationHeight
);
1382 This
->DestRect
.right
= This
->DestRect
.left
+ DestinationHeight
;
1387 static HRESULT WINAPI
Basicvideo_get_DestinationHeight(IBasicVideo
*iface
,
1388 long *pDestinationHeight
) {
1389 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1391 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationHeight
);
1393 *pDestinationHeight
= This
->DestRect
.right
- This
->DestRect
.left
;
1398 static HRESULT WINAPI
Basicvideo_SetSourcePosition(IBasicVideo
*iface
,
1403 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1405 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This
, iface
, Left
, Top
, Width
, Height
);
1407 This
->SourceRect
.left
= Left
;
1408 This
->SourceRect
.top
= Top
;
1409 This
->SourceRect
.right
= Left
+ Width
;
1410 This
->SourceRect
.bottom
= Top
+ Height
;
1415 static HRESULT WINAPI
Basicvideo_GetSourcePosition(IBasicVideo
*iface
,
1420 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1422 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1424 *pLeft
= This
->SourceRect
.left
;
1425 *pTop
= This
->SourceRect
.top
;
1426 *pWidth
= This
->SourceRect
.right
- This
->SourceRect
.left
;
1427 *pHeight
= This
->SourceRect
.bottom
- This
->SourceRect
.top
;
1432 static HRESULT WINAPI
Basicvideo_SetDefaultSourcePosition(IBasicVideo
*iface
) {
1433 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1435 TRACE("(%p/%p)->()\n", This
, iface
);
1437 This
->SourceRect
.left
= 0;
1438 This
->SourceRect
.top
= 0;
1439 This
->SourceRect
.right
= This
->VideoWidth
;
1440 This
->SourceRect
.bottom
= This
->VideoHeight
;
1445 static HRESULT WINAPI
Basicvideo_SetDestinationPosition(IBasicVideo
*iface
,
1450 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1452 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This
, iface
, Left
, Top
, Width
, Height
);
1454 This
->DestRect
.left
= Left
;
1455 This
->DestRect
.top
= Top
;
1456 This
->DestRect
.right
= Left
+ Width
;
1457 This
->DestRect
.bottom
= Top
+ Height
;
1462 static HRESULT WINAPI
Basicvideo_GetDestinationPosition(IBasicVideo
*iface
,
1467 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1469 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1471 *pLeft
= This
->DestRect
.left
;
1472 *pTop
= This
->DestRect
.top
;
1473 *pWidth
= This
->DestRect
.right
- This
->DestRect
.left
;
1474 *pHeight
= This
->DestRect
.bottom
- This
->DestRect
.top
;
1479 static HRESULT WINAPI
Basicvideo_SetDefaultDestinationPosition(IBasicVideo
*iface
) {
1480 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1483 TRACE("(%p/%p)->()\n", This
, iface
);
1485 if (!GetClientRect(This
->hWnd
, &rect
))
1488 This
->SourceRect
.left
= 0;
1489 This
->SourceRect
.top
= 0;
1490 This
->SourceRect
.right
= rect
.right
;
1491 This
->SourceRect
.bottom
= rect
.bottom
;
1496 static HRESULT WINAPI
Basicvideo_GetVideoSize(IBasicVideo
*iface
,
1499 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1501 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pWidth
, pHeight
);
1503 *pWidth
= This
->VideoWidth
;
1504 *pHeight
= This
->VideoHeight
;
1509 static HRESULT WINAPI
Basicvideo_GetVideoPaletteEntries(IBasicVideo
*iface
,
1514 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1516 FIXME("(%p/%p)->(%ld, %ld, %p, %p): stub !!!\n", This
, iface
, StartIndex
, Entries
, pRetrieved
, pPalette
);
1521 static HRESULT WINAPI
Basicvideo_GetCurrentImage(IBasicVideo
*iface
,
1524 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1525 BITMAPINFOHEADER
*bmiHeader
;
1527 AM_MEDIA_TYPE
*amt
= &This
->pInputPin
->pin
.mtCurrent
;
1530 EnterCriticalSection(&This
->csFilter
);
1532 if (!This
->sample_held
)
1534 LeaveCriticalSection(&This
->csFilter
);
1535 return (This
->state
== State_Paused
? E_UNEXPECTED
: VFW_E_NOT_PAUSED
);
1538 FIXME("(%p/%p)->(%p, %p): partial stub\n", This
, iface
, pBufferSize
, pDIBImage
);
1540 if (IsEqualIID(&amt
->formattype
, &FORMAT_VideoInfo
))
1542 bmiHeader
= &((VIDEOINFOHEADER
*)amt
->pbFormat
)->bmiHeader
;
1544 else if (IsEqualIID(&amt
->formattype
, &FORMAT_VideoInfo2
))
1546 bmiHeader
= &((VIDEOINFOHEADER2
*)amt
->pbFormat
)->bmiHeader
;
1550 FIXME("Unknown type %s\n", debugstr_guid(&amt
->subtype
));
1551 LeaveCriticalSection(&This
->csFilter
);
1552 return VFW_E_RUNTIME_ERROR
;
1555 needed_size
= bmiHeader
->biSize
;
1556 needed_size
+= IMediaSample_GetActualDataLength(This
->sample_held
);
1560 *pBufferSize
= needed_size
;
1561 LeaveCriticalSection(&This
->csFilter
);
1565 if (needed_size
< *pBufferSize
)
1567 ERR("Buffer too small %u/%lu\n", needed_size
, *pBufferSize
);
1568 LeaveCriticalSection(&This
->csFilter
);
1571 *pBufferSize
= needed_size
;
1573 memcpy(pDIBImage
, bmiHeader
, bmiHeader
->biSize
);
1574 IMediaSample_GetPointer(This
->sample_held
, (BYTE
**)&ptr
);
1575 memcpy((char *)pDIBImage
+ bmiHeader
->biSize
, ptr
, IMediaSample_GetActualDataLength(This
->sample_held
));
1577 LeaveCriticalSection(&This
->csFilter
);
1582 static HRESULT WINAPI
Basicvideo_IsUsingDefaultSource(IBasicVideo
*iface
) {
1583 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1585 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
1590 static HRESULT WINAPI
Basicvideo_IsUsingDefaultDestination(IBasicVideo
*iface
) {
1591 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1593 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
1599 static const IBasicVideoVtbl IBasicVideo_VTable
=
1601 Basicvideo_QueryInterface
,
1604 Basicvideo_GetTypeInfoCount
,
1605 Basicvideo_GetTypeInfo
,
1606 Basicvideo_GetIDsOfNames
,
1608 Basicvideo_get_AvgTimePerFrame
,
1609 Basicvideo_get_BitRate
,
1610 Basicvideo_get_BitErrorRate
,
1611 Basicvideo_get_VideoWidth
,
1612 Basicvideo_get_VideoHeight
,
1613 Basicvideo_put_SourceLeft
,
1614 Basicvideo_get_SourceLeft
,
1615 Basicvideo_put_SourceWidth
,
1616 Basicvideo_get_SourceWidth
,
1617 Basicvideo_put_SourceTop
,
1618 Basicvideo_get_SourceTop
,
1619 Basicvideo_put_SourceHeight
,
1620 Basicvideo_get_SourceHeight
,
1621 Basicvideo_put_DestinationLeft
,
1622 Basicvideo_get_DestinationLeft
,
1623 Basicvideo_put_DestinationWidth
,
1624 Basicvideo_get_DestinationWidth
,
1625 Basicvideo_put_DestinationTop
,
1626 Basicvideo_get_DestinationTop
,
1627 Basicvideo_put_DestinationHeight
,
1628 Basicvideo_get_DestinationHeight
,
1629 Basicvideo_SetSourcePosition
,
1630 Basicvideo_GetSourcePosition
,
1631 Basicvideo_SetDefaultSourcePosition
,
1632 Basicvideo_SetDestinationPosition
,
1633 Basicvideo_GetDestinationPosition
,
1634 Basicvideo_SetDefaultDestinationPosition
,
1635 Basicvideo_GetVideoSize
,
1636 Basicvideo_GetVideoPaletteEntries
,
1637 Basicvideo_GetCurrentImage
,
1638 Basicvideo_IsUsingDefaultSource
,
1639 Basicvideo_IsUsingDefaultDestination
1643 /*** IUnknown methods ***/
1644 static HRESULT WINAPI
Videowindow_QueryInterface(IVideoWindow
*iface
,
1647 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1649 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
1651 return VideoRenderer_QueryInterface((IBaseFilter
*)This
, riid
, ppvObj
);
1654 static ULONG WINAPI
Videowindow_AddRef(IVideoWindow
*iface
) {
1655 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1657 TRACE("(%p/%p)->()\n", This
, iface
);
1659 return VideoRenderer_AddRef((IBaseFilter
*)This
);
1662 static ULONG WINAPI
Videowindow_Release(IVideoWindow
*iface
) {
1663 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1665 TRACE("(%p/%p)->()\n", This
, iface
);
1667 return VideoRenderer_Release((IBaseFilter
*)This
);
1670 /*** IDispatch methods ***/
1671 static HRESULT WINAPI
Videowindow_GetTypeInfoCount(IVideoWindow
*iface
,
1673 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1675 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
1680 static HRESULT WINAPI
Videowindow_GetTypeInfo(IVideoWindow
*iface
,
1683 ITypeInfo
**ppTInfo
) {
1684 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1686 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
1691 static HRESULT WINAPI
Videowindow_GetIDsOfNames(IVideoWindow
*iface
,
1697 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1699 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1704 static HRESULT WINAPI
Videowindow_Invoke(IVideoWindow
*iface
,
1705 DISPID dispIdMember
,
1709 DISPPARAMS
*pDispParams
,
1711 EXCEPINFO
*pExepInfo
,
1713 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1715 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
);
1720 /*** IVideoWindow methods ***/
1721 static HRESULT WINAPI
Videowindow_put_Caption(IVideoWindow
*iface
,
1723 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1725 TRACE("(%p/%p)->(%s (%p))\n", This
, iface
, debugstr_w(strCaption
), strCaption
);
1727 if (!SetWindowTextW(This
->hWnd
, strCaption
))
1733 static HRESULT WINAPI
Videowindow_get_Caption(IVideoWindow
*iface
,
1735 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1737 TRACE("(%p/%p)->(%p)\n", This
, iface
, strCaption
);
1739 GetWindowTextW(This
->hWnd
, (LPWSTR
)strCaption
, 100);
1744 static HRESULT WINAPI
Videowindow_put_WindowStyle(IVideoWindow
*iface
,
1746 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1749 old
= GetWindowLongA(This
->hWnd
, GWL_STYLE
);
1751 TRACE("(%p/%p)->(%x -> %lx)\n", This
, iface
, old
, WindowStyle
);
1753 if (WindowStyle
& (WS_DISABLED
|WS_HSCROLL
|WS_ICONIC
|WS_MAXIMIZE
|WS_MINIMIZE
|WS_VSCROLL
))
1754 return E_INVALIDARG
;
1756 SetWindowLongA(This
->hWnd
, GWL_STYLE
, WindowStyle
);
1761 static HRESULT WINAPI
Videowindow_get_WindowStyle(IVideoWindow
*iface
,
1762 long *WindowStyle
) {
1763 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1765 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyle
);
1767 *WindowStyle
= GetWindowLongA(This
->hWnd
, GWL_STYLE
);
1772 static HRESULT WINAPI
Videowindow_put_WindowStyleEx(IVideoWindow
*iface
,
1773 long WindowStyleEx
) {
1774 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1776 TRACE("(%p/%p)->(%ld)\n", This
, iface
, WindowStyleEx
);
1778 if (WindowStyleEx
& (WS_DISABLED
|WS_HSCROLL
|WS_ICONIC
|WS_MAXIMIZE
|WS_MINIMIZE
|WS_VSCROLL
))
1779 return E_INVALIDARG
;
1781 if (!SetWindowLongA(This
->hWnd
, GWL_EXSTYLE
, WindowStyleEx
))
1787 static HRESULT WINAPI
Videowindow_get_WindowStyleEx(IVideoWindow
*iface
,
1788 long *WindowStyleEx
) {
1789 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1791 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyleEx
);
1793 *WindowStyleEx
= GetWindowLongA(This
->hWnd
, GWL_EXSTYLE
);
1798 static HRESULT WINAPI
Videowindow_put_AutoShow(IVideoWindow
*iface
,
1800 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1802 TRACE("(%p/%p)->(%ld)\n", This
, iface
, AutoShow
);
1804 This
->AutoShow
= 1; /* FXIME: Should be AutoShow */;
1809 static HRESULT WINAPI
Videowindow_get_AutoShow(IVideoWindow
*iface
,
1811 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1813 TRACE("(%p/%p)->(%p)\n", This
, iface
, AutoShow
);
1815 *AutoShow
= This
->AutoShow
;
1820 static HRESULT WINAPI
Videowindow_put_WindowState(IVideoWindow
*iface
,
1822 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1824 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, WindowState
);
1829 static HRESULT WINAPI
Videowindow_get_WindowState(IVideoWindow
*iface
,
1830 long *WindowState
) {
1831 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1833 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, WindowState
);
1838 static HRESULT WINAPI
Videowindow_put_BackgroundPalette(IVideoWindow
*iface
,
1839 long BackgroundPalette
) {
1840 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1842 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, BackgroundPalette
);
1847 static HRESULT WINAPI
Videowindow_get_BackgroundPalette(IVideoWindow
*iface
,
1848 long *pBackgroundPalette
) {
1849 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1851 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBackgroundPalette
);
1856 static HRESULT WINAPI
Videowindow_put_Visible(IVideoWindow
*iface
,
1858 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1860 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Visible
);
1862 ShowWindow(This
->hWnd
, Visible
? SW_SHOW
: SW_HIDE
);
1867 static HRESULT WINAPI
Videowindow_get_Visible(IVideoWindow
*iface
,
1869 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1871 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVisible
);
1873 *pVisible
= IsWindowVisible(This
->hWnd
);
1878 static HRESULT WINAPI
Videowindow_put_Left(IVideoWindow
*iface
,
1880 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1882 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Left
);
1884 if (!SetWindowPos(This
->hWnd
, NULL
, Left
, This
->WindowPos
.top
, 0, 0, SWP_NOZORDER
|SWP_NOSIZE
))
1887 This
->WindowPos
.left
= Left
;
1892 static HRESULT WINAPI
Videowindow_get_Left(IVideoWindow
*iface
,
1894 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1896 TRACE("(%p/%p)->(%p)\n", This
, iface
, pLeft
);
1898 *pLeft
= This
->WindowPos
.left
;
1903 static HRESULT WINAPI
Videowindow_put_Width(IVideoWindow
*iface
,
1905 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1907 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Width
);
1909 if (!SetWindowPos(This
->hWnd
, NULL
, 0, 0, Width
, This
->WindowPos
.bottom
-This
->WindowPos
.top
, SWP_NOZORDER
|SWP_NOMOVE
))
1912 This
->WindowPos
.right
= This
->WindowPos
.left
+ Width
;
1917 static HRESULT WINAPI
Videowindow_get_Width(IVideoWindow
*iface
,
1919 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1921 TRACE("(%p/%p)->(%p)\n", This
, iface
, pWidth
);
1923 *pWidth
= This
->WindowPos
.right
- This
->WindowPos
.left
;
1928 static HRESULT WINAPI
Videowindow_put_Top(IVideoWindow
*iface
,
1930 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1932 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Top
);
1934 if (!SetWindowPos(This
->hWnd
, NULL
, This
->WindowPos
.left
, Top
, 0, 0, SWP_NOZORDER
|SWP_NOSIZE
))
1937 This
->WindowPos
.top
= Top
;
1942 static HRESULT WINAPI
Videowindow_get_Top(IVideoWindow
*iface
,
1944 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1946 TRACE("(%p/%p)->(%p)\n", This
, iface
, pTop
);
1948 *pTop
= This
->WindowPos
.top
;
1953 static HRESULT WINAPI
Videowindow_put_Height(IVideoWindow
*iface
,
1955 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1957 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Height
);
1959 if (!SetWindowPos(This
->hWnd
, NULL
, 0, 0, This
->WindowPos
.right
-This
->WindowPos
.left
, Height
, SWP_NOZORDER
|SWP_NOMOVE
))
1962 This
->WindowPos
.bottom
= This
->WindowPos
.top
+ Height
;
1967 static HRESULT WINAPI
Videowindow_get_Height(IVideoWindow
*iface
,
1969 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1971 TRACE("(%p/%p)->(%p)\n", This
, iface
, pHeight
);
1973 *pHeight
= This
->WindowPos
.bottom
- This
->WindowPos
.top
;
1978 static HRESULT WINAPI
Videowindow_put_Owner(IVideoWindow
*iface
,
1980 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1982 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Owner
);
1984 SetParent(This
->hWnd
, (HWND
)Owner
);
1989 static HRESULT WINAPI
Videowindow_get_Owner(IVideoWindow
*iface
,
1991 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1993 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Owner
);
1995 *(HWND
*)Owner
= GetParent(This
->hWnd
);
2000 static HRESULT WINAPI
Videowindow_put_MessageDrain(IVideoWindow
*iface
,
2002 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2004 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Drain
);
2006 This
->hWndMsgDrain
= (HWND
)Drain
;
2011 static HRESULT WINAPI
Videowindow_get_MessageDrain(IVideoWindow
*iface
,
2013 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2015 TRACE("(%p/%p)->(%p)\n", This
, iface
, Drain
);
2017 *Drain
= (OAHWND
)This
->hWndMsgDrain
;
2022 static HRESULT WINAPI
Videowindow_get_BorderColor(IVideoWindow
*iface
,
2024 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2026 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, Color
);
2031 static HRESULT WINAPI
Videowindow_put_BorderColor(IVideoWindow
*iface
,
2033 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2035 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, Color
);
2040 static HRESULT WINAPI
Videowindow_get_FullScreenMode(IVideoWindow
*iface
,
2041 long *FullScreenMode
) {
2042 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2044 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, FullScreenMode
);
2049 static HRESULT WINAPI
Videowindow_put_FullScreenMode(IVideoWindow
*iface
,
2050 long FullScreenMode
) {
2051 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2053 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, FullScreenMode
);
2058 static HRESULT WINAPI
Videowindow_SetWindowForeground(IVideoWindow
*iface
,
2060 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2065 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Focus
);
2067 if ((Focus
!= FALSE
) && (Focus
!= TRUE
))
2068 return E_INVALIDARG
;
2070 hr
= IPin_ConnectedTo((IPin
*)This
->pInputPin
, &pPin
);
2071 if ((hr
!= S_OK
) || !pPin
)
2072 return VFW_E_NOT_CONNECTED
;
2075 ret
= SetForegroundWindow(This
->hWnd
);
2077 ret
= SetWindowPos(This
->hWnd
, HWND_TOP
, 0, 0, 0, 0, SWP_NOMOVE
|SWP_NOSIZE
);
2085 static HRESULT WINAPI
Videowindow_NotifyOwnerMessage(IVideoWindow
*iface
,
2090 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2092 TRACE("(%p/%p)->(%08x, %ld, %08lx, %08lx)\n", This
, iface
, (DWORD
) hwnd
, uMsg
, wParam
, lParam
);
2094 if (!PostMessageA(This
->hWnd
, uMsg
, wParam
, lParam
))
2100 static HRESULT WINAPI
Videowindow_SetWindowPosition(IVideoWindow
*iface
,
2105 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2107 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This
, iface
, Left
, Top
, Width
, Height
);
2109 if (!SetWindowPos(This
->hWnd
, NULL
, Left
, Top
, Width
, Height
, SWP_NOZORDER
))
2112 This
->WindowPos
.left
= Left
;
2113 This
->WindowPos
.top
= Top
;
2114 This
->WindowPos
.right
= Left
+ Width
;
2115 This
->WindowPos
.bottom
= Top
+ Height
;
2120 static HRESULT WINAPI
Videowindow_GetWindowPosition(IVideoWindow
*iface
,
2125 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2127 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
2129 *pLeft
= This
->WindowPos
.left
;
2130 *pTop
= This
->WindowPos
.top
;
2131 *pWidth
= This
->WindowPos
.right
- This
->WindowPos
.left
;
2132 *pHeight
= This
->WindowPos
.bottom
- This
->WindowPos
.top
;
2137 static HRESULT WINAPI
Videowindow_GetMinIdealImageSize(IVideoWindow
*iface
,
2140 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2142 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This
, iface
, pWidth
, pHeight
);
2144 *pWidth
= This
->VideoWidth
;
2145 *pHeight
= This
->VideoHeight
;
2150 static HRESULT WINAPI
Videowindow_GetMaxIdealImageSize(IVideoWindow
*iface
,
2153 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2155 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This
, iface
, pWidth
, pHeight
);
2157 *pWidth
= This
->VideoWidth
;
2158 *pHeight
= This
->VideoHeight
;
2163 static HRESULT WINAPI
Videowindow_GetRestorePosition(IVideoWindow
*iface
,
2168 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2170 FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
2175 static HRESULT WINAPI
Videowindow_HideCursor(IVideoWindow
*iface
,
2177 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2179 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, HideCursor
);
2184 static HRESULT WINAPI
Videowindow_IsCursorHidden(IVideoWindow
*iface
,
2185 long *CursorHidden
) {
2186 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2188 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, CursorHidden
);
2193 static const IVideoWindowVtbl IVideoWindow_VTable
=
2195 Videowindow_QueryInterface
,
2197 Videowindow_Release
,
2198 Videowindow_GetTypeInfoCount
,
2199 Videowindow_GetTypeInfo
,
2200 Videowindow_GetIDsOfNames
,
2202 Videowindow_put_Caption
,
2203 Videowindow_get_Caption
,
2204 Videowindow_put_WindowStyle
,
2205 Videowindow_get_WindowStyle
,
2206 Videowindow_put_WindowStyleEx
,
2207 Videowindow_get_WindowStyleEx
,
2208 Videowindow_put_AutoShow
,
2209 Videowindow_get_AutoShow
,
2210 Videowindow_put_WindowState
,
2211 Videowindow_get_WindowState
,
2212 Videowindow_put_BackgroundPalette
,
2213 Videowindow_get_BackgroundPalette
,
2214 Videowindow_put_Visible
,
2215 Videowindow_get_Visible
,
2216 Videowindow_put_Left
,
2217 Videowindow_get_Left
,
2218 Videowindow_put_Width
,
2219 Videowindow_get_Width
,
2220 Videowindow_put_Top
,
2221 Videowindow_get_Top
,
2222 Videowindow_put_Height
,
2223 Videowindow_get_Height
,
2224 Videowindow_put_Owner
,
2225 Videowindow_get_Owner
,
2226 Videowindow_put_MessageDrain
,
2227 Videowindow_get_MessageDrain
,
2228 Videowindow_get_BorderColor
,
2229 Videowindow_put_BorderColor
,
2230 Videowindow_get_FullScreenMode
,
2231 Videowindow_put_FullScreenMode
,
2232 Videowindow_SetWindowForeground
,
2233 Videowindow_NotifyOwnerMessage
,
2234 Videowindow_SetWindowPosition
,
2235 Videowindow_GetWindowPosition
,
2236 Videowindow_GetMinIdealImageSize
,
2237 Videowindow_GetMaxIdealImageSize
,
2238 Videowindow_GetRestorePosition
,
2239 Videowindow_HideCursor
,
2240 Videowindow_IsCursorHidden