2004-08-24 04:28:35 +02:00
|
|
|
/*
|
|
|
|
* Video Renderer (Fullscreen and Windowed using Direct Draw)
|
|
|
|
*
|
|
|
|
* Copyright 2004 Christian Costa
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2004-08-24 04:28:35 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#define NONAMELESSSTRUCT
|
|
|
|
#define NONAMELESSUNION
|
|
|
|
#include "quartz_private.h"
|
|
|
|
#include "pin.h"
|
|
|
|
|
|
|
|
#include "uuids.h"
|
|
|
|
#include "vfwmsgs.h"
|
|
|
|
#include "amvideo.h"
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "dshow.h"
|
2005-03-02 11:12:12 +01:00
|
|
|
#include "evcode.h"
|
2004-08-24 04:28:35 +02:00
|
|
|
#include "strmif.h"
|
|
|
|
#include "ddraw.h"
|
2008-04-12 00:10:19 +02:00
|
|
|
#include "dvdmedia.h"
|
2004-08-24 04:28:35 +02:00
|
|
|
|
2008-07-26 19:12:32 +02:00
|
|
|
#include <assert.h>
|
2004-08-24 04:28:35 +02:00
|
|
|
#include "wine/unicode.h"
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
|
|
|
|
|
|
|
|
typedef struct VideoRendererImpl
|
|
|
|
{
|
2012-03-31 03:08:55 +02:00
|
|
|
BaseRenderer renderer;
|
2012-03-31 03:09:14 +02:00
|
|
|
BaseControlWindow baseControlWindow;
|
2012-03-31 03:09:22 +02:00
|
|
|
BaseControlVideo baseControlVideo;
|
2012-03-31 03:09:14 +02:00
|
|
|
|
2012-07-02 01:06:01 +02:00
|
|
|
IUnknown IUnknown_inner;
|
2012-07-02 01:04:04 +02:00
|
|
|
IAMFilterMiscFlags IAMFilterMiscFlags_iface;
|
2012-07-02 01:06:01 +02:00
|
|
|
IUnknown *outer_unk;
|
2004-08-24 04:28:35 +02:00
|
|
|
|
2005-06-13 13:37:55 +02:00
|
|
|
BOOL init;
|
|
|
|
HANDLE hThread;
|
2008-07-04 10:33:04 +02:00
|
|
|
|
2005-06-13 13:37:55 +02:00
|
|
|
DWORD ThreadID;
|
|
|
|
HANDLE hEvent;
|
2012-03-31 03:08:55 +02:00
|
|
|
/* hEvent == evComplete? */
|
2005-06-13 13:37:55 +02:00
|
|
|
BOOL ThreadResult;
|
|
|
|
RECT SourceRect;
|
|
|
|
RECT DestRect;
|
|
|
|
RECT WindowPos;
|
2010-05-19 21:46:50 +02:00
|
|
|
LONG VideoWidth;
|
|
|
|
LONG VideoHeight;
|
2004-08-24 04:28:35 +02:00
|
|
|
} VideoRendererImpl;
|
|
|
|
|
2012-03-31 03:08:45 +02:00
|
|
|
static inline VideoRendererImpl *impl_from_BaseWindow(BaseWindow *iface)
|
2010-11-29 10:44:16 +01:00
|
|
|
{
|
2012-03-31 03:09:14 +02:00
|
|
|
return CONTAINING_RECORD(iface, VideoRendererImpl, baseControlWindow.baseWindow);
|
2005-06-13 13:37:55 +02:00
|
|
|
}
|
|
|
|
|
2012-03-31 03:08:55 +02:00
|
|
|
static inline VideoRendererImpl *impl_from_BaseRenderer(BaseRenderer *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, VideoRendererImpl, renderer);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline VideoRendererImpl *impl_from_IBaseFilter(IBaseFilter *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, VideoRendererImpl, renderer.filter.IBaseFilter_iface);
|
|
|
|
}
|
|
|
|
|
2012-03-31 03:09:14 +02:00
|
|
|
static inline VideoRendererImpl *impl_from_IVideoWindow(IVideoWindow *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, VideoRendererImpl, baseControlWindow.IVideoWindow_iface);
|
|
|
|
}
|
|
|
|
|
2012-03-31 03:09:22 +02:00
|
|
|
static inline VideoRendererImpl *impl_from_BaseControlVideo(BaseControlVideo *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, VideoRendererImpl, baseControlVideo);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline VideoRendererImpl *impl_from_IBasicVideo(IBasicVideo *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, VideoRendererImpl, baseControlVideo.IBasicVideo_iface);
|
|
|
|
}
|
|
|
|
|
2005-06-13 13:37:55 +02:00
|
|
|
static DWORD WINAPI MessageLoop(LPVOID lpParameter)
|
|
|
|
{
|
2009-01-29 11:14:55 +01:00
|
|
|
VideoRendererImpl* This = lpParameter;
|
2005-06-13 13:37:55 +02:00
|
|
|
MSG msg;
|
|
|
|
BOOL fGotMessage;
|
|
|
|
|
|
|
|
TRACE("Starting message loop\n");
|
|
|
|
|
2012-03-31 03:09:14 +02:00
|
|
|
if (FAILED(BaseWindowImpl_PrepareWindow(&This->baseControlWindow.baseWindow)))
|
2005-06-13 13:37:55 +02:00
|
|
|
{
|
|
|
|
This->ThreadResult = FALSE;
|
|
|
|
SetEvent(This->hEvent);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
This->ThreadResult = TRUE;
|
|
|
|
SetEvent(This->hEvent);
|
|
|
|
|
2010-12-03 09:38:13 +01:00
|
|
|
while ((fGotMessage = GetMessageW(&msg, NULL, 0, 0)) != 0 && fGotMessage != -1)
|
2005-06-13 13:37:55 +02:00
|
|
|
{
|
|
|
|
TranslateMessage(&msg);
|
2010-12-03 09:38:13 +01:00
|
|
|
DispatchMessageW(&msg);
|
2005-06-13 13:37:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("End of message loop\n");
|
|
|
|
|
|
|
|
return msg.wParam;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL CreateRenderingSubsystem(VideoRendererImpl* This)
|
|
|
|
{
|
2008-07-04 10:33:04 +02:00
|
|
|
This->hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
|
2005-06-13 13:37:55 +02:00
|
|
|
if (!This->hEvent)
|
|
|
|
return FALSE;
|
|
|
|
|
2009-01-29 11:14:55 +01:00
|
|
|
This->hThread = CreateThread(NULL, 0, MessageLoop, This, 0, &This->ThreadID);
|
2005-06-13 13:37:55 +02:00
|
|
|
if (!This->hThread)
|
|
|
|
{
|
|
|
|
CloseHandle(This->hEvent);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
WaitForSingleObject(This->hEvent, INFINITE);
|
|
|
|
|
|
|
|
if (!This->ThreadResult)
|
|
|
|
{
|
2008-07-04 10:33:04 +02:00
|
|
|
CloseHandle(This->hEvent);
|
2005-06-13 13:37:55 +02:00
|
|
|
CloseHandle(This->hThread);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2012-10-09 23:55:44 +02:00
|
|
|
static void VideoRenderer_AutoShowWindow(VideoRendererImpl *This)
|
|
|
|
{
|
2010-11-11 14:03:29 +01:00
|
|
|
if (!This->init && (!This->WindowPos.right || !This->WindowPos.top))
|
|
|
|
{
|
2012-03-31 03:09:14 +02:00
|
|
|
DWORD style = GetWindowLongW(This->baseControlWindow.baseWindow.hWnd, GWL_STYLE);
|
|
|
|
DWORD style_ex = GetWindowLongW(This->baseControlWindow.baseWindow.hWnd, GWL_EXSTYLE);
|
2010-11-11 14:03:29 +01:00
|
|
|
|
|
|
|
if (!This->WindowPos.right)
|
|
|
|
{
|
2012-10-09 23:55:44 +02:00
|
|
|
if (This->DestRect.right)
|
|
|
|
{
|
|
|
|
This->WindowPos.left = This->DestRect.left;
|
|
|
|
This->WindowPos.right = This->DestRect.right;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
This->WindowPos.left = This->SourceRect.left;
|
|
|
|
This->WindowPos.right = This->SourceRect.right;
|
|
|
|
}
|
2010-11-11 14:03:29 +01:00
|
|
|
}
|
|
|
|
if (!This->WindowPos.bottom)
|
|
|
|
{
|
2012-10-09 23:55:44 +02:00
|
|
|
if (This->DestRect.bottom)
|
|
|
|
{
|
|
|
|
This->WindowPos.top = This->DestRect.top;
|
|
|
|
This->WindowPos.bottom = This->DestRect.bottom;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
This->WindowPos.top = This->SourceRect.top;
|
|
|
|
This->WindowPos.bottom = This->SourceRect.bottom;
|
|
|
|
}
|
2010-11-11 14:03:29 +01:00
|
|
|
}
|
|
|
|
|
2012-10-09 23:55:53 +02:00
|
|
|
AdjustWindowRectEx(&This->WindowPos, style, FALSE, style_ex);
|
2010-11-11 14:03:29 +01:00
|
|
|
|
|
|
|
TRACE("WindowPos: %d %d %d %d\n", This->WindowPos.left, This->WindowPos.top, This->WindowPos.right, This->WindowPos.bottom);
|
2012-03-31 03:09:14 +02:00
|
|
|
SetWindowPos(This->baseControlWindow.baseWindow.hWnd, NULL,
|
2010-11-11 14:03:29 +01:00
|
|
|
This->WindowPos.left,
|
|
|
|
This->WindowPos.top,
|
|
|
|
This->WindowPos.right - This->WindowPos.left,
|
|
|
|
This->WindowPos.bottom - This->WindowPos.top,
|
|
|
|
SWP_NOZORDER|SWP_NOMOVE|SWP_DEFERERASE);
|
|
|
|
|
2012-03-31 03:09:14 +02:00
|
|
|
GetClientRect(This->baseControlWindow.baseWindow.hWnd, &This->DestRect);
|
2010-11-11 14:03:29 +01:00
|
|
|
}
|
|
|
|
else if (!This->init)
|
|
|
|
This->DestRect = This->WindowPos;
|
|
|
|
This->init = TRUE;
|
2012-03-31 03:09:14 +02:00
|
|
|
if (This->baseControlWindow.AutoShow)
|
|
|
|
ShowWindow(This->baseControlWindow.baseWindow.hWnd, SW_SHOW);
|
2010-11-11 14:03:29 +01:00
|
|
|
}
|
|
|
|
|
2004-08-24 04:28:35 +02:00
|
|
|
static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data, DWORD size)
|
|
|
|
{
|
|
|
|
AM_MEDIA_TYPE amt;
|
|
|
|
HRESULT hr = S_OK;
|
2008-04-12 00:10:19 +02:00
|
|
|
BITMAPINFOHEADER *bmiHeader;
|
2004-08-24 04:28:35 +02:00
|
|
|
|
2008-12-29 12:00:10 +01:00
|
|
|
TRACE("(%p)->(%p, %d)\n", This, data, size);
|
2004-08-24 04:28:35 +02:00
|
|
|
|
2012-03-31 03:08:55 +02:00
|
|
|
hr = IPin_ConnectionMediaType(&This->renderer.pInputPin->pin.IPin_iface, &amt);
|
2004-08-24 04:28:35 +02:00
|
|
|
if (FAILED(hr)) {
|
2005-06-13 13:37:55 +02:00
|
|
|
ERR("Unable to retrieve media type\n");
|
|
|
|
return hr;
|
2004-08-24 04:28:35 +02:00
|
|
|
}
|
2008-04-12 00:10:19 +02:00
|
|
|
|
|
|
|
if (IsEqualIID(&amt.formattype, &FORMAT_VideoInfo))
|
|
|
|
{
|
|
|
|
bmiHeader = &((VIDEOINFOHEADER *)amt.pbFormat)->bmiHeader;
|
|
|
|
}
|
|
|
|
else if (IsEqualIID(&amt.formattype, &FORMAT_VideoInfo2))
|
|
|
|
{
|
|
|
|
bmiHeader = &((VIDEOINFOHEADER2 *)amt.pbFormat)->bmiHeader;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FIXME("Unknown type %s\n", debugstr_guid(&amt.subtype));
|
|
|
|
return VFW_E_RUNTIME_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("biSize = %d\n", bmiHeader->biSize);
|
|
|
|
TRACE("biWidth = %d\n", bmiHeader->biWidth);
|
|
|
|
TRACE("biHeight = %d\n", bmiHeader->biHeight);
|
|
|
|
TRACE("biPlanes = %d\n", bmiHeader->biPlanes);
|
|
|
|
TRACE("biBitCount = %d\n", bmiHeader->biBitCount);
|
|
|
|
TRACE("biCompression = %s\n", debugstr_an((LPSTR)&(bmiHeader->biCompression), 4));
|
|
|
|
TRACE("biSizeImage = %d\n", bmiHeader->biSizeImage);
|
|
|
|
|
2012-03-31 03:09:14 +02:00
|
|
|
if (!This->baseControlWindow.baseWindow.hDC) {
|
2005-06-13 13:37:55 +02:00
|
|
|
ERR("Cannot get DC from window!\n");
|
|
|
|
return E_FAIL;
|
2004-08-24 04:28:35 +02:00
|
|
|
}
|
|
|
|
|
2006-10-12 20:57:23 +02:00
|
|
|
TRACE("Src Rect: %d %d %d %d\n", This->SourceRect.left, This->SourceRect.top, This->SourceRect.right, This->SourceRect.bottom);
|
|
|
|
TRACE("Dst Rect: %d %d %d %d\n", This->DestRect.left, This->DestRect.top, This->DestRect.right, This->DestRect.bottom);
|
2004-08-24 04:28:35 +02:00
|
|
|
|
2012-03-31 03:09:14 +02:00
|
|
|
StretchDIBits(This->baseControlWindow.baseWindow.hDC, This->DestRect.left, This->DestRect.top, This->DestRect.right -This->DestRect.left,
|
2005-06-13 13:37:55 +02:00
|
|
|
This->DestRect.bottom - This->DestRect.top, This->SourceRect.left, This->SourceRect.top,
|
|
|
|
This->SourceRect.right - This->SourceRect.left, This->SourceRect.bottom - This->SourceRect.top,
|
2008-04-12 00:10:19 +02:00
|
|
|
data, (BITMAPINFO *)bmiHeader, DIB_RGB_COLORS, SRCCOPY);
|
2005-06-13 13:37:55 +02:00
|
|
|
|
2004-08-24 04:28:35 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2012-04-20 08:39:55 +02:00
|
|
|
static HRESULT WINAPI VideoRenderer_ShouldDrawSampleNow(BaseRenderer *This, IMediaSample *pSample, REFERENCE_TIME *pStartTime, REFERENCE_TIME *pEndTime)
|
2004-08-24 04:28:35 +02:00
|
|
|
{
|
2012-03-31 03:08:55 +02:00
|
|
|
/* Preroll means the sample isn't shown, this is used for key frames and things like that */
|
|
|
|
if (IMediaSample_IsPreroll(pSample) == S_OK)
|
|
|
|
return E_FAIL;
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI VideoRenderer_DoRenderSample(BaseRenderer* iface, IMediaSample * pSample)
|
|
|
|
{
|
|
|
|
VideoRendererImpl *This = impl_from_BaseRenderer(iface);
|
2004-08-24 04:28:35 +02:00
|
|
|
LPBYTE pbSrcStream = NULL;
|
2010-05-20 01:14:09 +02:00
|
|
|
LONG cbSrcStream = 0;
|
2004-08-24 04:28:35 +02:00
|
|
|
HRESULT hr;
|
2008-12-02 20:29:48 +01:00
|
|
|
|
2012-03-31 03:08:55 +02:00
|
|
|
TRACE("(%p)->(%p)\n", This, pSample);
|
2008-04-17 20:16:13 +02:00
|
|
|
|
2004-08-24 04:28:35 +02:00
|
|
|
hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
2006-10-12 20:57:23 +02:00
|
|
|
ERR("Cannot get pointer to sample data (%x)\n", hr);
|
2005-06-13 13:37:55 +02:00
|
|
|
return hr;
|
2004-08-24 04:28:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
cbSrcStream = IMediaSample_GetActualDataLength(pSample);
|
|
|
|
|
2010-05-20 01:14:09 +02:00
|
|
|
TRACE("val %p %d\n", pbSrcStream, cbSrcStream);
|
2004-08-24 04:28:35 +02:00
|
|
|
|
|
|
|
#if 0 /* For debugging purpose */
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for(i = 0; i < cbSrcStream; i++)
|
|
|
|
{
|
2005-06-13 13:37:55 +02:00
|
|
|
if ((i!=0) && !(i%16))
|
2005-09-25 17:23:21 +02:00
|
|
|
TRACE("\n");
|
|
|
|
TRACE("%02x ", pbSrcStream[i]);
|
2004-08-24 04:28:35 +02:00
|
|
|
}
|
2005-09-25 17:23:21 +02:00
|
|
|
TRACE("\n");
|
2004-08-24 04:28:35 +02:00
|
|
|
}
|
|
|
|
#endif
|
2008-04-25 23:25:49 +02:00
|
|
|
|
2008-07-04 10:33:04 +02:00
|
|
|
SetEvent(This->hEvent);
|
2012-03-31 03:08:55 +02:00
|
|
|
if (This->renderer.filter.state == State_Paused)
|
2008-06-10 18:45:25 +02:00
|
|
|
{
|
2010-11-09 23:42:50 +01:00
|
|
|
VideoRenderer_SendSampleData(This, pbSrcStream, cbSrcStream);
|
2010-12-10 16:06:56 +01:00
|
|
|
SetEvent(This->hEvent);
|
2012-03-31 03:08:55 +02:00
|
|
|
if (This->renderer.filter.state == State_Paused)
|
2008-07-05 01:59:22 +02:00
|
|
|
{
|
2008-07-04 10:33:04 +02:00
|
|
|
/* Flushing */
|
|
|
|
return S_OK;
|
2008-07-05 01:59:22 +02:00
|
|
|
}
|
2012-03-31 03:08:55 +02:00
|
|
|
if (This->renderer.filter.state == State_Stopped)
|
2008-07-05 01:59:22 +02:00
|
|
|
{
|
2008-07-04 10:33:04 +02:00
|
|
|
return VFW_E_WRONG_STATE;
|
2008-07-05 01:59:22 +02:00
|
|
|
}
|
2010-11-09 23:42:50 +01:00
|
|
|
} else {
|
2012-03-31 03:08:55 +02:00
|
|
|
VideoRenderer_SendSampleData(This, pbSrcStream, cbSrcStream);
|
2008-04-29 00:00:51 +02:00
|
|
|
}
|
2004-08-24 04:28:35 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2012-03-31 03:08:55 +02:00
|
|
|
static HRESULT WINAPI VideoRenderer_CheckMediaType(BaseRenderer *iface, const AM_MEDIA_TYPE * pmt)
|
2004-08-24 04:28:35 +02:00
|
|
|
{
|
2012-03-31 03:08:55 +02:00
|
|
|
VideoRendererImpl *This = impl_from_BaseRenderer(iface);
|
2010-10-05 21:38:11 +02:00
|
|
|
|
2005-10-10 12:44:54 +02:00
|
|
|
if (!IsEqualIID(&pmt->majortype, &MEDIATYPE_Video))
|
|
|
|
return S_FALSE;
|
|
|
|
|
|
|
|
if (IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB32) ||
|
|
|
|
IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB24) ||
|
|
|
|
IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB565) ||
|
|
|
|
IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB8))
|
2005-06-13 13:37:55 +02:00
|
|
|
{
|
2010-05-19 21:46:50 +02:00
|
|
|
LONG height;
|
2005-10-10 12:44:54 +02:00
|
|
|
|
2008-04-12 00:10:19 +02:00
|
|
|
if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo))
|
|
|
|
{
|
|
|
|
VIDEOINFOHEADER *format = (VIDEOINFOHEADER *)pmt->pbFormat;
|
|
|
|
This->SourceRect.left = 0;
|
|
|
|
This->SourceRect.top = 0;
|
|
|
|
This->SourceRect.right = This->VideoWidth = format->bmiHeader.biWidth;
|
2010-05-19 21:46:50 +02:00
|
|
|
height = format->bmiHeader.biHeight;
|
|
|
|
if (height < 0)
|
|
|
|
This->SourceRect.bottom = This->VideoHeight = -height;
|
|
|
|
else
|
|
|
|
This->SourceRect.bottom = This->VideoHeight = height;
|
2008-04-12 00:10:19 +02:00
|
|
|
}
|
|
|
|
else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2))
|
|
|
|
{
|
|
|
|
VIDEOINFOHEADER2 *format2 = (VIDEOINFOHEADER2 *)pmt->pbFormat;
|
|
|
|
|
|
|
|
This->SourceRect.left = 0;
|
|
|
|
This->SourceRect.top = 0;
|
|
|
|
This->SourceRect.right = This->VideoWidth = format2->bmiHeader.biWidth;
|
2010-05-19 21:46:50 +02:00
|
|
|
height = format2->bmiHeader.biHeight;
|
|
|
|
if (height < 0)
|
|
|
|
This->SourceRect.bottom = This->VideoHeight = -height;
|
|
|
|
else
|
|
|
|
This->SourceRect.bottom = This->VideoHeight = height;
|
2008-04-12 00:10:19 +02:00
|
|
|
}
|
|
|
|
else
|
2005-10-10 12:44:54 +02:00
|
|
|
{
|
|
|
|
WARN("Format type %s not supported\n", debugstr_guid(&pmt->formattype));
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
2004-08-24 04:28:35 +02:00
|
|
|
return S_OK;
|
2005-06-13 13:37:55 +02:00
|
|
|
}
|
2004-08-24 04:28:35 +02:00
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
2012-03-31 03:08:55 +02:00
|
|
|
static HRESULT WINAPI VideoRenderer_EndFlush(BaseRenderer* iface)
|
2010-10-07 21:48:01 +02:00
|
|
|
{
|
2012-03-31 03:08:55 +02:00
|
|
|
VideoRendererImpl *This = impl_from_BaseRenderer(iface);
|
|
|
|
|
|
|
|
TRACE("(%p)->()\n", iface);
|
|
|
|
|
|
|
|
if (This->renderer.pMediaSample) {
|
|
|
|
ResetEvent(This->hEvent);
|
|
|
|
LeaveCriticalSection(iface->pInputPin->pin.pCritSec);
|
|
|
|
LeaveCriticalSection(&iface->csRenderLock);
|
2012-04-19 15:11:12 +02:00
|
|
|
LeaveCriticalSection(&iface->filter.csFilter);
|
2012-03-31 03:08:55 +02:00
|
|
|
WaitForSingleObject(This->hEvent, INFINITE);
|
|
|
|
EnterCriticalSection(&iface->filter.csFilter);
|
2012-04-19 15:11:12 +02:00
|
|
|
EnterCriticalSection(&iface->csRenderLock);
|
2012-03-31 03:08:55 +02:00
|
|
|
EnterCriticalSection(iface->pInputPin->pin.pCritSec);
|
|
|
|
}
|
|
|
|
if (This->renderer.filter.state == State_Paused) {
|
|
|
|
ResetEvent(This->hEvent);
|
|
|
|
}
|
|
|
|
|
|
|
|
return BaseRendererImpl_EndFlush(iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static VOID WINAPI VideoRenderer_OnStopStreaming(BaseRenderer* iface)
|
|
|
|
{
|
|
|
|
VideoRendererImpl *This = impl_from_BaseRenderer(iface);
|
2010-10-07 21:48:01 +02:00
|
|
|
|
2012-03-31 03:08:55 +02:00
|
|
|
TRACE("(%p)->()\n", This);
|
2010-10-07 21:48:01 +02:00
|
|
|
|
2012-03-31 03:08:55 +02:00
|
|
|
SetEvent(This->hEvent);
|
2012-03-31 03:09:14 +02:00
|
|
|
if (This->baseControlWindow.AutoShow)
|
2012-03-31 03:08:55 +02:00
|
|
|
/* Black it out */
|
2012-03-31 03:09:14 +02:00
|
|
|
RedrawWindow(This->baseControlWindow.baseWindow.hWnd, NULL, NULL, RDW_INVALIDATE|RDW_ERASE);
|
2010-10-07 21:48:01 +02:00
|
|
|
}
|
|
|
|
|
2012-03-31 03:08:55 +02:00
|
|
|
static VOID WINAPI VideoRenderer_OnStartStreaming(BaseRenderer* iface)
|
2010-10-07 21:48:01 +02:00
|
|
|
{
|
2012-03-31 03:08:55 +02:00
|
|
|
VideoRendererImpl *This = impl_from_BaseRenderer(iface);
|
|
|
|
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
|
|
|
if (This->renderer.pInputPin->pin.pConnectedTo && (This->renderer.filter.state == State_Stopped || !This->renderer.pInputPin->end_of_stream))
|
|
|
|
{
|
|
|
|
if (This->renderer.filter.state == State_Stopped)
|
|
|
|
{
|
|
|
|
ResetEvent(This->hEvent);
|
|
|
|
VideoRenderer_AutoShowWindow(This);
|
|
|
|
}
|
|
|
|
}
|
2010-10-07 21:48:01 +02:00
|
|
|
}
|
|
|
|
|
2012-03-31 03:08:45 +02:00
|
|
|
static LPWSTR WINAPI VideoRenderer_GetClassWindowStyles(BaseWindow *This, DWORD *pClassStyles, DWORD *pWindowStyles, DWORD *pWindowStylesEx)
|
|
|
|
{
|
|
|
|
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 };
|
|
|
|
|
|
|
|
*pClassStyles = 0;
|
|
|
|
*pWindowStyles = WS_SIZEBOX;
|
|
|
|
*pWindowStylesEx = 0;
|
|
|
|
|
|
|
|
return (LPWSTR)classnameW;
|
|
|
|
}
|
|
|
|
|
2012-03-31 03:09:14 +02:00
|
|
|
static RECT WINAPI VideoRenderer_GetDefaultRect(BaseWindow *iface)
|
2012-03-31 03:08:45 +02:00
|
|
|
{
|
|
|
|
VideoRendererImpl *This = impl_from_BaseWindow(iface);
|
2012-03-31 03:09:14 +02:00
|
|
|
static RECT defRect;
|
2012-03-31 03:08:45 +02:00
|
|
|
|
2012-03-31 03:09:14 +02:00
|
|
|
defRect.left = defRect.top = 0;
|
|
|
|
defRect.right = This->VideoWidth;
|
|
|
|
defRect.bottom = This->VideoHeight;
|
|
|
|
|
|
|
|
return defRect;
|
2012-03-31 03:08:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL WINAPI VideoRenderer_OnSize(BaseWindow *iface, LONG Width, LONG Height)
|
|
|
|
{
|
|
|
|
VideoRendererImpl *This = impl_from_BaseWindow(iface);
|
|
|
|
|
|
|
|
TRACE("WM_SIZE %d %d\n", Width, Height);
|
|
|
|
GetClientRect(iface->hWnd, &This->DestRect);
|
|
|
|
TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
|
|
|
|
This->DestRect.left,
|
|
|
|
This->DestRect.top,
|
|
|
|
This->DestRect.right - This->DestRect.left,
|
|
|
|
This->DestRect.bottom - This->DestRect.top);
|
2012-03-31 03:09:14 +02:00
|
|
|
return BaseWindowImpl_OnSize(iface, Width, Height);
|
2012-03-31 03:08:45 +02:00
|
|
|
}
|
|
|
|
|
2012-03-31 03:08:55 +02:00
|
|
|
static const BaseRendererFuncTable BaseFuncTable = {
|
2010-10-13 18:02:01 +02:00
|
|
|
VideoRenderer_CheckMediaType,
|
2012-03-31 03:08:55 +02:00
|
|
|
VideoRenderer_DoRenderSample,
|
|
|
|
/**/
|
2010-10-13 18:02:08 +02:00
|
|
|
NULL,
|
2012-03-31 03:08:55 +02:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
VideoRenderer_OnStartStreaming,
|
|
|
|
VideoRenderer_OnStopStreaming,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
VideoRenderer_ShouldDrawSampleNow,
|
|
|
|
NULL,
|
|
|
|
/**/
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
VideoRenderer_EndFlush,
|
2010-10-13 18:02:01 +02:00
|
|
|
};
|
|
|
|
|
2012-03-31 03:08:45 +02:00
|
|
|
static const BaseWindowFuncTable renderer_BaseWindowFuncTable = {
|
|
|
|
VideoRenderer_GetClassWindowStyles,
|
2012-03-31 03:09:14 +02:00
|
|
|
VideoRenderer_GetDefaultRect,
|
2012-03-31 03:08:45 +02:00
|
|
|
NULL,
|
2012-03-31 03:09:14 +02:00
|
|
|
BaseControlWindowImpl_PossiblyEatMessage,
|
2012-03-31 03:08:45 +02:00
|
|
|
VideoRenderer_OnSize
|
|
|
|
};
|
|
|
|
|
2012-04-20 08:39:55 +02:00
|
|
|
static HRESULT WINAPI VideoRenderer_GetSourceRect(BaseControlVideo* iface, RECT *pSourceRect)
|
2012-03-31 03:09:22 +02:00
|
|
|
{
|
|
|
|
VideoRendererImpl *This = impl_from_BaseControlVideo(iface);
|
|
|
|
CopyRect(pSourceRect,&This->SourceRect);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2012-04-20 08:39:55 +02:00
|
|
|
static HRESULT WINAPI VideoRenderer_GetStaticImage(BaseControlVideo* iface, LONG *pBufferSize, LONG *pDIBImage)
|
2012-03-31 03:09:22 +02:00
|
|
|
{
|
|
|
|
VideoRendererImpl *This = impl_from_BaseControlVideo(iface);
|
|
|
|
BITMAPINFOHEADER *bmiHeader;
|
|
|
|
LONG needed_size;
|
|
|
|
AM_MEDIA_TYPE *amt = &This->renderer.pInputPin->pin.mtCurrent;
|
|
|
|
char *ptr;
|
|
|
|
|
|
|
|
FIXME("(%p/%p)->(%p, %p): partial stub\n", This, iface, pBufferSize, pDIBImage);
|
|
|
|
|
|
|
|
EnterCriticalSection(&This->renderer.filter.csFilter);
|
|
|
|
|
|
|
|
if (!This->renderer.pMediaSample)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection(&This->renderer.filter.csFilter);
|
|
|
|
return (This->renderer.filter.state == State_Paused ? E_UNEXPECTED : VFW_E_NOT_PAUSED);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (IsEqualIID(&amt->formattype, &FORMAT_VideoInfo))
|
|
|
|
{
|
|
|
|
bmiHeader = &((VIDEOINFOHEADER *)amt->pbFormat)->bmiHeader;
|
|
|
|
}
|
|
|
|
else if (IsEqualIID(&amt->formattype, &FORMAT_VideoInfo2))
|
|
|
|
{
|
|
|
|
bmiHeader = &((VIDEOINFOHEADER2 *)amt->pbFormat)->bmiHeader;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FIXME("Unknown type %s\n", debugstr_guid(&amt->subtype));
|
|
|
|
LeaveCriticalSection(&This->renderer.filter.csFilter);
|
|
|
|
return VFW_E_RUNTIME_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
needed_size = bmiHeader->biSize;
|
|
|
|
needed_size += IMediaSample_GetActualDataLength(This->renderer.pMediaSample);
|
|
|
|
|
|
|
|
if (!pDIBImage)
|
|
|
|
{
|
|
|
|
*pBufferSize = needed_size;
|
|
|
|
LeaveCriticalSection(&This->renderer.filter.csFilter);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (needed_size < *pBufferSize)
|
|
|
|
{
|
|
|
|
ERR("Buffer too small %u/%u\n", needed_size, *pBufferSize);
|
|
|
|
LeaveCriticalSection(&This->renderer.filter.csFilter);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
*pBufferSize = needed_size;
|
|
|
|
|
|
|
|
memcpy(pDIBImage, bmiHeader, bmiHeader->biSize);
|
|
|
|
IMediaSample_GetPointer(This->renderer.pMediaSample, (BYTE **)&ptr);
|
|
|
|
memcpy((char *)pDIBImage + bmiHeader->biSize, ptr, IMediaSample_GetActualDataLength(This->renderer.pMediaSample));
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->renderer.filter.csFilter);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2012-04-20 08:39:55 +02:00
|
|
|
static HRESULT WINAPI VideoRenderer_GetTargetRect(BaseControlVideo* iface, RECT *pTargetRect)
|
2012-03-31 03:09:22 +02:00
|
|
|
{
|
|
|
|
VideoRendererImpl *This = impl_from_BaseControlVideo(iface);
|
|
|
|
CopyRect(pTargetRect,&This->DestRect);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2012-04-20 08:39:55 +02:00
|
|
|
static VIDEOINFOHEADER* WINAPI VideoRenderer_GetVideoFormat(BaseControlVideo* iface)
|
2012-03-31 03:09:22 +02:00
|
|
|
{
|
|
|
|
VideoRendererImpl *This = impl_from_BaseControlVideo(iface);
|
|
|
|
AM_MEDIA_TYPE *pmt;
|
|
|
|
|
|
|
|
TRACE("(%p/%p)\n", This, iface);
|
|
|
|
|
|
|
|
pmt = &This->renderer.pInputPin->pin.mtCurrent;
|
|
|
|
if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo)) {
|
|
|
|
return (VIDEOINFOHEADER*)pmt->pbFormat;
|
|
|
|
} else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2)) {
|
|
|
|
static VIDEOINFOHEADER vih;
|
|
|
|
VIDEOINFOHEADER2 *vih2 = (VIDEOINFOHEADER2*)pmt->pbFormat;
|
|
|
|
memcpy(&vih,vih2,sizeof(VIDEOINFOHEADER));
|
|
|
|
memcpy(&vih.bmiHeader, &vih2->bmiHeader, sizeof(BITMAPINFOHEADER));
|
|
|
|
return &vih;
|
|
|
|
} else {
|
|
|
|
ERR("Unknown format type %s\n", qzdebugstr_guid(&pmt->formattype));
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-20 08:39:55 +02:00
|
|
|
static HRESULT WINAPI VideoRenderer_IsDefaultSourceRect(BaseControlVideo* iface)
|
2012-03-31 03:09:22 +02:00
|
|
|
{
|
|
|
|
VideoRendererImpl *This = impl_from_BaseControlVideo(iface);
|
|
|
|
FIXME("(%p/%p)->(): stub !!!\n", This, iface);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2012-04-20 08:39:55 +02:00
|
|
|
static HRESULT WINAPI VideoRenderer_IsDefaultTargetRect(BaseControlVideo* iface)
|
2012-03-31 03:09:22 +02:00
|
|
|
{
|
|
|
|
VideoRendererImpl *This = impl_from_BaseControlVideo(iface);
|
|
|
|
FIXME("(%p/%p)->(): stub !!!\n", This, iface);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2012-04-20 08:39:55 +02:00
|
|
|
static HRESULT WINAPI VideoRenderer_SetDefaultSourceRect(BaseControlVideo* iface)
|
2012-03-31 03:09:22 +02:00
|
|
|
{
|
|
|
|
VideoRendererImpl *This = impl_from_BaseControlVideo(iface);
|
|
|
|
|
|
|
|
This->SourceRect.left = 0;
|
|
|
|
This->SourceRect.top = 0;
|
|
|
|
This->SourceRect.right = This->VideoWidth;
|
|
|
|
This->SourceRect.bottom = This->VideoHeight;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2012-04-20 08:39:55 +02:00
|
|
|
static HRESULT WINAPI VideoRenderer_SetDefaultTargetRect(BaseControlVideo* iface)
|
2012-03-31 03:09:22 +02:00
|
|
|
{
|
|
|
|
VideoRendererImpl *This = impl_from_BaseControlVideo(iface);
|
|
|
|
RECT rect;
|
|
|
|
|
|
|
|
if (!GetClientRect(This->baseControlWindow.baseWindow.hWnd, &rect))
|
|
|
|
return E_FAIL;
|
|
|
|
|
2012-10-07 22:01:08 +02:00
|
|
|
This->DestRect.left = 0;
|
|
|
|
This->DestRect.top = 0;
|
|
|
|
This->DestRect.right = rect.right;
|
|
|
|
This->DestRect.bottom = rect.bottom;
|
2012-03-31 03:09:22 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2012-04-20 08:39:55 +02:00
|
|
|
static HRESULT WINAPI VideoRenderer_SetSourceRect(BaseControlVideo* iface, RECT *pSourceRect)
|
2012-03-31 03:09:22 +02:00
|
|
|
{
|
|
|
|
VideoRendererImpl *This = impl_from_BaseControlVideo(iface);
|
|
|
|
CopyRect(&This->SourceRect,pSourceRect);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2012-04-20 08:39:55 +02:00
|
|
|
static HRESULT WINAPI VideoRenderer_SetTargetRect(BaseControlVideo* iface, RECT *pTargetRect)
|
2012-03-31 03:09:22 +02:00
|
|
|
{
|
|
|
|
VideoRendererImpl *This = impl_from_BaseControlVideo(iface);
|
|
|
|
CopyRect(&This->DestRect,pTargetRect);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const BaseControlVideoFuncTable renderer_BaseControlVideoFuncTable = {
|
|
|
|
VideoRenderer_GetSourceRect,
|
|
|
|
VideoRenderer_GetStaticImage,
|
|
|
|
VideoRenderer_GetTargetRect,
|
|
|
|
VideoRenderer_GetVideoFormat,
|
|
|
|
VideoRenderer_IsDefaultSourceRect,
|
|
|
|
VideoRenderer_IsDefaultTargetRect,
|
|
|
|
VideoRenderer_SetDefaultSourceRect,
|
|
|
|
VideoRenderer_SetDefaultTargetRect,
|
|
|
|
VideoRenderer_SetSourceRect,
|
|
|
|
VideoRenderer_SetTargetRect
|
|
|
|
};
|
|
|
|
|
2012-07-02 01:06:01 +02:00
|
|
|
static inline VideoRendererImpl *impl_from_IUnknown(IUnknown *iface)
|
2004-08-24 04:28:35 +02:00
|
|
|
{
|
2012-07-02 01:06:01 +02:00
|
|
|
return CONTAINING_RECORD(iface, VideoRendererImpl, IUnknown_inner);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI VideoRendererInner_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
VideoRendererImpl *This = impl_from_IUnknown(iface);
|
2004-08-24 04:28:35 +02:00
|
|
|
|
2012-07-02 01:06:01 +02:00
|
|
|
TRACE("(%p/%p)->(%s, %p)\n", This, iface, qzdebugstr_guid(riid), ppv);
|
2007-12-13 12:16:27 +01:00
|
|
|
|
2004-08-24 04:28:35 +02:00
|
|
|
*ppv = NULL;
|
|
|
|
|
|
|
|
if (IsEqualIID(riid, &IID_IUnknown))
|
2012-07-02 01:06:01 +02:00
|
|
|
*ppv = &This->IUnknown_inner;
|
2004-08-24 04:28:35 +02:00
|
|
|
else if (IsEqualIID(riid, &IID_IBasicVideo))
|
2012-03-31 03:09:22 +02:00
|
|
|
*ppv = &This->baseControlVideo.IBasicVideo_iface;
|
2004-08-24 04:28:35 +02:00
|
|
|
else if (IsEqualIID(riid, &IID_IVideoWindow))
|
2012-03-31 03:09:14 +02:00
|
|
|
*ppv = &This->baseControlWindow.IVideoWindow_iface;
|
2010-11-04 17:02:24 +01:00
|
|
|
else if (IsEqualIID(riid, &IID_IAMFilterMiscFlags))
|
2012-07-02 01:04:04 +02:00
|
|
|
*ppv = &This->IAMFilterMiscFlags_iface;
|
2012-03-31 03:08:55 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
hr = BaseRendererImpl_QueryInterface(&This->renderer.filter.IBaseFilter_iface, riid, ppv);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
return hr;
|
|
|
|
}
|
2004-08-24 04:28:35 +02:00
|
|
|
|
|
|
|
if (*ppv)
|
|
|
|
{
|
2012-07-02 01:06:01 +02:00
|
|
|
IUnknown_AddRef((IUnknown *)*ppv);
|
2004-08-24 04:28:35 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2008-03-21 23:36:51 +01:00
|
|
|
if (!IsEqualIID(riid, &IID_IPin))
|
|
|
|
FIXME("No interface for %s!\n", qzdebugstr_guid(riid));
|
2004-08-24 04:28:35 +02:00
|
|
|
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
2012-07-02 01:06:01 +02:00
|
|
|
static ULONG WINAPI VideoRendererInner_AddRef(IUnknown *iface)
|
2004-08-24 04:28:35 +02:00
|
|
|
{
|
2012-07-02 01:06:01 +02:00
|
|
|
VideoRendererImpl *This = impl_from_IUnknown(iface);
|
2012-03-31 03:08:55 +02:00
|
|
|
ULONG refCount = BaseFilterImpl_AddRef(&This->renderer.filter.IBaseFilter_iface);
|
2004-12-27 18:15:58 +01:00
|
|
|
|
2012-07-02 01:06:01 +02:00
|
|
|
TRACE("(%p)->(): new ref = %d\n", This, refCount);
|
2004-12-27 18:15:58 +01:00
|
|
|
|
2005-01-06 20:36:47 +01:00
|
|
|
return refCount;
|
2004-08-24 04:28:35 +02:00
|
|
|
}
|
|
|
|
|
2012-07-02 01:06:01 +02:00
|
|
|
static ULONG WINAPI VideoRendererInner_Release(IUnknown *iface)
|
2004-08-24 04:28:35 +02:00
|
|
|
{
|
2012-07-02 01:06:01 +02:00
|
|
|
VideoRendererImpl *This = impl_from_IUnknown(iface);
|
2012-03-31 03:08:55 +02:00
|
|
|
ULONG refCount = BaseRendererImpl_Release(&This->renderer.filter.IBaseFilter_iface);
|
2004-12-27 18:15:58 +01:00
|
|
|
|
2012-07-02 01:06:01 +02:00
|
|
|
TRACE("(%p)->(): new ref = %d\n", This, refCount);
|
2004-12-27 18:15:58 +01:00
|
|
|
|
2005-01-06 20:36:47 +01:00
|
|
|
if (!refCount)
|
2004-08-24 04:28:35 +02:00
|
|
|
{
|
2012-04-20 14:26:32 +02:00
|
|
|
BaseControlWindow_Destroy(&This->baseControlWindow);
|
2012-04-20 14:26:43 +02:00
|
|
|
BaseControlVideo_Destroy(&This->baseControlVideo);
|
2010-12-03 09:38:13 +01:00
|
|
|
PostThreadMessageW(This->ThreadID, WM_QUIT, 0, 0);
|
2005-06-13 13:37:55 +02:00
|
|
|
WaitForSingleObject(This->hThread, INFINITE);
|
|
|
|
CloseHandle(This->hThread);
|
2008-07-04 10:33:04 +02:00
|
|
|
CloseHandle(This->hEvent);
|
2005-06-13 13:37:55 +02:00
|
|
|
|
2004-08-24 04:28:35 +02:00
|
|
|
TRACE("Destroying Video Renderer\n");
|
|
|
|
CoTaskMemFree(This);
|
2012-03-31 03:08:55 +02:00
|
|
|
|
2004-08-24 04:28:35 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else
|
2005-01-06 20:36:47 +01:00
|
|
|
return refCount;
|
2004-08-24 04:28:35 +02:00
|
|
|
}
|
|
|
|
|
2007-12-13 12:16:27 +01:00
|
|
|
static const IUnknownVtbl IInner_VTable =
|
|
|
|
{
|
2007-12-14 00:05:58 +01:00
|
|
|
VideoRendererInner_QueryInterface,
|
|
|
|
VideoRendererInner_AddRef,
|
|
|
|
VideoRendererInner_Release
|
2007-12-13 12:16:27 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
static HRESULT WINAPI VideoRenderer_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv)
|
|
|
|
{
|
2012-03-31 03:08:55 +02:00
|
|
|
VideoRendererImpl *This = impl_from_IBaseFilter(iface);
|
2012-07-02 01:06:01 +02:00
|
|
|
return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
|
2007-12-13 12:16:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI VideoRenderer_AddRef(IBaseFilter * iface)
|
|
|
|
{
|
2012-03-31 03:08:55 +02:00
|
|
|
VideoRendererImpl *This = impl_from_IBaseFilter(iface);
|
2012-07-02 01:06:01 +02:00
|
|
|
return IUnknown_AddRef(This->outer_unk);
|
2007-12-13 12:16:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI VideoRenderer_Release(IBaseFilter * iface)
|
|
|
|
{
|
2012-03-31 03:08:55 +02:00
|
|
|
VideoRendererImpl *This = impl_from_IBaseFilter(iface);
|
2012-07-02 01:06:01 +02:00
|
|
|
return IUnknown_Release(This->outer_unk);
|
2007-12-13 12:16:27 +01:00
|
|
|
}
|
|
|
|
|
2004-08-24 04:28:35 +02:00
|
|
|
/** IMediaFilter methods **/
|
|
|
|
|
|
|
|
static HRESULT WINAPI VideoRenderer_Pause(IBaseFilter * iface)
|
|
|
|
{
|
2012-03-31 03:08:55 +02:00
|
|
|
VideoRendererImpl *This = impl_from_IBaseFilter(iface);
|
2012-10-09 23:55:44 +02:00
|
|
|
|
2004-08-24 04:28:35 +02:00
|
|
|
TRACE("(%p/%p)->()\n", This, iface);
|
|
|
|
|
2012-03-31 03:08:55 +02:00
|
|
|
EnterCriticalSection(&This->renderer.csRenderLock);
|
|
|
|
if (This->renderer.filter.state != State_Paused)
|
2004-08-24 04:28:35 +02:00
|
|
|
{
|
2012-03-31 03:08:55 +02:00
|
|
|
if (This->renderer.filter.state == State_Stopped)
|
2008-07-04 10:33:04 +02:00
|
|
|
{
|
2012-03-31 03:08:55 +02:00
|
|
|
This->renderer.pInputPin->end_of_stream = 0;
|
2008-07-04 10:33:04 +02:00
|
|
|
ResetEvent(This->hEvent);
|
2010-11-11 14:03:29 +01:00
|
|
|
VideoRenderer_AutoShowWindow(This);
|
2008-07-04 10:33:04 +02:00
|
|
|
}
|
2008-04-05 01:27:29 +02:00
|
|
|
|
2012-03-31 03:08:55 +02:00
|
|
|
ResetEvent(This->renderer.RenderEvent);
|
|
|
|
This->renderer.filter.state = State_Paused;
|
2004-08-24 04:28:35 +02:00
|
|
|
}
|
2012-03-31 03:08:55 +02:00
|
|
|
LeaveCriticalSection(&This->renderer.csRenderLock);
|
2004-08-24 04:28:35 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IBaseFilterVtbl VideoRenderer_Vtbl =
|
|
|
|
{
|
|
|
|
VideoRenderer_QueryInterface,
|
|
|
|
VideoRenderer_AddRef,
|
|
|
|
VideoRenderer_Release,
|
2010-10-07 21:47:33 +02:00
|
|
|
BaseFilterImpl_GetClassID,
|
2012-03-31 03:08:55 +02:00
|
|
|
BaseRendererImpl_Stop,
|
2004-08-24 04:28:35 +02:00
|
|
|
VideoRenderer_Pause,
|
2012-03-31 03:08:55 +02:00
|
|
|
BaseRendererImpl_Run,
|
|
|
|
BaseRendererImpl_GetState,
|
|
|
|
BaseRendererImpl_SetSyncSource,
|
2010-10-07 21:47:33 +02:00
|
|
|
BaseFilterImpl_GetSyncSource,
|
2010-10-07 21:48:01 +02:00
|
|
|
BaseFilterImpl_EnumPins,
|
2012-03-31 03:08:55 +02:00
|
|
|
BaseRendererImpl_FindPin,
|
2010-10-07 21:47:33 +02:00
|
|
|
BaseFilterImpl_QueryFilterInfo,
|
|
|
|
BaseFilterImpl_JoinFilterGraph,
|
|
|
|
BaseFilterImpl_QueryVendorInfo
|
2004-08-24 04:28:35 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/*** IUnknown methods ***/
|
2012-11-27 09:15:08 +01:00
|
|
|
static HRESULT WINAPI BasicVideo_QueryInterface(IBasicVideo *iface, REFIID riid, LPVOID *ppvObj)
|
2012-10-09 23:55:44 +02:00
|
|
|
{
|
2012-03-31 03:09:22 +02:00
|
|
|
VideoRendererImpl *This = impl_from_IBasicVideo(iface);
|
2004-08-24 04:28:35 +02:00
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
|
|
|
|
|
2012-07-02 01:06:01 +02:00
|
|
|
return IUnknown_QueryInterface(This->outer_unk, riid, ppvObj);
|
2004-08-24 04:28:35 +02:00
|
|
|
}
|
|
|
|
|
2012-11-27 09:15:08 +01:00
|
|
|
static ULONG WINAPI BasicVideo_AddRef(IBasicVideo *iface)
|
|
|
|
{
|
2012-03-31 03:09:22 +02:00
|
|
|
VideoRendererImpl *This = impl_from_IBasicVideo(iface);
|
2004-08-24 04:28:35 +02:00
|
|
|
|
|
|
|
TRACE("(%p/%p)->()\n", This, iface);
|
|
|
|
|
2012-07-02 01:06:01 +02:00
|
|
|
return IUnknown_AddRef(This->outer_unk);
|
2004-08-24 04:28:35 +02:00
|
|
|
}
|
|
|
|
|
2012-11-27 09:15:08 +01:00
|
|
|
static ULONG WINAPI BasicVideo_Release(IBasicVideo *iface)
|
|
|
|
{
|
2012-03-31 03:09:22 +02:00
|
|
|
VideoRendererImpl *This = impl_from_IBasicVideo(iface);
|
2004-08-24 04:28:35 +02:00
|
|
|
|
|
|
|
TRACE("(%p/%p)->()\n", This, iface);
|
|
|
|
|
2012-07-02 01:06:01 +02:00
|
|
|
return IUnknown_Release(This->outer_unk);
|
2004-08-24 04:28:35 +02:00
|
|
|
}
|
|
|
|
|
2005-06-06 21:50:35 +02:00
|
|
|
static const IBasicVideoVtbl IBasicVideo_VTable =
|
2004-08-24 04:28:35 +02:00
|
|
|
{
|
2012-11-27 09:15:08 +01:00
|
|
|
BasicVideo_QueryInterface,
|
|
|
|
BasicVideo_AddRef,
|
|
|
|
BasicVideo_Release,
|
2012-03-31 03:09:22 +02:00
|
|
|
BaseControlVideoImpl_GetTypeInfoCount,
|
|
|
|
BaseControlVideoImpl_GetTypeInfo,
|
|
|
|
BaseControlVideoImpl_GetIDsOfNames,
|
|
|
|
BaseControlVideoImpl_Invoke,
|
|
|
|
BaseControlVideoImpl_get_AvgTimePerFrame,
|
|
|
|
BaseControlVideoImpl_get_BitRate,
|
|
|
|
BaseControlVideoImpl_get_BitErrorRate,
|
|
|
|
BaseControlVideoImpl_get_VideoWidth,
|
|
|
|
BaseControlVideoImpl_get_VideoHeight,
|
|
|
|
BaseControlVideoImpl_put_SourceLeft,
|
|
|
|
BaseControlVideoImpl_get_SourceLeft,
|
|
|
|
BaseControlVideoImpl_put_SourceWidth,
|
|
|
|
BaseControlVideoImpl_get_SourceWidth,
|
|
|
|
BaseControlVideoImpl_put_SourceTop,
|
|
|
|
BaseControlVideoImpl_get_SourceTop,
|
|
|
|
BaseControlVideoImpl_put_SourceHeight,
|
|
|
|
BaseControlVideoImpl_get_SourceHeight,
|
|
|
|
BaseControlVideoImpl_put_DestinationLeft,
|
|
|
|
BaseControlVideoImpl_get_DestinationLeft,
|
|
|
|
BaseControlVideoImpl_put_DestinationWidth,
|
|
|
|
BaseControlVideoImpl_get_DestinationWidth,
|
|
|
|
BaseControlVideoImpl_put_DestinationTop,
|
|
|
|
BaseControlVideoImpl_get_DestinationTop,
|
|
|
|
BaseControlVideoImpl_put_DestinationHeight,
|
|
|
|
BaseControlVideoImpl_get_DestinationHeight,
|
|
|
|
BaseControlVideoImpl_SetSourcePosition,
|
|
|
|
BaseControlVideoImpl_GetSourcePosition,
|
|
|
|
BaseControlVideoImpl_SetDefaultSourcePosition,
|
|
|
|
BaseControlVideoImpl_SetDestinationPosition,
|
|
|
|
BaseControlVideoImpl_GetDestinationPosition,
|
|
|
|
BaseControlVideoImpl_SetDefaultDestinationPosition,
|
|
|
|
BaseControlVideoImpl_GetVideoSize,
|
|
|
|
BaseControlVideoImpl_GetVideoPaletteEntries,
|
|
|
|
BaseControlVideoImpl_GetCurrentImage,
|
|
|
|
BaseControlVideoImpl_IsUsingDefaultSource,
|
|
|
|
BaseControlVideoImpl_IsUsingDefaultDestination
|
2004-08-24 04:28:35 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*** IUnknown methods ***/
|
2012-11-27 09:15:08 +01:00
|
|
|
static HRESULT WINAPI VideoWindow_QueryInterface(IVideoWindow *iface, REFIID riid, LPVOID *ppvObj)
|
2012-10-09 23:55:44 +02:00
|
|
|
{
|
2012-03-31 03:09:14 +02:00
|
|
|
VideoRendererImpl *This = impl_from_IVideoWindow(iface);
|
2004-08-24 04:28:35 +02:00
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
|
|
|
|
|
2012-07-02 01:06:01 +02:00
|
|
|
return IUnknown_QueryInterface(This->outer_unk, riid, ppvObj);
|
2004-08-24 04:28:35 +02:00
|
|
|
}
|
|
|
|
|
2012-11-27 09:15:08 +01:00
|
|
|
static ULONG WINAPI VideoWindow_AddRef(IVideoWindow *iface)
|
|
|
|
{
|
2012-03-31 03:09:14 +02:00
|
|
|
VideoRendererImpl *This = impl_from_IVideoWindow(iface);
|
2004-08-24 04:28:35 +02:00
|
|
|
|
|
|
|
TRACE("(%p/%p)->()\n", This, iface);
|
|
|
|
|
2012-07-02 01:06:01 +02:00
|
|
|
return IUnknown_AddRef(This->outer_unk);
|
2004-08-24 04:28:35 +02:00
|
|
|
}
|
|
|
|
|
2012-11-27 09:15:08 +01:00
|
|
|
static ULONG WINAPI VideoWindow_Release(IVideoWindow *iface)
|
|
|
|
{
|
2012-03-31 03:09:14 +02:00
|
|
|
VideoRendererImpl *This = impl_from_IVideoWindow(iface);
|
2004-08-24 04:28:35 +02:00
|
|
|
|
|
|
|
TRACE("(%p/%p)->()\n", This, iface);
|
|
|
|
|
2012-07-02 01:06:01 +02:00
|
|
|
return IUnknown_Release(This->outer_unk);
|
2004-08-24 04:28:35 +02:00
|
|
|
}
|
|
|
|
|
2012-11-27 09:15:08 +01:00
|
|
|
static HRESULT WINAPI VideoWindow_get_FullScreenMode(IVideoWindow *iface,
|
|
|
|
LONG *FullScreenMode)
|
|
|
|
{
|
2012-03-31 03:09:14 +02:00
|
|
|
VideoRendererImpl *This = impl_from_IVideoWindow(iface);
|
2004-08-24 04:28:35 +02:00
|
|
|
|
2005-06-13 13:37:55 +02:00
|
|
|
FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, FullScreenMode);
|
2004-08-24 04:28:35 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2012-11-27 09:15:08 +01:00
|
|
|
static HRESULT WINAPI VideoWindow_put_FullScreenMode(IVideoWindow *iface,
|
|
|
|
LONG FullScreenMode)
|
|
|
|
{
|
2012-03-31 03:09:14 +02:00
|
|
|
VideoRendererImpl *This = impl_from_IVideoWindow(iface);
|
2004-08-24 04:28:35 +02:00
|
|
|
|
2009-03-11 00:31:26 +01:00
|
|
|
FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, FullScreenMode);
|
2004-08-24 04:28:35 +02:00
|
|
|
|
2010-11-25 00:11:53 +01:00
|
|
|
if (FullScreenMode) {
|
2012-04-26 18:29:09 +02:00
|
|
|
This->baseControlWindow.baseWindow.WindowStyles = GetWindowLongW(This->baseControlWindow.baseWindow.hWnd, GWL_STYLE);
|
2012-03-31 03:09:14 +02:00
|
|
|
ShowWindow(This->baseControlWindow.baseWindow.hWnd, SW_HIDE);
|
|
|
|
SetParent(This->baseControlWindow.baseWindow.hWnd, 0);
|
|
|
|
SetWindowLongW(This->baseControlWindow.baseWindow.hWnd, GWL_STYLE, WS_POPUP);
|
|
|
|
SetWindowPos(This->baseControlWindow.baseWindow.hWnd,HWND_TOP,0,0,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN),SWP_SHOWWINDOW);
|
|
|
|
GetWindowRect(This->baseControlWindow.baseWindow.hWnd, &This->DestRect);
|
2010-11-25 00:11:53 +01:00
|
|
|
This->WindowPos = This->DestRect;
|
|
|
|
} else {
|
2012-03-31 03:09:14 +02:00
|
|
|
ShowWindow(This->baseControlWindow.baseWindow.hWnd, SW_HIDE);
|
|
|
|
SetParent(This->baseControlWindow.baseWindow.hWnd, This->baseControlWindow.hwndOwner);
|
2012-04-26 18:29:09 +02:00
|
|
|
SetWindowLongW(This->baseControlWindow.baseWindow.hWnd, GWL_STYLE, This->baseControlWindow.baseWindow.WindowStyles);
|
2012-03-31 03:09:14 +02:00
|
|
|
GetClientRect(This->baseControlWindow.baseWindow.hWnd, &This->DestRect);
|
|
|
|
SetWindowPos(This->baseControlWindow.baseWindow.hWnd,0,This->DestRect.left,This->DestRect.top,This->DestRect.right,This->DestRect.bottom,SWP_NOZORDER|SWP_SHOWWINDOW);
|
2010-11-25 00:11:53 +01:00
|
|
|
This->WindowPos = This->DestRect;
|
|
|
|
}
|
|
|
|
|
2004-08-24 04:28:35 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2005-06-06 21:50:35 +02:00
|
|
|
static const IVideoWindowVtbl IVideoWindow_VTable =
|
2004-08-24 04:28:35 +02:00
|
|
|
{
|
2012-11-27 09:15:08 +01:00
|
|
|
VideoWindow_QueryInterface,
|
|
|
|
VideoWindow_AddRef,
|
|
|
|
VideoWindow_Release,
|
2012-03-31 03:09:14 +02:00
|
|
|
BaseControlWindowImpl_GetTypeInfoCount,
|
|
|
|
BaseControlWindowImpl_GetTypeInfo,
|
|
|
|
BaseControlWindowImpl_GetIDsOfNames,
|
|
|
|
BaseControlWindowImpl_Invoke,
|
|
|
|
BaseControlWindowImpl_put_Caption,
|
|
|
|
BaseControlWindowImpl_get_Caption,
|
|
|
|
BaseControlWindowImpl_put_WindowStyle,
|
|
|
|
BaseControlWindowImpl_get_WindowStyle,
|
|
|
|
BaseControlWindowImpl_put_WindowStyleEx,
|
|
|
|
BaseControlWindowImpl_get_WindowStyleEx,
|
|
|
|
BaseControlWindowImpl_put_AutoShow,
|
|
|
|
BaseControlWindowImpl_get_AutoShow,
|
|
|
|
BaseControlWindowImpl_put_WindowState,
|
|
|
|
BaseControlWindowImpl_get_WindowState,
|
|
|
|
BaseControlWindowImpl_put_BackgroundPalette,
|
|
|
|
BaseControlWindowImpl_get_BackgroundPalette,
|
|
|
|
BaseControlWindowImpl_put_Visible,
|
|
|
|
BaseControlWindowImpl_get_Visible,
|
|
|
|
BaseControlWindowImpl_put_Left,
|
|
|
|
BaseControlWindowImpl_get_Left,
|
|
|
|
BaseControlWindowImpl_put_Width,
|
|
|
|
BaseControlWindowImpl_get_Width,
|
|
|
|
BaseControlWindowImpl_put_Top,
|
|
|
|
BaseControlWindowImpl_get_Top,
|
|
|
|
BaseControlWindowImpl_put_Height,
|
|
|
|
BaseControlWindowImpl_get_Height,
|
|
|
|
BaseControlWindowImpl_put_Owner,
|
|
|
|
BaseControlWindowImpl_get_Owner,
|
|
|
|
BaseControlWindowImpl_put_MessageDrain,
|
|
|
|
BaseControlWindowImpl_get_MessageDrain,
|
|
|
|
BaseControlWindowImpl_get_BorderColor,
|
|
|
|
BaseControlWindowImpl_put_BorderColor,
|
2012-11-27 09:15:08 +01:00
|
|
|
VideoWindow_get_FullScreenMode,
|
|
|
|
VideoWindow_put_FullScreenMode,
|
2012-03-31 03:09:14 +02:00
|
|
|
BaseControlWindowImpl_SetWindowForeground,
|
|
|
|
BaseControlWindowImpl_NotifyOwnerMessage,
|
|
|
|
BaseControlWindowImpl_SetWindowPosition,
|
|
|
|
BaseControlWindowImpl_GetWindowPosition,
|
|
|
|
BaseControlWindowImpl_GetMinIdealImageSize,
|
|
|
|
BaseControlWindowImpl_GetMaxIdealImageSize,
|
|
|
|
BaseControlWindowImpl_GetRestorePosition,
|
|
|
|
BaseControlWindowImpl_HideCursor,
|
|
|
|
BaseControlWindowImpl_IsCursorHidden
|
2004-08-24 04:28:35 +02:00
|
|
|
};
|
2010-11-04 17:02:24 +01:00
|
|
|
|
2012-07-02 01:04:04 +02:00
|
|
|
static VideoRendererImpl *impl_from_IAMFilterMiscFlags(IAMFilterMiscFlags *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, VideoRendererImpl, IAMFilterMiscFlags_iface);
|
2010-11-04 17:02:24 +01:00
|
|
|
}
|
|
|
|
|
2012-07-02 01:04:04 +02:00
|
|
|
static HRESULT WINAPI AMFilterMiscFlags_QueryInterface(IAMFilterMiscFlags *iface, REFIID riid,
|
|
|
|
void **ppv)
|
|
|
|
{
|
|
|
|
VideoRendererImpl *This = impl_from_IAMFilterMiscFlags(iface);
|
2012-07-02 01:06:01 +02:00
|
|
|
return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
|
2010-11-04 17:02:24 +01:00
|
|
|
}
|
|
|
|
|
2012-07-02 01:04:04 +02:00
|
|
|
static ULONG WINAPI AMFilterMiscFlags_AddRef(IAMFilterMiscFlags *iface)
|
|
|
|
{
|
|
|
|
VideoRendererImpl *This = impl_from_IAMFilterMiscFlags(iface);
|
2012-07-02 01:06:01 +02:00
|
|
|
return IUnknown_AddRef(This->outer_unk);
|
2010-11-04 17:02:24 +01:00
|
|
|
}
|
|
|
|
|
2012-07-02 01:04:04 +02:00
|
|
|
static ULONG WINAPI AMFilterMiscFlags_Release(IAMFilterMiscFlags *iface)
|
|
|
|
{
|
|
|
|
VideoRendererImpl *This = impl_from_IAMFilterMiscFlags(iface);
|
2012-07-02 01:06:01 +02:00
|
|
|
return IUnknown_Release(This->outer_unk);
|
2010-11-04 17:02:24 +01:00
|
|
|
}
|
|
|
|
|
2012-07-02 01:04:04 +02:00
|
|
|
static ULONG WINAPI AMFilterMiscFlags_GetMiscFlags(IAMFilterMiscFlags *iface)
|
|
|
|
{
|
2010-11-04 17:02:24 +01:00
|
|
|
return AM_FILTER_MISC_FLAGS_IS_RENDERER;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl = {
|
|
|
|
AMFilterMiscFlags_QueryInterface,
|
|
|
|
AMFilterMiscFlags_AddRef,
|
|
|
|
AMFilterMiscFlags_Release,
|
|
|
|
AMFilterMiscFlags_GetMiscFlags
|
|
|
|
};
|
2012-07-02 01:07:46 +02:00
|
|
|
|
|
|
|
HRESULT VideoRenderer_create(IUnknown *pUnkOuter, void **ppv)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
VideoRendererImpl * pVideoRenderer;
|
|
|
|
|
|
|
|
TRACE("(%p, %p)\n", pUnkOuter, ppv);
|
|
|
|
|
|
|
|
*ppv = NULL;
|
|
|
|
|
|
|
|
pVideoRenderer = CoTaskMemAlloc(sizeof(VideoRendererImpl));
|
|
|
|
pVideoRenderer->IUnknown_inner.lpVtbl = &IInner_VTable;
|
|
|
|
pVideoRenderer->IAMFilterMiscFlags_iface.lpVtbl = &IAMFilterMiscFlags_Vtbl;
|
|
|
|
|
2013-10-25 00:19:07 +02:00
|
|
|
pVideoRenderer->init = FALSE;
|
2012-07-02 01:07:46 +02:00
|
|
|
ZeroMemory(&pVideoRenderer->SourceRect, sizeof(RECT));
|
|
|
|
ZeroMemory(&pVideoRenderer->DestRect, sizeof(RECT));
|
|
|
|
ZeroMemory(&pVideoRenderer->WindowPos, sizeof(RECT));
|
|
|
|
|
|
|
|
if (pUnkOuter)
|
|
|
|
pVideoRenderer->outer_unk = pUnkOuter;
|
|
|
|
else
|
|
|
|
pVideoRenderer->outer_unk = &pVideoRenderer->IUnknown_inner;
|
|
|
|
|
|
|
|
hr = BaseRenderer_Init(&pVideoRenderer->renderer, &VideoRenderer_Vtbl, pUnkOuter,
|
|
|
|
&CLSID_VideoRenderer, (DWORD_PTR)(__FILE__ ": VideoRendererImpl.csFilter"),
|
|
|
|
&BaseFuncTable);
|
|
|
|
|
|
|
|
if (FAILED(hr))
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
hr = BaseControlWindow_Init(&pVideoRenderer->baseControlWindow, &IVideoWindow_VTable,
|
|
|
|
&pVideoRenderer->renderer.filter, &pVideoRenderer->renderer.filter.csFilter,
|
|
|
|
&pVideoRenderer->renderer.pInputPin->pin, &renderer_BaseWindowFuncTable);
|
|
|
|
if (FAILED(hr))
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
hr = BaseControlVideo_Init(&pVideoRenderer->baseControlVideo, &IBasicVideo_VTable,
|
|
|
|
&pVideoRenderer->renderer.filter, &pVideoRenderer->renderer.filter.csFilter,
|
|
|
|
&pVideoRenderer->renderer.pInputPin->pin, &renderer_BaseControlVideoFuncTable);
|
|
|
|
if (FAILED(hr))
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
if (!CreateRenderingSubsystem(pVideoRenderer)) {
|
|
|
|
hr = E_FAIL;
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
*ppv = &pVideoRenderer->IUnknown_inner;
|
|
|
|
return S_OK;
|
|
|
|
|
|
|
|
fail:
|
|
|
|
BaseRendererImpl_Release(&pVideoRenderer->renderer.filter.IBaseFilter_iface);
|
|
|
|
CoTaskMemFree(pVideoRenderer);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT VideoRendererDefault_create(IUnknown * pUnkOuter, LPVOID * ppv)
|
|
|
|
{
|
|
|
|
/* TODO: Attempt to use the VMR-7 renderer instead when possible */
|
|
|
|
return VideoRenderer_create(pUnkOuter, ppv);
|
|
|
|
}
|