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
;
62 IUnknown
*seekthru_unk
;
65 CRITICAL_SECTION csFilter
;
67 REFERENCE_TIME rtStreamStart
;
68 IReferenceClock
* pClock
;
69 FILTER_INFO filterInfo
;
91 REFERENCE_TIME rtLastStop
;
92 MediaSeekingImpl mediaSeeking
;
95 /* During pause we can hold a single sample, for use in GetCurrentImage */
96 IMediaSample
*sample_held
;
99 static LRESULT CALLBACK
VideoWndProcA(HWND hwnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
101 VideoRendererImpl
* pVideoRenderer
= (VideoRendererImpl
*)GetWindowLongPtrW(hwnd
, 0);
102 LPRECT lprect
= (LPRECT
)lParam
;
104 if (pVideoRenderer
&& pVideoRenderer
->hWndMsgDrain
)
110 case WM_LBUTTONDBLCLK
:
113 case WM_MBUTTONDBLCLK
:
116 case WM_MOUSEACTIVATE
:
118 case WM_NCLBUTTONDBLCLK
:
119 case WM_NCLBUTTONDOWN
:
121 case WM_NCMBUTTONDBLCLK
:
122 case WM_NCMBUTTONDOWN
:
125 case WM_NCRBUTTONDBLCLK
:
126 case WM_NCRBUTTONDOWN
:
128 case WM_RBUTTONDBLCLK
:
131 PostMessageA(pVideoRenderer
->hWndMsgDrain
, uMsg
, wParam
, lParam
);
141 /* TRACE("WM_SIZING %d %d %d %d\n", lprect->left, lprect->top, lprect->right, lprect->bottom); */
142 SetWindowPos(hwnd
, NULL
, lprect
->left
, lprect
->top
, lprect
->right
- lprect
->left
, lprect
->bottom
- lprect
->top
, SWP_NOZORDER
);
143 GetClientRect(hwnd
, &pVideoRenderer
->DestRect
);
144 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
145 pVideoRenderer
->DestRect
.left
,
146 pVideoRenderer
->DestRect
.top
,
147 pVideoRenderer
->DestRect
.right
- pVideoRenderer
->DestRect
.left
,
148 pVideoRenderer
->DestRect
.bottom
- pVideoRenderer
->DestRect
.top
);
151 TRACE("WM_SIZE %d %d\n", LOWORD(lParam
), HIWORD(lParam
));
152 GetClientRect(hwnd
, &pVideoRenderer
->DestRect
);
153 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
154 pVideoRenderer
->DestRect
.left
,
155 pVideoRenderer
->DestRect
.top
,
156 pVideoRenderer
->DestRect
.right
- pVideoRenderer
->DestRect
.left
,
157 pVideoRenderer
->DestRect
.bottom
- pVideoRenderer
->DestRect
.top
);
160 return DefWindowProcA(hwnd
, uMsg
, wParam
, lParam
);
165 static BOOL
CreateRenderingWindow(VideoRendererImpl
* This
)
169 TRACE("(%p)->()\n", This
);
172 winclass
.lpfnWndProc
= VideoWndProcA
;
173 winclass
.cbClsExtra
= 0;
174 winclass
.cbWndExtra
= sizeof(VideoRendererImpl
*);
175 winclass
.hInstance
= NULL
;
176 winclass
.hIcon
= NULL
;
177 winclass
.hCursor
= NULL
;
178 winclass
.hbrBackground
= GetStockObject(BLACK_BRUSH
);
179 winclass
.lpszMenuName
= NULL
;
180 winclass
.lpszClassName
= "Wine ActiveMovie Class";
182 if (!wnd_class_registered
)
184 if (!RegisterClassA(&winclass
))
186 ERR("Unable to register window %u\n", GetLastError());
189 wnd_class_registered
= TRUE
;
192 This
->hWnd
= CreateWindowExA(0, "Wine ActiveMovie Class", "Wine ActiveMovie Window", WS_SIZEBOX
,
193 CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
, NULL
,
198 ERR("Unable to create window\n");
202 SetWindowLongPtrW(This
->hWnd
, 0, (LONG_PTR
)This
);
207 static DWORD WINAPI
MessageLoop(LPVOID lpParameter
)
209 VideoRendererImpl
* This
= lpParameter
;
213 TRACE("Starting message loop\n");
215 if (!CreateRenderingWindow(This
))
217 This
->ThreadResult
= FALSE
;
218 SetEvent(This
->hEvent
);
222 This
->ThreadResult
= TRUE
;
223 SetEvent(This
->hEvent
);
225 while ((fGotMessage
= GetMessageA(&msg
, NULL
, 0, 0)) != 0 && fGotMessage
!= -1)
227 TranslateMessage(&msg
);
228 DispatchMessageA(&msg
);
231 TRACE("End of message loop\n");
236 static BOOL
CreateRenderingSubsystem(VideoRendererImpl
* This
)
238 This
->hEvent
= CreateEventW(NULL
, TRUE
, FALSE
, NULL
);
242 This
->hThread
= CreateThread(NULL
, 0, MessageLoop
, This
, 0, &This
->ThreadID
);
245 CloseHandle(This
->hEvent
);
249 WaitForSingleObject(This
->hEvent
, INFINITE
);
251 if (!This
->ThreadResult
)
253 CloseHandle(This
->hEvent
);
254 CloseHandle(This
->hThread
);
261 static DWORD
VideoRenderer_SendSampleData(VideoRendererImpl
* This
, LPBYTE data
, DWORD size
)
267 BITMAPINFOHEADER
*bmiHeader
;
269 TRACE("(%p)->(%p, %d)\n", This
, data
, size
);
271 sdesc
.dwSize
= sizeof(sdesc
);
272 hr
= IPin_ConnectionMediaType((IPin
*)This
->pInputPin
, &amt
);
274 ERR("Unable to retrieve media type\n");
278 if (IsEqualIID(&amt
.formattype
, &FORMAT_VideoInfo
))
280 bmiHeader
= &((VIDEOINFOHEADER
*)amt
.pbFormat
)->bmiHeader
;
282 else if (IsEqualIID(&amt
.formattype
, &FORMAT_VideoInfo2
))
284 bmiHeader
= &((VIDEOINFOHEADER2
*)amt
.pbFormat
)->bmiHeader
;
288 FIXME("Unknown type %s\n", debugstr_guid(&amt
.subtype
));
289 return VFW_E_RUNTIME_ERROR
;
292 TRACE("biSize = %d\n", bmiHeader
->biSize
);
293 TRACE("biWidth = %d\n", bmiHeader
->biWidth
);
294 TRACE("biHeight = %d\n", bmiHeader
->biHeight
);
295 TRACE("biPlanes = %d\n", bmiHeader
->biPlanes
);
296 TRACE("biBitCount = %d\n", bmiHeader
->biBitCount
);
297 TRACE("biCompression = %s\n", debugstr_an((LPSTR
)&(bmiHeader
->biCompression
), 4));
298 TRACE("biSizeImage = %d\n", bmiHeader
->biSizeImage
);
302 if (!This
->WindowPos
.right
|| !This
->WindowPos
.top
)
304 DWORD style
= GetWindowLongW(This
->hWnd
, GWL_STYLE
);
305 DWORD style_ex
= GetWindowLongW(This
->hWnd
, GWL_EXSTYLE
);
307 if (!This
->WindowPos
.right
)
309 This
->WindowPos
.left
= This
->SourceRect
.left
;
310 This
->WindowPos
.right
= This
->SourceRect
.right
;
312 if (!This
->WindowPos
.bottom
)
314 This
->WindowPos
.top
= This
->SourceRect
.top
;
315 This
->WindowPos
.bottom
= This
->SourceRect
.bottom
;
318 AdjustWindowRectEx(&This
->WindowPos
, style
, TRUE
, style_ex
);
320 TRACE("WindowPos: %d %d %d %d\n", This
->WindowPos
.left
, This
->WindowPos
.top
, This
->WindowPos
.right
, This
->WindowPos
.bottom
);
321 SetWindowPos(This
->hWnd
, NULL
,
322 This
->WindowPos
.left
,
324 This
->WindowPos
.right
- This
->WindowPos
.left
,
325 This
->WindowPos
.bottom
- This
->WindowPos
.top
,
326 SWP_NOZORDER
|SWP_NOMOVE
|SWP_DEFERERASE
);
328 GetClientRect(This
->hWnd
, &This
->DestRect
);
331 This
->DestRect
= This
->WindowPos
;
335 hDC
= GetDC(This
->hWnd
);
338 ERR("Cannot get DC from window!\n");
342 TRACE("Src Rect: %d %d %d %d\n", This
->SourceRect
.left
, This
->SourceRect
.top
, This
->SourceRect
.right
, This
->SourceRect
.bottom
);
343 TRACE("Dst Rect: %d %d %d %d\n", This
->DestRect
.left
, This
->DestRect
.top
, This
->DestRect
.right
, This
->DestRect
.bottom
);
345 StretchDIBits(hDC
, This
->DestRect
.left
, This
->DestRect
.top
, This
->DestRect
.right
-This
->DestRect
.left
,
346 This
->DestRect
.bottom
- This
->DestRect
.top
, This
->SourceRect
.left
, This
->SourceRect
.top
,
347 This
->SourceRect
.right
- This
->SourceRect
.left
, This
->SourceRect
.bottom
- This
->SourceRect
.top
,
348 data
, (BITMAPINFO
*)bmiHeader
, DIB_RGB_COLORS
, SRCCOPY
);
350 ReleaseDC(This
->hWnd
, hDC
);
352 ShowWindow(This
->hWnd
, SW_SHOW
);
357 static HRESULT
VideoRenderer_Sample(LPVOID iface
, IMediaSample
* pSample
)
359 VideoRendererImpl
*This
= iface
;
360 LPBYTE pbSrcStream
= NULL
;
361 LONG cbSrcStream
= 0;
362 REFERENCE_TIME tStart
, tStop
;
365 TRACE("(%p)->(%p)\n", iface
, pSample
);
367 EnterCriticalSection(&This
->csFilter
);
369 if (This
->pInputPin
->flushing
|| This
->pInputPin
->end_of_stream
)
371 LeaveCriticalSection(&This
->csFilter
);
375 if (This
->state
== State_Stopped
)
377 LeaveCriticalSection(&This
->csFilter
);
378 return VFW_E_WRONG_STATE
;
381 hr
= IMediaSample_GetTime(pSample
, &tStart
, &tStop
);
383 ERR("Cannot get sample time (%x)\n", hr
);
385 MediaSeekingPassThru_RegisterMediaTime(This
->seekthru_unk
, tStart
);
387 if (This
->rtLastStop
!= tStart
&& This
->state
== State_Running
)
390 delta
= tStart
- This
->rtLastStop
;
391 if ((delta
< -100000 || delta
> 100000) &&
392 IMediaSample_IsDiscontinuity(pSample
) == S_FALSE
)
393 ERR("Unexpected discontinuity: Last: %u.%03u, tStart: %u.%03u\n",
394 (DWORD
)(This
->rtLastStop
/ 10000000),
395 (DWORD
)((This
->rtLastStop
/ 10000)%1000),
396 (DWORD
)(tStart
/ 10000000), (DWORD
)((tStart
/ 10000)%1000));
397 This
->rtLastStop
= tStart
;
400 /* Preroll means the sample isn't shown, this is used for key frames and things like that */
401 if (IMediaSample_IsPreroll(pSample
) == S_OK
)
403 This
->rtLastStop
= tStop
;
404 LeaveCriticalSection(&This
->csFilter
);
408 hr
= IMediaSample_GetPointer(pSample
, &pbSrcStream
);
411 ERR("Cannot get pointer to sample data (%x)\n", hr
);
412 LeaveCriticalSection(&This
->csFilter
);
416 cbSrcStream
= IMediaSample_GetActualDataLength(pSample
);
418 TRACE("val %p %d\n", pbSrcStream
, cbSrcStream
);
420 #if 0 /* For debugging purpose */
423 for(i
= 0; i
< cbSrcStream
; i
++)
425 if ((i
!=0) && !(i
%16))
427 TRACE("%02x ", pbSrcStream
[i
]);
433 SetEvent(This
->hEvent
);
434 if (This
->state
== State_Paused
)
436 This
->sample_held
= pSample
;
437 LeaveCriticalSection(&This
->csFilter
);
438 WaitForSingleObject(This
->blocked
, INFINITE
);
439 EnterCriticalSection(&This
->csFilter
);
440 This
->sample_held
= NULL
;
441 if (This
->state
== State_Paused
)
444 LeaveCriticalSection(&This
->csFilter
);
447 if (This
->state
== State_Stopped
)
449 LeaveCriticalSection(&This
->csFilter
);
450 return VFW_E_WRONG_STATE
;
454 if (This
->pClock
&& This
->state
== State_Running
)
456 REFERENCE_TIME time
, trefstart
, trefstop
;
459 /* Perhaps I <SHOULD> use the reference clock AdviseTime function here
460 * I'm not going to! When I tried, it seemed to generate lag and
461 * it caused instability.
463 IReferenceClock_GetTime(This
->pClock
, &time
);
465 trefstart
= This
->rtStreamStart
;
466 trefstop
= (REFERENCE_TIME
)((double)(tStop
- tStart
) / This
->pInputPin
->dRate
) + This
->rtStreamStart
;
467 delta
= (LONG
)((trefstart
-time
)/10000);
468 This
->rtStreamStart
= trefstop
;
469 This
->rtLastStop
= tStop
;
473 TRACE("Sleeping for %u ms\n", delta
);
476 else if (time
> trefstop
)
478 TRACE("Dropping sample: Time: %u.%03u ms trefstop: %u.%03u ms!\n",
479 (DWORD
)(time
/ 10000000), (DWORD
)((time
/ 10000)%1000),
480 (DWORD
)(trefstop
/ 10000000), (DWORD
)((trefstop
/ 10000)%1000) );
481 This
->rtLastStop
= tStop
;
482 LeaveCriticalSection(&This
->csFilter
);
486 This
->rtLastStop
= tStop
;
488 VideoRenderer_SendSampleData(This
, pbSrcStream
, cbSrcStream
);
490 LeaveCriticalSection(&This
->csFilter
);
494 static HRESULT
VideoRenderer_QueryAccept(LPVOID iface
, const AM_MEDIA_TYPE
* pmt
)
496 if (!IsEqualIID(&pmt
->majortype
, &MEDIATYPE_Video
))
499 if (IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB32
) ||
500 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB24
) ||
501 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB565
) ||
502 IsEqualIID(&pmt
->subtype
, &MEDIASUBTYPE_RGB8
))
504 VideoRendererImpl
* This
= iface
;
507 if (IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo
))
509 VIDEOINFOHEADER
*format
= (VIDEOINFOHEADER
*)pmt
->pbFormat
;
510 This
->SourceRect
.left
= 0;
511 This
->SourceRect
.top
= 0;
512 This
->SourceRect
.right
= This
->VideoWidth
= format
->bmiHeader
.biWidth
;
513 height
= format
->bmiHeader
.biHeight
;
515 This
->SourceRect
.bottom
= This
->VideoHeight
= -height
;
517 This
->SourceRect
.bottom
= This
->VideoHeight
= height
;
519 else if (IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo2
))
521 VIDEOINFOHEADER2
*format2
= (VIDEOINFOHEADER2
*)pmt
->pbFormat
;
523 This
->SourceRect
.left
= 0;
524 This
->SourceRect
.top
= 0;
525 This
->SourceRect
.right
= This
->VideoWidth
= format2
->bmiHeader
.biWidth
;
526 height
= format2
->bmiHeader
.biHeight
;
528 This
->SourceRect
.bottom
= This
->VideoHeight
= -height
;
530 This
->SourceRect
.bottom
= This
->VideoHeight
= height
;
534 WARN("Format type %s not supported\n", debugstr_guid(&pmt
->formattype
));
542 HRESULT
VideoRenderer_create(IUnknown
* pUnkOuter
, LPVOID
* ppv
)
546 VideoRendererImpl
* pVideoRenderer
;
547 ISeekingPassThru
*passthru
;
549 TRACE("(%p, %p)\n", pUnkOuter
, ppv
);
553 pVideoRenderer
= CoTaskMemAlloc(sizeof(VideoRendererImpl
));
554 pVideoRenderer
->pUnkOuter
= pUnkOuter
;
555 pVideoRenderer
->bUnkOuterValid
= FALSE
;
556 pVideoRenderer
->bAggregatable
= FALSE
;
557 pVideoRenderer
->IInner_vtbl
= &IInner_VTable
;
559 pVideoRenderer
->lpVtbl
= &VideoRenderer_Vtbl
;
560 pVideoRenderer
->IBasicVideo_vtbl
= &IBasicVideo_VTable
;
561 pVideoRenderer
->IVideoWindow_vtbl
= &IVideoWindow_VTable
;
563 pVideoRenderer
->refCount
= 1;
564 InitializeCriticalSection(&pVideoRenderer
->csFilter
);
565 pVideoRenderer
->csFilter
.DebugInfo
->Spare
[0] = (DWORD_PTR
)(__FILE__
": VideoRendererImpl.csFilter");
566 pVideoRenderer
->state
= State_Stopped
;
567 pVideoRenderer
->pClock
= NULL
;
568 pVideoRenderer
->init
= 0;
569 pVideoRenderer
->AutoShow
= 1;
570 pVideoRenderer
->rtLastStop
= -1;
571 ZeroMemory(&pVideoRenderer
->filterInfo
, sizeof(FILTER_INFO
));
572 ZeroMemory(&pVideoRenderer
->SourceRect
, sizeof(RECT
));
573 ZeroMemory(&pVideoRenderer
->DestRect
, sizeof(RECT
));
574 ZeroMemory(&pVideoRenderer
->WindowPos
, sizeof(RECT
));
575 pVideoRenderer
->hWndMsgDrain
= NULL
;
576 pVideoRenderer
->WindowStyle
= WS_OVERLAPPED
;
578 /* construct input pin */
579 piInput
.dir
= PINDIR_INPUT
;
580 piInput
.pFilter
= (IBaseFilter
*)pVideoRenderer
;
581 lstrcpynW(piInput
.achName
, wcsInputPinName
, sizeof(piInput
.achName
) / sizeof(piInput
.achName
[0]));
583 hr
= InputPin_Construct(&VideoRenderer_InputPin_Vtbl
, &piInput
, VideoRenderer_Sample
, (LPVOID
)pVideoRenderer
, VideoRenderer_QueryAccept
, NULL
, &pVideoRenderer
->csFilter
, NULL
, (IPin
**)&pVideoRenderer
->pInputPin
);
587 hr
= CoCreateInstance(&CLSID_SeekingPassThru
, pUnkOuter
? pUnkOuter
: (IUnknown
*)&pVideoRenderer
->IInner_vtbl
, CLSCTX_INPROC_SERVER
, &IID_IUnknown
, (void**)&pVideoRenderer
->seekthru_unk
);
589 IPin_Release((IPin
*)pVideoRenderer
->pInputPin
);
592 IUnknown_QueryInterface(pVideoRenderer
->seekthru_unk
, &IID_ISeekingPassThru
, (void**)&passthru
);
593 ISeekingPassThru_Init(passthru
, TRUE
, (IPin
*)pVideoRenderer
->pInputPin
);
594 ISeekingPassThru_Release(passthru
);
595 pVideoRenderer
->sample_held
= NULL
;
596 *ppv
= pVideoRenderer
;
601 if (!CreateRenderingSubsystem(pVideoRenderer
))
604 pVideoRenderer
->blocked
= CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
605 if (!pVideoRenderer
->blocked
)
607 hr
= HRESULT_FROM_WIN32(GetLastError());
608 IUnknown_Release((IUnknown
*)pVideoRenderer
);
613 pVideoRenderer
->csFilter
.DebugInfo
->Spare
[0] = 0;
614 DeleteCriticalSection(&pVideoRenderer
->csFilter
);
615 CoTaskMemFree(pVideoRenderer
);
619 HRESULT
VideoRendererDefault_create(IUnknown
* pUnkOuter
, LPVOID
* ppv
)
621 /* TODO: Attempt to use the VMR-7 renderer instead when possible */
622 return VideoRenderer_create(pUnkOuter
, ppv
);
625 static HRESULT WINAPI
VideoRendererInner_QueryInterface(IUnknown
* iface
, REFIID riid
, LPVOID
* ppv
)
627 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
628 TRACE("(%p/%p)->(%s, %p)\n", This
, iface
, qzdebugstr_guid(riid
), ppv
);
630 if (This
->bAggregatable
)
631 This
->bUnkOuterValid
= TRUE
;
635 if (IsEqualIID(riid
, &IID_IUnknown
))
636 *ppv
= &This
->IInner_vtbl
;
637 else if (IsEqualIID(riid
, &IID_IPersist
))
639 else if (IsEqualIID(riid
, &IID_IMediaFilter
))
641 else if (IsEqualIID(riid
, &IID_IBaseFilter
))
643 else if (IsEqualIID(riid
, &IID_IBasicVideo
))
644 *ppv
= &This
->IBasicVideo_vtbl
;
645 else if (IsEqualIID(riid
, &IID_IVideoWindow
))
646 *ppv
= &This
->IVideoWindow_vtbl
;
647 else if (IsEqualIID(riid
, &IID_IMediaSeeking
))
648 return IUnknown_QueryInterface(This
->seekthru_unk
, riid
, ppv
);
652 IUnknown_AddRef((IUnknown
*)(*ppv
));
656 if (!IsEqualIID(riid
, &IID_IPin
))
657 FIXME("No interface for %s!\n", qzdebugstr_guid(riid
));
659 return E_NOINTERFACE
;
662 static ULONG WINAPI
VideoRendererInner_AddRef(IUnknown
* iface
)
664 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
665 ULONG refCount
= InterlockedIncrement(&This
->refCount
);
667 TRACE("(%p/%p)->() AddRef from %d\n", This
, iface
, refCount
- 1);
672 static ULONG WINAPI
VideoRendererInner_Release(IUnknown
* iface
)
674 ICOM_THIS_MULTI(VideoRendererImpl
, IInner_vtbl
, iface
);
675 ULONG refCount
= InterlockedDecrement(&This
->refCount
);
677 TRACE("(%p/%p)->() Release from %d\n", This
, iface
, refCount
+ 1);
683 DestroyWindow(This
->hWnd
);
684 PostThreadMessageA(This
->ThreadID
, WM_QUIT
, 0, 0);
685 WaitForSingleObject(This
->hThread
, INFINITE
);
686 CloseHandle(This
->hThread
);
687 CloseHandle(This
->hEvent
);
690 IReferenceClock_Release(This
->pClock
);
692 if (SUCCEEDED(IPin_ConnectedTo((IPin
*)This
->pInputPin
, &pConnectedTo
)))
694 IPin_Disconnect(pConnectedTo
);
695 IPin_Release(pConnectedTo
);
697 IPin_Disconnect((IPin
*)This
->pInputPin
);
699 IPin_Release((IPin
*)This
->pInputPin
);
702 IUnknown_Release(This
->seekthru_unk
);
703 This
->csFilter
.DebugInfo
->Spare
[0] = 0;
704 DeleteCriticalSection(&This
->csFilter
);
706 TRACE("Destroying Video Renderer\n");
715 static const IUnknownVtbl IInner_VTable
=
717 VideoRendererInner_QueryInterface
,
718 VideoRendererInner_AddRef
,
719 VideoRendererInner_Release
722 static HRESULT WINAPI
VideoRenderer_QueryInterface(IBaseFilter
* iface
, REFIID riid
, LPVOID
* ppv
)
724 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
726 if (This
->bAggregatable
)
727 This
->bUnkOuterValid
= TRUE
;
731 if (This
->bAggregatable
)
732 return IUnknown_QueryInterface(This
->pUnkOuter
, riid
, ppv
);
734 if (IsEqualIID(riid
, &IID_IUnknown
))
738 IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
739 hr
= IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
740 IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
741 This
->bAggregatable
= TRUE
;
746 return E_NOINTERFACE
;
749 return IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
752 static ULONG WINAPI
VideoRenderer_AddRef(IBaseFilter
* iface
)
754 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
756 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
757 return IUnknown_AddRef(This
->pUnkOuter
);
758 return IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
761 static ULONG WINAPI
VideoRenderer_Release(IBaseFilter
* iface
)
763 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
765 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
766 return IUnknown_Release(This
->pUnkOuter
);
767 return IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
770 /** IPersist methods **/
772 static HRESULT WINAPI
VideoRenderer_GetClassID(IBaseFilter
* iface
, CLSID
* pClsid
)
774 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
776 TRACE("(%p/%p)->(%p)\n", This
, iface
, pClsid
);
778 *pClsid
= CLSID_VideoRenderer
;
783 /** IMediaFilter methods **/
785 static HRESULT WINAPI
VideoRenderer_Stop(IBaseFilter
* iface
)
787 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
789 TRACE("(%p/%p)->()\n", This
, iface
);
791 EnterCriticalSection(&This
->csFilter
);
793 This
->state
= State_Stopped
;
794 SetEvent(This
->hEvent
);
795 SetEvent(This
->blocked
);
796 MediaSeekingPassThru_ResetMediaTime(This
->seekthru_unk
);
798 LeaveCriticalSection(&This
->csFilter
);
803 static HRESULT WINAPI
VideoRenderer_Pause(IBaseFilter
* iface
)
805 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
807 TRACE("(%p/%p)->()\n", This
, iface
);
809 EnterCriticalSection(&This
->csFilter
);
810 if (This
->state
!= State_Paused
)
812 if (This
->state
== State_Stopped
)
814 This
->pInputPin
->end_of_stream
= 0;
815 ResetEvent(This
->hEvent
);
818 This
->state
= State_Paused
;
819 ResetEvent(This
->blocked
);
821 LeaveCriticalSection(&This
->csFilter
);
826 static HRESULT WINAPI
VideoRenderer_Run(IBaseFilter
* iface
, REFERENCE_TIME tStart
)
828 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
830 TRACE("(%p/%p)->(%s)\n", This
, iface
, wine_dbgstr_longlong(tStart
));
832 EnterCriticalSection(&This
->csFilter
);
833 if (This
->state
!= State_Running
)
835 if (This
->state
== State_Stopped
)
837 This
->pInputPin
->end_of_stream
= 0;
838 ResetEvent(This
->hEvent
);
840 SetEvent(This
->blocked
);
842 This
->rtStreamStart
= tStart
;
843 This
->state
= State_Running
;
845 LeaveCriticalSection(&This
->csFilter
);
850 static HRESULT WINAPI
VideoRenderer_GetState(IBaseFilter
* iface
, DWORD dwMilliSecsTimeout
, FILTER_STATE
*pState
)
852 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
855 TRACE("(%p/%p)->(%d, %p)\n", This
, iface
, dwMilliSecsTimeout
, pState
);
857 if (WaitForSingleObject(This
->hEvent
, dwMilliSecsTimeout
) == WAIT_TIMEOUT
)
858 hr
= VFW_S_STATE_INTERMEDIATE
;
862 EnterCriticalSection(&This
->csFilter
);
864 *pState
= This
->state
;
866 LeaveCriticalSection(&This
->csFilter
);
871 static HRESULT WINAPI
VideoRenderer_SetSyncSource(IBaseFilter
* iface
, IReferenceClock
*pClock
)
873 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
875 TRACE("(%p/%p)->(%p)\n", This
, iface
, pClock
);
877 EnterCriticalSection(&This
->csFilter
);
880 IReferenceClock_Release(This
->pClock
);
881 This
->pClock
= pClock
;
883 IReferenceClock_AddRef(This
->pClock
);
885 LeaveCriticalSection(&This
->csFilter
);
890 static HRESULT WINAPI
VideoRenderer_GetSyncSource(IBaseFilter
* iface
, IReferenceClock
**ppClock
)
892 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
894 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppClock
);
896 EnterCriticalSection(&This
->csFilter
);
898 *ppClock
= This
->pClock
;
900 IReferenceClock_AddRef(This
->pClock
);
902 LeaveCriticalSection(&This
->csFilter
);
907 /** IBaseFilter implementation **/
909 static IPin
* WINAPI
VideoRenderer_GetPin(IBaseFilter
*iface
, int pos
)
911 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
913 if (pos
>= 1 || pos
< 0)
916 IPin_AddRef((IPin
*)This
->pInputPin
);
917 return (IPin
*)This
->pInputPin
;
920 static LONG WINAPI
VideoRenderer_GetPinCount(IBaseFilter
*iface
)
925 static LONG WINAPI
VideoRenderer_GetPinVersion(IBaseFilter
*iface
)
927 /* Our pins are static, not changing so setting static tick count is ok */
931 static HRESULT WINAPI
VideoRenderer_EnumPins(IBaseFilter
* iface
, IEnumPins
**ppEnum
)
933 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
935 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppEnum
);
937 return EnumPins_Construct(iface
, VideoRenderer_GetPin
, VideoRenderer_GetPinCount
, VideoRenderer_GetPinVersion
, ppEnum
);
940 static HRESULT WINAPI
VideoRenderer_FindPin(IBaseFilter
* iface
, LPCWSTR Id
, IPin
**ppPin
)
942 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
944 FIXME("(%p/%p)->(%p,%p): stub !!!\n", This
, iface
, debugstr_w(Id
), ppPin
);
946 /* FIXME: critical section */
951 static HRESULT WINAPI
VideoRenderer_QueryFilterInfo(IBaseFilter
* iface
, FILTER_INFO
*pInfo
)
953 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
955 TRACE("(%p/%p)->(%p)\n", This
, iface
, pInfo
);
957 strcpyW(pInfo
->achName
, This
->filterInfo
.achName
);
958 pInfo
->pGraph
= This
->filterInfo
.pGraph
;
961 IFilterGraph_AddRef(pInfo
->pGraph
);
966 static HRESULT WINAPI
VideoRenderer_JoinFilterGraph(IBaseFilter
* iface
, IFilterGraph
*pGraph
, LPCWSTR pName
)
968 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
970 TRACE("(%p/%p)->(%p, %s)\n", This
, iface
, pGraph
, debugstr_w(pName
));
972 EnterCriticalSection(&This
->csFilter
);
975 strcpyW(This
->filterInfo
.achName
, pName
);
977 *This
->filterInfo
.achName
= '\0';
978 This
->filterInfo
.pGraph
= pGraph
; /* NOTE: do NOT increase ref. count */
980 LeaveCriticalSection(&This
->csFilter
);
985 static HRESULT WINAPI
VideoRenderer_QueryVendorInfo(IBaseFilter
* iface
, LPWSTR
*pVendorInfo
)
987 VideoRendererImpl
*This
= (VideoRendererImpl
*)iface
;
988 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVendorInfo
);
992 static const IBaseFilterVtbl VideoRenderer_Vtbl
=
994 VideoRenderer_QueryInterface
,
995 VideoRenderer_AddRef
,
996 VideoRenderer_Release
,
997 VideoRenderer_GetClassID
,
1001 VideoRenderer_GetState
,
1002 VideoRenderer_SetSyncSource
,
1003 VideoRenderer_GetSyncSource
,
1004 VideoRenderer_EnumPins
,
1005 VideoRenderer_FindPin
,
1006 VideoRenderer_QueryFilterInfo
,
1007 VideoRenderer_JoinFilterGraph
,
1008 VideoRenderer_QueryVendorInfo
1011 static HRESULT WINAPI
VideoRenderer_InputPin_EndOfStream(IPin
* iface
)
1013 InputPin
* This
= (InputPin
*)iface
;
1014 VideoRendererImpl
*pFilter
;
1015 IMediaEventSink
* pEventSink
;
1018 TRACE("(%p/%p)->()\n", This
, iface
);
1020 pFilter
= (VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
;
1021 hr
= IFilterGraph_QueryInterface(pFilter
->filterInfo
.pGraph
, &IID_IMediaEventSink
, (LPVOID
*)&pEventSink
);
1024 hr
= IMediaEventSink_Notify(pEventSink
, EC_COMPLETE
, S_OK
, 0);
1025 IMediaEventSink_Release(pEventSink
);
1027 MediaSeekingPassThru_EOS(pFilter
->seekthru_unk
);
1032 static HRESULT WINAPI
VideoRenderer_InputPin_BeginFlush(IPin
* iface
)
1034 InputPin
* This
= (InputPin
*)iface
;
1035 VideoRendererImpl
*pVideoRenderer
= (VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
;
1038 TRACE("(%p/%p)->()\n", This
, iface
);
1040 EnterCriticalSection(This
->pin
.pCritSec
);
1041 if (pVideoRenderer
->state
== State_Paused
)
1042 SetEvent(pVideoRenderer
->blocked
);
1044 hr
= InputPin_BeginFlush(iface
);
1045 LeaveCriticalSection(This
->pin
.pCritSec
);
1050 static HRESULT WINAPI
VideoRenderer_InputPin_EndFlush(IPin
* iface
)
1052 InputPin
* This
= (InputPin
*)iface
;
1053 VideoRendererImpl
*pVideoRenderer
= (VideoRendererImpl
*)This
->pin
.pinInfo
.pFilter
;
1056 TRACE("(%p/%p)->()\n", This
, iface
);
1058 EnterCriticalSection(This
->pin
.pCritSec
);
1059 if (pVideoRenderer
->state
== State_Paused
)
1060 ResetEvent(pVideoRenderer
->blocked
);
1062 hr
= InputPin_EndFlush(iface
);
1063 LeaveCriticalSection(This
->pin
.pCritSec
);
1064 MediaSeekingPassThru_ResetMediaTime(pVideoRenderer
->seekthru_unk
);
1069 static const IPinVtbl VideoRenderer_InputPin_Vtbl
=
1071 InputPin_QueryInterface
,
1075 InputPin_ReceiveConnection
,
1076 BasePinImpl_Disconnect
,
1077 BasePinImpl_ConnectedTo
,
1078 BasePinImpl_ConnectionMediaType
,
1079 BasePinImpl_QueryPinInfo
,
1080 BasePinImpl_QueryDirection
,
1081 BasePinImpl_QueryId
,
1082 InputPin_QueryAccept
,
1083 BasePinImpl_EnumMediaTypes
,
1084 BasePinImpl_QueryInternalConnections
,
1085 VideoRenderer_InputPin_EndOfStream
,
1086 VideoRenderer_InputPin_BeginFlush
,
1087 VideoRenderer_InputPin_EndFlush
,
1091 /*** IUnknown methods ***/
1092 static HRESULT WINAPI
Basicvideo_QueryInterface(IBasicVideo
*iface
,
1095 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1097 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
1099 return VideoRenderer_QueryInterface((IBaseFilter
*)This
, riid
, ppvObj
);
1102 static ULONG WINAPI
Basicvideo_AddRef(IBasicVideo
*iface
) {
1103 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1105 TRACE("(%p/%p)->()\n", This
, iface
);
1107 return VideoRenderer_AddRef((IBaseFilter
*)This
);
1110 static ULONG WINAPI
Basicvideo_Release(IBasicVideo
*iface
) {
1111 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1113 TRACE("(%p/%p)->()\n", This
, iface
);
1115 return VideoRenderer_Release((IBaseFilter
*)This
);
1118 /*** IDispatch methods ***/
1119 static HRESULT WINAPI
Basicvideo_GetTypeInfoCount(IBasicVideo
*iface
,
1121 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1123 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
1128 static HRESULT WINAPI
Basicvideo_GetTypeInfo(IBasicVideo
*iface
,
1131 ITypeInfo
**ppTInfo
) {
1132 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1134 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
1139 static HRESULT WINAPI
Basicvideo_GetIDsOfNames(IBasicVideo
*iface
,
1145 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1147 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1152 static HRESULT WINAPI
Basicvideo_Invoke(IBasicVideo
*iface
,
1153 DISPID dispIdMember
,
1157 DISPPARAMS
*pDispParams
,
1159 EXCEPINFO
*pExepInfo
,
1161 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1163 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
);
1168 /*** IBasicVideo methods ***/
1169 static HRESULT WINAPI
Basicvideo_get_AvgTimePerFrame(IBasicVideo
*iface
,
1170 REFTIME
*pAvgTimePerFrame
) {
1172 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1174 if (!This
->pInputPin
->pin
.pConnectedTo
)
1175 return VFW_E_NOT_CONNECTED
;
1177 TRACE("(%p/%p)->(%p)\n", This
, iface
, pAvgTimePerFrame
);
1179 pmt
= &This
->pInputPin
->pin
.mtCurrent
;
1180 if (IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo
)) {
1181 VIDEOINFOHEADER
*vih
= (VIDEOINFOHEADER
*)pmt
->pbFormat
;
1182 *pAvgTimePerFrame
= vih
->AvgTimePerFrame
;
1183 } else if (IsEqualIID(&pmt
->formattype
, &FORMAT_VideoInfo2
)) {
1184 VIDEOINFOHEADER2
*vih
= (VIDEOINFOHEADER2
*)pmt
->pbFormat
;
1185 *pAvgTimePerFrame
= vih
->AvgTimePerFrame
;
1187 ERR("Unknown format type %s\n", qzdebugstr_guid(&pmt
->formattype
));
1188 *pAvgTimePerFrame
= 0;
1193 static HRESULT WINAPI
Basicvideo_get_BitRate(IBasicVideo
*iface
,
1195 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1197 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBitRate
);
1202 static HRESULT WINAPI
Basicvideo_get_BitErrorRate(IBasicVideo
*iface
,
1203 LONG
*pBitErrorRate
) {
1204 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1206 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBitErrorRate
);
1211 static HRESULT WINAPI
Basicvideo_get_VideoWidth(IBasicVideo
*iface
,
1212 LONG
*pVideoWidth
) {
1213 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1215 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoWidth
);
1217 *pVideoWidth
= This
->VideoWidth
;
1222 static HRESULT WINAPI
Basicvideo_get_VideoHeight(IBasicVideo
*iface
,
1223 LONG
*pVideoHeight
) {
1224 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1226 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoHeight
);
1228 *pVideoHeight
= This
->VideoHeight
;
1233 static HRESULT WINAPI
Basicvideo_put_SourceLeft(IBasicVideo
*iface
,
1235 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1237 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceLeft
);
1239 This
->SourceRect
.left
= SourceLeft
;
1244 static HRESULT WINAPI
Basicvideo_get_SourceLeft(IBasicVideo
*iface
,
1245 LONG
*pSourceLeft
) {
1246 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1248 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceLeft
);
1250 *pSourceLeft
= This
->SourceRect
.left
;
1255 static HRESULT WINAPI
Basicvideo_put_SourceWidth(IBasicVideo
*iface
,
1257 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1259 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceWidth
);
1261 This
->SourceRect
.right
= This
->SourceRect
.left
+ SourceWidth
;
1266 static HRESULT WINAPI
Basicvideo_get_SourceWidth(IBasicVideo
*iface
,
1267 LONG
*pSourceWidth
) {
1268 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1270 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceWidth
);
1272 *pSourceWidth
= This
->SourceRect
.right
- This
->SourceRect
.left
;
1277 static HRESULT WINAPI
Basicvideo_put_SourceTop(IBasicVideo
*iface
,
1279 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1281 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceTop
);
1283 This
->SourceRect
.top
= SourceTop
;
1288 static HRESULT WINAPI
Basicvideo_get_SourceTop(IBasicVideo
*iface
,
1290 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1292 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceTop
);
1294 *pSourceTop
= This
->SourceRect
.top
;
1299 static HRESULT WINAPI
Basicvideo_put_SourceHeight(IBasicVideo
*iface
,
1300 LONG SourceHeight
) {
1301 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1303 TRACE("(%p/%p)->(%d)\n", This
, iface
, SourceHeight
);
1305 This
->SourceRect
.bottom
= This
->SourceRect
.top
+ SourceHeight
;
1310 static HRESULT WINAPI
Basicvideo_get_SourceHeight(IBasicVideo
*iface
,
1311 LONG
*pSourceHeight
) {
1312 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1314 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceHeight
);
1316 *pSourceHeight
= This
->SourceRect
.bottom
- This
->SourceRect
.top
;
1321 static HRESULT WINAPI
Basicvideo_put_DestinationLeft(IBasicVideo
*iface
,
1322 LONG DestinationLeft
) {
1323 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1325 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationLeft
);
1327 This
->DestRect
.left
= DestinationLeft
;
1332 static HRESULT WINAPI
Basicvideo_get_DestinationLeft(IBasicVideo
*iface
,
1333 LONG
*pDestinationLeft
) {
1334 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1336 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationLeft
);
1338 *pDestinationLeft
= This
->DestRect
.left
;
1343 static HRESULT WINAPI
Basicvideo_put_DestinationWidth(IBasicVideo
*iface
,
1344 LONG DestinationWidth
) {
1345 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1347 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationWidth
);
1349 This
->DestRect
.right
= This
->DestRect
.left
+ DestinationWidth
;
1354 static HRESULT WINAPI
Basicvideo_get_DestinationWidth(IBasicVideo
*iface
,
1355 LONG
*pDestinationWidth
) {
1356 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1358 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationWidth
);
1360 *pDestinationWidth
= This
->DestRect
.right
- This
->DestRect
.left
;
1365 static HRESULT WINAPI
Basicvideo_put_DestinationTop(IBasicVideo
*iface
,
1366 LONG DestinationTop
) {
1367 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1369 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationTop
);
1371 This
->DestRect
.top
= DestinationTop
;
1376 static HRESULT WINAPI
Basicvideo_get_DestinationTop(IBasicVideo
*iface
,
1377 LONG
*pDestinationTop
) {
1378 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1380 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationTop
);
1382 *pDestinationTop
= This
->DestRect
.top
;
1387 static HRESULT WINAPI
Basicvideo_put_DestinationHeight(IBasicVideo
*iface
,
1388 LONG DestinationHeight
) {
1389 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1391 TRACE("(%p/%p)->(%d)\n", This
, iface
, DestinationHeight
);
1393 This
->DestRect
.right
= This
->DestRect
.left
+ DestinationHeight
;
1398 static HRESULT WINAPI
Basicvideo_get_DestinationHeight(IBasicVideo
*iface
,
1399 LONG
*pDestinationHeight
) {
1400 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1402 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationHeight
);
1404 *pDestinationHeight
= This
->DestRect
.right
- This
->DestRect
.left
;
1409 static HRESULT WINAPI
Basicvideo_SetSourcePosition(IBasicVideo
*iface
,
1414 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1416 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This
, iface
, Left
, Top
, Width
, Height
);
1418 This
->SourceRect
.left
= Left
;
1419 This
->SourceRect
.top
= Top
;
1420 This
->SourceRect
.right
= Left
+ Width
;
1421 This
->SourceRect
.bottom
= Top
+ Height
;
1426 static HRESULT WINAPI
Basicvideo_GetSourcePosition(IBasicVideo
*iface
,
1431 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1433 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1435 *pLeft
= This
->SourceRect
.left
;
1436 *pTop
= This
->SourceRect
.top
;
1437 *pWidth
= This
->SourceRect
.right
- This
->SourceRect
.left
;
1438 *pHeight
= This
->SourceRect
.bottom
- This
->SourceRect
.top
;
1443 static HRESULT WINAPI
Basicvideo_SetDefaultSourcePosition(IBasicVideo
*iface
) {
1444 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1446 TRACE("(%p/%p)->()\n", This
, iface
);
1448 This
->SourceRect
.left
= 0;
1449 This
->SourceRect
.top
= 0;
1450 This
->SourceRect
.right
= This
->VideoWidth
;
1451 This
->SourceRect
.bottom
= This
->VideoHeight
;
1456 static HRESULT WINAPI
Basicvideo_SetDestinationPosition(IBasicVideo
*iface
,
1461 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1463 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This
, iface
, Left
, Top
, Width
, Height
);
1465 This
->DestRect
.left
= Left
;
1466 This
->DestRect
.top
= Top
;
1467 This
->DestRect
.right
= Left
+ Width
;
1468 This
->DestRect
.bottom
= Top
+ Height
;
1473 static HRESULT WINAPI
Basicvideo_GetDestinationPosition(IBasicVideo
*iface
,
1478 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1480 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
1482 *pLeft
= This
->DestRect
.left
;
1483 *pTop
= This
->DestRect
.top
;
1484 *pWidth
= This
->DestRect
.right
- This
->DestRect
.left
;
1485 *pHeight
= This
->DestRect
.bottom
- This
->DestRect
.top
;
1490 static HRESULT WINAPI
Basicvideo_SetDefaultDestinationPosition(IBasicVideo
*iface
) {
1491 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1494 TRACE("(%p/%p)->()\n", This
, iface
);
1496 if (!GetClientRect(This
->hWnd
, &rect
))
1499 This
->SourceRect
.left
= 0;
1500 This
->SourceRect
.top
= 0;
1501 This
->SourceRect
.right
= rect
.right
;
1502 This
->SourceRect
.bottom
= rect
.bottom
;
1507 static HRESULT WINAPI
Basicvideo_GetVideoSize(IBasicVideo
*iface
,
1510 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1512 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pWidth
, pHeight
);
1514 *pWidth
= This
->VideoWidth
;
1515 *pHeight
= This
->VideoHeight
;
1520 static HRESULT WINAPI
Basicvideo_GetVideoPaletteEntries(IBasicVideo
*iface
,
1525 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1527 FIXME("(%p/%p)->(%d, %d, %p, %p): stub !!!\n", This
, iface
, StartIndex
, Entries
, pRetrieved
, pPalette
);
1532 static HRESULT WINAPI
Basicvideo_GetCurrentImage(IBasicVideo
*iface
,
1535 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1536 BITMAPINFOHEADER
*bmiHeader
;
1538 AM_MEDIA_TYPE
*amt
= &This
->pInputPin
->pin
.mtCurrent
;
1541 FIXME("(%p/%p)->(%p, %p): partial stub\n", This
, iface
, pBufferSize
, pDIBImage
);
1543 EnterCriticalSection(&This
->csFilter
);
1545 if (!This
->sample_held
)
1547 LeaveCriticalSection(&This
->csFilter
);
1548 return (This
->state
== State_Paused
? E_UNEXPECTED
: VFW_E_NOT_PAUSED
);
1551 if (IsEqualIID(&amt
->formattype
, &FORMAT_VideoInfo
))
1553 bmiHeader
= &((VIDEOINFOHEADER
*)amt
->pbFormat
)->bmiHeader
;
1555 else if (IsEqualIID(&amt
->formattype
, &FORMAT_VideoInfo2
))
1557 bmiHeader
= &((VIDEOINFOHEADER2
*)amt
->pbFormat
)->bmiHeader
;
1561 FIXME("Unknown type %s\n", debugstr_guid(&amt
->subtype
));
1562 LeaveCriticalSection(&This
->csFilter
);
1563 return VFW_E_RUNTIME_ERROR
;
1566 needed_size
= bmiHeader
->biSize
;
1567 needed_size
+= IMediaSample_GetActualDataLength(This
->sample_held
);
1571 *pBufferSize
= needed_size
;
1572 LeaveCriticalSection(&This
->csFilter
);
1576 if (needed_size
< *pBufferSize
)
1578 ERR("Buffer too small %u/%u\n", needed_size
, *pBufferSize
);
1579 LeaveCriticalSection(&This
->csFilter
);
1582 *pBufferSize
= needed_size
;
1584 memcpy(pDIBImage
, bmiHeader
, bmiHeader
->biSize
);
1585 IMediaSample_GetPointer(This
->sample_held
, (BYTE
**)&ptr
);
1586 memcpy((char *)pDIBImage
+ bmiHeader
->biSize
, ptr
, IMediaSample_GetActualDataLength(This
->sample_held
));
1588 LeaveCriticalSection(&This
->csFilter
);
1593 static HRESULT WINAPI
Basicvideo_IsUsingDefaultSource(IBasicVideo
*iface
) {
1594 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1596 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
1601 static HRESULT WINAPI
Basicvideo_IsUsingDefaultDestination(IBasicVideo
*iface
) {
1602 ICOM_THIS_MULTI(VideoRendererImpl
, IBasicVideo_vtbl
, iface
);
1604 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
1610 static const IBasicVideoVtbl IBasicVideo_VTable
=
1612 Basicvideo_QueryInterface
,
1615 Basicvideo_GetTypeInfoCount
,
1616 Basicvideo_GetTypeInfo
,
1617 Basicvideo_GetIDsOfNames
,
1619 Basicvideo_get_AvgTimePerFrame
,
1620 Basicvideo_get_BitRate
,
1621 Basicvideo_get_BitErrorRate
,
1622 Basicvideo_get_VideoWidth
,
1623 Basicvideo_get_VideoHeight
,
1624 Basicvideo_put_SourceLeft
,
1625 Basicvideo_get_SourceLeft
,
1626 Basicvideo_put_SourceWidth
,
1627 Basicvideo_get_SourceWidth
,
1628 Basicvideo_put_SourceTop
,
1629 Basicvideo_get_SourceTop
,
1630 Basicvideo_put_SourceHeight
,
1631 Basicvideo_get_SourceHeight
,
1632 Basicvideo_put_DestinationLeft
,
1633 Basicvideo_get_DestinationLeft
,
1634 Basicvideo_put_DestinationWidth
,
1635 Basicvideo_get_DestinationWidth
,
1636 Basicvideo_put_DestinationTop
,
1637 Basicvideo_get_DestinationTop
,
1638 Basicvideo_put_DestinationHeight
,
1639 Basicvideo_get_DestinationHeight
,
1640 Basicvideo_SetSourcePosition
,
1641 Basicvideo_GetSourcePosition
,
1642 Basicvideo_SetDefaultSourcePosition
,
1643 Basicvideo_SetDestinationPosition
,
1644 Basicvideo_GetDestinationPosition
,
1645 Basicvideo_SetDefaultDestinationPosition
,
1646 Basicvideo_GetVideoSize
,
1647 Basicvideo_GetVideoPaletteEntries
,
1648 Basicvideo_GetCurrentImage
,
1649 Basicvideo_IsUsingDefaultSource
,
1650 Basicvideo_IsUsingDefaultDestination
1654 /*** IUnknown methods ***/
1655 static HRESULT WINAPI
Videowindow_QueryInterface(IVideoWindow
*iface
,
1658 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1660 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
1662 return VideoRenderer_QueryInterface((IBaseFilter
*)This
, riid
, ppvObj
);
1665 static ULONG WINAPI
Videowindow_AddRef(IVideoWindow
*iface
) {
1666 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1668 TRACE("(%p/%p)->()\n", This
, iface
);
1670 return VideoRenderer_AddRef((IBaseFilter
*)This
);
1673 static ULONG WINAPI
Videowindow_Release(IVideoWindow
*iface
) {
1674 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1676 TRACE("(%p/%p)->()\n", This
, iface
);
1678 return VideoRenderer_Release((IBaseFilter
*)This
);
1681 /*** IDispatch methods ***/
1682 static HRESULT WINAPI
Videowindow_GetTypeInfoCount(IVideoWindow
*iface
,
1684 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1686 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
1691 static HRESULT WINAPI
Videowindow_GetTypeInfo(IVideoWindow
*iface
,
1694 ITypeInfo
**ppTInfo
) {
1695 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1697 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
1702 static HRESULT WINAPI
Videowindow_GetIDsOfNames(IVideoWindow
*iface
,
1708 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1710 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1715 static HRESULT WINAPI
Videowindow_Invoke(IVideoWindow
*iface
,
1716 DISPID dispIdMember
,
1720 DISPPARAMS
*pDispParams
,
1722 EXCEPINFO
*pExepInfo
,
1724 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1726 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
);
1731 /*** IVideoWindow methods ***/
1732 static HRESULT WINAPI
Videowindow_put_Caption(IVideoWindow
*iface
,
1734 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1736 TRACE("(%p/%p)->(%s (%p))\n", This
, iface
, debugstr_w(strCaption
), strCaption
);
1738 if (!SetWindowTextW(This
->hWnd
, strCaption
))
1744 static HRESULT WINAPI
Videowindow_get_Caption(IVideoWindow
*iface
,
1746 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1748 TRACE("(%p/%p)->(%p)\n", This
, iface
, strCaption
);
1750 GetWindowTextW(This
->hWnd
, (LPWSTR
)strCaption
, 100);
1755 static HRESULT WINAPI
Videowindow_put_WindowStyle(IVideoWindow
*iface
,
1757 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1760 old
= GetWindowLongA(This
->hWnd
, GWL_STYLE
);
1762 TRACE("(%p/%p)->(%x -> %x)\n", This
, iface
, old
, WindowStyle
);
1764 if (WindowStyle
& (WS_DISABLED
|WS_HSCROLL
|WS_ICONIC
|WS_MAXIMIZE
|WS_MINIMIZE
|WS_VSCROLL
))
1765 return E_INVALIDARG
;
1767 SetWindowLongA(This
->hWnd
, GWL_STYLE
, WindowStyle
);
1768 SetWindowPos(This
->hWnd
,0,0,0,0,0,SWP_FRAMECHANGED
|SWP_NOSIZE
|SWP_NOZORDER
);
1769 This
->WindowStyle
= WindowStyle
;
1774 static HRESULT WINAPI
Videowindow_get_WindowStyle(IVideoWindow
*iface
,
1775 LONG
*WindowStyle
) {
1776 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1778 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyle
);
1780 *WindowStyle
= This
->WindowStyle
;
1785 static HRESULT WINAPI
Videowindow_put_WindowStyleEx(IVideoWindow
*iface
,
1786 LONG WindowStyleEx
) {
1787 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1789 TRACE("(%p/%p)->(%d)\n", This
, iface
, WindowStyleEx
);
1791 if (!SetWindowLongA(This
->hWnd
, GWL_EXSTYLE
, WindowStyleEx
))
1797 static HRESULT WINAPI
Videowindow_get_WindowStyleEx(IVideoWindow
*iface
,
1798 LONG
*WindowStyleEx
) {
1799 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1801 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyleEx
);
1803 *WindowStyleEx
= GetWindowLongA(This
->hWnd
, GWL_EXSTYLE
);
1808 static HRESULT WINAPI
Videowindow_put_AutoShow(IVideoWindow
*iface
,
1810 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1812 TRACE("(%p/%p)->(%d)\n", This
, iface
, AutoShow
);
1814 This
->AutoShow
= AutoShow
;
1819 static HRESULT WINAPI
Videowindow_get_AutoShow(IVideoWindow
*iface
,
1821 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1823 TRACE("(%p/%p)->(%p)\n", This
, iface
, AutoShow
);
1825 *AutoShow
= This
->AutoShow
;
1830 static HRESULT WINAPI
Videowindow_put_WindowState(IVideoWindow
*iface
,
1832 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1834 TRACE("(%p/%p)->(%d)\n", This
, iface
, WindowState
);
1835 ShowWindow(This
->hWnd
, WindowState
);
1839 static HRESULT WINAPI
Videowindow_get_WindowState(IVideoWindow
*iface
,
1840 LONG
*WindowState
) {
1841 WINDOWPLACEMENT place
;
1842 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1844 place
.length
= sizeof(place
);
1845 GetWindowPlacement(This
->hWnd
, &place
);
1846 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowState
);
1847 *WindowState
= place
.showCmd
;
1852 static HRESULT WINAPI
Videowindow_put_BackgroundPalette(IVideoWindow
*iface
,
1853 LONG BackgroundPalette
) {
1854 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1856 FIXME("(%p/%p)->(%d): stub !!!\n", This
, iface
, BackgroundPalette
);
1861 static HRESULT WINAPI
Videowindow_get_BackgroundPalette(IVideoWindow
*iface
,
1862 LONG
*pBackgroundPalette
) {
1863 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1865 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pBackgroundPalette
);
1870 static HRESULT WINAPI
Videowindow_put_Visible(IVideoWindow
*iface
,
1872 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1874 TRACE("(%p/%p)->(%d)\n", This
, iface
, Visible
);
1876 ShowWindow(This
->hWnd
, Visible
? SW_SHOW
: SW_HIDE
);
1881 static HRESULT WINAPI
Videowindow_get_Visible(IVideoWindow
*iface
,
1883 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1885 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVisible
);
1887 *pVisible
= IsWindowVisible(This
->hWnd
);
1892 static HRESULT WINAPI
Videowindow_put_Left(IVideoWindow
*iface
,
1894 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1896 TRACE("(%p/%p)->(%d)\n", This
, iface
, Left
);
1898 if (!SetWindowPos(This
->hWnd
, NULL
, Left
, This
->WindowPos
.top
, 0, 0, SWP_NOZORDER
|SWP_NOSIZE
))
1901 This
->WindowPos
.left
= Left
;
1906 static HRESULT WINAPI
Videowindow_get_Left(IVideoWindow
*iface
,
1908 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1910 TRACE("(%p/%p)->(%p)\n", This
, iface
, pLeft
);
1912 *pLeft
= This
->WindowPos
.left
;
1917 static HRESULT WINAPI
Videowindow_put_Width(IVideoWindow
*iface
,
1919 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1921 TRACE("(%p/%p)->(%d)\n", This
, iface
, Width
);
1923 if (!SetWindowPos(This
->hWnd
, NULL
, 0, 0, Width
, This
->WindowPos
.bottom
-This
->WindowPos
.top
, SWP_NOZORDER
|SWP_NOMOVE
))
1926 This
->WindowPos
.right
= This
->WindowPos
.left
+ Width
;
1931 static HRESULT WINAPI
Videowindow_get_Width(IVideoWindow
*iface
,
1933 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1935 TRACE("(%p/%p)->(%p)\n", This
, iface
, pWidth
);
1937 *pWidth
= This
->WindowPos
.right
- This
->WindowPos
.left
;
1942 static HRESULT WINAPI
Videowindow_put_Top(IVideoWindow
*iface
,
1944 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1946 TRACE("(%p/%p)->(%d)\n", This
, iface
, Top
);
1948 if (!SetWindowPos(This
->hWnd
, NULL
, This
->WindowPos
.left
, Top
, 0, 0, SWP_NOZORDER
|SWP_NOSIZE
))
1951 This
->WindowPos
.top
= Top
;
1956 static HRESULT WINAPI
Videowindow_get_Top(IVideoWindow
*iface
,
1958 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1960 TRACE("(%p/%p)->(%p)\n", This
, iface
, pTop
);
1962 *pTop
= This
->WindowPos
.top
;
1967 static HRESULT WINAPI
Videowindow_put_Height(IVideoWindow
*iface
,
1969 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1971 TRACE("(%p/%p)->(%d)\n", This
, iface
, Height
);
1973 if (!SetWindowPos(This
->hWnd
, NULL
, 0, 0, This
->WindowPos
.right
-This
->WindowPos
.left
, Height
, SWP_NOZORDER
|SWP_NOMOVE
))
1976 This
->WindowPos
.bottom
= This
->WindowPos
.top
+ Height
;
1981 static HRESULT WINAPI
Videowindow_get_Height(IVideoWindow
*iface
,
1983 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1985 TRACE("(%p/%p)->(%p)\n", This
, iface
, pHeight
);
1987 *pHeight
= This
->WindowPos
.bottom
- This
->WindowPos
.top
;
1992 static HRESULT WINAPI
Videowindow_put_Owner(IVideoWindow
*iface
,
1994 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
1996 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Owner
);
1998 SetParent(This
->hWnd
, (HWND
)Owner
);
1999 if (This
->WindowStyle
& WS_CHILD
)
2001 LONG old
= GetWindowLongA(This
->hWnd
, GWL_STYLE
);
2002 if (old
!= This
->WindowStyle
)
2004 SetWindowLongA(This
->hWnd
, GWL_STYLE
, This
->WindowStyle
);
2005 SetWindowPos(This
->hWnd
,0,0,0,0,0,SWP_FRAMECHANGED
|SWP_NOSIZE
|SWP_NOZORDER
);
2012 static HRESULT WINAPI
Videowindow_get_Owner(IVideoWindow
*iface
,
2014 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2016 TRACE("(%p/%p)->(%p)\n", This
, iface
, Owner
);
2018 *(HWND
*)Owner
= GetParent(This
->hWnd
);
2023 static HRESULT WINAPI
Videowindow_put_MessageDrain(IVideoWindow
*iface
,
2025 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2027 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Drain
);
2029 This
->hWndMsgDrain
= (HWND
)Drain
;
2034 static HRESULT WINAPI
Videowindow_get_MessageDrain(IVideoWindow
*iface
,
2036 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2038 TRACE("(%p/%p)->(%p)\n", This
, iface
, Drain
);
2040 *Drain
= (OAHWND
)This
->hWndMsgDrain
;
2045 static HRESULT WINAPI
Videowindow_get_BorderColor(IVideoWindow
*iface
,
2047 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2049 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, Color
);
2054 static HRESULT WINAPI
Videowindow_put_BorderColor(IVideoWindow
*iface
,
2056 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2058 FIXME("(%p/%p)->(%d): stub !!!\n", This
, iface
, Color
);
2063 static HRESULT WINAPI
Videowindow_get_FullScreenMode(IVideoWindow
*iface
,
2064 LONG
*FullScreenMode
) {
2065 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2067 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, FullScreenMode
);
2072 static HRESULT WINAPI
Videowindow_put_FullScreenMode(IVideoWindow
*iface
,
2073 LONG FullScreenMode
) {
2074 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2076 FIXME("(%p/%p)->(%d): stub !!!\n", This
, iface
, FullScreenMode
);
2081 static HRESULT WINAPI
Videowindow_SetWindowForeground(IVideoWindow
*iface
,
2083 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2088 TRACE("(%p/%p)->(%d)\n", This
, iface
, Focus
);
2090 if ((Focus
!= FALSE
) && (Focus
!= TRUE
))
2091 return E_INVALIDARG
;
2093 hr
= IPin_ConnectedTo((IPin
*)This
->pInputPin
, &pPin
);
2094 if ((hr
!= S_OK
) || !pPin
)
2095 return VFW_E_NOT_CONNECTED
;
2098 ret
= SetForegroundWindow(This
->hWnd
);
2100 ret
= SetWindowPos(This
->hWnd
, HWND_TOP
, 0, 0, 0, 0, SWP_NOMOVE
|SWP_NOSIZE
);
2108 static HRESULT WINAPI
Videowindow_NotifyOwnerMessage(IVideoWindow
*iface
,
2113 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2115 TRACE("(%p/%p)->(%08lx, %d, %08lx, %08lx)\n", This
, iface
, hwnd
, uMsg
, wParam
, lParam
);
2117 if (!PostMessageA(This
->hWnd
, uMsg
, wParam
, lParam
))
2123 static HRESULT WINAPI
Videowindow_SetWindowPosition(IVideoWindow
*iface
,
2128 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2130 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This
, iface
, Left
, Top
, Width
, Height
);
2132 if (!SetWindowPos(This
->hWnd
, NULL
, Left
, Top
, Width
, Height
, SWP_NOZORDER
))
2135 This
->WindowPos
.left
= Left
;
2136 This
->WindowPos
.top
= Top
;
2137 This
->WindowPos
.right
= Left
+ Width
;
2138 This
->WindowPos
.bottom
= Top
+ Height
;
2143 static HRESULT WINAPI
Videowindow_GetWindowPosition(IVideoWindow
*iface
,
2148 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2150 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
2152 *pLeft
= This
->WindowPos
.left
;
2153 *pTop
= This
->WindowPos
.top
;
2154 *pWidth
= This
->WindowPos
.right
- This
->WindowPos
.left
;
2155 *pHeight
= This
->WindowPos
.bottom
- This
->WindowPos
.top
;
2160 static HRESULT WINAPI
Videowindow_GetMinIdealImageSize(IVideoWindow
*iface
,
2163 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2165 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This
, iface
, pWidth
, pHeight
);
2167 *pWidth
= This
->VideoWidth
;
2168 *pHeight
= This
->VideoHeight
;
2173 static HRESULT WINAPI
Videowindow_GetMaxIdealImageSize(IVideoWindow
*iface
,
2176 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2178 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This
, iface
, pWidth
, pHeight
);
2180 *pWidth
= This
->VideoWidth
;
2181 *pHeight
= This
->VideoHeight
;
2186 static HRESULT WINAPI
Videowindow_GetRestorePosition(IVideoWindow
*iface
,
2191 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2193 FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
2198 static HRESULT WINAPI
Videowindow_HideCursor(IVideoWindow
*iface
,
2200 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2202 FIXME("(%p/%p)->(%d): stub !!!\n", This
, iface
, HideCursor
);
2207 static HRESULT WINAPI
Videowindow_IsCursorHidden(IVideoWindow
*iface
,
2208 LONG
*CursorHidden
) {
2209 ICOM_THIS_MULTI(VideoRendererImpl
, IVideoWindow_vtbl
, iface
);
2211 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, CursorHidden
);
2216 static const IVideoWindowVtbl IVideoWindow_VTable
=
2218 Videowindow_QueryInterface
,
2220 Videowindow_Release
,
2221 Videowindow_GetTypeInfoCount
,
2222 Videowindow_GetTypeInfo
,
2223 Videowindow_GetIDsOfNames
,
2225 Videowindow_put_Caption
,
2226 Videowindow_get_Caption
,
2227 Videowindow_put_WindowStyle
,
2228 Videowindow_get_WindowStyle
,
2229 Videowindow_put_WindowStyleEx
,
2230 Videowindow_get_WindowStyleEx
,
2231 Videowindow_put_AutoShow
,
2232 Videowindow_get_AutoShow
,
2233 Videowindow_put_WindowState
,
2234 Videowindow_get_WindowState
,
2235 Videowindow_put_BackgroundPalette
,
2236 Videowindow_get_BackgroundPalette
,
2237 Videowindow_put_Visible
,
2238 Videowindow_get_Visible
,
2239 Videowindow_put_Left
,
2240 Videowindow_get_Left
,
2241 Videowindow_put_Width
,
2242 Videowindow_get_Width
,
2243 Videowindow_put_Top
,
2244 Videowindow_get_Top
,
2245 Videowindow_put_Height
,
2246 Videowindow_get_Height
,
2247 Videowindow_put_Owner
,
2248 Videowindow_get_Owner
,
2249 Videowindow_put_MessageDrain
,
2250 Videowindow_get_MessageDrain
,
2251 Videowindow_get_BorderColor
,
2252 Videowindow_put_BorderColor
,
2253 Videowindow_get_FullScreenMode
,
2254 Videowindow_put_FullScreenMode
,
2255 Videowindow_SetWindowForeground
,
2256 Videowindow_NotifyOwnerMessage
,
2257 Videowindow_SetWindowPosition
,
2258 Videowindow_GetWindowPosition
,
2259 Videowindow_GetMinIdealImageSize
,
2260 Videowindow_GetMaxIdealImageSize
,
2261 Videowindow_GetRestorePosition
,
2262 Videowindow_HideCursor
,
2263 Videowindow_IsCursorHidden