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 "control_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 WCHAR wcsInputPinName[] = {'i','n','p','u','t',' ','p','i','n',0};
|
2009-12-23 17:17:38 +01:00
|
|
|
static const WCHAR wcsAltInputPinName[] = {'I','n',0};
|
2008-03-12 18:12:18 +01:00
|
|
|
|
|
|
|
static const IBaseFilterVtbl NullRenderer_Vtbl;
|
|
|
|
static const IUnknownVtbl IInner_VTable;
|
|
|
|
static const IPinVtbl NullRenderer_InputPin_Vtbl;
|
2010-11-04 17:02:26 +01:00
|
|
|
static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl;
|
2008-03-12 18:12:18 +01:00
|
|
|
|
|
|
|
typedef struct NullRendererImpl
|
|
|
|
{
|
2010-10-07 21:47:33 +02:00
|
|
|
BaseFilter filter;
|
2008-03-12 18:12:18 +01:00
|
|
|
const IUnknownVtbl * IInner_vtbl;
|
2010-11-04 17:02:26 +01:00
|
|
|
const IAMFilterMiscFlagsVtbl *IAMFilterMiscFlags_vtbl;
|
2010-05-22 16:06:00 +02:00
|
|
|
IUnknown *seekthru_unk;
|
2008-03-12 18:12:18 +01:00
|
|
|
|
2010-10-05 21:38:11 +02:00
|
|
|
BaseInputPin *pInputPin;
|
2008-03-12 18:12:18 +01:00
|
|
|
IUnknown * pUnkOuter;
|
|
|
|
BOOL bUnkOuterValid;
|
|
|
|
BOOL bAggregatable;
|
|
|
|
} NullRendererImpl;
|
|
|
|
|
2010-10-13 18:02:01 +02:00
|
|
|
static HRESULT WINAPI NullRenderer_Receive(BaseInputPin *pin, IMediaSample * pSample)
|
2008-03-12 18:12:18 +01:00
|
|
|
{
|
2010-10-05 21:38:11 +02:00
|
|
|
NullRendererImpl *This = ((NullRendererImpl*)pin->pin.pinInfo.pFilter);
|
2008-07-05 01:59:22 +02:00
|
|
|
HRESULT hr = S_OK;
|
2010-05-22 16:06:00 +02:00
|
|
|
REFERENCE_TIME start, stop;
|
2008-03-12 18:12:18 +01:00
|
|
|
|
2010-10-13 18:02:01 +02:00
|
|
|
TRACE("%p %p\n", pin, pSample);
|
2008-03-12 18:12:18 +01:00
|
|
|
|
2010-11-07 15:02:53 +01:00
|
|
|
if (SUCCEEDED(IMediaSample_GetMediaTime(pSample, &start, &stop)))
|
2010-05-22 16:06:00 +02:00
|
|
|
MediaSeekingPassThru_RegisterMediaTime(This->seekthru_unk, start);
|
2010-10-07 21:47:33 +02:00
|
|
|
EnterCriticalSection(&This->filter.csFilter);
|
2008-07-05 01:59:22 +02:00
|
|
|
if (This->pInputPin->flushing || This->pInputPin->end_of_stream)
|
|
|
|
hr = S_FALSE;
|
2010-10-07 21:47:33 +02:00
|
|
|
LeaveCriticalSection(&This->filter.csFilter);
|
2008-03-12 18:12:18 +01:00
|
|
|
|
2008-07-05 01:59:22 +02:00
|
|
|
return hr;
|
2008-03-12 18:12:18 +01:00
|
|
|
}
|
|
|
|
|
2010-10-13 18:02:01 +02:00
|
|
|
static HRESULT WINAPI NullRenderer_CheckMediaType(BasePin *iface, const AM_MEDIA_TYPE * pmt)
|
2008-03-12 18:12:18 +01:00
|
|
|
{
|
|
|
|
TRACE("Not a stub!\n");
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2010-10-13 18:02:01 +02:00
|
|
|
static IPin* WINAPI NullRenderer_GetPin(BaseFilter *iface, int pos)
|
2010-10-07 21:48:01 +02:00
|
|
|
{
|
|
|
|
NullRendererImpl *This = (NullRendererImpl *)iface;
|
|
|
|
|
|
|
|
if (pos >= 1 || pos < 0)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
IPin_AddRef((IPin *)This->pInputPin);
|
|
|
|
return (IPin *)This->pInputPin;
|
|
|
|
}
|
|
|
|
|
2010-10-13 18:02:01 +02:00
|
|
|
static LONG WINAPI NullRenderer_GetPinCount(BaseFilter *iface)
|
2010-10-07 21:48:01 +02:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-10-13 18:02:01 +02:00
|
|
|
static const BaseFilterFuncTable BaseFuncTable = {
|
|
|
|
NullRenderer_GetPin,
|
|
|
|
NullRenderer_GetPinCount
|
|
|
|
};
|
|
|
|
|
|
|
|
static const BasePinFuncTable input_BaseFuncTable = {
|
|
|
|
NullRenderer_CheckMediaType,
|
2010-10-13 18:02:08 +02:00
|
|
|
NULL,
|
|
|
|
BasePinImpl_GetMediaTypeVersion,
|
|
|
|
BasePinImpl_GetMediaType
|
2010-10-13 18:02:01 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static const BaseInputPinFuncTable input_BaseInputFuncTable = {
|
|
|
|
NullRenderer_Receive
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-12 18:12:18 +01:00
|
|
|
HRESULT NullRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
PIN_INFO piInput;
|
|
|
|
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
|
|
|
|
2010-10-13 18:02:01 +02:00
|
|
|
BaseFilter_Init(&pNullRenderer->filter, &NullRenderer_Vtbl, &CLSID_NullRenderer, (DWORD_PTR)(__FILE__ ": NullRendererImpl.csFilter"), &BaseFuncTable);
|
2008-03-12 18:12:18 +01:00
|
|
|
|
|
|
|
/* construct input pin */
|
|
|
|
piInput.dir = PINDIR_INPUT;
|
|
|
|
piInput.pFilter = (IBaseFilter *)pNullRenderer;
|
|
|
|
lstrcpynW(piInput.achName, wcsInputPinName, sizeof(piInput.achName) / sizeof(piInput.achName[0]));
|
|
|
|
|
2010-10-13 18:02:01 +02:00
|
|
|
hr = BaseInputPin_Construct(&NullRenderer_InputPin_Vtbl, &piInput, &input_BaseFuncTable, &input_BaseInputFuncTable, &pNullRenderer->filter.csFilter, NULL, (IPin **)&pNullRenderer->pInputPin);
|
2008-03-12 18:12:18 +01:00
|
|
|
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
2010-05-22 16:06:00 +02:00
|
|
|
ISeekingPassThru *passthru;
|
|
|
|
hr = CoCreateInstance(&CLSID_SeekingPassThru, pUnkOuter ? pUnkOuter : (IUnknown*)&pNullRenderer->IInner_vtbl, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&pNullRenderer->seekthru_unk);
|
|
|
|
if (FAILED(hr)) {
|
|
|
|
IUnknown_Release((IUnknown*)pNullRenderer);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
IUnknown_QueryInterface(pNullRenderer->seekthru_unk, &IID_ISeekingPassThru, (void**)&passthru);
|
|
|
|
ISeekingPassThru_Init(passthru, TRUE, (IPin*)pNullRenderer->pInputPin);
|
|
|
|
ISeekingPassThru_Release(passthru);
|
2009-01-29 11:14:55 +01:00
|
|
|
*ppv = pNullRenderer;
|
2008-03-12 18:12:18 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-10-07 21:47:33 +02:00
|
|
|
BaseFilterImpl_Release((IBaseFilter*)pNullRenderer);
|
2008-03-12 18:12:18 +01:00
|
|
|
CoTaskMemFree(pNullRenderer);
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
2008-03-12 18:12:18 +01:00
|
|
|
else if (IsEqualIID(riid, &IID_IPersist))
|
2009-01-29 11:14:55 +01:00
|
|
|
*ppv = This;
|
2008-03-12 18:12:18 +01:00
|
|
|
else if (IsEqualIID(riid, &IID_IMediaFilter))
|
2009-01-29 11:14:55 +01:00
|
|
|
*ppv = This;
|
2008-03-12 18:12:18 +01:00
|
|
|
else if (IsEqualIID(riid, &IID_IBaseFilter))
|
2009-01-29 11:14:55 +01:00
|
|
|
*ppv = This;
|
2008-04-02 20:57:58 +02:00
|
|
|
else if (IsEqualIID(riid, &IID_IMediaSeeking))
|
2010-05-22 16:06:00 +02:00
|
|
|
return IUnknown_QueryInterface(This->seekthru_unk, riid, ppv);
|
2010-11-04 17:02:26 +01:00
|
|
|
else if (IsEqualIID(riid, &IID_IAMFilterMiscFlags))
|
|
|
|
*ppv = &This->IAMFilterMiscFlags_vtbl;
|
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);
|
2010-10-07 21:47:33 +02:00
|
|
|
ULONG refCount = InterlockedIncrement(&This->filter.refCount);
|
2008-03-12 18:12:18 +01:00
|
|
|
|
|
|
|
TRACE("(%p/%p)->() AddRef from %d\n", This, iface, refCount - 1);
|
|
|
|
|
|
|
|
return refCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI NullRendererInner_Release(IUnknown * iface)
|
|
|
|
{
|
|
|
|
ICOM_THIS_MULTI(NullRendererImpl, IInner_vtbl, iface);
|
2010-10-07 21:47:33 +02:00
|
|
|
ULONG refCount = InterlockedDecrement(&This->filter.refCount);
|
2008-03-12 18:12:18 +01:00
|
|
|
|
|
|
|
TRACE("(%p/%p)->() Release from %d\n", This, iface, refCount + 1);
|
|
|
|
|
|
|
|
if (!refCount)
|
|
|
|
{
|
|
|
|
IPin *pConnectedTo;
|
|
|
|
|
2008-04-25 23:25:49 +02:00
|
|
|
if (SUCCEEDED(IPin_ConnectedTo((IPin *)This->pInputPin, &pConnectedTo)))
|
2008-03-12 18:12:18 +01:00
|
|
|
{
|
|
|
|
IPin_Disconnect(pConnectedTo);
|
|
|
|
IPin_Release(pConnectedTo);
|
|
|
|
}
|
2008-04-25 23:25:49 +02:00
|
|
|
IPin_Disconnect((IPin *)This->pInputPin);
|
|
|
|
IPin_Release((IPin *)This->pInputPin);
|
2008-03-12 18:12:18 +01:00
|
|
|
|
2010-10-07 21:47:33 +02:00
|
|
|
This->filter.lpVtbl = NULL;
|
2010-05-22 16:06:00 +02:00
|
|
|
if (This->seekthru_unk)
|
|
|
|
IUnknown_Release(This->seekthru_unk);
|
2008-03-12 18:12:18 +01:00
|
|
|
|
2010-10-07 21:47:33 +02:00
|
|
|
This->filter.csFilter.DebugInfo->Spare[0] = 0;
|
|
|
|
DeleteCriticalSection(&This->filter.csFilter);
|
2008-03-12 18:12:18 +01:00
|
|
|
|
|
|
|
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));
|
|
|
|
}
|
|
|
|
|
|
|
|
/** IMediaFilter methods **/
|
|
|
|
|
|
|
|
static HRESULT WINAPI NullRenderer_Stop(IBaseFilter * iface)
|
|
|
|
{
|
|
|
|
NullRendererImpl *This = (NullRendererImpl *)iface;
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->()\n", This, iface);
|
|
|
|
|
2010-10-07 21:47:33 +02:00
|
|
|
EnterCriticalSection(&This->filter.csFilter);
|
2008-03-12 18:12:18 +01:00
|
|
|
{
|
2010-10-07 21:47:33 +02:00
|
|
|
This->filter.state = State_Stopped;
|
2010-05-22 16:06:00 +02:00
|
|
|
MediaSeekingPassThru_ResetMediaTime(This->seekthru_unk);
|
2008-03-12 18:12:18 +01:00
|
|
|
}
|
2010-10-07 21:47:33 +02:00
|
|
|
LeaveCriticalSection(&This->filter.csFilter);
|
2008-03-12 18:12:18 +01:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI NullRenderer_Pause(IBaseFilter * iface)
|
|
|
|
{
|
|
|
|
NullRendererImpl *This = (NullRendererImpl *)iface;
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->()\n", This, iface);
|
|
|
|
|
2010-10-07 21:47:33 +02:00
|
|
|
EnterCriticalSection(&This->filter.csFilter);
|
2008-03-12 18:12:18 +01:00
|
|
|
{
|
2010-10-07 21:47:33 +02:00
|
|
|
if (This->filter.state == State_Stopped)
|
2008-04-05 01:27:29 +02:00
|
|
|
This->pInputPin->end_of_stream = 0;
|
2010-10-07 21:47:33 +02:00
|
|
|
This->filter.state = State_Paused;
|
2008-03-12 18:12:18 +01:00
|
|
|
}
|
2010-10-07 21:47:33 +02:00
|
|
|
LeaveCriticalSection(&This->filter.csFilter);
|
2008-03-12 18:12:18 +01:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI NullRenderer_Run(IBaseFilter * iface, REFERENCE_TIME tStart)
|
|
|
|
{
|
2010-11-04 17:02:25 +01:00
|
|
|
HRESULT hr = S_OK;
|
2008-03-12 18:12:18 +01:00
|
|
|
NullRendererImpl *This = (NullRendererImpl *)iface;
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%s)\n", This, iface, wine_dbgstr_longlong(tStart));
|
|
|
|
|
2010-10-07 21:47:33 +02:00
|
|
|
EnterCriticalSection(&This->filter.csFilter);
|
2010-12-06 14:16:42 +01:00
|
|
|
This->filter.rtStreamStart = tStart;
|
2010-11-04 17:02:25 +01:00
|
|
|
if (This->filter.state == State_Running)
|
|
|
|
goto out;
|
|
|
|
if (This->pInputPin->pin.pConnectedTo)
|
2008-03-12 18:12:18 +01:00
|
|
|
{
|
2008-04-05 01:27:29 +02:00
|
|
|
This->pInputPin->end_of_stream = 0;
|
2008-03-12 18:12:18 +01:00
|
|
|
}
|
2010-11-04 17:02:25 +01:00
|
|
|
else if (This->filter.filterInfo.pGraph)
|
|
|
|
{
|
|
|
|
IMediaEventSink *pEventSink;
|
|
|
|
hr = IFilterGraph_QueryInterface(This->filter.filterInfo.pGraph, &IID_IMediaEventSink, (LPVOID*)&pEventSink);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
hr = IMediaEventSink_Notify(pEventSink, EC_COMPLETE, S_OK, (LONG_PTR)This);
|
|
|
|
IMediaEventSink_Release(pEventSink);
|
|
|
|
}
|
|
|
|
hr = S_OK;
|
|
|
|
}
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
This->filter.state = State_Running;
|
|
|
|
out:
|
2010-10-07 21:47:33 +02:00
|
|
|
LeaveCriticalSection(&This->filter.csFilter);
|
2008-03-12 18:12:18 +01:00
|
|
|
|
2010-11-04 17:02:25 +01:00
|
|
|
return hr;
|
2008-03-12 18:12:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/** IBaseFilter implementation **/
|
|
|
|
|
|
|
|
static HRESULT WINAPI NullRenderer_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)
|
|
|
|
{
|
|
|
|
NullRendererImpl *This = (NullRendererImpl *)iface;
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%p,%p)\n", This, iface, debugstr_w(Id), ppPin);
|
|
|
|
|
2009-12-23 17:17:38 +01:00
|
|
|
if (!Id || !ppPin)
|
|
|
|
return E_POINTER;
|
2008-03-12 18:12:18 +01:00
|
|
|
|
2009-12-23 17:17:38 +01:00
|
|
|
if (!lstrcmpiW(Id,wcsInputPinName) || !lstrcmpiW(Id,wcsAltInputPinName))
|
|
|
|
{
|
|
|
|
*ppPin = (IPin *)This->pInputPin;
|
|
|
|
IPin_AddRef(*ppPin);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
*ppPin = NULL;
|
|
|
|
return VFW_E_NOT_FOUND;
|
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,
|
2008-03-12 18:12:18 +01:00
|
|
|
NullRenderer_Stop,
|
|
|
|
NullRenderer_Pause,
|
|
|
|
NullRenderer_Run,
|
2010-10-07 21:47:33 +02:00
|
|
|
BaseFilterImpl_GetState,
|
|
|
|
BaseFilterImpl_SetSyncSource,
|
|
|
|
BaseFilterImpl_GetSyncSource,
|
2010-10-07 21:48:01 +02:00
|
|
|
BaseFilterImpl_EnumPins,
|
2008-03-12 18:12:18 +01:00
|
|
|
NullRenderer_FindPin,
|
2010-10-07 21:47:33 +02:00
|
|
|
BaseFilterImpl_QueryFilterInfo,
|
|
|
|
BaseFilterImpl_JoinFilterGraph,
|
|
|
|
BaseFilterImpl_QueryVendorInfo
|
2008-03-12 18:12:18 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
static HRESULT WINAPI NullRenderer_InputPin_EndOfStream(IPin * iface)
|
|
|
|
{
|
2010-10-05 21:38:11 +02:00
|
|
|
BaseInputPin* This = (BaseInputPin*)iface;
|
2008-03-12 18:12:18 +01:00
|
|
|
IMediaEventSink* pEventSink;
|
2010-05-22 16:06:00 +02:00
|
|
|
NullRendererImpl *pNull;
|
2008-06-10 18:00:38 +02:00
|
|
|
IFilterGraph *graph;
|
|
|
|
HRESULT hr = S_OK;
|
2008-03-12 18:12:18 +01:00
|
|
|
|
|
|
|
TRACE("(%p/%p)->()\n", This, iface);
|
|
|
|
|
2010-10-05 21:38:11 +02:00
|
|
|
BaseInputPinImpl_EndOfStream(iface);
|
2010-05-22 16:06:00 +02:00
|
|
|
pNull = (NullRendererImpl*)This->pin.pinInfo.pFilter;
|
2010-10-07 21:47:33 +02:00
|
|
|
graph = pNull->filter.filterInfo.pGraph;
|
2008-06-10 18:00:38 +02:00
|
|
|
if (graph)
|
2008-03-12 18:12:18 +01:00
|
|
|
{
|
2010-11-04 17:02:25 +01:00
|
|
|
hr = IFilterGraph_QueryInterface(pNull->filter.filterInfo.pGraph, &IID_IMediaEventSink, (LPVOID*)&pEventSink);
|
2008-06-10 18:00:38 +02:00
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
2010-11-04 17:02:25 +01:00
|
|
|
hr = IMediaEventSink_Notify(pEventSink, EC_COMPLETE, S_OK, (LONG_PTR)pNull);
|
2008-06-10 18:00:38 +02:00
|
|
|
IMediaEventSink_Release(pEventSink);
|
|
|
|
}
|
2008-03-12 18:12:18 +01:00
|
|
|
}
|
2010-05-22 16:06:00 +02:00
|
|
|
MediaSeekingPassThru_EOS(pNull->seekthru_unk);
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI NullRenderer_InputPin_EndFlush(IPin * iface)
|
|
|
|
{
|
2010-10-05 21:38:11 +02:00
|
|
|
BaseInputPin* This = (BaseInputPin*)iface;
|
2010-05-22 16:06:00 +02:00
|
|
|
NullRendererImpl *pNull;
|
|
|
|
HRESULT hr = S_OK;
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->()\n", This, iface);
|
2008-03-12 18:12:18 +01:00
|
|
|
|
2010-10-05 21:38:11 +02:00
|
|
|
hr = BaseInputPinImpl_EndOfStream(iface);
|
2010-05-22 16:06:00 +02:00
|
|
|
pNull = (NullRendererImpl*)This->pin.pinInfo.pFilter;
|
|
|
|
MediaSeekingPassThru_ResetMediaTime(pNull->seekthru_unk);
|
2008-03-12 18:12:18 +01:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IPinVtbl NullRenderer_InputPin_Vtbl =
|
|
|
|
{
|
2010-10-05 21:38:11 +02:00
|
|
|
BaseInputPinImpl_QueryInterface,
|
2010-10-05 21:37:42 +02:00
|
|
|
BasePinImpl_AddRef,
|
2010-10-05 21:38:11 +02:00
|
|
|
BaseInputPinImpl_Release,
|
|
|
|
BaseInputPinImpl_Connect,
|
|
|
|
BaseInputPinImpl_ReceiveConnection,
|
2010-10-05 21:37:42 +02:00
|
|
|
BasePinImpl_Disconnect,
|
|
|
|
BasePinImpl_ConnectedTo,
|
|
|
|
BasePinImpl_ConnectionMediaType,
|
|
|
|
BasePinImpl_QueryPinInfo,
|
|
|
|
BasePinImpl_QueryDirection,
|
|
|
|
BasePinImpl_QueryId,
|
2010-10-05 21:38:11 +02:00
|
|
|
BaseInputPinImpl_QueryAccept,
|
2010-10-05 21:37:42 +02:00
|
|
|
BasePinImpl_EnumMediaTypes,
|
|
|
|
BasePinImpl_QueryInternalConnections,
|
2008-03-12 18:12:18 +01:00
|
|
|
NullRenderer_InputPin_EndOfStream,
|
2010-10-05 21:38:11 +02:00
|
|
|
BaseInputPinImpl_BeginFlush,
|
2010-05-22 16:06:00 +02:00
|
|
|
NullRenderer_InputPin_EndFlush,
|
2010-10-05 21:38:11 +02:00
|
|
|
BaseInputPinImpl_NewSegment
|
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));
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI AMFilterMiscFlags_QueryInterface(IAMFilterMiscFlags *iface, const REFIID riid, void **ppv) {
|
|
|
|
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
|
|
|
|
};
|