2008-03-12 18:12:18 +01:00
|
|
|
/*
|
|
|
|
* Null Renderer (Promiscuous, not rendering anything at all!)
|
|
|
|
*
|
|
|
|
* Copyright 2004 Christian Costa
|
|
|
|
* Copyright 2008 Maarten Lankhorst
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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"
|
|
|
|
#include "evcode.h"
|
|
|
|
#include "strmif.h"
|
|
|
|
#include "ddraw.h"
|
|
|
|
|
|
|
|
#include "wine/unicode.h"
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
|
|
|
|
|
|
|
|
static const IBaseFilterVtbl NullRenderer_Vtbl;
|
|
|
|
static const IUnknownVtbl IInner_VTable;
|
2010-11-04 17:02:26 +01:00
|
|
|
static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl;
|
2008-03-12 18:12:18 +01:00
|
|
|
|
|
|
|
typedef struct NullRendererImpl
|
|
|
|
{
|
2012-03-30 02:21:54 +02:00
|
|
|
BaseRenderer renderer;
|
|
|
|
|
2008-03-12 18:12:18 +01:00
|
|
|
const IUnknownVtbl * IInner_vtbl;
|
2010-11-04 17:02:26 +01:00
|
|
|
const IAMFilterMiscFlagsVtbl *IAMFilterMiscFlags_vtbl;
|
2008-03-12 18:12:18 +01:00
|
|
|
|
|
|
|
IUnknown * pUnkOuter;
|
|
|
|
BOOL bUnkOuterValid;
|
|
|
|
BOOL bAggregatable;
|
|
|
|
} NullRendererImpl;
|
|
|
|
|
2012-03-30 02:21:54 +02:00
|
|
|
static HRESULT WINAPI NullRenderer_DoRenderSample(BaseRenderer *iface, IMediaSample *pMediaSample)
|
2008-03-12 18:12:18 +01:00
|
|
|
{
|
2012-03-30 02:21:54 +02:00
|
|
|
return S_OK;
|
2008-03-12 18:12:18 +01:00
|
|
|
}
|
|
|
|
|
2012-03-30 02:21:54 +02:00
|
|
|
static HRESULT WINAPI NullRenderer_CheckMediaType(BaseRenderer *iface, const AM_MEDIA_TYPE * pmt)
|
2008-03-12 18:12:18 +01:00
|
|
|
{
|
|
|
|
TRACE("Not a stub!\n");
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2012-03-30 02:21:54 +02:00
|
|
|
static const BaseRendererFuncTable RendererFuncTable = {
|
2010-10-13 18:02:01 +02:00
|
|
|
NullRenderer_CheckMediaType,
|
2012-03-30 02:21:54 +02:00
|
|
|
NullRenderer_DoRenderSample,
|
2012-03-31 03:08:07 +02:00
|
|
|
/**/
|
2012-03-30 02:21:54 +02:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2012-03-31 03:08:07 +02:00
|
|
|
/**/
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2012-03-30 02:21:54 +02:00
|
|
|
NULL,
|
2010-10-13 18:02:08 +02:00
|
|
|
NULL,
|
2010-10-13 18:02:01 +02:00
|
|
|
};
|
|
|
|
|
2008-03-12 18:12:18 +01:00
|
|
|
HRESULT NullRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
NullRendererImpl * pNullRenderer;
|
|
|
|
|
|
|
|
TRACE("(%p, %p)\n", pUnkOuter, ppv);
|
|
|
|
|
|
|
|
*ppv = NULL;
|
|
|
|
|
|
|
|
pNullRenderer = CoTaskMemAlloc(sizeof(NullRendererImpl));
|
|
|
|
pNullRenderer->pUnkOuter = pUnkOuter;
|
|
|
|
pNullRenderer->bUnkOuterValid = FALSE;
|
|
|
|
pNullRenderer->bAggregatable = FALSE;
|
|
|
|
pNullRenderer->IInner_vtbl = &IInner_VTable;
|
2010-11-04 17:02:26 +01:00
|
|
|
pNullRenderer->IAMFilterMiscFlags_vtbl = &IAMFilterMiscFlags_Vtbl;
|
2008-03-12 18:12:18 +01:00
|
|
|
|
2012-03-30 02:21:54 +02:00
|
|
|
hr = BaseRenderer_Init(&pNullRenderer->renderer, &NullRenderer_Vtbl, pUnkOuter, &CLSID_NullRenderer, (DWORD_PTR)(__FILE__ ": NullRendererImpl.csFilter"), &RendererFuncTable);
|
2008-03-12 18:12:18 +01:00
|
|
|
|
2012-03-30 02:21:54 +02:00
|
|
|
if (FAILED(hr))
|
2008-03-12 18:12:18 +01:00
|
|
|
{
|
2012-03-30 02:21:54 +02:00
|
|
|
BaseRendererImpl_Release(&pNullRenderer->renderer.filter.IBaseFilter_iface);
|
2008-03-12 18:12:18 +01:00
|
|
|
CoTaskMemFree(pNullRenderer);
|
|
|
|
}
|
2012-03-30 02:21:54 +02:00
|
|
|
else
|
|
|
|
*ppv = pNullRenderer;
|
2008-03-12 18:12:18 +01:00
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI NullRendererInner_QueryInterface(IUnknown * iface, REFIID riid, LPVOID * ppv)
|
|
|
|
{
|
|
|
|
ICOM_THIS_MULTI(NullRendererImpl, IInner_vtbl, iface);
|
|
|
|
TRACE("(%p/%p)->(%s, %p)\n", This, iface, qzdebugstr_guid(riid), ppv);
|
|
|
|
|
|
|
|
if (This->bAggregatable)
|
|
|
|
This->bUnkOuterValid = TRUE;
|
|
|
|
|
|
|
|
*ppv = NULL;
|
|
|
|
|
|
|
|
if (IsEqualIID(riid, &IID_IUnknown))
|
2009-01-29 11:14:55 +01:00
|
|
|
*ppv = &This->IInner_vtbl;
|
2010-11-04 17:02:26 +01:00
|
|
|
else if (IsEqualIID(riid, &IID_IAMFilterMiscFlags))
|
|
|
|
*ppv = &This->IAMFilterMiscFlags_vtbl;
|
2012-03-30 02:21:54 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
hr = BaseRendererImpl_QueryInterface(&This->renderer.filter.IBaseFilter_iface, riid, ppv);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
return hr;
|
|
|
|
}
|
2008-03-12 18:12:18 +01:00
|
|
|
|
|
|
|
if (*ppv)
|
|
|
|
{
|
|
|
|
IUnknown_AddRef((IUnknown *)(*ppv));
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2008-04-11 00:38:56 +02:00
|
|
|
if (!IsEqualIID(riid, &IID_IPin) && !IsEqualIID(riid, &IID_IVideoWindow))
|
2008-03-21 23:36:51 +01:00
|
|
|
FIXME("No interface for %s!\n", qzdebugstr_guid(riid));
|
2008-03-12 18:12:18 +01:00
|
|
|
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI NullRendererInner_AddRef(IUnknown * iface)
|
|
|
|
{
|
|
|
|
ICOM_THIS_MULTI(NullRendererImpl, IInner_vtbl, iface);
|
2012-03-30 02:21:54 +02:00
|
|
|
return BaseFilterImpl_AddRef(&This->renderer.filter.IBaseFilter_iface);
|
2008-03-12 18:12:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI NullRendererInner_Release(IUnknown * iface)
|
|
|
|
{
|
|
|
|
ICOM_THIS_MULTI(NullRendererImpl, IInner_vtbl, iface);
|
2012-03-30 02:21:54 +02:00
|
|
|
ULONG refCount = BaseRendererImpl_Release(&This->renderer.filter.IBaseFilter_iface);
|
2008-03-12 18:12:18 +01:00
|
|
|
|
|
|
|
if (!refCount)
|
|
|
|
{
|
|
|
|
TRACE("Destroying Null Renderer\n");
|
|
|
|
CoTaskMemFree(This);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return refCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IUnknownVtbl IInner_VTable =
|
|
|
|
{
|
|
|
|
NullRendererInner_QueryInterface,
|
|
|
|
NullRendererInner_AddRef,
|
|
|
|
NullRendererInner_Release
|
|
|
|
};
|
|
|
|
|
|
|
|
static HRESULT WINAPI NullRenderer_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv)
|
|
|
|
{
|
|
|
|
NullRendererImpl *This = (NullRendererImpl *)iface;
|
|
|
|
|
|
|
|
if (This->bAggregatable)
|
|
|
|
This->bUnkOuterValid = TRUE;
|
|
|
|
|
|
|
|
if (This->pUnkOuter)
|
|
|
|
{
|
|
|
|
if (This->bAggregatable)
|
|
|
|
return IUnknown_QueryInterface(This->pUnkOuter, riid, ppv);
|
|
|
|
|
|
|
|
if (IsEqualIID(riid, &IID_IUnknown))
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
|
|
|
|
hr = IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
|
|
|
|
IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
|
|
|
|
This->bAggregatable = TRUE;
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
*ppv = NULL;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI NullRenderer_AddRef(IBaseFilter * iface)
|
|
|
|
{
|
|
|
|
NullRendererImpl *This = (NullRendererImpl *)iface;
|
|
|
|
|
|
|
|
if (This->pUnkOuter && This->bUnkOuterValid)
|
|
|
|
return IUnknown_AddRef(This->pUnkOuter);
|
|
|
|
return IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI NullRenderer_Release(IBaseFilter * iface)
|
|
|
|
{
|
|
|
|
NullRendererImpl *This = (NullRendererImpl *)iface;
|
|
|
|
|
|
|
|
if (This->pUnkOuter && This->bUnkOuterValid)
|
|
|
|
return IUnknown_Release(This->pUnkOuter);
|
|
|
|
return IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IBaseFilterVtbl NullRenderer_Vtbl =
|
|
|
|
{
|
|
|
|
NullRenderer_QueryInterface,
|
|
|
|
NullRenderer_AddRef,
|
|
|
|
NullRenderer_Release,
|
2010-10-07 21:47:33 +02:00
|
|
|
BaseFilterImpl_GetClassID,
|
2012-03-30 02:21:54 +02:00
|
|
|
BaseRendererImpl_Stop,
|
|
|
|
BaseRendererImpl_Pause,
|
|
|
|
BaseRendererImpl_Run,
|
2012-03-31 03:08:07 +02:00
|
|
|
BaseRendererImpl_GetState,
|
2012-04-02 14:52:08 +02:00
|
|
|
BaseRendererImpl_SetSyncSource,
|
2010-10-07 21:47:33 +02:00
|
|
|
BaseFilterImpl_GetSyncSource,
|
2010-10-07 21:48:01 +02:00
|
|
|
BaseFilterImpl_EnumPins,
|
2012-03-30 02:21:54 +02:00
|
|
|
BaseRendererImpl_FindPin,
|
2010-10-07 21:47:33 +02:00
|
|
|
BaseFilterImpl_QueryFilterInfo,
|
|
|
|
BaseFilterImpl_JoinFilterGraph,
|
|
|
|
BaseFilterImpl_QueryVendorInfo
|
2008-03-12 18:12:18 +01:00
|
|
|
};
|
|
|
|
|
2010-11-04 17:02:26 +01:00
|
|
|
static NullRendererImpl *from_IAMFilterMiscFlags(IAMFilterMiscFlags *iface) {
|
|
|
|
return (NullRendererImpl*)((char*)iface - offsetof(NullRendererImpl, IAMFilterMiscFlags_vtbl));
|
|
|
|
}
|
|
|
|
|
2011-03-14 05:32:52 +01:00
|
|
|
static HRESULT WINAPI AMFilterMiscFlags_QueryInterface(IAMFilterMiscFlags *iface, REFIID riid, void **ppv) {
|
2010-11-04 17:02:26 +01:00
|
|
|
NullRendererImpl *This = from_IAMFilterMiscFlags(iface);
|
|
|
|
return IUnknown_QueryInterface((IUnknown*)This, riid, ppv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI AMFilterMiscFlags_AddRef(IAMFilterMiscFlags *iface) {
|
|
|
|
NullRendererImpl *This = from_IAMFilterMiscFlags(iface);
|
|
|
|
return IUnknown_AddRef((IUnknown*)This);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI AMFilterMiscFlags_Release(IAMFilterMiscFlags *iface) {
|
|
|
|
NullRendererImpl *This = from_IAMFilterMiscFlags(iface);
|
|
|
|
return IUnknown_Release((IUnknown*)This);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI AMFilterMiscFlags_GetMiscFlags(IAMFilterMiscFlags *iface) {
|
|
|
|
return AM_FILTER_MISC_FLAGS_IS_RENDERER;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl = {
|
|
|
|
AMFilterMiscFlags_QueryInterface,
|
|
|
|
AMFilterMiscFlags_AddRef,
|
|
|
|
AMFilterMiscFlags_Release,
|
|
|
|
AMFilterMiscFlags_GetMiscFlags
|
|
|
|
};
|