Commit 79108708 authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

strmbase: Add an implementation of BaseFilterImpl_EnumPins.

parent 1d42659c
......@@ -79,6 +79,21 @@ typedef struct VfwPinImpl
const IKsPropertySetVtbl * KSP_VT;
} VfwPinImpl;
static IPin* WINAPI VfwCapture_GetPin(IBaseFilter *iface, int pos)
{
VfwCapture *This = (VfwCapture *)iface;
if (pos >= 1 || pos < 0)
return NULL;
IPin_AddRef(This->pOutputPin);
return This->pOutputPin;
}
static LONG WINAPI VfwCapture_GetPinCount(IBaseFilter *iface)
{
return 1;
}
IUnknown * WINAPI QCAP_createVFWCaptureFilter(IUnknown *pUnkOuter, HRESULT *phr)
{
......@@ -97,7 +112,7 @@ IUnknown * WINAPI QCAP_createVFWCaptureFilter(IUnknown *pUnkOuter, HRESULT *phr)
if (!pVfwCapture)
return NULL;
BaseFilter_Init(&pVfwCapture->filter, &VfwCapture_Vtbl, &CLSID_VfwCapture, (DWORD_PTR)(__FILE__ ": VfwCapture.csFilter"));
BaseFilter_Init(&pVfwCapture->filter, &VfwCapture_Vtbl, &CLSID_VfwCapture, (DWORD_PTR)(__FILE__ ": VfwCapture.csFilter"), VfwCapture_GetPin, VfwCapture_GetPinCount);
pVfwCapture->IAMStreamConfig_vtbl = &IAMStreamConfig_VTable;
pVfwCapture->IAMVideoProcAmp_vtbl = &IAMVideoProcAmp_VTable;
......@@ -222,36 +237,6 @@ static HRESULT WINAPI VfwCapture_Run(IBaseFilter * iface, REFERENCE_TIME tStart)
}
/** IBaseFilter methods **/
static IPin* WINAPI VfwCapture_GetPin(IBaseFilter *iface, int pos)
{
VfwCapture *This = (VfwCapture *)iface;
if (pos >= 1 || pos < 0)
return NULL;
IPin_AddRef(This->pOutputPin);
return This->pOutputPin;
}
static LONG WINAPI VfwCapture_GetPinCount(IBaseFilter *iface)
{
return 1;
}
static LONG WINAPI VfwCapture_GetPinVersion(IBaseFilter *iface)
{
/* Our pins are static, not changing so setting static tick count is ok */
return 0;
}
static HRESULT WINAPI
VfwCapture_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum)
{
TRACE("(%p)\n", ppEnum);
return EnumPins_Construct(iface, VfwCapture_GetPin, VfwCapture_GetPinCount, VfwCapture_GetPinVersion, ppEnum);
}
static HRESULT WINAPI VfwCapture_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)
{
FIXME("(%s, %p) - stub\n", debugstr_w(Id), ppPin);
......@@ -270,7 +255,7 @@ static const IBaseFilterVtbl VfwCapture_Vtbl =
BaseFilterImpl_GetState,
BaseFilterImpl_SetSyncSource,
BaseFilterImpl_GetSyncSource,
VfwCapture_EnumPins,
BaseFilterImpl_EnumPins,
VfwCapture_FindPin,
BaseFilterImpl_QueryFilterInfo,
BaseFilterImpl_JoinFilterGraph,
......
......@@ -363,6 +363,23 @@ static HRESULT WINAPI DSoundRender_CheckMediaType(IPin *iface, const AM_MEDIA_TY
return S_OK;
}
static IPin* WINAPI DSoundRender_GetPin(IBaseFilter *iface, int pos)
{
DSoundRenderImpl *This = (DSoundRenderImpl *)iface;
if (pos >= 1 || pos < 0)
return NULL;
IPin_AddRef((IPin*)This->pInputPin);
return (IPin*)This->pInputPin;
}
static LONG WINAPI DSoundRender_GetPinCount(IBaseFilter *iface)
{
/* Our pins are static */
return 1;
}
HRESULT DSoundRender_create(IUnknown * pUnkOuter, LPVOID * ppv)
{
HRESULT hr;
......@@ -381,7 +398,7 @@ HRESULT DSoundRender_create(IUnknown * pUnkOuter, LPVOID * ppv)
return E_OUTOFMEMORY;
ZeroMemory(pDSoundRender, sizeof(DSoundRenderImpl));
BaseFilter_Init(&pDSoundRender->filter, &DSoundRender_Vtbl, &CLSID_DSoundRender, (DWORD_PTR)(__FILE__ ": DSoundRenderImpl.csFilter"));
BaseFilter_Init(&pDSoundRender->filter, &DSoundRender_Vtbl, &CLSID_DSoundRender, (DWORD_PTR)(__FILE__ ": DSoundRenderImpl.csFilter"), DSoundRender_GetPin, DSoundRender_GetPinCount);
pDSoundRender->IBasicAudio_vtbl = &IBasicAudio_Vtbl;
pDSoundRender->IReferenceClock_vtbl = &IReferenceClock_Vtbl;
......@@ -627,38 +644,6 @@ static HRESULT WINAPI DSoundRender_GetState(IBaseFilter * iface, DWORD dwMilliSe
/** IBaseFilter implementation **/
static IPin* WINAPI DSoundRender_GetPin(IBaseFilter *iface, int pos)
{
DSoundRenderImpl *This = (DSoundRenderImpl *)iface;
if (pos >= 1 || pos < 0)
return NULL;
IPin_AddRef((IPin*)This->pInputPin);
return (IPin*)This->pInputPin;
}
static LONG WINAPI DSoundRender_GetPinCount(IBaseFilter *iface)
{
/* Our pins are static, not changing so setting static tick count is ok */
return 1;
}
static LONG WINAPI DSoundRender_GetPinVersion(IBaseFilter *iface)
{
/* Our pins are static, not changing so setting static tick count is ok */
return 0;
}
static HRESULT WINAPI DSoundRender_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum)
{
DSoundRenderImpl *This = (DSoundRenderImpl *)iface;
TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
return EnumPins_Construct(iface, DSoundRender_GetPin, DSoundRender_GetPinCount, DSoundRender_GetPinVersion, ppEnum);
}
static HRESULT WINAPI DSoundRender_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)
{
DSoundRenderImpl *This = (DSoundRenderImpl *)iface;
......@@ -684,7 +669,7 @@ static const IBaseFilterVtbl DSoundRender_Vtbl =
DSoundRender_GetState,
BaseFilterImpl_SetSyncSource,
BaseFilterImpl_GetSyncSource,
DSoundRender_EnumPins,
BaseFilterImpl_EnumPins,
DSoundRender_FindPin,
BaseFilterImpl_QueryFilterInfo,
BaseFilterImpl_JoinFilterGraph,
......
......@@ -42,8 +42,6 @@ typedef struct AsyncReader
BaseFilter filter;
const IFileSourceFilterVtbl * lpVtblFSF;
DWORD lastpinchange;
IPin * pOutputPin;
LPOLESTR pszFileName;
AM_MEDIA_TYPE * pmt;
......@@ -330,6 +328,27 @@ static HRESULT GetClassMediaFile(IAsyncReader * pReader, LPCOLESTR pszFileName,
return hr;
}
static IPin* WINAPI AsyncReader_GetPin(IBaseFilter *iface, int pos)
{
AsyncReader *This = (AsyncReader *)iface;
if (pos >= 1 || !This->pOutputPin)
return NULL;
IPin_AddRef(This->pOutputPin);
return This->pOutputPin;
}
static LONG WINAPI AsyncReader_GetPinCount(IBaseFilter *iface)
{
AsyncReader *This = (AsyncReader *)iface;
if (!This->pOutputPin)
return 0;
else
return 1;
}
HRESULT AsyncReader_create(IUnknown * pUnkOuter, LPVOID * ppv)
{
AsyncReader *pAsyncRead;
......@@ -342,11 +361,10 @@ HRESULT AsyncReader_create(IUnknown * pUnkOuter, LPVOID * ppv)
if (!pAsyncRead)
return E_OUTOFMEMORY;
BaseFilter_Init(&pAsyncRead->filter, &AsyncReader_Vtbl, &CLSID_AsyncReader, (DWORD_PTR)(__FILE__ ": AsyncReader.csFilter"));
BaseFilter_Init(&pAsyncRead->filter, &AsyncReader_Vtbl, &CLSID_AsyncReader, (DWORD_PTR)(__FILE__ ": AsyncReader.csFilter"), AsyncReader_GetPin, AsyncReader_GetPinCount);
pAsyncRead->lpVtblFSF = &FileSource_Vtbl;
pAsyncRead->pOutputPin = NULL;
pAsyncRead->lastpinchange = GetTickCount();
pAsyncRead->pszFileName = NULL;
pAsyncRead->pmt = NULL;
......@@ -459,44 +477,6 @@ static HRESULT WINAPI AsyncReader_Run(IBaseFilter * iface, REFERENCE_TIME tStart
/** IBaseFilter methods **/
static IPin* WINAPI AsyncReader_GetPin(IBaseFilter *iface, int pos)
{
AsyncReader *This = (AsyncReader *)iface;
if (pos >= 1 || !This->pOutputPin)
return NULL;
IPin_AddRef(This->pOutputPin);
return This->pOutputPin;
}
static LONG WINAPI AsyncReader_GetPinCount(IBaseFilter *iface)
{
AsyncReader *This = (AsyncReader *)iface;
if (!This->pOutputPin)
return 0;
else
return 1;
}
static LONG WINAPI AsyncReader_GetPinVersion(IBaseFilter *iface)
{
AsyncReader *This = (AsyncReader *)iface;
/* Our pins are almost static, not changing so setting static tick count is ok */
return This->lastpinchange;
}
static HRESULT WINAPI AsyncReader_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum)
{
AsyncReader *This = (AsyncReader *)iface;
TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
return EnumPins_Construct(iface, AsyncReader_GetPin, AsyncReader_GetPinCount, AsyncReader_GetPinVersion, ppEnum);
}
static HRESULT WINAPI AsyncReader_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)
{
FIXME("(%s, %p)\n", debugstr_w(Id), ppPin);
......@@ -516,7 +496,7 @@ static const IBaseFilterVtbl AsyncReader_Vtbl =
BaseFilterImpl_GetState,
BaseFilterImpl_SetSyncSource,
BaseFilterImpl_GetSyncSource,
AsyncReader_EnumPins,
BaseFilterImpl_EnumPins,
AsyncReader_FindPin,
BaseFilterImpl_QueryFilterInfo,
BaseFilterImpl_JoinFilterGraph,
......@@ -564,7 +544,7 @@ static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFi
/* create pin */
hr = FileAsyncReader_Construct(hFile, (IBaseFilter *)&This->filter.lpVtbl, &This->filter.csFilter, &This->pOutputPin);
This->lastpinchange = GetTickCount();
BaseFilterImpl_IncrementPinVersion((IBaseFilter *)&This->filter.lpVtbl);
if (SUCCEEDED(hr))
hr = IPin_QueryInterface(This->pOutputPin, &IID_IAsyncReader, (LPVOID *)&pReader);
......
......@@ -86,6 +86,22 @@ static HRESULT WINAPI NullRenderer_CheckMediaType(IPin *iface, const AM_MEDIA_TY
return S_OK;
}
static IPin* WINAPI NullRenderer_GetPin(IBaseFilter *iface, int pos)
{
NullRendererImpl *This = (NullRendererImpl *)iface;
if (pos >= 1 || pos < 0)
return NULL;
IPin_AddRef((IPin *)This->pInputPin);
return (IPin *)This->pInputPin;
}
static LONG WINAPI NullRenderer_GetPinCount(IBaseFilter *iface)
{
return 1;
}
HRESULT NullRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
{
HRESULT hr;
......@@ -102,7 +118,7 @@ HRESULT NullRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
pNullRenderer->bAggregatable = FALSE;
pNullRenderer->IInner_vtbl = &IInner_VTable;
BaseFilter_Init(&pNullRenderer->filter, &NullRenderer_Vtbl, &CLSID_NullRenderer, (DWORD_PTR)(__FILE__ ": NullRendererImpl.csFilter"));
BaseFilter_Init(&pNullRenderer->filter, &NullRenderer_Vtbl, &CLSID_NullRenderer, (DWORD_PTR)(__FILE__ ": NullRendererImpl.csFilter"), NullRenderer_GetPin, NullRenderer_GetPinCount);
/* construct input pin */
piInput.dir = PINDIR_INPUT;
......@@ -319,37 +335,6 @@ static HRESULT WINAPI NullRenderer_Run(IBaseFilter * iface, REFERENCE_TIME tStar
/** IBaseFilter implementation **/
static IPin* WINAPI NullRenderer_GetPin(IBaseFilter *iface, int pos)
{
NullRendererImpl *This = (NullRendererImpl *)iface;
if (pos >= 1 || pos < 0)
return NULL;
IPin_AddRef((IPin *)This->pInputPin);
return (IPin *)This->pInputPin;
}
static LONG WINAPI NullRenderer_GetPinCount(IBaseFilter *iface)
{
return 1;
}
static LONG WINAPI NullRenderer_GetPinVersion(IBaseFilter *iface)
{
/* Our pins are static, not changing so setting static tick count is ok */
return 0;
}
static HRESULT WINAPI NullRenderer_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum)
{
NullRendererImpl *This = (NullRendererImpl *)iface;
TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
return EnumPins_Construct(iface, NullRenderer_GetPin, NullRenderer_GetPinCount, NullRenderer_GetPinVersion, ppEnum);
}
static HRESULT WINAPI NullRenderer_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)
{
NullRendererImpl *This = (NullRendererImpl *)iface;
......@@ -381,7 +366,7 @@ static const IBaseFilterVtbl NullRenderer_Vtbl =
BaseFilterImpl_GetState,
BaseFilterImpl_SetSyncSource,
BaseFilterImpl_GetSyncSource,
NullRenderer_EnumPins,
BaseFilterImpl_EnumPins,
NullRenderer_FindPin,
BaseFilterImpl_QueryFilterInfo,
BaseFilterImpl_JoinFilterGraph,
......
......@@ -50,6 +50,27 @@ static inline ParserImpl *impl_from_IMediaSeeking( IMediaSeeking *iface )
return (ParserImpl *)((char*)iface - FIELD_OFFSET(ParserImpl, mediaSeeking.lpVtbl));
}
/* FIXME: WRONG */
static IPin* WINAPI Parser_GetPin(IBaseFilter *iface, int pos)
{
ParserImpl *This = (ParserImpl *)iface;
TRACE("Asking for pos %x\n", pos);
/* Input pin also has a pin, hence the > and not >= */
if (pos > This->cStreams || pos < 0)
return NULL;
IPin_AddRef(This->ppPins[pos]);
return This->ppPins[pos];
}
static LONG WINAPI Parser_GetPinCount(IBaseFilter *iface)
{
ParserImpl *This = (ParserImpl *)iface;
return This->cStreams;
}
HRESULT Parser_Create(ParserImpl* pParser, const IBaseFilterVtbl *Parser_Vtbl, const CLSID* pClsid, PFN_PROCESS_SAMPLE fnProcessSample, PFN_QUERY_ACCEPT fnQueryAccept, PFN_PRE_CONNECT fnPreConnect, PFN_CLEANUP fnCleanup, PFN_DISCONNECT fnDisconnect, REQUESTPROC fnRequest, STOPPROCESSPROC fnDone, CHANGEPROC stop, CHANGEPROC current, CHANGEPROC rate)
{
......@@ -57,10 +78,9 @@ HRESULT Parser_Create(ParserImpl* pParser, const IBaseFilterVtbl *Parser_Vtbl, c
PIN_INFO piInput;
/* pTransformFilter is already allocated */
BaseFilter_Init(&pParser->filter, Parser_Vtbl, pClsid, (DWORD_PTR)(__FILE__ ": ParserImpl.csFilter"));
BaseFilter_Init(&pParser->filter, Parser_Vtbl, pClsid, (DWORD_PTR)(__FILE__ ": ParserImpl.csFilter"), Parser_GetPin, Parser_GetPinCount);
pParser->fnDisconnect = fnDisconnect;
pParser->lastpinchange = GetTickCount();
pParser->cStreams = 0;
pParser->ppPins = CoTaskMemAlloc(1 * sizeof(IPin *));
......@@ -354,42 +374,9 @@ HRESULT WINAPI Parser_GetSyncSource(IBaseFilter * iface, IReferenceClock **ppClo
/** IBaseFilter implementation **/
/* FIXME: WRONG */
static IPin* WINAPI Parser_GetPin(IBaseFilter *iface, int pos)
{
ParserImpl *This = (ParserImpl *)iface;
TRACE("Asking for pos %x\n", pos);
/* Input pin also has a pin, hence the > and not >= */
if (pos > This->cStreams || pos < 0)
return NULL;
IPin_AddRef(This->ppPins[pos]);
return This->ppPins[pos];
}
static LONG WINAPI Parser_GetPinCount(IBaseFilter *iface)
{
ParserImpl *This = (ParserImpl *)iface;
return This->cStreams;
}
static LONG WINAPI Parser_GetPinVersion(IBaseFilter *iface)
{
ParserImpl *This = (ParserImpl *)iface;
return This->lastpinchange;
}
HRESULT WINAPI Parser_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum)
{
ParserImpl *This = (ParserImpl *)iface;
TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
return EnumPins_Construct(iface, Parser_GetPin, Parser_GetPinCount, Parser_GetPinVersion, ppEnum);
return BaseFilterImpl_EnumPins(iface,ppEnum);
}
HRESULT WINAPI Parser_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)
......@@ -439,7 +426,7 @@ HRESULT Parser_AddPin(ParserImpl * This, const PIN_INFO * piOutput, ALLOCATOR_PR
pin->pin.pin.pinInfo.pFilter = (LPVOID)This;
pin->pin.custom_allocator = 1;
This->cStreams++;
This->lastpinchange = GetTickCount();
BaseFilterImpl_IncrementPinVersion((IBaseFilter*)This);
CoTaskMemFree(ppOldPins);
}
else
......@@ -472,7 +459,7 @@ static HRESULT Parser_RemoveOutputPins(ParserImpl * This)
IPin_Release(ppOldPins[i + 1]);
}
This->lastpinchange = GetTickCount();
BaseFilterImpl_IncrementPinVersion((IBaseFilter*)This);
This->cStreams = 0;
CoTaskMemFree(ppOldPins);
......
......@@ -36,7 +36,6 @@ struct ParserImpl
PullPin * pInputPin;
IPin ** ppPins;
ULONG cStreams;
DWORD lastpinchange;
MediaSeekingImpl mediaSeeking;
};
......
......@@ -74,13 +74,31 @@ static HRESULT WINAPI TransformFilter_Output_QueryAccept(IPin *iface, const AM_M
return S_FALSE;
}
static IPin* WINAPI TransformFilter_GetPin(IBaseFilter *iface, int pos)
{
TransformFilterImpl *This = (TransformFilterImpl *)iface;
if (pos >= This->npins || pos < 0)
return NULL;
IPin_AddRef(This->ppPins[pos]);
return This->ppPins[pos];
}
static LONG WINAPI TransformFilter_GetPinCount(IBaseFilter *iface)
{
TransformFilterImpl *This = (TransformFilterImpl *)iface;
return (This->npins+1);
}
HRESULT TransformFilter_Create(TransformFilterImpl* pTransformFilter, const CLSID* pClsid, const TransformFuncsTable* pFuncsTable)
{
HRESULT hr;
PIN_INFO piInput;
PIN_INFO piOutput;
BaseFilter_Init(&pTransformFilter->filter, &TransformFilter_Vtbl, pClsid, (DWORD_PTR)(__FILE__ ": TransformFilterImpl.csFilter"));
BaseFilter_Init(&pTransformFilter->filter, &TransformFilter_Vtbl, pClsid, (DWORD_PTR)(__FILE__ ": TransformFilterImpl.csFilter"), TransformFilter_GetPin, TransformFilter_GetPinCount);
/* pTransformFilter is already allocated */
pTransformFilter->pFuncsTable = pFuncsTable;
......@@ -270,39 +288,6 @@ static HRESULT WINAPI TransformFilter_Run(IBaseFilter * iface, REFERENCE_TIME tS
/** IBaseFilter implementation **/
static IPin* WINAPI TransformFilter_GetPin(IBaseFilter *iface, int pos)
{
TransformFilterImpl *This = (TransformFilterImpl *)iface;
if (pos >= This->npins || pos < 0)
return NULL;
IPin_AddRef(This->ppPins[pos]);
return This->ppPins[pos];
}
static LONG WINAPI TransformFilter_GetPinCount(IBaseFilter *iface)
{
TransformFilterImpl *This = (TransformFilterImpl *)iface;
return (This->npins+1);
}
static LONG WINAPI TransformFilter_GetPinVersion(IBaseFilter *iface)
{
/* Our pins are static, not changing so setting static tick count is ok */
return 0;
}
static HRESULT WINAPI TransformFilter_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum)
{
TransformFilterImpl *This = (TransformFilterImpl *)iface;
TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
return EnumPins_Construct(iface, TransformFilter_GetPin, TransformFilter_GetPinCount, TransformFilter_GetPinVersion, ppEnum);
}
static HRESULT WINAPI TransformFilter_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)
{
TransformFilterImpl *This = (TransformFilterImpl *)iface;
......@@ -324,7 +309,7 @@ static const IBaseFilterVtbl TransformFilter_Vtbl =
BaseFilterImpl_GetState,
BaseFilterImpl_SetSyncSource,
BaseFilterImpl_GetSyncSource,
TransformFilter_EnumPins,
BaseFilterImpl_EnumPins,
TransformFilter_FindPin,
BaseFilterImpl_QueryFilterInfo,
BaseFilterImpl_JoinFilterGraph,
......
......@@ -535,6 +535,22 @@ static HRESULT WINAPI VideoRenderer_CheckMediaType(IPin *iface, const AM_MEDIA_T
return S_FALSE;
}
static IPin* WINAPI VideoRenderer_GetPin(IBaseFilter *iface, int pos)
{
VideoRendererImpl *This = (VideoRendererImpl *)iface;
if (pos >= 1 || pos < 0)
return NULL;
IPin_AddRef((IPin *)This->pInputPin);
return (IPin *)This->pInputPin;
}
static LONG WINAPI VideoRenderer_GetPinCount(IBaseFilter *iface)
{
return 1;
}
HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
{
HRESULT hr;
......@@ -552,7 +568,7 @@ HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
pVideoRenderer->bAggregatable = FALSE;
pVideoRenderer->IInner_vtbl = &IInner_VTable;
BaseFilter_Init(&pVideoRenderer->filter, &VideoRenderer_Vtbl, &CLSID_VideoRenderer, (DWORD_PTR)(__FILE__ ": VideoRendererImpl.csFilter"));
BaseFilter_Init(&pVideoRenderer->filter, &VideoRenderer_Vtbl, &CLSID_VideoRenderer, (DWORD_PTR)(__FILE__ ": VideoRendererImpl.csFilter"), VideoRenderer_GetPin, VideoRenderer_GetPinCount);
pVideoRenderer->IBasicVideo_vtbl = &IBasicVideo_VTable;
pVideoRenderer->IVideoWindow_vtbl = &IVideoWindow_VTable;
......@@ -840,37 +856,6 @@ static HRESULT WINAPI VideoRenderer_GetState(IBaseFilter * iface, DWORD dwMilliS
/** IBaseFilter implementation **/
static IPin* WINAPI VideoRenderer_GetPin(IBaseFilter *iface, int pos)
{
VideoRendererImpl *This = (VideoRendererImpl *)iface;
if (pos >= 1 || pos < 0)
return NULL;
IPin_AddRef((IPin *)This->pInputPin);
return (IPin *)This->pInputPin;
}
static LONG WINAPI VideoRenderer_GetPinCount(IBaseFilter *iface)
{
return 1;
}
static LONG WINAPI VideoRenderer_GetPinVersion(IBaseFilter *iface)
{
/* Our pins are static, not changing so setting static tick count is ok */
return 0;
}
static HRESULT WINAPI VideoRenderer_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum)
{
VideoRendererImpl *This = (VideoRendererImpl *)iface;
TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
return EnumPins_Construct(iface, VideoRenderer_GetPin, VideoRenderer_GetPinCount, VideoRenderer_GetPinVersion, ppEnum);
}
static HRESULT WINAPI VideoRenderer_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)
{
VideoRendererImpl *This = (VideoRendererImpl *)iface;
......@@ -894,7 +879,7 @@ static const IBaseFilterVtbl VideoRenderer_Vtbl =
VideoRenderer_GetState,
BaseFilterImpl_SetSyncSource,
BaseFilterImpl_GetSyncSource,
VideoRenderer_EnumPins,
BaseFilterImpl_EnumPins,
VideoRenderer_FindPin,
BaseFilterImpl_QueryFilterInfo,
BaseFilterImpl_JoinFilterGraph,
......
......@@ -142,6 +142,16 @@ HRESULT WINAPI BaseFilterImpl_GetSyncSource(IBaseFilter * iface, IReferenceClock
return S_OK;
}
HRESULT WINAPI BaseFilterImpl_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum)
{
BaseFilter *This = (BaseFilter*)iface;
TRACE("(%p)->(%p)\n", iface, ppEnum);
return EnumPins_Construct(iface, This->pfnGetPin, This->pfnGetPinCount, BaseFilterImpl_GetPinVersion, ppEnum);
}
HRESULT WINAPI BaseFilterImpl_QueryFilterInfo(IBaseFilter * iface, FILTER_INFO *pInfo)
{
BaseFilter *This = (BaseFilter*)iface;
......@@ -182,7 +192,21 @@ HRESULT WINAPI BaseFilterImpl_QueryVendorInfo(IBaseFilter * iface, LPWSTR *pVend
return E_NOTIMPL;
}
HRESULT WINAPI BaseFilter_Init(BaseFilter * This, const IBaseFilterVtbl *Vtbl, const CLSID *pClsid, DWORD_PTR DebugInfo)
LONG WINAPI BaseFilterImpl_GetPinVersion(IBaseFilter * iface)
{
BaseFilter * This = (BaseFilter*)iface;
TRACE("(%p)\n", This);
return This->pinVersion;
}
VOID WINAPI BaseFilterImpl_IncrementPinVersion(IBaseFilter * iface)
{
BaseFilter * This = (BaseFilter*)iface;
InterlockedIncrement(&This->pinVersion);
TRACE("(%p) -> New pinVersion %i\n", This,This->pinVersion);
}
HRESULT WINAPI BaseFilter_Init(BaseFilter * This, const IBaseFilterVtbl *Vtbl, const CLSID *pClsid, DWORD_PTR DebugInfo, BaseFilter_GetPin pfGetPin, BaseFilter_GetPinCount pfGetPinCount)
{
This->lpVtbl = Vtbl;
This->refCount = 1;
......@@ -193,6 +217,10 @@ HRESULT WINAPI BaseFilter_Init(BaseFilter * This, const IBaseFilterVtbl *Vtbl,
ZeroMemory(&This->filterInfo, sizeof(FILTER_INFO));
This->clsid = *pClsid;
This->csFilter.DebugInfo->Spare[0] = DebugInfo;
This->pinVersion = 1;
This->pfnGetPin = pfGetPin;
This->pfnGetPinCount = pfGetPinCount;
return S_OK;
}
......@@ -136,6 +136,10 @@ typedef struct BaseFilter
IReferenceClock * pClock;
FILTER_INFO filterInfo;
CLSID clsid;
LONG pinVersion;
BaseFilter_GetPin pfnGetPin;
BaseFilter_GetPinCount pfnGetPinCount;
} BaseFilter;
HRESULT WINAPI BaseFilterImpl_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv);
......@@ -145,8 +149,12 @@ HRESULT WINAPI BaseFilterImpl_GetClassID(IBaseFilter * iface, CLSID * pClsid);
HRESULT WINAPI BaseFilterImpl_GetState(IBaseFilter * iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState );
HRESULT WINAPI BaseFilterImpl_SetSyncSource(IBaseFilter * iface, IReferenceClock *pClock);
HRESULT WINAPI BaseFilterImpl_GetSyncSource(IBaseFilter * iface, IReferenceClock **ppClock);
HRESULT WINAPI BaseFilterImpl_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum);
HRESULT WINAPI BaseFilterImpl_QueryFilterInfo(IBaseFilter * iface, FILTER_INFO *pInfo);
HRESULT WINAPI BaseFilterImpl_JoinFilterGraph(IBaseFilter * iface, IFilterGraph *pGraph, LPCWSTR pName );
HRESULT WINAPI BaseFilterImpl_QueryVendorInfo(IBaseFilter * iface, LPWSTR *pVendorInfo);
HRESULT WINAPI BaseFilter_Init(BaseFilter * This, const IBaseFilterVtbl *Vtbl, const CLSID *pClsid, DWORD_PTR DebugInfo);
LONG WINAPI BaseFilterImpl_GetPinVersion(IBaseFilter* This);
VOID WINAPI BaseFilterImpl_IncrementPinVersion(IBaseFilter* This);
HRESULT WINAPI BaseFilter_Init(BaseFilter * This, const IBaseFilterVtbl *Vtbl, const CLSID *pClsid, DWORD_PTR DebugInfo, BaseFilter_GetPin pfGetPin, BaseFilter_GetPinCount pfGetPinCount);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment