2 * Video Renderer (Fullscreen and Windowed using Direct Draw)
4 * Copyright 2004 Christian Costa
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #define NONAMELESSSTRUCT
24 #define NONAMELESSUNION
25 #include "quartz_private.h"
26 #include "control_private.h"
41 #include "wine/unicode.h"
42 #include "wine/debug.h"
44 WINE_DEFAULT_DEBUG_CHANNEL(quartz
);
46 static BOOL wnd_class_registered
= FALSE
;
48 static const WCHAR wcsInputPinName
[] = {'i','n','p','u','t',' ','p','i','n',0};
50 static const IBaseFilterVtbl VideoRenderer_Vtbl
;
51 static const IUnknownVtbl IInner_VTable
;
52 static const IBasicVideoVtbl IBasicVideo_VTable
;
53 static const IVideoWindowVtbl IVideoWindow_VTable
;
54 static const IPinVtbl VideoRenderer_InputPin_Vtbl
;
56 typedef struct VideoRendererImpl
58 const IBaseFilterVtbl
* lpVtbl
;
59 const IBasicVideoVtbl
* IBasicVideo_vtbl
;
60 const IVideoWindowVtbl
* IVideoWindow_vtbl
;
61 const IUnknownVtbl
* IInner_vtbl
;
64 CRITICAL_SECTION csFilter
;
66 REFERENCE_TIME rtStreamStart
;
67 IReferenceClock
* pClock
;
68 FILTER_INFO filterInfo
;
90 REFERENCE_TIME rtLastStop
;
91 MediaSeekingImpl mediaSeeking
;
93 /* During pause we can hold a single sample, for use in GetCurrentImage */
94 IMediaSample
*sample_held
;
97 static LRESULT CALLBACK
VideoWndProcA(HWND hwnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
99 VideoRendererImpl
* pVideoRenderer
= (VideoRendererImpl
*)GetWindowLongPtrW(hwnd
, 0);
100 LPRECT lprect
= (LPRECT
)lParam
;
102 if (pVideoRenderer
&& pVideoRenderer
->hWndMsgDrain
)
108 case WM_LBUTTONDBLCLK
:
111 case WM_MBUTTONDBLCLK
:
114 case WM_MOUSEACTIVATE
:
116 case WM_NCLBUTTONDBLCLK
:
117 case WM_NCLBUTTONDOWN
:
119 case WM_NCMBUTTONDBLCLK
:
120 case WM_NCMBUTTONDOWN
:
123 case WM_NCRBUTTONDBLCLK
:
124 case WM_NCRBUTTONDOWN
:
126 case WM_RBUTTONDBLCLK
:
129 PostMessageA(pVideoRenderer
->hWndMsgDrain
, uMsg
, wParam
, lParam
);
139 /* TRACE("WM_SIZING %d %d %d %d\n", lprect->left, lprect->top, lprect->right, lprect->bottom); */
140 SetWindowPos(hwnd
, NULL
, lprect
->left
, lprect
->top
, lprect
->right
- lprect
->left
, lprect
->bottom
- lprect
->top
, SWP_NOZORDER
);
141 GetClientRect(hwnd
, &pVideoRenderer
->DestRect
);
142 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
143 pVideoRenderer
->DestRect
.left
,
144 pVideoRenderer
->DestRect
.top
,
145 pVideoRenderer
->DestRect
.right
- pVideoRenderer
->DestRect
.left
,
146 pVideoRenderer
->DestRect
.bottom
- pVideoRenderer
->DestRect
.top
);
149 TRACE("WM_SIZE %d %d\n", LOWORD(lParam
), HIWORD(lParam
));
150 GetClientRect(hwnd
, &pVideoRenderer
->DestRect
);
151 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
152 pVideoRenderer
->DestRect
.left
,
153 pVideoRenderer
->DestRect
.top
,
154 pVideoRenderer
->DestRect
.right
- pVideoRenderer
->DestRect
.left
,
155 pVideoRenderer
->DestRect
.bottom
- pVideoRenderer
->DestRect
.top
);
158 return DefWindowProcA(hwnd
, uMsg
, wParam
, lParam
);
163 static BOOL
CreateRenderingWindow(VideoRendererImpl
* This
)
167 TRACE("(%p)->()\n", This
);
170 winclass
.lpfnWndProc
= VideoWndProcA
;
171 winclass
.cbClsExtra
= 0;
172 winclass
.cbWndExtra
= sizeof(VideoRendererImpl
*);
173 winclass
.hInstance
= NULL
;
174 winclass
.hIcon
= NULL
;
175 winclass
.hCursor
= NULL
;
176 winclass
.hbrBackground
= GetStockObject(BLACK_BRUSH
);
177 winclass
.lpszMenuName
= NULL
;
178 winclass
.lpszClassName
= "Wine ActiveMovie Class";
180 if (!wnd_class_registered
)
182 if (!RegisterClassA(&winclass
))
184 ERR("Unable to register window %u\n", GetLastError());
187 wnd_class_registered
= TRUE
;
190 This
->hWnd
= CreateWindowExA(0, "Wine ActiveMovie Class", "Wine ActiveMovie Window", WS_SIZEBOX
,
191 CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
, NULL
,
196 ERR("Unable to create window\n");
200 SetWindowLongPtrW(This
->hWnd
, 0, (LONG_PTR
)This
);
205 static DWORD WINAPI
MessageLoop(LPVOID lpParameter
)
207 VideoRendererImpl
* This
= lpParameter
;
211 TRACE("Starting message loop\n");
213 if (!CreateRenderingWindow(This
))
215 This
->ThreadResult
= FALSE
;
216 SetEvent(This
->hEvent
);
220 This
->ThreadResult
= TRUE
;
221 SetEvent(This
->hEvent
);
223 while ((fGotMessage
= GetMessageA(&msg
, NULL
, 0, 0)) != 0 && fGotMessage
!= -1)
225 TranslateMessage(&msg
);
226 DispatchMessageA(&msg
);
229 TRACE("End of message loop\n");
234 static BOOL
CreateRenderingSubsystem(VideoRendererImpl
* This
)
236 This
->hEvent
= CreateEventW(NULL
, TRUE
, FALSE
, NULL
);
240 This
->hThread
= CreateThread(NULL
, 0, MessageLoop
, This
, 0, &This
->ThreadID
);
243 CloseHandle(This
->hEvent
);
247 WaitForSingleObject(This
->hEvent
, INFINITE
);
249 if (!This
->ThreadResult
)
251 CloseHandle(This
->hEvent
);
252 CloseHandle(This
->hThread
);
259 static DWORD
VideoRenderer_SendSampleData(VideoRendererImpl
* This
, LPBYTE data
, DWORD size
)
265 BITMAPINFOHEADER
*bmiHeader
;
267 TRACE("(%p)->(%p, %d)\n", This
, data
, size
);
269 sdesc
.dwSize
= sizeof(sdesc
);
270 hr
= IPin_ConnectionMediaType((IPin
*)This
->pInputPin
, &amt
);
272 ERR("Unable to retrieve media type\n");
276 if (IsEqualIID(&amt
.formattype
, &FORMAT_VideoInfo
))
278 bmiHeader
= &((VIDEOINFOHEADER
*)amt
.pbFormat
)->bmiHeader
;
280 else if (IsEqualIID(&amt
.formattype
, &FORMAT_VideoInfo2
))
282 bmiHeader
= &((VIDEOINFOHEADER2
*)amt
.pbFormat
)->bmiHeader
;
286 FIXME("Unknown type %s\n", debugstr_guid(&amt
.subtype
));
287 return VFW_E_RUNTIME_ERROR
;
291 TRACE("biSize = %d\n", bmiHeader
->biSize
);
292 TRACE("biWidth = %d\n", bmiHeader
->biWidth
);
293 TRACE("biHeight = %d\n", bmiHeader
->biHeight
);
294 TRACE("biPlanes = %d\n", bmiHeader
->biPlanes
);
295 TRACE("biBitCount = %d\n", bmiHeader
->biBitCount
);
296 TRACE("biCompression = %s\n", debugstr_an((LPSTR
)&(bmiHeader
->biCompression
), 4));
297 TRACE("biSizeImage = %d\n", bmiHeader
->biSizeImage
);
301 if (!This
->WindowPos
.right
|| !This
->WindowPos
.bottom
)
302 This
->WindowPos
= This
->SourceRect
;
304 TRACE("WindowPos: %d %d %d %d\n", This
->WindowPos
.left
, This
->WindowPos
.top
, This
->WindowPos
.right
, This
->WindowPos
.bottom
);
305 SetWindowPos(This
->hWnd
, NULL
,
306 This
->WindowPos
.left
,
308 This
->WindowPos
.right
- This
->WindowPos
.left
,
309 This
->WindowPos
.bottom
- This
->WindowPos
.top
,
310 SWP_NOZORDER
|SWP_NOMOVE
);
312 GetClientRect(This
->hWnd
, &This
->DestRect
);
316 hDC
= GetDC(This
->hWnd
);
319 ERR("Cannot get DC from window!\n");
323 TRACE("Src Rect: %d %d %d %d\n", This
->SourceRect
.left
, This
->SourceRect
.top
, This
->SourceRect
.right
, This
->SourceRect
.bottom
);
324 TRACE("Dst Rect: %d %d %d %d\n", This
->DestRect
.left
, This
->DestRect
.top
, This
->DestRect
.right
, This
->DestRect
.bottom
);
326 StretchDIBits(hDC
, This
->DestRect
.left
, This
->DestRect
.top
, This
->DestRect
.right
-This
->DestRect
.left
,
327 This
->DestRect
.bottom
- This
->DestRect
.top
, This
->SourceRect
.left
, This
->SourceRect
.top
,
328 This
->SourceRect
.right
- This
->SourceRect
.left
, This
->SourceRect
.bottom
- This
->SourceRect
.top
,
329 data
, (BITMAPINFO
*)bmiHeader
, DIB_RGB_COLORS
, SRCCOPY
);
331 ReleaseDC(This
->hWnd
, hDC
);
333 ShowWindow(This
->hWnd
, SW_SHOW
);
338 static HRESULT
VideoRenderer_Sample(LPVOID iface
, IMediaSample
* pSample
)
340 VideoRendererImpl
*This
= iface
;
341 LPBYTE pbSrcStream
= NULL
;
342 long cbSrcStream
= 0;
343 REFERENCE_TIME tStart
, tStop
;
346 TRACE("(%p)->(%p)\n", iface
, pSample
);
348 EnterCriticalSection(&This
->csFilter
);
350 if (This
->pInputPin
->flushing
|| This
->pInputPin
->end_of_stream
)
352 LeaveCriticalSection(&This
->csFilter
);
356 if (This
->state
== State_Stopped
)
358 LeaveCriticalSection(&This
->csFilter
);
359 return VFW_E_WRONG_STATE
;
362 hr
= IMediaSample_GetTime(pSample
, &tStart
, &tStop
);
364 ERR("Cannot get sample time (%x)\n", hr
);
366 if (This
->rtLastStop
!= tStart
)
368 if (IMediaSample_IsDiscontinuity(pSample
) == S_FALSE
)
369 ERR("Unexpected discontinuity: Last: %u.%03u, tStart: %u.%03u\n",
370 (DWORD
)(This
->rtLastStop
/ 10000000),
371 (DWORD
)((This
->rtLastStop
/ 10000)%1000),
372 (DWORD
)(tStart
/ 10000000), (DWORD
)((tStart
/ 10000)%1000));
373 This
->rtLastStop
= tStart
;
376 /* Preroll means the sample isn't shown, this is used for key frames and things like that */
377 if (IMediaSample_IsPreroll(pSample
) == S_OK
)
379 This
->rtLastStop
= tStop
;
380 LeaveCriticalSection(&This
->csFilter
);
384 hr
= IMediaSample_GetPointer(pSample
, &pbSrcStream
);
387 ERR("Cannot get pointer to sample data (%x)\n", hr
);
388 LeaveCriticalSection(&This
->csFilter
);
392 cbSrcStream
= IMediaSample_GetActualDataLength(pSample
);
394 TRACE("val %p %ld\n", pbSrcStream
, cbSrcStream
);
396 #if 0 /* For debugging purpose */
399 for(i
= 0; i
< cbSrcStream
; i
++)
401 if ((i
!=0) && !(i
%16))
403 TRACE("%02x ", pbSrcStream
[i
]);
409 SetEvent(This
->hEvent
);
410 if (This
->state
== State_Paused
)
412 This
->sample_held
= pSample
;
413 LeaveCriticalSection(&This
->csFilter
);
414 WaitForSingleObject(This
->blocked
, INFINITE
);
415 EnterCriticalSection(&This
->csFilter
);
416 This
->sample_held
= NULL
;
417 if (This
->state
== State_Paused
)
420 LeaveCriticalSection(&This
->csFilter
);
423 if (This
->state
== State_Stopped
)
425 LeaveCriticalSection(&This
->csFilter
);
426 return VFW_E_WRONG_STATE
;
430 if (This
->pClock
&& This
->state
== State_Running
)
432 REFERENCE_TIME time
, trefstart
, trefstop
;
435 /* Perhaps I <SHOULD> use the reference clock AdviseTime function here
436 * I'm not going to! When I tried, it seemed to generate lag and
437 * it caused instability.
439 IReferenceClock_GetTime(This
->pClock
, &time
);
441 trefstart
= This
->rtStreamStart
;
442 trefstop
= (REFERENCE_TIME
)((double)(tStop
- tStart
) / This
->pInputPin
->dRate
) + This
->rtStreamStart
;
443 delta
= (LONG
)((trefstart
-time
)/10000);
444 This
->rtStreamStart
= trefstop
;
445 This
->rtLastStop
= tStop
;
449 TRACE("Sleeping for %u ms\n", delta
);
452 else if (time
> trefstop
)
454 TRACE("Dropping sample: Time: %u.%03u ms trefstop: %u.%03u ms!\n",
455 (DWORD
)(time
/ 10000000), (DWORD
)((time
/ 10000)%1000),
456 (DWORD
)(trefstop
/ 10000000), (DWORD
)((trefstop
/ 10000)%1000) );
457 This
->rtLastStop
= tStop
;
458 LeaveCriticalSection(&This
->csFilter
);
462 This
->rtLastStop
= tStop
;
464 VideoRenderer_SendSampleData(This
, pbSrcStream
, cbSrcStream
);
466 LeaveCriticalSection(&This
->csFilter
);
470 static HRESULT
VideoRenderer_QueryAccept(LPVOID iface
, const AM_MEDIA_TYPE
* pmt
)
472 if (!IsEqualIID(&pmt
->majortype
, &MEDIATYPE_Video
))
475 if (IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB32
) ||
476 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB24
) ||
477 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB565
) ||
478 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB8
))
480 VideoRendererImpl
* This
= iface
;
482 if (IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo
))
484 VIDEOINFOHEADER
*format
= (VIDEOINFOHEADER
*)pmt
->pbFormat
;
485 This
->SourceRect
.left
= 0;
486 This
->SourceRect
.top
= 0;
487 This
->SourceRect
.right
= This
->VideoWidth
= format
->bmiHeader
.biWidth
;
488 This
->SourceRect
.bottom
= This
->VideoHeight
= format
->bmiHeader
.biHeight
;
490 else if (IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo2
))
492 VIDEOINFOHEADER2
*format2
= (VIDEOINFOHEADER2
*)pmt
->pbFormat
;
494 This
->SourceRect
.left
= 0;
495 This
->SourceRect
.top
= 0;
496 This
->SourceRect
.right
= This
->VideoWidth
= format2
->bmiHeader
.biWidth
;
497 This
->SourceRect
.bottom
= This
->VideoHeight
= format2
->bmiHeader
.biHeight
;
501 WARN("Format type %s not supported\n", debugstr_guid(&pmt
->formattype
));
509 static inline VideoRendererImpl
*impl_from_IMediaSeeking( IMediaSeeking
*iface
)
511 return (VideoRendererImpl
*)((char*)iface
- FIELD_OFFSET(VideoRendererImpl
, mediaSeeking
.lpVtbl
));
514 static HRESULT WINAPI
VideoRendererImpl_Seeking_QueryInterface(IMediaSeeking
* iface
, REFIID riid
, LPVOID
* ppv
)
516 VideoRendererImpl
*This
= impl_from_IMediaSeeking(iface
);
518 return IUnknown_QueryInterface((IUnknown
*)This
, riid
, ppv
);
521 static ULONG WINAPI
VideoRendererImpl_Seeking_AddRef(IMediaSeeking
* iface
)
523 VideoRendererImpl
*This
= impl_from_IMediaSeeking(iface
);
525 return IUnknown_AddRef((IUnknown
*)This
);
528 static ULONG WINAPI
VideoRendererImpl_Seeking_Release(IMediaSeeking
* iface
)
530 VideoRendererImpl
*This
= impl_from_IMediaSeeking(iface
);
532 return IUnknown_Release((IUnknown
*)This
);
535 static const IMediaSeekingVtbl VideoRendererImpl_Seeking_Vtbl
=
537 VideoRendererImpl_Seeking_QueryInterface
,
538 VideoRendererImpl_Seeking_AddRef
,
539 VideoRendererImpl_Seeking_Release
,
540 MediaSeekingImpl_GetCapabilities
,
541 MediaSeekingImpl_CheckCapabilities
,
542 MediaSeekingImpl_IsFormatSupported
,
543 MediaSeekingImpl_QueryPreferredFormat
,
544 MediaSeekingImpl_GetTimeFormat
,
545 MediaSeekingImpl_IsUsingTimeFormat
,
546 MediaSeekingImpl_SetTimeFormat
,
547 MediaSeekingImpl_GetDuration
,
548 MediaSeekingImpl_GetStopPosition
,
549 MediaSeekingImpl_GetCurrentPosition
,
550 MediaSeekingImpl_ConvertTimeFormat
,
551 MediaSeekingImpl_SetPositions
,
552 MediaSeekingImpl_GetPositions
,
553 MediaSeekingImpl_GetAvailable
,
554 MediaSeekingImpl_SetRate
,
555 MediaSeekingImpl_GetRate
,
556 MediaSeekingImpl_GetPreroll
559 static HRESULT
VideoRendererImpl_Change(IBaseFilter
*iface
)
561 TRACE("(%p)->()\n", iface
);
565 HRESULT
VideoRenderer_create(IUnknown
* pUnkOuter
, LPVOID
* ppv
)
569 VideoRendererImpl
* pVideoRenderer
;
571 TRACE("(%p, %p)\n", pUnkOuter
, ppv
);
575 pVideoRenderer
= CoTaskMemAlloc(sizeof(VideoRendererImpl
));
576 pVideoRenderer
->pUnkOuter
= pUnkOuter
;
577 pVideoRenderer
->bUnkOuterValid
= FALSE
;
578 pVideoRenderer
->bAggregatable
= FALSE
;
579 pVideoRenderer
->IInner_vtbl
= &IInner_VTable
;
581 pVideoRenderer
->lpVtbl
= &VideoRenderer_Vtbl
;
582 pVideoRenderer
->IBasicVideo_vtbl
= &IBasicVideo_VTable
;
583 pVideoRenderer
->IVideoWindow_vtbl
= &IVideoWindow_VTable
;
585 pVideoRenderer
->refCount
= 1;
586 InitializeCriticalSection(&pVideoRenderer
->csFilter
);
587 pVideoRenderer
->csFilter
.DebugInfo
->Spare
[0] = (DWORD_PTR
)(__FILE__
": VideoRendererImpl.csFilter");
588 pVideoRenderer
->state
= State_Stopped
;
589 pVideoRenderer
->pClock
= NULL
;
590 pVideoRenderer
->init
= 0;
591 pVideoRenderer
->AutoShow
= 1;
592 pVideoRenderer
->rtLastStop
= -1;
593 ZeroMemory(&pVideoRenderer
->filterInfo
, sizeof(FILTER_INFO
));
594 ZeroMemory(&pVideoRenderer
->SourceRect
, sizeof(RECT
));
595 ZeroMemory(&pVideoRenderer
->DestRect
, sizeof(RECT
));
596 ZeroMemory(&pVideoRenderer
->WindowPos
, sizeof(RECT
));
597 pVideoRenderer
->hWndMsgDrain
= NULL
;
599 /* construct input pin */
600 piInput
.dir
= PINDIR_INPUT
;
601 piInput
.pFilter
= (IBaseFilter
*)pVideoRenderer
;
602 lstrcpynW(piInput
.achName
, wcsInputPinName
, sizeof(piInput
.achName
) / sizeof(piInput
.achName
[0]));
604 hr
= InputPin_Construct(&VideoRenderer_InputPin_Vtbl
, &piInput
, VideoRenderer_Sample
, (LPVOID
)pVideoRenderer
, VideoRenderer_QueryAccept
, NULL
, &pVideoRenderer
->csFilter
, NULL
, (IPin
**)&pVideoRenderer
->pInputPin
);
608 MediaSeekingImpl_Init((IBaseFilter
*)pVideoRenderer
, VideoRendererImpl_Change
, VideoRendererImpl_Change
, VideoRendererImpl_Change
, &pVideoRenderer
->mediaSeeking
, &pVideoRenderer
->csFilter
);
609 pVideoRenderer
->mediaSeeking
.lpVtbl
= &VideoRendererImpl_Seeking_Vtbl
;
611 pVideoRenderer
->sample_held
= NULL
;
612 *ppv
= pVideoRenderer
;
616 pVideoRenderer
->csFilter
.DebugInfo
->Spare
[0] = 0;
617 DeleteCriticalSection(&pVideoRenderer
->csFilter
);
618 CoTaskMemFree(pVideoRenderer
);
621 if (!CreateRenderingSubsystem(pVideoRenderer
))
624 pVideoRenderer
->blocked
= CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
625 if (!pVideoRenderer
->blocked
)
627 hr
= HRESULT_FROM_WIN32(GetLastError());
628 IUnknown_Release((IUnknown
*)pVideoRenderer
);
634 HRESULT
VideoRendererDefault_create(IUnknown
* pUnkOuter
, LPVOID
* ppv
)
636 /* TODO: Attempt to use the VMR-7 renderer instead when possible */
637 return VideoRenderer_create(pUnkOuter
, ppv
);
640 static HRESULT WINAPI
VideoRendererInner_QueryInterface(IUnknown
* iface
, REFIID riid
, LPVOID
* ppv
)
642 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
643 TRACE("(%p/%p)->(%s, %p)\n", This
, iface
, qzdebugstr_guid(riid
), ppv
);
645 if (This
->bAggregatable
)
646 This
->bUnkOuterValid
= TRUE
;
650 if (IsEqualIID(riid
, &IID_IUnknown
))
651 *ppv
= &This
->IInner_vtbl
;
652 else if (IsEqualIID(riid
, &IID_IPersist
))
654 else if (IsEqualIID(riid
, &IID_IMediaFilter
))
656 else if (IsEqualIID(riid
, &IID_IBaseFilter
))
658 else if (IsEqualIID(riid
, &IID_IBasicVideo
))
659 *ppv
= &This
->IBasicVideo_vtbl
;
660 else if (IsEqualIID(riid
, &IID_IVideoWindow
))
661 *ppv
= &This
->IVideoWindow_vtbl
;
662 else if (IsEqualIID(riid
, &IID_IMediaSeeking
))
663 *ppv
= &This
->mediaSeeking
;
667 IUnknown_AddRef((IUnknown
*)(*ppv
));
671 if (!IsEqualIID(riid
, &IID_IPin
))
672 FIXME("No interface for %s!\n", qzdebugstr_guid(riid
));
674 return E_NOINTERFACE
;
677 static ULONG WINAPI
VideoRendererInner_AddRef(IUnknown
* iface
)
679 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
680 ULONG refCount
= InterlockedIncrement(&This
->refCount
);
682 TRACE("(%p/%p)->() AddRef from %d\n", This
, iface
, refCount
- 1);
687 static ULONG WINAPI
VideoRendererInner_Release(IUnknown
* iface
)
689 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
690 ULONG refCount
= InterlockedDecrement(&This
->refCount
);
692 TRACE("(%p/%p)->() Release from %d\n", This
, iface
, refCount
+ 1);
698 DestroyWindow(This
->hWnd
);
699 PostThreadMessageA(This
->ThreadID
, WM_QUIT
, 0, 0);
700 WaitForSingleObject(This
->hThread
, INFINITE
);
701 CloseHandle(This
->hThread
);
702 CloseHandle(This
->hEvent
);
705 IReferenceClock_Release(This
->pClock
);
707 if (SUCCEEDED(IPin_ConnectedTo((IPin
*)This
->pInputPin
, &pConnectedTo
)))
709 IPin_Disconnect(pConnectedTo
);
710 IPin_Release(pConnectedTo
);
712 IPin_Disconnect((IPin
*)This
->pInputPin
);
714 IPin_Release((IPin
*)This
->pInputPin
);
718 This
->csFilter
.DebugInfo
->Spare
[0] = 0;
719 DeleteCriticalSection(&This
->csFilter
);
721 TRACE("Destroying Video Renderer\n");
730 static const IUnknownVtbl IInner_VTable
=
732 VideoRendererInner_QueryInterface
,
733 VideoRendererInner_AddRef
,
734 VideoRendererInner_Release
737 static HRESULT WINAPI
VideoRenderer_QueryInterface(IBaseFilter
* iface
, REFIID riid
, LPVOID
* ppv
)
739 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
741 if (This
->bAggregatable
)
742 This
->bUnkOuterValid
= TRUE
;
746 if (This
->bAggregatable
)
747 return IUnknown_QueryInterface(This
->pUnkOuter
, riid
, ppv
);
749 if (IsEqualIID(riid
, &IID_IUnknown
))
753 IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
754 hr
= IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
755 IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
756 This
->bAggregatable
= TRUE
;
761 return E_NOINTERFACE
;
764 return IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
767 static ULONG WINAPI
VideoRenderer_AddRef(IBaseFilter
* iface
)
769 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
771 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
772 return IUnknown_AddRef(This
->pUnkOuter
);
773 return IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
776 static ULONG WINAPI
VideoRenderer_Release(IBaseFilter
* iface
)
778 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
780 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
781 return IUnknown_Release(This
->pUnkOuter
);
782 return IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
785 /** IPersist methods **/
787 static HRESULT WINAPI
VideoRenderer_GetClassID(IBaseFilter
* iface
, CLSID
* pClsid
)
789 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
791 TRACE("(%p/%p)->(%p)\n", This
, iface
, pClsid
);
793 *pClsid
= CLSID_VideoRenderer
;
798 /** IMediaFilter methods **/
800 static HRESULT WINAPI
VideoRenderer_Stop(IBaseFilter
* iface
)
802 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
804 TRACE("(%p/%p)->()\n", This
, iface
);
806 EnterCriticalSection(&This
->csFilter
);
808 This
->state
= State_Stopped
;
809 SetEvent(This
->hEvent
);
810 SetEvent(This
->blocked
);
812 LeaveCriticalSection(&This
->csFilter
);
817 static HRESULT WINAPI
VideoRenderer_Pause(IBaseFilter
* iface
)
819 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
821 TRACE("(%p/%p)->()\n", This
, iface
);
823 EnterCriticalSection(&This
->csFilter
);
824 if (This
->state
!= State_Paused
)
826 if (This
->state
== State_Stopped
)
828 This
->pInputPin
->end_of_stream
= 0;
829 ResetEvent(This
->hEvent
);
832 This
->state
= State_Paused
;
833 ResetEvent(This
->blocked
);
835 LeaveCriticalSection(&This
->csFilter
);
840 static HRESULT WINAPI
VideoRenderer_Run(IBaseFilter
* iface
, REFERENCE_TIME tStart
)
842 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
844 TRACE("(%p/%p)->(%s)\n", This
, iface
, wine_dbgstr_longlong(tStart
));
846 EnterCriticalSection(&This
->csFilter
);
847 if (This
->state
!= State_Running
)
849 if (This
->state
== State_Stopped
)
851 This
->pInputPin
->end_of_stream
= 0;
852 ResetEvent(This
->hEvent
);
854 SetEvent(This
->blocked
);
856 This
->rtStreamStart
= tStart
;
857 This
->state
= State_Running
;
859 LeaveCriticalSection(&This
->csFilter
);
864 static HRESULT WINAPI
VideoRenderer_GetState(IBaseFilter
* iface
, DWORD dwMilliSecsTimeout
, FILTER_STATE
*pState
)
866 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
869 TRACE("(%p/%p)->(%d, %p)\n", This
, iface
, dwMilliSecsTimeout
, pState
);
871 if (WaitForSingleObject(This
->hEvent
, dwMilliSecsTimeout
) == WAIT_TIMEOUT
)
872 hr
= VFW_S_STATE_INTERMEDIATE
;
876 EnterCriticalSection(&This
->csFilter
);
878 *pState
= This
->state
;
880 LeaveCriticalSection(&This
->csFilter
);
885 static HRESULT WINAPI
VideoRenderer_SetSyncSource(IBaseFilter
* iface
, IReferenceClock
*pClock
)
887 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
889 TRACE("(%p/%p)->(%p)\n", This
, iface
, pClock
);
891 EnterCriticalSection(&This
->csFilter
);
894 IReferenceClock_Release(This
->pClock
);
895 This
->pClock
= pClock
;
897 IReferenceClock_AddRef(This
->pClock
);
899 LeaveCriticalSection(&This
->csFilter
);
904 static HRESULT WINAPI
VideoRenderer_GetSyncSource(IBaseFilter
* iface
, IReferenceClock
**ppClock
)
906 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
908 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppClock
);
910 EnterCriticalSection(&This
->csFilter
);
912 *ppClock
= This
->pClock
;
914 IReferenceClock_AddRef(This
->pClock
);
916 LeaveCriticalSection(&This
->csFilter
);
921 /** IBaseFilter implementation **/
923 static HRESULT
VideoRenderer_GetPin(IBaseFilter
*iface
, ULONG pos
, IPin
**pin
, DWORD
*lastsynctick
)
925 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
927 /* Our pins are static, not changing so setting static tick count is ok */
933 *pin
= (IPin
*)This
->pInputPin
;
938 static HRESULT WINAPI
VideoRenderer_EnumPins(IBaseFilter
* iface
, IEnumPins
**ppEnum
)
940 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
942 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppEnum
);
944 return IEnumPinsImpl_Construct(ppEnum
, VideoRenderer_GetPin
, iface
);
947 static HRESULT WINAPI
VideoRenderer_FindPin(IBaseFilter
* iface
, LPCWSTR Id
, IPin
**ppPin
)
949 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
951 FIXME("(%p/%p)->(%p,%p): stub !!!\n", This
, iface
, debugstr_w(Id
), ppPin
);
953 /* FIXME: critical section */
958 static HRESULT WINAPI
VideoRenderer_QueryFilterInfo(IBaseFilter
* iface
, FILTER_INFO
*pInfo
)
960 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
962 TRACE("(%p/%p)->(%p)\n", This
, iface
, pInfo
);
964 strcpyW(pInfo
->achName
, This
->filterInfo
.achName
);
965 pInfo
->pGraph
= This
->filterInfo
.pGraph
;
968 IFilterGraph_AddRef(pInfo
->pGraph
);
973 static HRESULT WINAPI
VideoRenderer_JoinFilterGraph(IBaseFilter
* iface
, IFilterGraph
*pGraph
, LPCWSTR pName
)
975 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
977 TRACE("(%p/%p)->(%p, %s)\n", This
, iface
, pGraph
, debugstr_w(pName
));
979 EnterCriticalSection(&This
->csFilter
);
982 strcpyW(This
->filterInfo
.achName
, pName
);
984 *This
->filterInfo
.achName
= '\0';
985 This
->filterInfo
.pGraph
= pGraph
; /* NOTE: do NOT increase ref. count */
987 LeaveCriticalSection(&This
->csFilter
);
992 static HRESULT WINAPI
VideoRenderer_QueryVendorInfo(IBaseFilter
* iface
, LPWSTR
*pVendorInfo
)
994 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
995 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVendorInfo
);
999 static const IBaseFilterVtbl VideoRenderer_Vtbl
=
1001 VideoRenderer_QueryInterface
,
1002 VideoRenderer_AddRef
,
1003 VideoRenderer_Release
,
1004 VideoRenderer_GetClassID
,
1006 VideoRenderer_Pause
,
1008 VideoRenderer_GetState
,
1009 VideoRenderer_SetSyncSource
,
1010 VideoRenderer_GetSyncSource
,
1011 VideoRenderer_EnumPins
,
1012 VideoRenderer_FindPin
,
1013 VideoRenderer_QueryFilterInfo
,
1014 VideoRenderer_JoinFilterGraph
,
1015 VideoRenderer_QueryVendorInfo
1018 static HRESULT WINAPI
VideoRenderer_InputPin_EndOfStream(IPin
* iface
)
1020 InputPin
* This
= (InputPin
*)iface
;
1021 IMediaEventSink
* pEventSink
;
1024 TRACE("(%p/%p)->()\n", This
, iface
);
1026 hr
= IFilterGraph_QueryInterface(((VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
)->filterInfo
.pGraph
, &IID_IMediaEventSink
, (LPVOID
*)&pEventSink
);
1029 hr
= IMediaEventSink_Notify(pEventSink
, EC_COMPLETE
, S_OK
, 0);
1030 IMediaEventSink_Release(pEventSink
);
1036 static HRESULT WINAPI
VideoRenderer_InputPin_BeginFlush(IPin
* iface
)
1038 InputPin
* This
= (InputPin
*)iface
;
1039 VideoRendererImpl
*pVideoRenderer
= (VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
;
1042 TRACE("(%p/%p)->()\n", This
, iface
);
1044 EnterCriticalSection(This
->pin
.pCritSec
);
1045 if (pVideoRenderer
->state
== State_Paused
)
1046 SetEvent(pVideoRenderer
->blocked
);
1048 hr
= InputPin_BeginFlush(iface
);
1049 LeaveCriticalSection(This
->pin
.pCritSec
);
1054 static HRESULT WINAPI
VideoRenderer_InputPin_EndFlush(IPin
* iface
)
1056 InputPin
* This
= (InputPin
*)iface
;
1057 VideoRendererImpl
*pVideoRenderer
= (VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
;
1060 TRACE("(%p/%p)->()\n", This
, iface
);
1062 EnterCriticalSection(This
->pin
.pCritSec
);
1063 if (pVideoRenderer
->state
== State_Paused
)
1064 ResetEvent(pVideoRenderer
->blocked
);
1066 hr
= InputPin_EndFlush(iface
);
1067 LeaveCriticalSection(This
->pin
.pCritSec
);
1072 static const IPinVtbl VideoRenderer_InputPin_Vtbl
=
1074 InputPin_QueryInterface
,
1078 InputPin_ReceiveConnection
,
1079 IPinImpl_Disconnect
,
1080 IPinImpl_ConnectedTo
,
1081 IPinImpl_ConnectionMediaType
,
1082 IPinImpl_QueryPinInfo
,
1083 IPinImpl_QueryDirection
,
1085 IPinImpl_QueryAccept
,
1086 IPinImpl_EnumMediaTypes
,
1087 IPinImpl_QueryInternalConnections
,
1088 VideoRenderer_InputPin_EndOfStream
,
1089 VideoRenderer_InputPin_BeginFlush
,
1090 VideoRenderer_InputPin_EndFlush
,
1094 /*** IUnknown methods ***/
1095 static HRESULT WINAPI
Basicvideo_QueryInterface(IBasicVideo
*iface
,
1098 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1100 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
1102 return VideoRenderer_QueryInterface((IBaseFilter
*)This
, riid
, ppvObj
);
1105 static ULONG WINAPI
Basicvideo_AddRef(IBasicVideo
*iface
) {
1106 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1108 TRACE("(%p/%p)->()\n", This
, iface
);
1110 return VideoRenderer_AddRef((IBaseFilter
*)This
);
1113 static ULONG WINAPI
Basicvideo_Release(IBasicVideo
*iface
) {
1114 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1116 TRACE("(%p/%p)->()\n", This
, iface
);
1118 return VideoRenderer_Release((IBaseFilter
*)This
);
1121 /*** IDispatch methods ***/
1122 static HRESULT WINAPI
Basicvideo_GetTypeInfoCount(IBasicVideo
*iface
,
1124 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1126 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
1131 static HRESULT WINAPI
Basicvideo_GetTypeInfo(IBasicVideo
*iface
,
1134 ITypeInfo
**ppTInfo
) {
1135 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1137 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
1142 static HRESULT WINAPI
Basicvideo_GetIDsOfNames(IBasicVideo
*iface
,
1148 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1150 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1155 static HRESULT WINAPI
Basicvideo_Invoke(IBasicVideo
*iface
,
1156 DISPID dispIdMember
,
1160 DISPPARAMS
*pDispParams
,
1162 EXCEPINFO
*pExepInfo
,
1164 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1166 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
);
1171 /*** IBasicVideo methods ***/
1172 static HRESULT WINAPI
Basicvideo_get_AvgTimePerFrame(IBasicVideo
*iface
,
1173 REFTIME
*pAvgTimePerFrame
) {
1174 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1176 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pAvgTimePerFrame
);
1181 static HRESULT WINAPI
Basicvideo_get_BitRate(IBasicVideo
*iface
,
1183 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1185 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBitRate
);
1190 static HRESULT WINAPI
Basicvideo_get_BitErrorRate(IBasicVideo
*iface
,
1191 long *pBitErrorRate
) {
1192 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1194 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBitErrorRate
);
1199 static HRESULT WINAPI
Basicvideo_get_VideoWidth(IBasicVideo
*iface
,
1200 long *pVideoWidth
) {
1201 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1203 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoWidth
);
1205 *pVideoWidth
= This
->VideoWidth
;
1210 static HRESULT WINAPI
Basicvideo_get_VideoHeight(IBasicVideo
*iface
,
1211 long *pVideoHeight
) {
1212 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1214 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoHeight
);
1216 *pVideoHeight
= This
->VideoHeight
;
1221 static HRESULT WINAPI
Basicvideo_put_SourceLeft(IBasicVideo
*iface
,
1223 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1225 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceLeft
);
1227 This
->SourceRect
.left
= SourceLeft
;
1232 static HRESULT WINAPI
Basicvideo_get_SourceLeft(IBasicVideo
*iface
,
1233 long *pSourceLeft
) {
1234 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1236 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceLeft
);
1238 *pSourceLeft
= This
->SourceRect
.left
;
1243 static HRESULT WINAPI
Basicvideo_put_SourceWidth(IBasicVideo
*iface
,
1245 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1247 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceWidth
);
1249 This
->SourceRect
.right
= This
->SourceRect
.left
+ SourceWidth
;
1254 static HRESULT WINAPI
Basicvideo_get_SourceWidth(IBasicVideo
*iface
,
1255 long *pSourceWidth
) {
1256 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1258 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceWidth
);
1260 *pSourceWidth
= This
->SourceRect
.right
- This
->SourceRect
.left
;
1265 static HRESULT WINAPI
Basicvideo_put_SourceTop(IBasicVideo
*iface
,
1267 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1269 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceTop
);
1271 This
->SourceRect
.top
= SourceTop
;
1276 static HRESULT WINAPI
Basicvideo_get_SourceTop(IBasicVideo
*iface
,
1278 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1280 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceTop
);
1282 *pSourceTop
= This
->SourceRect
.top
;
1287 static HRESULT WINAPI
Basicvideo_put_SourceHeight(IBasicVideo
*iface
,
1288 long SourceHeight
) {
1289 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1291 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceHeight
);
1293 This
->SourceRect
.bottom
= This
->SourceRect
.top
+ SourceHeight
;
1298 static HRESULT WINAPI
Basicvideo_get_SourceHeight(IBasicVideo
*iface
,
1299 long *pSourceHeight
) {
1300 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1302 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceHeight
);
1304 *pSourceHeight
= This
->SourceRect
.bottom
- This
->SourceRect
.top
;
1309 static HRESULT WINAPI
Basicvideo_put_DestinationLeft(IBasicVideo
*iface
,
1310 long DestinationLeft
) {
1311 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1313 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationLeft
);
1315 This
->DestRect
.left
= DestinationLeft
;
1320 static HRESULT WINAPI
Basicvideo_get_DestinationLeft(IBasicVideo
*iface
,
1321 long *pDestinationLeft
) {
1322 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1324 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationLeft
);
1326 *pDestinationLeft
= This
->DestRect
.left
;
1331 static HRESULT WINAPI
Basicvideo_put_DestinationWidth(IBasicVideo
*iface
,
1332 long DestinationWidth
) {
1333 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1335 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationWidth
);
1337 This
->DestRect
.right
= This
->DestRect
.left
+ DestinationWidth
;
1342 static HRESULT WINAPI
Basicvideo_get_DestinationWidth(IBasicVideo
*iface
,
1343 long *pDestinationWidth
) {
1344 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1346 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationWidth
);
1348 *pDestinationWidth
= This
->DestRect
.right
- This
->DestRect
.left
;
1353 static HRESULT WINAPI
Basicvideo_put_DestinationTop(IBasicVideo
*iface
,
1354 long DestinationTop
) {
1355 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1357 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationTop
);
1359 This
->DestRect
.top
= DestinationTop
;
1364 static HRESULT WINAPI
Basicvideo_get_DestinationTop(IBasicVideo
*iface
,
1365 long *pDestinationTop
) {
1366 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1368 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationTop
);
1370 *pDestinationTop
= This
->DestRect
.top
;
1375 static HRESULT WINAPI
Basicvideo_put_DestinationHeight(IBasicVideo
*iface
,
1376 long DestinationHeight
) {
1377 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1379 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationHeight
);
1381 This
->DestRect
.right
= This
->DestRect
.left
+ DestinationHeight
;
1386 static HRESULT WINAPI
Basicvideo_get_DestinationHeight(IBasicVideo
*iface
,
1387 long *pDestinationHeight
) {
1388 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1390 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationHeight
);
1392 *pDestinationHeight
= This
->DestRect
.right
- This
->DestRect
.left
;
1397 static HRESULT WINAPI
Basicvideo_SetSourcePosition(IBasicVideo
*iface
,
1402 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1404 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This
, iface
, Left
, Top
, Width
, Height
);
1406 This
->SourceRect
.left
= Left
;
1407 This
->SourceRect
.top
= Top
;
1408 This
->SourceRect
.right
= Left
+ Width
;
1409 This
->SourceRect
.bottom
= Top
+ Height
;
1414 static HRESULT WINAPI
Basicvideo_GetSourcePosition(IBasicVideo
*iface
,
1419 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1421 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1423 *pLeft
= This
->SourceRect
.left
;
1424 *pTop
= This
->SourceRect
.top
;
1425 *pWidth
= This
->SourceRect
.right
- This
->SourceRect
.left
;
1426 *pHeight
= This
->SourceRect
.bottom
- This
->SourceRect
.top
;
1431 static HRESULT WINAPI
Basicvideo_SetDefaultSourcePosition(IBasicVideo
*iface
) {
1432 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1434 TRACE("(%p/%p)->()\n", This
, iface
);
1436 This
->SourceRect
.left
= 0;
1437 This
->SourceRect
.top
= 0;
1438 This
->SourceRect
.right
= This
->VideoWidth
;
1439 This
->SourceRect
.bottom
= This
->VideoHeight
;
1444 static HRESULT WINAPI
Basicvideo_SetDestinationPosition(IBasicVideo
*iface
,
1449 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1451 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This
, iface
, Left
, Top
, Width
, Height
);
1453 This
->DestRect
.left
= Left
;
1454 This
->DestRect
.top
= Top
;
1455 This
->DestRect
.right
= Left
+ Width
;
1456 This
->DestRect
.bottom
= Top
+ Height
;
1461 static HRESULT WINAPI
Basicvideo_GetDestinationPosition(IBasicVideo
*iface
,
1466 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1468 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1470 *pLeft
= This
->DestRect
.left
;
1471 *pTop
= This
->DestRect
.top
;
1472 *pWidth
= This
->DestRect
.right
- This
->DestRect
.left
;
1473 *pHeight
= This
->DestRect
.bottom
- This
->DestRect
.top
;
1478 static HRESULT WINAPI
Basicvideo_SetDefaultDestinationPosition(IBasicVideo
*iface
) {
1479 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1482 TRACE("(%p/%p)->()\n", This
, iface
);
1484 if (!GetClientRect(This
->hWnd
, &rect
))
1487 This
->SourceRect
.left
= 0;
1488 This
->SourceRect
.top
= 0;
1489 This
->SourceRect
.right
= rect
.right
;
1490 This
->SourceRect
.bottom
= rect
.bottom
;
1495 static HRESULT WINAPI
Basicvideo_GetVideoSize(IBasicVideo
*iface
,
1498 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1500 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pWidth
, pHeight
);
1502 *pWidth
= This
->VideoWidth
;
1503 *pHeight
= This
->VideoHeight
;
1508 static HRESULT WINAPI
Basicvideo_GetVideoPaletteEntries(IBasicVideo
*iface
,
1513 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1515 FIXME("(%p/%p)->(%ld, %ld, %p, %p): stub !!!\n", This
, iface
, StartIndex
, Entries
, pRetrieved
, pPalette
);
1520 static HRESULT WINAPI
Basicvideo_GetCurrentImage(IBasicVideo
*iface
,
1523 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1524 BITMAPINFOHEADER
*bmiHeader
;
1526 AM_MEDIA_TYPE
*amt
= &This
->pInputPin
->pin
.mtCurrent
;
1529 FIXME("(%p/%p)->(%p, %p): partial stub\n", This
, iface
, pBufferSize
, pDIBImage
);
1531 EnterCriticalSection(&This
->csFilter
);
1533 if (!This
->sample_held
)
1535 LeaveCriticalSection(&This
->csFilter
);
1536 return (This
->state
== State_Paused
? E_UNEXPECTED
: VFW_E_NOT_PAUSED
);
1539 if (IsEqualIID(&amt
->formattype
, &FORMAT_VideoInfo
))
1541 bmiHeader
= &((VIDEOINFOHEADER
*)amt
->pbFormat
)->bmiHeader
;
1543 else if (IsEqualIID(&amt
->formattype
, &FORMAT_VideoInfo2
))
1545 bmiHeader
= &((VIDEOINFOHEADER2
*)amt
->pbFormat
)->bmiHeader
;
1549 FIXME("Unknown type %s\n", debugstr_guid(&amt
->subtype
));
1550 LeaveCriticalSection(&This
->csFilter
);
1551 return VFW_E_RUNTIME_ERROR
;
1554 needed_size
= bmiHeader
->biSize
;
1555 needed_size
+= IMediaSample_GetActualDataLength(This
->sample_held
);
1559 *pBufferSize
= needed_size
;
1560 LeaveCriticalSection(&This
->csFilter
);
1564 if (needed_size
< *pBufferSize
)
1566 ERR("Buffer too small %u/%lu\n", needed_size
, *pBufferSize
);
1567 LeaveCriticalSection(&This
->csFilter
);
1570 *pBufferSize
= needed_size
;
1572 memcpy(pDIBImage
, bmiHeader
, bmiHeader
->biSize
);
1573 IMediaSample_GetPointer(This
->sample_held
, (BYTE
**)&ptr
);
1574 memcpy((char *)pDIBImage
+ bmiHeader
->biSize
, ptr
, IMediaSample_GetActualDataLength(This
->sample_held
));
1576 LeaveCriticalSection(&This
->csFilter
);
1581 static HRESULT WINAPI
Basicvideo_IsUsingDefaultSource(IBasicVideo
*iface
) {
1582 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1584 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
1589 static HRESULT WINAPI
Basicvideo_IsUsingDefaultDestination(IBasicVideo
*iface
) {
1590 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1592 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
1598 static const IBasicVideoVtbl IBasicVideo_VTable
=
1600 Basicvideo_QueryInterface
,
1603 Basicvideo_GetTypeInfoCount
,
1604 Basicvideo_GetTypeInfo
,
1605 Basicvideo_GetIDsOfNames
,
1607 Basicvideo_get_AvgTimePerFrame
,
1608 Basicvideo_get_BitRate
,
1609 Basicvideo_get_BitErrorRate
,
1610 Basicvideo_get_VideoWidth
,
1611 Basicvideo_get_VideoHeight
,
1612 Basicvideo_put_SourceLeft
,
1613 Basicvideo_get_SourceLeft
,
1614 Basicvideo_put_SourceWidth
,
1615 Basicvideo_get_SourceWidth
,
1616 Basicvideo_put_SourceTop
,
1617 Basicvideo_get_SourceTop
,
1618 Basicvideo_put_SourceHeight
,
1619 Basicvideo_get_SourceHeight
,
1620 Basicvideo_put_DestinationLeft
,
1621 Basicvideo_get_DestinationLeft
,
1622 Basicvideo_put_DestinationWidth
,
1623 Basicvideo_get_DestinationWidth
,
1624 Basicvideo_put_DestinationTop
,
1625 Basicvideo_get_DestinationTop
,
1626 Basicvideo_put_DestinationHeight
,
1627 Basicvideo_get_DestinationHeight
,
1628 Basicvideo_SetSourcePosition
,
1629 Basicvideo_GetSourcePosition
,
1630 Basicvideo_SetDefaultSourcePosition
,
1631 Basicvideo_SetDestinationPosition
,
1632 Basicvideo_GetDestinationPosition
,
1633 Basicvideo_SetDefaultDestinationPosition
,
1634 Basicvideo_GetVideoSize
,
1635 Basicvideo_GetVideoPaletteEntries
,
1636 Basicvideo_GetCurrentImage
,
1637 Basicvideo_IsUsingDefaultSource
,
1638 Basicvideo_IsUsingDefaultDestination
1642 /*** IUnknown methods ***/
1643 static HRESULT WINAPI
Videowindow_QueryInterface(IVideoWindow
*iface
,
1646 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1648 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
1650 return VideoRenderer_QueryInterface((IBaseFilter
*)This
, riid
, ppvObj
);
1653 static ULONG WINAPI
Videowindow_AddRef(IVideoWindow
*iface
) {
1654 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1656 TRACE("(%p/%p)->()\n", This
, iface
);
1658 return VideoRenderer_AddRef((IBaseFilter
*)This
);
1661 static ULONG WINAPI
Videowindow_Release(IVideoWindow
*iface
) {
1662 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1664 TRACE("(%p/%p)->()\n", This
, iface
);
1666 return VideoRenderer_Release((IBaseFilter
*)This
);
1669 /*** IDispatch methods ***/
1670 static HRESULT WINAPI
Videowindow_GetTypeInfoCount(IVideoWindow
*iface
,
1672 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1674 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
1679 static HRESULT WINAPI
Videowindow_GetTypeInfo(IVideoWindow
*iface
,
1682 ITypeInfo
**ppTInfo
) {
1683 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1685 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
1690 static HRESULT WINAPI
Videowindow_GetIDsOfNames(IVideoWindow
*iface
,
1696 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1698 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1703 static HRESULT WINAPI
Videowindow_Invoke(IVideoWindow
*iface
,
1704 DISPID dispIdMember
,
1708 DISPPARAMS
*pDispParams
,
1710 EXCEPINFO
*pExepInfo
,
1712 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1714 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
);
1719 /*** IVideoWindow methods ***/
1720 static HRESULT WINAPI
Videowindow_put_Caption(IVideoWindow
*iface
,
1722 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1724 TRACE("(%p/%p)->(%s (%p))\n", This
, iface
, debugstr_w(strCaption
), strCaption
);
1726 if (!SetWindowTextW(This
->hWnd
, strCaption
))
1732 static HRESULT WINAPI
Videowindow_get_Caption(IVideoWindow
*iface
,
1734 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1736 TRACE("(%p/%p)->(%p)\n", This
, iface
, strCaption
);
1738 GetWindowTextW(This
->hWnd
, (LPWSTR
)strCaption
, 100);
1743 static HRESULT WINAPI
Videowindow_put_WindowStyle(IVideoWindow
*iface
,
1745 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1748 old
= GetWindowLongA(This
->hWnd
, GWL_STYLE
);
1750 TRACE("(%p/%p)->(%x -> %lx)\n", This
, iface
, old
, WindowStyle
);
1752 if (WindowStyle
& (WS_DISABLED
|WS_HSCROLL
|WS_ICONIC
|WS_MAXIMIZE
|WS_MINIMIZE
|WS_VSCROLL
))
1753 return E_INVALIDARG
;
1755 SetWindowLongA(This
->hWnd
, GWL_STYLE
, WindowStyle
);
1760 static HRESULT WINAPI
Videowindow_get_WindowStyle(IVideoWindow
*iface
,
1761 long *WindowStyle
) {
1762 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1764 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyle
);
1766 *WindowStyle
= GetWindowLongA(This
->hWnd
, GWL_STYLE
);
1771 static HRESULT WINAPI
Videowindow_put_WindowStyleEx(IVideoWindow
*iface
,
1772 long WindowStyleEx
) {
1773 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1775 TRACE("(%p/%p)->(%ld)\n", This
, iface
, WindowStyleEx
);
1777 if (WindowStyleEx
& (WS_DISABLED
|WS_HSCROLL
|WS_ICONIC
|WS_MAXIMIZE
|WS_MINIMIZE
|WS_VSCROLL
))
1778 return E_INVALIDARG
;
1780 if (!SetWindowLongA(This
->hWnd
, GWL_EXSTYLE
, WindowStyleEx
))
1786 static HRESULT WINAPI
Videowindow_get_WindowStyleEx(IVideoWindow
*iface
,
1787 long *WindowStyleEx
) {
1788 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1790 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyleEx
);
1792 *WindowStyleEx
= GetWindowLongA(This
->hWnd
, GWL_EXSTYLE
);
1797 static HRESULT WINAPI
Videowindow_put_AutoShow(IVideoWindow
*iface
,
1799 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1801 TRACE("(%p/%p)->(%ld)\n", This
, iface
, AutoShow
);
1803 This
->AutoShow
= 1; /* FIXME: Should be AutoShow */;
1808 static HRESULT WINAPI
Videowindow_get_AutoShow(IVideoWindow
*iface
,
1810 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1812 TRACE("(%p/%p)->(%p)\n", This
, iface
, AutoShow
);
1814 *AutoShow
= This
->AutoShow
;
1819 static HRESULT WINAPI
Videowindow_put_WindowState(IVideoWindow
*iface
,
1821 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1823 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, WindowState
);
1828 static HRESULT WINAPI
Videowindow_get_WindowState(IVideoWindow
*iface
,
1829 long *WindowState
) {
1830 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1832 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, WindowState
);
1837 static HRESULT WINAPI
Videowindow_put_BackgroundPalette(IVideoWindow
*iface
,
1838 long BackgroundPalette
) {
1839 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1841 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, BackgroundPalette
);
1846 static HRESULT WINAPI
Videowindow_get_BackgroundPalette(IVideoWindow
*iface
,
1847 long *pBackgroundPalette
) {
1848 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1850 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBackgroundPalette
);
1855 static HRESULT WINAPI
Videowindow_put_Visible(IVideoWindow
*iface
,
1857 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1859 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Visible
);
1861 ShowWindow(This
->hWnd
, Visible
? SW_SHOW
: SW_HIDE
);
1866 static HRESULT WINAPI
Videowindow_get_Visible(IVideoWindow
*iface
,
1868 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1870 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVisible
);
1872 *pVisible
= IsWindowVisible(This
->hWnd
);
1877 static HRESULT WINAPI
Videowindow_put_Left(IVideoWindow
*iface
,
1879 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1881 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Left
);
1883 if (!SetWindowPos(This
->hWnd
, NULL
, Left
, This
->WindowPos
.top
, 0, 0, SWP_NOZORDER
|SWP_NOSIZE
))
1886 This
->WindowPos
.left
= Left
;
1891 static HRESULT WINAPI
Videowindow_get_Left(IVideoWindow
*iface
,
1893 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1895 TRACE("(%p/%p)->(%p)\n", This
, iface
, pLeft
);
1897 *pLeft
= This
->WindowPos
.left
;
1902 static HRESULT WINAPI
Videowindow_put_Width(IVideoWindow
*iface
,
1904 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1906 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Width
);
1908 if (!SetWindowPos(This
->hWnd
, NULL
, 0, 0, Width
, This
->WindowPos
.bottom
-This
->WindowPos
.top
, SWP_NOZORDER
|SWP_NOMOVE
))
1911 This
->WindowPos
.right
= This
->WindowPos
.left
+ Width
;
1916 static HRESULT WINAPI
Videowindow_get_Width(IVideoWindow
*iface
,
1918 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1920 TRACE("(%p/%p)->(%p)\n", This
, iface
, pWidth
);
1922 *pWidth
= This
->WindowPos
.right
- This
->WindowPos
.left
;
1927 static HRESULT WINAPI
Videowindow_put_Top(IVideoWindow
*iface
,
1929 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1931 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Top
);
1933 if (!SetWindowPos(This
->hWnd
, NULL
, This
->WindowPos
.left
, Top
, 0, 0, SWP_NOZORDER
|SWP_NOSIZE
))
1936 This
->WindowPos
.top
= Top
;
1941 static HRESULT WINAPI
Videowindow_get_Top(IVideoWindow
*iface
,
1943 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1945 TRACE("(%p/%p)->(%p)\n", This
, iface
, pTop
);
1947 *pTop
= This
->WindowPos
.top
;
1952 static HRESULT WINAPI
Videowindow_put_Height(IVideoWindow
*iface
,
1954 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1956 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Height
);
1958 if (!SetWindowPos(This
->hWnd
, NULL
, 0, 0, This
->WindowPos
.right
-This
->WindowPos
.left
, Height
, SWP_NOZORDER
|SWP_NOMOVE
))
1961 This
->WindowPos
.bottom
= This
->WindowPos
.top
+ Height
;
1966 static HRESULT WINAPI
Videowindow_get_Height(IVideoWindow
*iface
,
1968 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1970 TRACE("(%p/%p)->(%p)\n", This
, iface
, pHeight
);
1972 *pHeight
= This
->WindowPos
.bottom
- This
->WindowPos
.top
;
1977 static HRESULT WINAPI
Videowindow_put_Owner(IVideoWindow
*iface
,
1979 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1981 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Owner
);
1983 SetParent(This
->hWnd
, (HWND
)Owner
);
1988 static HRESULT WINAPI
Videowindow_get_Owner(IVideoWindow
*iface
,
1990 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1992 TRACE("(%p/%p)->(%p)\n", This
, iface
, Owner
);
1994 *(HWND
*)Owner
= GetParent(This
->hWnd
);
1999 static HRESULT WINAPI
Videowindow_put_MessageDrain(IVideoWindow
*iface
,
2001 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2003 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Drain
);
2005 This
->hWndMsgDrain
= (HWND
)Drain
;
2010 static HRESULT WINAPI
Videowindow_get_MessageDrain(IVideoWindow
*iface
,
2012 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2014 TRACE("(%p/%p)->(%p)\n", This
, iface
, Drain
);
2016 *Drain
= (OAHWND
)This
->hWndMsgDrain
;
2021 static HRESULT WINAPI
Videowindow_get_BorderColor(IVideoWindow
*iface
,
2023 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2025 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, Color
);
2030 static HRESULT WINAPI
Videowindow_put_BorderColor(IVideoWindow
*iface
,
2032 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2034 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, Color
);
2039 static HRESULT WINAPI
Videowindow_get_FullScreenMode(IVideoWindow
*iface
,
2040 long *FullScreenMode
) {
2041 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2043 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, FullScreenMode
);
2048 static HRESULT WINAPI
Videowindow_put_FullScreenMode(IVideoWindow
*iface
,
2049 long FullScreenMode
) {
2050 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2052 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, FullScreenMode
);
2057 static HRESULT WINAPI
Videowindow_SetWindowForeground(IVideoWindow
*iface
,
2059 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2064 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Focus
);
2066 if ((Focus
!= FALSE
) && (Focus
!= TRUE
))
2067 return E_INVALIDARG
;
2069 hr
= IPin_ConnectedTo((IPin
*)This
->pInputPin
, &pPin
);
2070 if ((hr
!= S_OK
) || !pPin
)
2071 return VFW_E_NOT_CONNECTED
;
2074 ret
= SetForegroundWindow(This
->hWnd
);
2076 ret
= SetWindowPos(This
->hWnd
, HWND_TOP
, 0, 0, 0, 0, SWP_NOMOVE
|SWP_NOSIZE
);
2084 static HRESULT WINAPI
Videowindow_NotifyOwnerMessage(IVideoWindow
*iface
,
2089 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2091 TRACE("(%p/%p)->(%08x, %ld, %08lx, %08lx)\n", This
, iface
, (DWORD
) hwnd
, uMsg
, wParam
, lParam
);
2093 if (!PostMessageA(This
->hWnd
, uMsg
, wParam
, lParam
))
2099 static HRESULT WINAPI
Videowindow_SetWindowPosition(IVideoWindow
*iface
,
2104 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2106 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This
, iface
, Left
, Top
, Width
, Height
);
2108 if (!SetWindowPos(This
->hWnd
, NULL
, Left
, Top
, Width
, Height
, SWP_NOZORDER
))
2111 This
->WindowPos
.left
= Left
;
2112 This
->WindowPos
.top
= Top
;
2113 This
->WindowPos
.right
= Left
+ Width
;
2114 This
->WindowPos
.bottom
= Top
+ Height
;
2119 static HRESULT WINAPI
Videowindow_GetWindowPosition(IVideoWindow
*iface
,
2124 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2126 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
2128 *pLeft
= This
->WindowPos
.left
;
2129 *pTop
= This
->WindowPos
.top
;
2130 *pWidth
= This
->WindowPos
.right
- This
->WindowPos
.left
;
2131 *pHeight
= This
->WindowPos
.bottom
- This
->WindowPos
.top
;
2136 static HRESULT WINAPI
Videowindow_GetMinIdealImageSize(IVideoWindow
*iface
,
2139 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2141 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This
, iface
, pWidth
, pHeight
);
2143 *pWidth
= This
->VideoWidth
;
2144 *pHeight
= This
->VideoHeight
;
2149 static HRESULT WINAPI
Videowindow_GetMaxIdealImageSize(IVideoWindow
*iface
,
2152 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2154 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This
, iface
, pWidth
, pHeight
);
2156 *pWidth
= This
->VideoWidth
;
2157 *pHeight
= This
->VideoHeight
;
2162 static HRESULT WINAPI
Videowindow_GetRestorePosition(IVideoWindow
*iface
,
2167 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2169 FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
2174 static HRESULT WINAPI
Videowindow_HideCursor(IVideoWindow
*iface
,
2176 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2178 FIXME("(%p/%p)->(%ld): stub !!!\n", This
, iface
, HideCursor
);
2183 static HRESULT WINAPI
Videowindow_IsCursorHidden(IVideoWindow
*iface
,
2184 long *CursorHidden
) {
2185 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2187 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, CursorHidden
);
2192 static const IVideoWindowVtbl IVideoWindow_VTable
=
2194 Videowindow_QueryInterface
,
2196 Videowindow_Release
,
2197 Videowindow_GetTypeInfoCount
,
2198 Videowindow_GetTypeInfo
,
2199 Videowindow_GetIDsOfNames
,
2201 Videowindow_put_Caption
,
2202 Videowindow_get_Caption
,
2203 Videowindow_put_WindowStyle
,
2204 Videowindow_get_WindowStyle
,
2205 Videowindow_put_WindowStyleEx
,
2206 Videowindow_get_WindowStyleEx
,
2207 Videowindow_put_AutoShow
,
2208 Videowindow_get_AutoShow
,
2209 Videowindow_put_WindowState
,
2210 Videowindow_get_WindowState
,
2211 Videowindow_put_BackgroundPalette
,
2212 Videowindow_get_BackgroundPalette
,
2213 Videowindow_put_Visible
,
2214 Videowindow_get_Visible
,
2215 Videowindow_put_Left
,
2216 Videowindow_get_Left
,
2217 Videowindow_put_Width
,
2218 Videowindow_get_Width
,
2219 Videowindow_put_Top
,
2220 Videowindow_get_Top
,
2221 Videowindow_put_Height
,
2222 Videowindow_get_Height
,
2223 Videowindow_put_Owner
,
2224 Videowindow_get_Owner
,
2225 Videowindow_put_MessageDrain
,
2226 Videowindow_get_MessageDrain
,
2227 Videowindow_get_BorderColor
,
2228 Videowindow_put_BorderColor
,
2229 Videowindow_get_FullScreenMode
,
2230 Videowindow_put_FullScreenMode
,
2231 Videowindow_SetWindowForeground
,
2232 Videowindow_NotifyOwnerMessage
,
2233 Videowindow_SetWindowPosition
,
2234 Videowindow_GetWindowPosition
,
2235 Videowindow_GetMinIdealImageSize
,
2236 Videowindow_GetMaxIdealImageSize
,
2237 Videowindow_GetRestorePosition
,
2238 Videowindow_HideCursor
,
2239 Videowindow_IsCursorHidden