quartz: Convert VideoRenderer to use strmbase BaseRenderer.
[wine/multimedia.git] / dlls / quartz / videorenderer.c
blobd69cce9da726427e9c030fb10e5efdde2894a990
1 /*
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
21 #include "config.h"
23 #define NONAMELESSSTRUCT
24 #define NONAMELESSUNION
25 #include "quartz_private.h"
26 #include "pin.h"
28 #include "uuids.h"
29 #include "vfwmsgs.h"
30 #include "amvideo.h"
31 #include "windef.h"
32 #include "winbase.h"
33 #include "dshow.h"
34 #include "evcode.h"
35 #include "strmif.h"
36 #include "ddraw.h"
37 #include "dvdmedia.h"
39 #include <assert.h>
40 #include "wine/unicode.h"
41 #include "wine/debug.h"
43 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
45 static const IBaseFilterVtbl VideoRenderer_Vtbl;
46 static const IUnknownVtbl IInner_VTable;
47 static const IBasicVideoVtbl IBasicVideo_VTable;
48 static const IVideoWindowVtbl IVideoWindow_VTable;
49 static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl;
51 typedef struct VideoRendererImpl
53 BaseRenderer renderer;
54 const IBasicVideoVtbl * IBasicVideo_vtbl;
55 const IVideoWindowVtbl * IVideoWindow_vtbl;
56 const IUnknownVtbl * IInner_vtbl;
57 const IAMFilterMiscFlagsVtbl *IAMFilterMiscFlags_vtbl;
59 BOOL init;
60 HANDLE hThread;
62 BaseWindow baseWindow;
64 DWORD ThreadID;
65 HANDLE hEvent;
66 /* hEvent == evComplete? */
67 BOOL ThreadResult;
68 HWND hWndMsgDrain;
69 HWND hWndOwner;
70 BOOL AutoShow;
71 RECT SourceRect;
72 RECT DestRect;
73 RECT WindowPos;
74 LONG VideoWidth;
75 LONG VideoHeight;
76 IUnknown * pUnkOuter;
77 BOOL bUnkOuterValid;
78 BOOL bAggregatable;
79 LONG WindowStyle;
80 } VideoRendererImpl;
82 static inline VideoRendererImpl *impl_from_BaseWindow(BaseWindow *iface)
84 return CONTAINING_RECORD(iface, VideoRendererImpl, baseWindow);
87 static inline VideoRendererImpl *impl_from_BaseRenderer(BaseRenderer *iface)
89 return CONTAINING_RECORD(iface, VideoRendererImpl, renderer);
92 static inline VideoRendererImpl *impl_from_IBaseFilter(IBaseFilter *iface)
94 return CONTAINING_RECORD(iface, VideoRendererImpl, renderer.filter.IBaseFilter_iface);
97 static DWORD WINAPI MessageLoop(LPVOID lpParameter)
99 VideoRendererImpl* This = lpParameter;
100 MSG msg;
101 BOOL fGotMessage;
103 TRACE("Starting message loop\n");
105 if (FAILED(BaseWindowImpl_PrepareWindow(&This->baseWindow)))
107 This->ThreadResult = FALSE;
108 SetEvent(This->hEvent);
109 return 0;
112 This->ThreadResult = TRUE;
113 SetEvent(This->hEvent);
115 while ((fGotMessage = GetMessageW(&msg, NULL, 0, 0)) != 0 && fGotMessage != -1)
117 TranslateMessage(&msg);
118 DispatchMessageW(&msg);
121 TRACE("End of message loop\n");
123 return msg.wParam;
126 static BOOL CreateRenderingSubsystem(VideoRendererImpl* This)
128 This->hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
129 if (!This->hEvent)
130 return FALSE;
132 This->hThread = CreateThread(NULL, 0, MessageLoop, This, 0, &This->ThreadID);
133 if (!This->hThread)
135 CloseHandle(This->hEvent);
136 return FALSE;
139 WaitForSingleObject(This->hEvent, INFINITE);
141 if (!This->ThreadResult)
143 CloseHandle(This->hEvent);
144 CloseHandle(This->hThread);
145 return FALSE;
148 return TRUE;
151 static void VideoRenderer_AutoShowWindow(VideoRendererImpl *This) {
152 if (!This->init && (!This->WindowPos.right || !This->WindowPos.top))
154 DWORD style = GetWindowLongW(This->baseWindow.hWnd, GWL_STYLE);
155 DWORD style_ex = GetWindowLongW(This->baseWindow.hWnd, GWL_EXSTYLE);
157 if (!This->WindowPos.right)
159 This->WindowPos.left = This->SourceRect.left;
160 This->WindowPos.right = This->SourceRect.right;
162 if (!This->WindowPos.bottom)
164 This->WindowPos.top = This->SourceRect.top;
165 This->WindowPos.bottom = This->SourceRect.bottom;
168 AdjustWindowRectEx(&This->WindowPos, style, TRUE, style_ex);
170 TRACE("WindowPos: %d %d %d %d\n", This->WindowPos.left, This->WindowPos.top, This->WindowPos.right, This->WindowPos.bottom);
171 SetWindowPos(This->baseWindow.hWnd, NULL,
172 This->WindowPos.left,
173 This->WindowPos.top,
174 This->WindowPos.right - This->WindowPos.left,
175 This->WindowPos.bottom - This->WindowPos.top,
176 SWP_NOZORDER|SWP_NOMOVE|SWP_DEFERERASE);
178 GetClientRect(This->baseWindow.hWnd, &This->DestRect);
180 else if (!This->init)
181 This->DestRect = This->WindowPos;
182 This->init = TRUE;
183 if (This->AutoShow)
184 ShowWindow(This->baseWindow.hWnd, SW_SHOW);
187 static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data, DWORD size)
189 AM_MEDIA_TYPE amt;
190 HRESULT hr = S_OK;
191 DDSURFACEDESC sdesc;
192 BITMAPINFOHEADER *bmiHeader;
194 TRACE("(%p)->(%p, %d)\n", This, data, size);
196 sdesc.dwSize = sizeof(sdesc);
197 hr = IPin_ConnectionMediaType(&This->renderer.pInputPin->pin.IPin_iface, &amt);
198 if (FAILED(hr)) {
199 ERR("Unable to retrieve media type\n");
200 return hr;
203 if (IsEqualIID(&amt.formattype, &FORMAT_VideoInfo))
205 bmiHeader = &((VIDEOINFOHEADER *)amt.pbFormat)->bmiHeader;
207 else if (IsEqualIID(&amt.formattype, &FORMAT_VideoInfo2))
209 bmiHeader = &((VIDEOINFOHEADER2 *)amt.pbFormat)->bmiHeader;
211 else
213 FIXME("Unknown type %s\n", debugstr_guid(&amt.subtype));
214 return VFW_E_RUNTIME_ERROR;
217 TRACE("biSize = %d\n", bmiHeader->biSize);
218 TRACE("biWidth = %d\n", bmiHeader->biWidth);
219 TRACE("biHeight = %d\n", bmiHeader->biHeight);
220 TRACE("biPlanes = %d\n", bmiHeader->biPlanes);
221 TRACE("biBitCount = %d\n", bmiHeader->biBitCount);
222 TRACE("biCompression = %s\n", debugstr_an((LPSTR)&(bmiHeader->biCompression), 4));
223 TRACE("biSizeImage = %d\n", bmiHeader->biSizeImage);
225 if (!This->baseWindow.hDC) {
226 ERR("Cannot get DC from window!\n");
227 return E_FAIL;
230 TRACE("Src Rect: %d %d %d %d\n", This->SourceRect.left, This->SourceRect.top, This->SourceRect.right, This->SourceRect.bottom);
231 TRACE("Dst Rect: %d %d %d %d\n", This->DestRect.left, This->DestRect.top, This->DestRect.right, This->DestRect.bottom);
233 StretchDIBits(This->baseWindow.hDC, This->DestRect.left, This->DestRect.top, This->DestRect.right -This->DestRect.left,
234 This->DestRect.bottom - This->DestRect.top, This->SourceRect.left, This->SourceRect.top,
235 This->SourceRect.right - This->SourceRect.left, This->SourceRect.bottom - This->SourceRect.top,
236 data, (BITMAPINFO *)bmiHeader, DIB_RGB_COLORS, SRCCOPY);
238 return S_OK;
241 HRESULT WINAPI VideoRenderer_ShouldDrawSampleNow(BaseRenderer *This, IMediaSample *pSample, REFERENCE_TIME *pStartTime, REFERENCE_TIME *pEndTime)
243 /* Preroll means the sample isn't shown, this is used for key frames and things like that */
244 if (IMediaSample_IsPreroll(pSample) == S_OK)
245 return E_FAIL;
246 return S_FALSE;
249 static HRESULT WINAPI VideoRenderer_DoRenderSample(BaseRenderer* iface, IMediaSample * pSample)
251 VideoRendererImpl *This = impl_from_BaseRenderer(iface);
252 LPBYTE pbSrcStream = NULL;
253 LONG cbSrcStream = 0;
254 HRESULT hr;
256 TRACE("(%p)->(%p)\n", This, pSample);
258 hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
259 if (FAILED(hr))
261 ERR("Cannot get pointer to sample data (%x)\n", hr);
262 return hr;
265 cbSrcStream = IMediaSample_GetActualDataLength(pSample);
267 TRACE("val %p %d\n", pbSrcStream, cbSrcStream);
269 #if 0 /* For debugging purpose */
271 int i;
272 for(i = 0; i < cbSrcStream; i++)
274 if ((i!=0) && !(i%16))
275 TRACE("\n");
276 TRACE("%02x ", pbSrcStream[i]);
278 TRACE("\n");
280 #endif
282 SetEvent(This->hEvent);
283 if (This->renderer.filter.state == State_Paused)
285 VideoRenderer_SendSampleData(This, pbSrcStream, cbSrcStream);
286 SetEvent(This->hEvent);
287 if (This->renderer.filter.state == State_Paused)
289 /* Flushing */
290 return S_OK;
292 if (This->renderer.filter.state == State_Stopped)
294 return VFW_E_WRONG_STATE;
296 } else {
297 VideoRenderer_SendSampleData(This, pbSrcStream, cbSrcStream);
299 return S_OK;
302 static HRESULT WINAPI VideoRenderer_CheckMediaType(BaseRenderer *iface, const AM_MEDIA_TYPE * pmt)
304 VideoRendererImpl *This = impl_from_BaseRenderer(iface);
306 if (!IsEqualIID(&pmt->majortype, &MEDIATYPE_Video))
307 return S_FALSE;
309 if (IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB32) ||
310 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB24) ||
311 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB565) ||
312 IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB8))
314 LONG height;
316 if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo))
318 VIDEOINFOHEADER *format = (VIDEOINFOHEADER *)pmt->pbFormat;
319 This->SourceRect.left = 0;
320 This->SourceRect.top = 0;
321 This->SourceRect.right = This->VideoWidth = format->bmiHeader.biWidth;
322 height = format->bmiHeader.biHeight;
323 if (height < 0)
324 This->SourceRect.bottom = This->VideoHeight = -height;
325 else
326 This->SourceRect.bottom = This->VideoHeight = height;
328 else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2))
330 VIDEOINFOHEADER2 *format2 = (VIDEOINFOHEADER2 *)pmt->pbFormat;
332 This->SourceRect.left = 0;
333 This->SourceRect.top = 0;
334 This->SourceRect.right = This->VideoWidth = format2->bmiHeader.biWidth;
335 height = format2->bmiHeader.biHeight;
336 if (height < 0)
337 This->SourceRect.bottom = This->VideoHeight = -height;
338 else
339 This->SourceRect.bottom = This->VideoHeight = height;
341 else
343 WARN("Format type %s not supported\n", debugstr_guid(&pmt->formattype));
344 return S_FALSE;
346 return S_OK;
348 return S_FALSE;
351 static HRESULT WINAPI VideoRenderer_EndFlush(BaseRenderer* iface)
353 VideoRendererImpl *This = impl_from_BaseRenderer(iface);
355 TRACE("(%p)->()\n", iface);
357 if (This->renderer.pMediaSample) {
358 ResetEvent(This->hEvent);
359 LeaveCriticalSection(iface->pInputPin->pin.pCritSec);
360 LeaveCriticalSection(&iface->filter.csFilter);
361 LeaveCriticalSection(&iface->csRenderLock);
362 WaitForSingleObject(This->hEvent, INFINITE);
363 EnterCriticalSection(&iface->csRenderLock);
364 EnterCriticalSection(&iface->filter.csFilter);
365 EnterCriticalSection(iface->pInputPin->pin.pCritSec);
367 if (This->renderer.filter.state == State_Paused) {
368 ResetEvent(This->hEvent);
371 return BaseRendererImpl_EndFlush(iface);
374 static VOID WINAPI VideoRenderer_OnStopStreaming(BaseRenderer* iface)
376 VideoRendererImpl *This = impl_from_BaseRenderer(iface);
378 TRACE("(%p)->()\n", This);
380 SetEvent(This->hEvent);
381 if (This->AutoShow)
382 /* Black it out */
383 RedrawWindow(This->baseWindow.hWnd, NULL, NULL, RDW_INVALIDATE|RDW_ERASE);
386 static VOID WINAPI VideoRenderer_OnStartStreaming(BaseRenderer* iface)
388 VideoRendererImpl *This = impl_from_BaseRenderer(iface);
390 TRACE("(%p)\n", This);
392 if (This->renderer.pInputPin->pin.pConnectedTo && (This->renderer.filter.state == State_Stopped || !This->renderer.pInputPin->end_of_stream))
394 if (This->renderer.filter.state == State_Stopped)
396 ResetEvent(This->hEvent);
397 VideoRenderer_AutoShowWindow(This);
403 static LPWSTR WINAPI VideoRenderer_GetClassWindowStyles(BaseWindow *This, DWORD *pClassStyles, DWORD *pWindowStyles, DWORD *pWindowStylesEx)
405 static const WCHAR classnameW[] = { 'W','i','n','e',' ','A','c','t','i','v','e','M','o','v','i','e',' ','C','l','a','s','s',0 };
407 *pClassStyles = 0;
408 *pWindowStyles = WS_SIZEBOX;
409 *pWindowStylesEx = 0;
411 return (LPWSTR)classnameW;
414 static BOOL WINAPI VideoRenderer_PossiblyEatMessage(BaseWindow *iface, UINT uMsg, WPARAM wParam, LPARAM lParam)
416 VideoRendererImpl *This = impl_from_BaseWindow(iface);
418 if (This->hWndMsgDrain)
420 switch(uMsg)
422 case WM_KEYDOWN:
423 case WM_KEYUP:
424 case WM_LBUTTONDBLCLK:
425 case WM_LBUTTONDOWN:
426 case WM_LBUTTONUP:
427 case WM_MBUTTONDBLCLK:
428 case WM_MBUTTONDOWN:
429 case WM_MBUTTONUP:
430 case WM_MOUSEACTIVATE:
431 case WM_MOUSEMOVE:
432 case WM_NCLBUTTONDBLCLK:
433 case WM_NCLBUTTONDOWN:
434 case WM_NCLBUTTONUP:
435 case WM_NCMBUTTONDBLCLK:
436 case WM_NCMBUTTONDOWN:
437 case WM_NCMBUTTONUP:
438 case WM_NCMOUSEMOVE:
439 case WM_NCRBUTTONDBLCLK:
440 case WM_NCRBUTTONDOWN:
441 case WM_NCRBUTTONUP:
442 case WM_RBUTTONDBLCLK:
443 case WM_RBUTTONDOWN:
444 case WM_RBUTTONUP:
445 PostMessageW(This->hWndMsgDrain, uMsg, wParam, lParam);
446 return TRUE;
447 break;
448 default:
449 break;
452 return FALSE;
455 static BOOL WINAPI VideoRenderer_OnSize(BaseWindow *iface, LONG Width, LONG Height)
457 VideoRendererImpl *This = impl_from_BaseWindow(iface);
459 TRACE("WM_SIZE %d %d\n", Width, Height);
460 GetClientRect(iface->hWnd, &This->DestRect);
461 TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
462 This->DestRect.left,
463 This->DestRect.top,
464 This->DestRect.right - This->DestRect.left,
465 This->DestRect.bottom - This->DestRect.top);
466 return TRUE;
469 static const BaseRendererFuncTable BaseFuncTable = {
470 VideoRenderer_CheckMediaType,
471 VideoRenderer_DoRenderSample,
472 /**/
473 NULL,
474 NULL,
475 NULL,
476 VideoRenderer_OnStartStreaming,
477 VideoRenderer_OnStopStreaming,
478 NULL,
479 NULL,
480 NULL,
481 VideoRenderer_ShouldDrawSampleNow,
482 NULL,
483 /**/
484 NULL,
485 NULL,
486 NULL,
487 NULL,
488 VideoRenderer_EndFlush,
491 static const BaseWindowFuncTable renderer_BaseWindowFuncTable = {
492 VideoRenderer_GetClassWindowStyles,
493 NULL,
494 NULL,
495 VideoRenderer_PossiblyEatMessage,
496 VideoRenderer_OnSize
499 HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
501 HRESULT hr;
502 VideoRendererImpl * pVideoRenderer;
504 TRACE("(%p, %p)\n", pUnkOuter, ppv);
506 *ppv = NULL;
508 pVideoRenderer = CoTaskMemAlloc(sizeof(VideoRendererImpl));
509 pVideoRenderer->pUnkOuter = pUnkOuter;
510 pVideoRenderer->bUnkOuterValid = FALSE;
511 pVideoRenderer->bAggregatable = FALSE;
512 pVideoRenderer->IInner_vtbl = &IInner_VTable;
513 pVideoRenderer->IAMFilterMiscFlags_vtbl = &IAMFilterMiscFlags_Vtbl;
514 pVideoRenderer->IBasicVideo_vtbl = &IBasicVideo_VTable;
515 pVideoRenderer->IVideoWindow_vtbl = &IVideoWindow_VTable;
517 pVideoRenderer->init = 0;
518 pVideoRenderer->AutoShow = 1;
519 ZeroMemory(&pVideoRenderer->SourceRect, sizeof(RECT));
520 ZeroMemory(&pVideoRenderer->DestRect, sizeof(RECT));
521 ZeroMemory(&pVideoRenderer->WindowPos, sizeof(RECT));
522 pVideoRenderer->hWndMsgDrain = pVideoRenderer->hWndOwner = NULL;
523 pVideoRenderer->WindowStyle = WS_OVERLAPPED;
525 hr = BaseRenderer_Init(&pVideoRenderer->renderer, &VideoRenderer_Vtbl, pUnkOuter, &CLSID_VideoRenderer, (DWORD_PTR)(__FILE__ ": VideoRendererImpl.csFilter"), &BaseFuncTable);
527 if (FAILED(hr))
528 goto fail;
530 *ppv = pVideoRenderer;
531 hr = BaseWindow_Init(&pVideoRenderer->baseWindow, &renderer_BaseWindowFuncTable);
532 if (FAILED(hr))
533 goto fail;
535 if (!CreateRenderingSubsystem(pVideoRenderer))
536 return E_FAIL;
538 return hr;
539 fail:
540 BaseRendererImpl_Release(&pVideoRenderer->renderer.filter.IBaseFilter_iface);
541 CoTaskMemFree(pVideoRenderer);
542 return hr;
545 HRESULT VideoRendererDefault_create(IUnknown * pUnkOuter, LPVOID * ppv)
547 /* TODO: Attempt to use the VMR-7 renderer instead when possible */
548 return VideoRenderer_create(pUnkOuter, ppv);
551 static HRESULT WINAPI VideoRendererInner_QueryInterface(IUnknown * iface, REFIID riid, LPVOID * ppv)
553 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
554 TRACE("(%p/%p)->(%s, %p)\n", This, iface, qzdebugstr_guid(riid), ppv);
556 if (This->bAggregatable)
557 This->bUnkOuterValid = TRUE;
559 *ppv = NULL;
561 if (IsEqualIID(riid, &IID_IUnknown))
562 *ppv = &This->IInner_vtbl;
563 else if (IsEqualIID(riid, &IID_IBasicVideo))
564 *ppv = &This->IBasicVideo_vtbl;
565 else if (IsEqualIID(riid, &IID_IVideoWindow))
566 *ppv = &This->IVideoWindow_vtbl;
567 else if (IsEqualIID(riid, &IID_IAMFilterMiscFlags))
568 *ppv = &This->IAMFilterMiscFlags_vtbl;
569 else
571 HRESULT hr;
572 hr = BaseRendererImpl_QueryInterface(&This->renderer.filter.IBaseFilter_iface, riid, ppv);
573 if (SUCCEEDED(hr))
574 return hr;
577 if (*ppv)
579 IUnknown_AddRef((IUnknown *)(*ppv));
580 return S_OK;
583 if (!IsEqualIID(riid, &IID_IPin))
584 FIXME("No interface for %s!\n", qzdebugstr_guid(riid));
586 return E_NOINTERFACE;
589 static ULONG WINAPI VideoRendererInner_AddRef(IUnknown * iface)
591 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
592 ULONG refCount = BaseFilterImpl_AddRef(&This->renderer.filter.IBaseFilter_iface);
594 TRACE("(%p/%p)->() AddRef from %d\n", This, iface, refCount - 1);
596 return refCount;
599 static ULONG WINAPI VideoRendererInner_Release(IUnknown * iface)
601 ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
602 ULONG refCount = BaseRendererImpl_Release(&This->renderer.filter.IBaseFilter_iface);
604 TRACE("(%p/%p)->() Release from %d\n", This, iface, refCount + 1);
606 if (!refCount)
608 BaseWindowImpl_DoneWithWindow(&This->baseWindow);
609 PostThreadMessageW(This->ThreadID, WM_QUIT, 0, 0);
610 WaitForSingleObject(This->hThread, INFINITE);
611 CloseHandle(This->hThread);
612 CloseHandle(This->hEvent);
614 TRACE("Destroying Video Renderer\n");
615 CoTaskMemFree(This);
617 return 0;
619 else
620 return refCount;
623 static const IUnknownVtbl IInner_VTable =
625 VideoRendererInner_QueryInterface,
626 VideoRendererInner_AddRef,
627 VideoRendererInner_Release
630 static HRESULT WINAPI VideoRenderer_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv)
632 VideoRendererImpl *This = impl_from_IBaseFilter(iface);
634 if (This->bAggregatable)
635 This->bUnkOuterValid = TRUE;
637 if (This->pUnkOuter)
639 if (This->bAggregatable)
640 return IUnknown_QueryInterface(This->pUnkOuter, riid, ppv);
642 if (IsEqualIID(riid, &IID_IUnknown))
644 HRESULT hr;
646 IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
647 hr = IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
648 IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
649 This->bAggregatable = TRUE;
650 return hr;
653 *ppv = NULL;
654 return E_NOINTERFACE;
657 return IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
660 static ULONG WINAPI VideoRenderer_AddRef(IBaseFilter * iface)
662 VideoRendererImpl *This = impl_from_IBaseFilter(iface);
664 if (This->pUnkOuter && This->bUnkOuterValid)
665 return IUnknown_AddRef(This->pUnkOuter);
666 return IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
669 static ULONG WINAPI VideoRenderer_Release(IBaseFilter * iface)
671 VideoRendererImpl *This = impl_from_IBaseFilter(iface);
673 if (This->pUnkOuter && This->bUnkOuterValid)
674 return IUnknown_Release(This->pUnkOuter);
675 return IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
678 /** IMediaFilter methods **/
680 static HRESULT WINAPI VideoRenderer_Pause(IBaseFilter * iface)
682 VideoRendererImpl *This = impl_from_IBaseFilter(iface);
684 TRACE("(%p/%p)->()\n", This, iface);
686 EnterCriticalSection(&This->renderer.csRenderLock);
687 if (This->renderer.filter.state != State_Paused)
689 if (This->renderer.filter.state == State_Stopped)
691 This->renderer.pInputPin->end_of_stream = 0;
692 ResetEvent(This->hEvent);
693 VideoRenderer_AutoShowWindow(This);
696 ResetEvent(This->renderer.RenderEvent);
697 This->renderer.filter.state = State_Paused;
699 LeaveCriticalSection(&This->renderer.csRenderLock);
701 return S_OK;
704 static const IBaseFilterVtbl VideoRenderer_Vtbl =
706 VideoRenderer_QueryInterface,
707 VideoRenderer_AddRef,
708 VideoRenderer_Release,
709 BaseFilterImpl_GetClassID,
710 BaseRendererImpl_Stop,
711 VideoRenderer_Pause,
712 BaseRendererImpl_Run,
713 BaseRendererImpl_GetState,
714 BaseRendererImpl_SetSyncSource,
715 BaseFilterImpl_GetSyncSource,
716 BaseFilterImpl_EnumPins,
717 BaseRendererImpl_FindPin,
718 BaseFilterImpl_QueryFilterInfo,
719 BaseFilterImpl_JoinFilterGraph,
720 BaseFilterImpl_QueryVendorInfo
723 /*** IUnknown methods ***/
724 static HRESULT WINAPI Basicvideo_QueryInterface(IBasicVideo *iface,
725 REFIID riid,
726 LPVOID*ppvObj) {
727 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
729 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
731 return VideoRenderer_QueryInterface(&This->renderer.filter.IBaseFilter_iface, riid, ppvObj);
734 static ULONG WINAPI Basicvideo_AddRef(IBasicVideo *iface) {
735 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
737 TRACE("(%p/%p)->()\n", This, iface);
739 return VideoRenderer_AddRef(&This->renderer.filter.IBaseFilter_iface);
742 static ULONG WINAPI Basicvideo_Release(IBasicVideo *iface) {
743 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
745 TRACE("(%p/%p)->()\n", This, iface);
747 return VideoRenderer_Release(&This->renderer.filter.IBaseFilter_iface);
750 /*** IDispatch methods ***/
751 static HRESULT WINAPI Basicvideo_GetTypeInfoCount(IBasicVideo *iface,
752 UINT*pctinfo) {
753 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
755 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
757 return S_OK;
760 static HRESULT WINAPI Basicvideo_GetTypeInfo(IBasicVideo *iface,
761 UINT iTInfo,
762 LCID lcid,
763 ITypeInfo**ppTInfo) {
764 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
766 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
768 return S_OK;
771 static HRESULT WINAPI Basicvideo_GetIDsOfNames(IBasicVideo *iface,
772 REFIID riid,
773 LPOLESTR*rgszNames,
774 UINT cNames,
775 LCID lcid,
776 DISPID*rgDispId) {
777 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
779 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
781 return S_OK;
784 static HRESULT WINAPI Basicvideo_Invoke(IBasicVideo *iface,
785 DISPID dispIdMember,
786 REFIID riid,
787 LCID lcid,
788 WORD wFlags,
789 DISPPARAMS*pDispParams,
790 VARIANT*pVarResult,
791 EXCEPINFO*pExepInfo,
792 UINT*puArgErr) {
793 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
795 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);
797 return S_OK;
800 /*** IBasicVideo methods ***/
801 static HRESULT WINAPI Basicvideo_get_AvgTimePerFrame(IBasicVideo *iface,
802 REFTIME *pAvgTimePerFrame) {
803 AM_MEDIA_TYPE *pmt;
804 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
806 if (!This->renderer.pInputPin->pin.pConnectedTo)
807 return VFW_E_NOT_CONNECTED;
809 TRACE("(%p/%p)->(%p)\n", This, iface, pAvgTimePerFrame);
811 pmt = &This->renderer.pInputPin->pin.mtCurrent;
812 if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo)) {
813 VIDEOINFOHEADER *vih = (VIDEOINFOHEADER*)pmt->pbFormat;
814 *pAvgTimePerFrame = vih->AvgTimePerFrame;
815 } else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2)) {
816 VIDEOINFOHEADER2 *vih = (VIDEOINFOHEADER2*)pmt->pbFormat;
817 *pAvgTimePerFrame = vih->AvgTimePerFrame;
818 } else {
819 ERR("Unknown format type %s\n", qzdebugstr_guid(&pmt->formattype));
820 *pAvgTimePerFrame = 0;
822 return S_OK;
825 static HRESULT WINAPI Basicvideo_get_BitRate(IBasicVideo *iface,
826 LONG *pBitRate) {
827 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
829 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBitRate);
831 return S_OK;
834 static HRESULT WINAPI Basicvideo_get_BitErrorRate(IBasicVideo *iface,
835 LONG *pBitErrorRate) {
836 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
838 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBitErrorRate);
840 return S_OK;
843 static HRESULT WINAPI Basicvideo_get_VideoWidth(IBasicVideo *iface,
844 LONG *pVideoWidth) {
845 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
847 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoWidth);
849 *pVideoWidth = This->VideoWidth;
851 return S_OK;
854 static HRESULT WINAPI Basicvideo_get_VideoHeight(IBasicVideo *iface,
855 LONG *pVideoHeight) {
856 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
858 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoHeight);
860 *pVideoHeight = This->VideoHeight;
862 return S_OK;
865 static HRESULT WINAPI Basicvideo_put_SourceLeft(IBasicVideo *iface,
866 LONG SourceLeft) {
867 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
869 TRACE("(%p/%p)->(%d)\n", This, iface, SourceLeft);
871 This->SourceRect.left = SourceLeft;
873 return S_OK;
876 static HRESULT WINAPI Basicvideo_get_SourceLeft(IBasicVideo *iface,
877 LONG *pSourceLeft) {
878 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
880 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceLeft);
882 *pSourceLeft = This->SourceRect.left;
884 return S_OK;
887 static HRESULT WINAPI Basicvideo_put_SourceWidth(IBasicVideo *iface,
888 LONG SourceWidth) {
889 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
891 TRACE("(%p/%p)->(%d)\n", This, iface, SourceWidth);
893 This->SourceRect.right = This->SourceRect.left + SourceWidth;
895 return S_OK;
898 static HRESULT WINAPI Basicvideo_get_SourceWidth(IBasicVideo *iface,
899 LONG *pSourceWidth) {
900 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
902 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceWidth);
904 *pSourceWidth = This->SourceRect.right - This->SourceRect.left;
906 return S_OK;
909 static HRESULT WINAPI Basicvideo_put_SourceTop(IBasicVideo *iface,
910 LONG SourceTop) {
911 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
913 TRACE("(%p/%p)->(%d)\n", This, iface, SourceTop);
915 This->SourceRect.top = SourceTop;
917 return S_OK;
920 static HRESULT WINAPI Basicvideo_get_SourceTop(IBasicVideo *iface,
921 LONG *pSourceTop) {
922 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
924 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceTop);
926 *pSourceTop = This->SourceRect.top;
928 return S_OK;
931 static HRESULT WINAPI Basicvideo_put_SourceHeight(IBasicVideo *iface,
932 LONG SourceHeight) {
933 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
935 TRACE("(%p/%p)->(%d)\n", This, iface, SourceHeight);
937 This->SourceRect.bottom = This->SourceRect.top + SourceHeight;
939 return S_OK;
942 static HRESULT WINAPI Basicvideo_get_SourceHeight(IBasicVideo *iface,
943 LONG *pSourceHeight) {
944 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
946 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceHeight);
948 *pSourceHeight = This->SourceRect.bottom - This->SourceRect.top;
950 return S_OK;
953 static HRESULT WINAPI Basicvideo_put_DestinationLeft(IBasicVideo *iface,
954 LONG DestinationLeft) {
955 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
957 TRACE("(%p/%p)->(%d)\n", This, iface, DestinationLeft);
959 This->DestRect.left = DestinationLeft;
961 return S_OK;
964 static HRESULT WINAPI Basicvideo_get_DestinationLeft(IBasicVideo *iface,
965 LONG *pDestinationLeft) {
966 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
968 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationLeft);
970 *pDestinationLeft = This->DestRect.left;
972 return S_OK;
975 static HRESULT WINAPI Basicvideo_put_DestinationWidth(IBasicVideo *iface,
976 LONG DestinationWidth) {
977 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
979 TRACE("(%p/%p)->(%d)\n", This, iface, DestinationWidth);
981 This->DestRect.right = This->DestRect.left + DestinationWidth;
983 return S_OK;
986 static HRESULT WINAPI Basicvideo_get_DestinationWidth(IBasicVideo *iface,
987 LONG *pDestinationWidth) {
988 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
990 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationWidth);
992 *pDestinationWidth = This->DestRect.right - This->DestRect.left;
994 return S_OK;
997 static HRESULT WINAPI Basicvideo_put_DestinationTop(IBasicVideo *iface,
998 LONG DestinationTop) {
999 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1001 TRACE("(%p/%p)->(%d)\n", This, iface, DestinationTop);
1003 This->DestRect.top = DestinationTop;
1005 return S_OK;
1008 static HRESULT WINAPI Basicvideo_get_DestinationTop(IBasicVideo *iface,
1009 LONG *pDestinationTop) {
1010 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1012 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationTop);
1014 *pDestinationTop = This->DestRect.top;
1016 return S_OK;
1019 static HRESULT WINAPI Basicvideo_put_DestinationHeight(IBasicVideo *iface,
1020 LONG DestinationHeight) {
1021 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1023 TRACE("(%p/%p)->(%d)\n", This, iface, DestinationHeight);
1025 This->DestRect.right = This->DestRect.left + DestinationHeight;
1027 return S_OK;
1030 static HRESULT WINAPI Basicvideo_get_DestinationHeight(IBasicVideo *iface,
1031 LONG *pDestinationHeight) {
1032 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1034 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationHeight);
1036 *pDestinationHeight = This->DestRect.right - This->DestRect.left;
1038 return S_OK;
1041 static HRESULT WINAPI Basicvideo_SetSourcePosition(IBasicVideo *iface,
1042 LONG Left,
1043 LONG Top,
1044 LONG Width,
1045 LONG Height) {
1046 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1048 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height);
1050 This->SourceRect.left = Left;
1051 This->SourceRect.top = Top;
1052 This->SourceRect.right = Left + Width;
1053 This->SourceRect.bottom = Top + Height;
1055 return S_OK;
1058 static HRESULT WINAPI Basicvideo_GetSourcePosition(IBasicVideo *iface,
1059 LONG *pLeft,
1060 LONG *pTop,
1061 LONG *pWidth,
1062 LONG *pHeight) {
1063 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1065 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1067 *pLeft = This->SourceRect.left;
1068 *pTop = This->SourceRect.top;
1069 *pWidth = This->SourceRect.right - This->SourceRect.left;
1070 *pHeight = This->SourceRect.bottom - This->SourceRect.top;
1072 return S_OK;
1075 static HRESULT WINAPI Basicvideo_SetDefaultSourcePosition(IBasicVideo *iface) {
1076 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1078 TRACE("(%p/%p)->()\n", This, iface);
1080 This->SourceRect.left = 0;
1081 This->SourceRect.top = 0;
1082 This->SourceRect.right = This->VideoWidth;
1083 This->SourceRect.bottom = This->VideoHeight;
1085 return S_OK;
1088 static HRESULT WINAPI Basicvideo_SetDestinationPosition(IBasicVideo *iface,
1089 LONG Left,
1090 LONG Top,
1091 LONG Width,
1092 LONG Height) {
1093 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1095 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height);
1097 This->DestRect.left = Left;
1098 This->DestRect.top = Top;
1099 This->DestRect.right = Left + Width;
1100 This->DestRect.bottom = Top + Height;
1102 return S_OK;
1105 static HRESULT WINAPI Basicvideo_GetDestinationPosition(IBasicVideo *iface,
1106 LONG *pLeft,
1107 LONG *pTop,
1108 LONG *pWidth,
1109 LONG *pHeight) {
1110 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1112 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1114 *pLeft = This->DestRect.left;
1115 *pTop = This->DestRect.top;
1116 *pWidth = This->DestRect.right - This->DestRect.left;
1117 *pHeight = This->DestRect.bottom - This->DestRect.top;
1119 return S_OK;
1122 static HRESULT WINAPI Basicvideo_SetDefaultDestinationPosition(IBasicVideo *iface) {
1123 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1124 RECT rect;
1126 TRACE("(%p/%p)->()\n", This, iface);
1128 if (!GetClientRect(This->baseWindow.hWnd, &rect))
1129 return E_FAIL;
1131 This->SourceRect.left = 0;
1132 This->SourceRect.top = 0;
1133 This->SourceRect.right = rect.right;
1134 This->SourceRect.bottom = rect.bottom;
1136 return S_OK;
1139 static HRESULT WINAPI Basicvideo_GetVideoSize(IBasicVideo *iface,
1140 LONG *pWidth,
1141 LONG *pHeight) {
1142 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1144 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
1146 *pWidth = This->VideoWidth;
1147 *pHeight = This->VideoHeight;
1149 return S_OK;
1152 static HRESULT WINAPI Basicvideo_GetVideoPaletteEntries(IBasicVideo *iface,
1153 LONG StartIndex,
1154 LONG Entries,
1155 LONG *pRetrieved,
1156 LONG *pPalette) {
1157 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1159 TRACE("(%p/%p)->(%d, %d, %p, %p)\n", This, iface, StartIndex, Entries, pRetrieved, pPalette);
1161 if (pRetrieved)
1162 *pRetrieved = 0;
1163 return VFW_E_NO_PALETTE_AVAILABLE;
1166 static HRESULT WINAPI Basicvideo_GetCurrentImage(IBasicVideo *iface,
1167 LONG *pBufferSize,
1168 LONG *pDIBImage) {
1169 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1170 BITMAPINFOHEADER *bmiHeader;
1171 LONG needed_size;
1172 AM_MEDIA_TYPE *amt = &This->renderer.pInputPin->pin.mtCurrent;
1173 char *ptr;
1175 FIXME("(%p/%p)->(%p, %p): partial stub\n", This, iface, pBufferSize, pDIBImage);
1177 EnterCriticalSection(&This->renderer.filter.csFilter);
1179 if (!This->renderer.pMediaSample)
1181 LeaveCriticalSection(&This->renderer.filter.csFilter);
1182 return (This->renderer.filter.state == State_Paused ? E_UNEXPECTED : VFW_E_NOT_PAUSED);
1185 if (IsEqualIID(&amt->formattype, &FORMAT_VideoInfo))
1187 bmiHeader = &((VIDEOINFOHEADER *)amt->pbFormat)->bmiHeader;
1189 else if (IsEqualIID(&amt->formattype, &FORMAT_VideoInfo2))
1191 bmiHeader = &((VIDEOINFOHEADER2 *)amt->pbFormat)->bmiHeader;
1193 else
1195 FIXME("Unknown type %s\n", debugstr_guid(&amt->subtype));
1196 LeaveCriticalSection(&This->renderer.filter.csFilter);
1197 return VFW_E_RUNTIME_ERROR;
1200 needed_size = bmiHeader->biSize;
1201 needed_size += IMediaSample_GetActualDataLength(This->renderer.pMediaSample);
1203 if (!pDIBImage)
1205 *pBufferSize = needed_size;
1206 LeaveCriticalSection(&This->renderer.filter.csFilter);
1207 return S_OK;
1210 if (needed_size < *pBufferSize)
1212 ERR("Buffer too small %u/%u\n", needed_size, *pBufferSize);
1213 LeaveCriticalSection(&This->renderer.filter.csFilter);
1214 return E_FAIL;
1216 *pBufferSize = needed_size;
1218 memcpy(pDIBImage, bmiHeader, bmiHeader->biSize);
1219 IMediaSample_GetPointer(This->renderer.pMediaSample, (BYTE **)&ptr);
1220 memcpy((char *)pDIBImage + bmiHeader->biSize, ptr, IMediaSample_GetActualDataLength(This->renderer.pMediaSample));
1222 LeaveCriticalSection(&This->renderer.filter.csFilter);
1224 return S_OK;
1227 static HRESULT WINAPI Basicvideo_IsUsingDefaultSource(IBasicVideo *iface) {
1228 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1230 FIXME("(%p/%p)->(): stub !!!\n", This, iface);
1232 return S_OK;
1235 static HRESULT WINAPI Basicvideo_IsUsingDefaultDestination(IBasicVideo *iface) {
1236 ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
1238 FIXME("(%p/%p)->(): stub !!!\n", This, iface);
1240 return S_OK;
1244 static const IBasicVideoVtbl IBasicVideo_VTable =
1246 Basicvideo_QueryInterface,
1247 Basicvideo_AddRef,
1248 Basicvideo_Release,
1249 Basicvideo_GetTypeInfoCount,
1250 Basicvideo_GetTypeInfo,
1251 Basicvideo_GetIDsOfNames,
1252 Basicvideo_Invoke,
1253 Basicvideo_get_AvgTimePerFrame,
1254 Basicvideo_get_BitRate,
1255 Basicvideo_get_BitErrorRate,
1256 Basicvideo_get_VideoWidth,
1257 Basicvideo_get_VideoHeight,
1258 Basicvideo_put_SourceLeft,
1259 Basicvideo_get_SourceLeft,
1260 Basicvideo_put_SourceWidth,
1261 Basicvideo_get_SourceWidth,
1262 Basicvideo_put_SourceTop,
1263 Basicvideo_get_SourceTop,
1264 Basicvideo_put_SourceHeight,
1265 Basicvideo_get_SourceHeight,
1266 Basicvideo_put_DestinationLeft,
1267 Basicvideo_get_DestinationLeft,
1268 Basicvideo_put_DestinationWidth,
1269 Basicvideo_get_DestinationWidth,
1270 Basicvideo_put_DestinationTop,
1271 Basicvideo_get_DestinationTop,
1272 Basicvideo_put_DestinationHeight,
1273 Basicvideo_get_DestinationHeight,
1274 Basicvideo_SetSourcePosition,
1275 Basicvideo_GetSourcePosition,
1276 Basicvideo_SetDefaultSourcePosition,
1277 Basicvideo_SetDestinationPosition,
1278 Basicvideo_GetDestinationPosition,
1279 Basicvideo_SetDefaultDestinationPosition,
1280 Basicvideo_GetVideoSize,
1281 Basicvideo_GetVideoPaletteEntries,
1282 Basicvideo_GetCurrentImage,
1283 Basicvideo_IsUsingDefaultSource,
1284 Basicvideo_IsUsingDefaultDestination
1288 /*** IUnknown methods ***/
1289 static HRESULT WINAPI Videowindow_QueryInterface(IVideoWindow *iface,
1290 REFIID riid,
1291 LPVOID*ppvObj) {
1292 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1294 TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
1296 return VideoRenderer_QueryInterface(&This->renderer.filter.IBaseFilter_iface, riid, ppvObj);
1299 static ULONG WINAPI Videowindow_AddRef(IVideoWindow *iface) {
1300 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1302 TRACE("(%p/%p)->()\n", This, iface);
1304 return VideoRenderer_AddRef(&This->renderer.filter.IBaseFilter_iface);
1307 static ULONG WINAPI Videowindow_Release(IVideoWindow *iface) {
1308 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1310 TRACE("(%p/%p)->()\n", This, iface);
1312 return VideoRenderer_Release(&This->renderer.filter.IBaseFilter_iface);
1315 /*** IDispatch methods ***/
1316 static HRESULT WINAPI Videowindow_GetTypeInfoCount(IVideoWindow *iface,
1317 UINT*pctinfo) {
1318 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1320 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
1322 return S_OK;
1325 static HRESULT WINAPI Videowindow_GetTypeInfo(IVideoWindow *iface,
1326 UINT iTInfo,
1327 LCID lcid,
1328 ITypeInfo**ppTInfo) {
1329 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1331 FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
1333 return S_OK;
1336 static HRESULT WINAPI Videowindow_GetIDsOfNames(IVideoWindow *iface,
1337 REFIID riid,
1338 LPOLESTR*rgszNames,
1339 UINT cNames,
1340 LCID lcid,
1341 DISPID*rgDispId) {
1342 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1344 FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
1346 return S_OK;
1349 static HRESULT WINAPI Videowindow_Invoke(IVideoWindow *iface,
1350 DISPID dispIdMember,
1351 REFIID riid,
1352 LCID lcid,
1353 WORD wFlags,
1354 DISPPARAMS*pDispParams,
1355 VARIANT*pVarResult,
1356 EXCEPINFO*pExepInfo,
1357 UINT*puArgErr) {
1358 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1360 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);
1362 return S_OK;
1365 /*** IVideoWindow methods ***/
1366 static HRESULT WINAPI Videowindow_put_Caption(IVideoWindow *iface,
1367 BSTR strCaption) {
1368 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1370 TRACE("(%p/%p)->(%s (%p))\n", This, iface, debugstr_w(strCaption), strCaption);
1372 if (!SetWindowTextW(This->baseWindow.hWnd, strCaption))
1373 return E_FAIL;
1375 return S_OK;
1378 static HRESULT WINAPI Videowindow_get_Caption(IVideoWindow *iface,
1379 BSTR *strCaption) {
1380 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1382 TRACE("(%p/%p)->(%p)\n", This, iface, strCaption);
1384 GetWindowTextW(This->baseWindow.hWnd, (LPWSTR)strCaption, 100);
1386 return S_OK;
1389 static HRESULT WINAPI Videowindow_put_WindowStyle(IVideoWindow *iface,
1390 LONG WindowStyle) {
1391 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1392 LONG old;
1394 old = GetWindowLongW(This->baseWindow.hWnd, GWL_STYLE);
1396 TRACE("(%p/%p)->(%x -> %x)\n", This, iface, old, WindowStyle);
1398 if (WindowStyle & (WS_DISABLED|WS_HSCROLL|WS_ICONIC|WS_MAXIMIZE|WS_MINIMIZE|WS_VSCROLL))
1399 return E_INVALIDARG;
1401 SetWindowLongW(This->baseWindow.hWnd, GWL_STYLE, WindowStyle);
1402 SetWindowPos(This->baseWindow.hWnd,0,0,0,0,0,SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOZORDER);
1403 This->WindowStyle = WindowStyle;
1405 return S_OK;
1408 static HRESULT WINAPI Videowindow_get_WindowStyle(IVideoWindow *iface,
1409 LONG *WindowStyle) {
1410 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1412 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyle);
1414 *WindowStyle = This->WindowStyle;
1416 return S_OK;
1419 static HRESULT WINAPI Videowindow_put_WindowStyleEx(IVideoWindow *iface,
1420 LONG WindowStyleEx) {
1421 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1423 TRACE("(%p/%p)->(%d)\n", This, iface, WindowStyleEx);
1425 if (!SetWindowLongW(This->baseWindow.hWnd, GWL_EXSTYLE, WindowStyleEx))
1426 return E_FAIL;
1428 return S_OK;
1431 static HRESULT WINAPI Videowindow_get_WindowStyleEx(IVideoWindow *iface,
1432 LONG *WindowStyleEx) {
1433 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1435 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyleEx);
1437 *WindowStyleEx = GetWindowLongW(This->baseWindow.hWnd, GWL_EXSTYLE);
1439 return S_OK;
1442 static HRESULT WINAPI Videowindow_put_AutoShow(IVideoWindow *iface,
1443 LONG AutoShow) {
1444 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1446 TRACE("(%p/%p)->(%d)\n", This, iface, AutoShow);
1448 This->AutoShow = AutoShow;
1450 return S_OK;
1453 static HRESULT WINAPI Videowindow_get_AutoShow(IVideoWindow *iface,
1454 LONG *AutoShow) {
1455 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1457 TRACE("(%p/%p)->(%p)\n", This, iface, AutoShow);
1459 *AutoShow = This->AutoShow;
1461 return S_OK;
1464 static HRESULT WINAPI Videowindow_put_WindowState(IVideoWindow *iface,
1465 LONG WindowState) {
1466 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1468 TRACE("(%p/%p)->(%d)\n", This, iface, WindowState);
1469 ShowWindow(This->baseWindow.hWnd, WindowState);
1470 return S_OK;
1473 static HRESULT WINAPI Videowindow_get_WindowState(IVideoWindow *iface,
1474 LONG *WindowState) {
1475 WINDOWPLACEMENT place;
1476 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1478 place.length = sizeof(place);
1479 GetWindowPlacement(This->baseWindow.hWnd, &place);
1480 TRACE("(%p/%p)->(%p)\n", This, iface, WindowState);
1481 *WindowState = place.showCmd;
1483 return S_OK;
1486 static HRESULT WINAPI Videowindow_put_BackgroundPalette(IVideoWindow *iface,
1487 LONG BackgroundPalette) {
1488 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1490 FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, BackgroundPalette);
1492 return S_OK;
1495 static HRESULT WINAPI Videowindow_get_BackgroundPalette(IVideoWindow *iface,
1496 LONG *pBackgroundPalette) {
1497 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1499 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBackgroundPalette);
1501 return S_OK;
1504 static HRESULT WINAPI Videowindow_put_Visible(IVideoWindow *iface,
1505 LONG Visible) {
1506 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1508 TRACE("(%p/%p)->(%d)\n", This, iface, Visible);
1510 ShowWindow(This->baseWindow.hWnd, Visible ? SW_SHOW : SW_HIDE);
1512 return S_OK;
1515 static HRESULT WINAPI Videowindow_get_Visible(IVideoWindow *iface,
1516 LONG *pVisible) {
1517 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1519 TRACE("(%p/%p)->(%p)\n", This, iface, pVisible);
1521 *pVisible = IsWindowVisible(This->baseWindow.hWnd);
1523 return S_OK;
1526 static HRESULT WINAPI Videowindow_put_Left(IVideoWindow *iface,
1527 LONG Left) {
1528 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1530 TRACE("(%p/%p)->(%d)\n", This, iface, Left);
1532 if (!SetWindowPos(This->baseWindow.hWnd, NULL, Left, This->WindowPos.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE))
1533 return E_FAIL;
1535 This->WindowPos.left = Left;
1537 return S_OK;
1540 static HRESULT WINAPI Videowindow_get_Left(IVideoWindow *iface,
1541 LONG *pLeft) {
1542 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1544 TRACE("(%p/%p)->(%p)\n", This, iface, pLeft);
1546 *pLeft = This->WindowPos.left;
1548 return S_OK;
1551 static HRESULT WINAPI Videowindow_put_Width(IVideoWindow *iface,
1552 LONG Width) {
1553 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1555 TRACE("(%p/%p)->(%d)\n", This, iface, Width);
1557 if (!SetWindowPos(This->baseWindow.hWnd, NULL, 0, 0, Width, This->WindowPos.bottom-This->WindowPos.top, SWP_NOZORDER|SWP_NOMOVE))
1558 return E_FAIL;
1560 This->WindowPos.right = This->WindowPos.left + Width;
1562 return S_OK;
1565 static HRESULT WINAPI Videowindow_get_Width(IVideoWindow *iface,
1566 LONG *pWidth) {
1567 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1569 TRACE("(%p/%p)->(%p)\n", This, iface, pWidth);
1571 *pWidth = This->WindowPos.right - This->WindowPos.left;
1573 return S_OK;
1576 static HRESULT WINAPI Videowindow_put_Top(IVideoWindow *iface,
1577 LONG Top) {
1578 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1580 TRACE("(%p/%p)->(%d)\n", This, iface, Top);
1582 if (!SetWindowPos(This->baseWindow.hWnd, NULL, This->WindowPos.left, Top, 0, 0, SWP_NOZORDER|SWP_NOSIZE))
1583 return E_FAIL;
1585 This->WindowPos.top = Top;
1587 return S_OK;
1590 static HRESULT WINAPI Videowindow_get_Top(IVideoWindow *iface,
1591 LONG *pTop) {
1592 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1594 TRACE("(%p/%p)->(%p)\n", This, iface, pTop);
1596 *pTop = This->WindowPos.top;
1598 return S_OK;
1601 static HRESULT WINAPI Videowindow_put_Height(IVideoWindow *iface,
1602 LONG Height) {
1603 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1605 TRACE("(%p/%p)->(%d)\n", This, iface, Height);
1607 if (!SetWindowPos(This->baseWindow.hWnd, NULL, 0, 0, This->WindowPos.right-This->WindowPos.left, Height, SWP_NOZORDER|SWP_NOMOVE))
1608 return E_FAIL;
1610 This->WindowPos.bottom = This->WindowPos.top + Height;
1612 return S_OK;
1615 static HRESULT WINAPI Videowindow_get_Height(IVideoWindow *iface,
1616 LONG *pHeight) {
1617 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1619 TRACE("(%p/%p)->(%p)\n", This, iface, pHeight);
1621 *pHeight = This->WindowPos.bottom - This->WindowPos.top;
1623 return S_OK;
1626 static HRESULT WINAPI Videowindow_put_Owner(IVideoWindow *iface,
1627 OAHWND Owner) {
1628 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1630 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Owner);
1632 This->hWndOwner = (HWND)Owner;
1633 SetParent(This->baseWindow.hWnd, This->hWndOwner);
1634 if (This->WindowStyle & WS_CHILD)
1636 LONG old = GetWindowLongW(This->baseWindow.hWnd, GWL_STYLE);
1637 if (old != This->WindowStyle)
1639 SetWindowLongW(This->baseWindow.hWnd, GWL_STYLE, This->WindowStyle);
1640 SetWindowPos(This->baseWindow.hWnd,0,0,0,0,0,SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOZORDER);
1644 return S_OK;
1647 static HRESULT WINAPI Videowindow_get_Owner(IVideoWindow *iface,
1648 OAHWND *Owner) {
1649 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1651 TRACE("(%p/%p)->(%p)\n", This, iface, Owner);
1653 *(HWND*)Owner = This->hWndOwner;
1655 return S_OK;
1658 static HRESULT WINAPI Videowindow_put_MessageDrain(IVideoWindow *iface,
1659 OAHWND Drain) {
1660 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1662 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Drain);
1664 This->hWndMsgDrain = (HWND)Drain;
1666 return S_OK;
1669 static HRESULT WINAPI Videowindow_get_MessageDrain(IVideoWindow *iface,
1670 OAHWND *Drain) {
1671 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1673 TRACE("(%p/%p)->(%p)\n", This, iface, Drain);
1675 *Drain = (OAHWND)This->hWndMsgDrain;
1677 return S_OK;
1680 static HRESULT WINAPI Videowindow_get_BorderColor(IVideoWindow *iface,
1681 LONG *Color) {
1682 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1684 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, Color);
1686 return S_OK;
1689 static HRESULT WINAPI Videowindow_put_BorderColor(IVideoWindow *iface,
1690 LONG Color) {
1691 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1693 FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, Color);
1695 return S_OK;
1698 static HRESULT WINAPI Videowindow_get_FullScreenMode(IVideoWindow *iface,
1699 LONG *FullScreenMode) {
1700 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1702 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, FullScreenMode);
1704 return S_OK;
1707 static HRESULT WINAPI Videowindow_put_FullScreenMode(IVideoWindow *iface,
1708 LONG FullScreenMode) {
1709 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1711 FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, FullScreenMode);
1713 if (FullScreenMode) {
1714 ShowWindow(This->baseWindow.hWnd, SW_HIDE);
1715 SetParent(This->baseWindow.hWnd, 0);
1716 SetWindowLongW(This->baseWindow.hWnd, GWL_STYLE, WS_POPUP);
1717 SetWindowPos(This->baseWindow.hWnd,HWND_TOP,0,0,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN),SWP_SHOWWINDOW);
1718 GetWindowRect(This->baseWindow.hWnd, &This->DestRect);
1719 This->WindowPos = This->DestRect;
1720 } else {
1721 ShowWindow(This->baseWindow.hWnd, SW_HIDE);
1722 SetParent(This->baseWindow.hWnd, This->hWndOwner);
1723 SetWindowLongW(This->baseWindow.hWnd, GWL_STYLE, This->WindowStyle);
1724 GetClientRect(This->baseWindow.hWnd, &This->DestRect);
1725 SetWindowPos(This->baseWindow.hWnd,0,This->DestRect.left,This->DestRect.top,This->DestRect.right,This->DestRect.bottom,SWP_NOZORDER|SWP_SHOWWINDOW);
1726 This->WindowPos = This->DestRect;
1729 return S_OK;
1732 static HRESULT WINAPI Videowindow_SetWindowForeground(IVideoWindow *iface,
1733 LONG Focus) {
1734 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1735 BOOL ret;
1736 IPin* pPin;
1737 HRESULT hr;
1739 TRACE("(%p/%p)->(%d)\n", This, iface, Focus);
1741 if ((Focus != FALSE) && (Focus != TRUE))
1742 return E_INVALIDARG;
1744 hr = IPin_ConnectedTo(&This->renderer.pInputPin->pin.IPin_iface, &pPin);
1745 if ((hr != S_OK) || !pPin)
1746 return VFW_E_NOT_CONNECTED;
1748 if (Focus)
1749 ret = SetForegroundWindow(This->baseWindow.hWnd);
1750 else
1751 ret = SetWindowPos(This->baseWindow.hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
1753 if (!ret)
1754 return E_FAIL;
1756 return S_OK;
1759 static HRESULT WINAPI Videowindow_NotifyOwnerMessage(IVideoWindow *iface,
1760 OAHWND hwnd,
1761 LONG uMsg,
1762 LONG_PTR wParam,
1763 LONG_PTR lParam) {
1764 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1766 TRACE("(%p/%p)->(%08lx, %d, %08lx, %08lx)\n", This, iface, hwnd, uMsg, wParam, lParam);
1768 if (!PostMessageW(This->baseWindow.hWnd, uMsg, wParam, lParam))
1769 return E_FAIL;
1771 return S_OK;
1774 static HRESULT WINAPI Videowindow_SetWindowPosition(IVideoWindow *iface,
1775 LONG Left,
1776 LONG Top,
1777 LONG Width,
1778 LONG Height) {
1779 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1781 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height);
1783 if (!SetWindowPos(This->baseWindow.hWnd, NULL, Left, Top, Width, Height, SWP_NOZORDER))
1784 return E_FAIL;
1786 This->WindowPos.left = Left;
1787 This->WindowPos.top = Top;
1788 This->WindowPos.right = Left + Width;
1789 This->WindowPos.bottom = Top + Height;
1791 return S_OK;
1794 static HRESULT WINAPI Videowindow_GetWindowPosition(IVideoWindow *iface,
1795 LONG *pLeft,
1796 LONG *pTop,
1797 LONG *pWidth,
1798 LONG *pHeight) {
1799 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1801 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
1803 *pLeft = This->WindowPos.left;
1804 *pTop = This->WindowPos.top;
1805 *pWidth = This->WindowPos.right - This->WindowPos.left;
1806 *pHeight = This->WindowPos.bottom - This->WindowPos.top;
1808 return S_OK;
1811 static HRESULT WINAPI Videowindow_GetMinIdealImageSize(IVideoWindow *iface,
1812 LONG *pWidth,
1813 LONG *pHeight) {
1814 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1816 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This, iface, pWidth, pHeight);
1818 *pWidth = This->VideoWidth;
1819 *pHeight = This->VideoHeight;
1821 return S_OK;
1824 static HRESULT WINAPI Videowindow_GetMaxIdealImageSize(IVideoWindow *iface,
1825 LONG *pWidth,
1826 LONG *pHeight) {
1827 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1829 FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This, iface, pWidth, pHeight);
1831 *pWidth = This->VideoWidth;
1832 *pHeight = This->VideoHeight;
1834 return S_OK;
1837 static HRESULT WINAPI Videowindow_GetRestorePosition(IVideoWindow *iface,
1838 LONG *pLeft,
1839 LONG *pTop,
1840 LONG *pWidth,
1841 LONG *pHeight) {
1842 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1844 FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This, iface, pLeft, pTop, pWidth, pHeight);
1846 return S_OK;
1849 static HRESULT WINAPI Videowindow_HideCursor(IVideoWindow *iface,
1850 LONG HideCursor) {
1851 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1853 FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, HideCursor);
1855 return S_OK;
1858 static HRESULT WINAPI Videowindow_IsCursorHidden(IVideoWindow *iface,
1859 LONG *CursorHidden) {
1860 ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
1862 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, CursorHidden);
1864 return S_OK;
1867 static const IVideoWindowVtbl IVideoWindow_VTable =
1869 Videowindow_QueryInterface,
1870 Videowindow_AddRef,
1871 Videowindow_Release,
1872 Videowindow_GetTypeInfoCount,
1873 Videowindow_GetTypeInfo,
1874 Videowindow_GetIDsOfNames,
1875 Videowindow_Invoke,
1876 Videowindow_put_Caption,
1877 Videowindow_get_Caption,
1878 Videowindow_put_WindowStyle,
1879 Videowindow_get_WindowStyle,
1880 Videowindow_put_WindowStyleEx,
1881 Videowindow_get_WindowStyleEx,
1882 Videowindow_put_AutoShow,
1883 Videowindow_get_AutoShow,
1884 Videowindow_put_WindowState,
1885 Videowindow_get_WindowState,
1886 Videowindow_put_BackgroundPalette,
1887 Videowindow_get_BackgroundPalette,
1888 Videowindow_put_Visible,
1889 Videowindow_get_Visible,
1890 Videowindow_put_Left,
1891 Videowindow_get_Left,
1892 Videowindow_put_Width,
1893 Videowindow_get_Width,
1894 Videowindow_put_Top,
1895 Videowindow_get_Top,
1896 Videowindow_put_Height,
1897 Videowindow_get_Height,
1898 Videowindow_put_Owner,
1899 Videowindow_get_Owner,
1900 Videowindow_put_MessageDrain,
1901 Videowindow_get_MessageDrain,
1902 Videowindow_get_BorderColor,
1903 Videowindow_put_BorderColor,
1904 Videowindow_get_FullScreenMode,
1905 Videowindow_put_FullScreenMode,
1906 Videowindow_SetWindowForeground,
1907 Videowindow_NotifyOwnerMessage,
1908 Videowindow_SetWindowPosition,
1909 Videowindow_GetWindowPosition,
1910 Videowindow_GetMinIdealImageSize,
1911 Videowindow_GetMaxIdealImageSize,
1912 Videowindow_GetRestorePosition,
1913 Videowindow_HideCursor,
1914 Videowindow_IsCursorHidden
1917 static VideoRendererImpl *from_IAMFilterMiscFlags(IAMFilterMiscFlags *iface) {
1918 return (VideoRendererImpl*)((char*)iface - offsetof(VideoRendererImpl, IAMFilterMiscFlags_vtbl));
1921 static HRESULT WINAPI AMFilterMiscFlags_QueryInterface(IAMFilterMiscFlags *iface, REFIID riid, void **ppv) {
1922 VideoRendererImpl *This = from_IAMFilterMiscFlags(iface);
1923 return IUnknown_QueryInterface((IUnknown*)This, riid, ppv);
1926 static ULONG WINAPI AMFilterMiscFlags_AddRef(IAMFilterMiscFlags *iface) {
1927 VideoRendererImpl *This = from_IAMFilterMiscFlags(iface);
1928 return IUnknown_AddRef((IUnknown*)This);
1931 static ULONG WINAPI AMFilterMiscFlags_Release(IAMFilterMiscFlags *iface) {
1932 VideoRendererImpl *This = from_IAMFilterMiscFlags(iface);
1933 return IUnknown_Release((IUnknown*)This);
1936 static ULONG WINAPI AMFilterMiscFlags_GetMiscFlags(IAMFilterMiscFlags *iface) {
1937 return AM_FILTER_MISC_FLAGS_IS_RENDERER;
1940 static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl = {
1941 AMFilterMiscFlags_QueryInterface,
1942 AMFilterMiscFlags_AddRef,
1943 AMFilterMiscFlags_Release,
1944 AMFilterMiscFlags_GetMiscFlags