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"
|
|
|
|
|
|
|
|
#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);
|
|
|
|
|
|
|
|
typedef struct NullRendererImpl
|
|
|
|
{
|
2012-03-30 02:21:54 +02:00
|
|
|
BaseRenderer renderer;
|
2012-07-02 01:01:26 +02:00
|
|
|
IUnknown IUnknown_inner;
|
2012-07-02 01:00:40 +02:00
|
|
|
IAMFilterMiscFlags IAMFilterMiscFlags_iface;
|
2012-07-02 01:01:26 +02:00
|
|
|
IUnknown *outer_unk;
|
2008-03-12 18:12:18 +01:00
|
|
|
} 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
|
|
|
};
|
|
|
|
|
2012-07-02 01:01:26 +02:00
|
|
|
static inline NullRendererImpl *impl_from_IUnknown(IUnknown *iface)
|
2008-03-12 18:12:18 +01:00
|
|
|
{
|
2012-07-02 01:01:26 +02:00
|
|
|
return CONTAINING_RECORD(iface, NullRendererImpl, IUnknown_inner);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI NullRendererInner_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
NullRendererImpl *This = impl_from_IUnknown(iface);
|
2008-03-12 18:12:18 +01:00
|
|
|
|
2012-07-02 01:01:26 +02:00
|
|
|
TRACE("(%p/%p)->(%s, %p)\n", This, iface, qzdebugstr_guid(riid), ppv);
|
2008-03-12 18:12:18 +01:00
|
|
|
|
|
|
|
*ppv = NULL;
|
|
|
|
|
|
|
|
if (IsEqualIID(riid, &IID_IUnknown))
|
2012-07-02 01:01:26 +02:00
|
|
|
*ppv = &This->IUnknown_inner;
|
2010-11-04 17:02:26 +01:00
|
|
|
else if (IsEqualIID(riid, &IID_IAMFilterMiscFlags))
|
2012-07-02 01:00:40 +02:00
|
|
|
*ppv = &This->IAMFilterMiscFlags_iface;
|
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)
|
|
|
|
{
|
2012-07-02 01:01:26 +02:00
|
|
|
IUnknown_AddRef((IUnknown *)*ppv);
|
2008-03-12 18:12:18 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2012-07-02 01:01:26 +02:00
|
|
|
static ULONG WINAPI NullRendererInner_AddRef(IUnknown *iface)
|
2008-03-12 18:12:18 +01:00
|
|
|
{
|
2012-07-02 01:01:26 +02:00
|
|
|
NullRendererImpl *This = impl_from_IUnknown(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
|
|
|
}
|
|
|
|
|
2012-07-02 01:01:26 +02:00
|
|
|
static ULONG WINAPI NullRendererInner_Release(IUnknown *iface)
|
2008-03-12 18:12:18 +01:00
|
|
|
{
|
2012-07-02 01:01:26 +02:00
|
|
|
NullRendererImpl *This = impl_from_IUnknown(iface);
|
2014-07-28 12:10:01 +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);
|
|
|
|
}
|
2012-07-02 01:01:26 +02:00
|
|
|
|
|
|
|
return refCount;
|
2008-03-12 18:12:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static const IUnknownVtbl IInner_VTable =
|
|
|
|
{
|
|
|
|
NullRendererInner_QueryInterface,
|
|
|
|
NullRendererInner_AddRef,
|
|
|
|
NullRendererInner_Release
|
|
|
|
};
|
|
|
|
|
2012-07-02 01:02:24 +02:00
|
|
|
static inline NullRendererImpl *impl_from_IBaseFilter(IBaseFilter *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, NullRendererImpl, renderer.filter.IBaseFilter_iface);
|
|
|
|
}
|
|
|
|
|
2008-03-12 18:12:18 +01:00
|
|
|
static HRESULT WINAPI NullRenderer_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv)
|
|
|
|
{
|
2012-07-02 01:02:24 +02:00
|
|
|
NullRendererImpl *This = impl_from_IBaseFilter(iface);
|
2012-07-02 01:01:26 +02:00
|
|
|
return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
|
2008-03-12 18:12:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI NullRenderer_AddRef(IBaseFilter * iface)
|
|
|
|
{
|
2012-07-02 01:02:24 +02:00
|
|
|
NullRendererImpl *This = impl_from_IBaseFilter(iface);
|
2012-07-02 01:01:26 +02:00
|
|
|
return IUnknown_AddRef(This->outer_unk);
|
2008-03-12 18:12:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI NullRenderer_Release(IBaseFilter * iface)
|
|
|
|
{
|
2012-07-02 01:02:24 +02:00
|
|
|
NullRendererImpl *This = impl_from_IBaseFilter(iface);
|
2012-07-02 01:01:26 +02:00
|
|
|
return IUnknown_Release(This->outer_unk);
|
2008-03-12 18:12:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
};
|
|
|
|
|
2012-07-02 01:00:40 +02:00
|
|
|
static NullRendererImpl *impl_from_IAMFilterMiscFlags(IAMFilterMiscFlags *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, NullRendererImpl, IAMFilterMiscFlags_iface);
|
2010-11-04 17:02:26 +01:00
|
|
|
}
|
|
|
|
|
2012-07-02 01:00:40 +02:00
|
|
|
static HRESULT WINAPI AMFilterMiscFlags_QueryInterface(IAMFilterMiscFlags *iface, REFIID riid,
|
|
|
|
void **ppv)
|
|
|
|
{
|
|
|
|
NullRendererImpl *This = impl_from_IAMFilterMiscFlags(iface);
|
2012-07-02 01:01:26 +02:00
|
|
|
return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
|
2010-11-04 17:02:26 +01:00
|
|
|
}
|
|
|
|
|
2012-07-02 01:00:40 +02:00
|
|
|
static ULONG WINAPI AMFilterMiscFlags_AddRef(IAMFilterMiscFlags *iface)
|
|
|
|
{
|
|
|
|
NullRendererImpl *This = impl_from_IAMFilterMiscFlags(iface);
|
2012-07-02 01:01:26 +02:00
|
|
|
return IUnknown_AddRef(This->outer_unk);
|
2010-11-04 17:02:26 +01:00
|
|
|
}
|
|
|
|
|
2012-07-02 01:00:40 +02:00
|
|
|
static ULONG WINAPI AMFilterMiscFlags_Release(IAMFilterMiscFlags *iface)
|
|
|
|
{
|
|
|
|
NullRendererImpl *This = impl_from_IAMFilterMiscFlags(iface);
|
2012-07-02 01:01:26 +02:00
|
|
|
return IUnknown_Release(This->outer_unk);
|
2010-11-04 17:02:26 +01:00
|
|
|
}
|
|
|
|
|
2012-07-02 01:00:40 +02:00
|
|
|
static ULONG WINAPI AMFilterMiscFlags_GetMiscFlags(IAMFilterMiscFlags *iface)
|
|
|
|
{
|
2010-11-04 17:02:26 +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:03:21 +02:00
|
|
|
|
|
|
|
HRESULT NullRenderer_create(IUnknown *pUnkOuter, void **ppv)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
NullRendererImpl *pNullRenderer;
|
|
|
|
|
|
|
|
TRACE("(%p, %p)\n", pUnkOuter, ppv);
|
|
|
|
|
|
|
|
*ppv = NULL;
|
|
|
|
|
|
|
|
pNullRenderer = CoTaskMemAlloc(sizeof(NullRendererImpl));
|
|
|
|
pNullRenderer->IUnknown_inner.lpVtbl = &IInner_VTable;
|
|
|
|
pNullRenderer->IAMFilterMiscFlags_iface.lpVtbl = &IAMFilterMiscFlags_Vtbl;
|
|
|
|
|
|
|
|
if (pUnkOuter)
|
|
|
|
pNullRenderer->outer_unk = pUnkOuter;
|
|
|
|
else
|
|
|
|
pNullRenderer->outer_unk = &pNullRenderer->IUnknown_inner;
|
|
|
|
|
|
|
|
hr = BaseRenderer_Init(&pNullRenderer->renderer, &NullRenderer_Vtbl, pUnkOuter,
|
|
|
|
&CLSID_NullRenderer, (DWORD_PTR)(__FILE__ ": NullRendererImpl.csFilter"),
|
|
|
|
&RendererFuncTable);
|
|
|
|
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
BaseRendererImpl_Release(&pNullRenderer->renderer.filter.IBaseFilter_iface);
|
|
|
|
CoTaskMemFree(pNullRenderer);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
*ppv = &pNullRenderer->IUnknown_inner;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|