Commit 3c2dfd18 authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

strmbase: Standardize "class" function into functions tables in the structs.

This allows the standardization of the "class" functions to use the class as the argument and will aid in expanding the implementation of these functions.
parent 8f3c3723
...@@ -79,7 +79,7 @@ typedef struct VfwPinImpl ...@@ -79,7 +79,7 @@ typedef struct VfwPinImpl
const IKsPropertySetVtbl * KSP_VT; const IKsPropertySetVtbl * KSP_VT;
} VfwPinImpl; } VfwPinImpl;
static IPin* WINAPI VfwCapture_GetPin(IBaseFilter *iface, int pos) static IPin* WINAPI VfwCapture_GetPin(BaseFilter *iface, int pos)
{ {
VfwCapture *This = (VfwCapture *)iface; VfwCapture *This = (VfwCapture *)iface;
...@@ -90,11 +90,16 @@ static IPin* WINAPI VfwCapture_GetPin(IBaseFilter *iface, int pos) ...@@ -90,11 +90,16 @@ static IPin* WINAPI VfwCapture_GetPin(IBaseFilter *iface, int pos)
return This->pOutputPin; return This->pOutputPin;
} }
static LONG WINAPI VfwCapture_GetPinCount(IBaseFilter *iface) static LONG WINAPI VfwCapture_GetPinCount(BaseFilter *iface)
{ {
return 1; return 1;
} }
static const BaseFilterFuncTable BaseFuncTable = {
VfwCapture_GetPin,
VfwCapture_GetPinCount
};
IUnknown * WINAPI QCAP_createVFWCaptureFilter(IUnknown *pUnkOuter, HRESULT *phr) IUnknown * WINAPI QCAP_createVFWCaptureFilter(IUnknown *pUnkOuter, HRESULT *phr)
{ {
VfwCapture *pVfwCapture; VfwCapture *pVfwCapture;
...@@ -112,7 +117,7 @@ IUnknown * WINAPI QCAP_createVFWCaptureFilter(IUnknown *pUnkOuter, HRESULT *phr) ...@@ -112,7 +117,7 @@ IUnknown * WINAPI QCAP_createVFWCaptureFilter(IUnknown *pUnkOuter, HRESULT *phr)
if (!pVfwCapture) if (!pVfwCapture)
return NULL; return NULL;
BaseFilter_Init(&pVfwCapture->filter, &VfwCapture_Vtbl, &CLSID_VfwCapture, (DWORD_PTR)(__FILE__ ": VfwCapture.csFilter"), VfwCapture_GetPin, VfwCapture_GetPinCount); BaseFilter_Init(&pVfwCapture->filter, &VfwCapture_Vtbl, &CLSID_VfwCapture, (DWORD_PTR)(__FILE__ ": VfwCapture.csFilter"), &BaseFuncTable);
pVfwCapture->IAMStreamConfig_vtbl = &IAMStreamConfig_VTable; pVfwCapture->IAMStreamConfig_vtbl = &IAMStreamConfig_VTable;
pVfwCapture->IAMVideoProcAmp_vtbl = &IAMVideoProcAmp_VTable; pVfwCapture->IAMVideoProcAmp_vtbl = &IAMVideoProcAmp_VTable;
...@@ -646,7 +651,7 @@ static const IKsPropertySetVtbl KSP_VTable = ...@@ -646,7 +651,7 @@ static const IKsPropertySetVtbl KSP_VTable =
KSP_QuerySupported KSP_QuerySupported
}; };
static HRESULT WINAPI VfwPin_GetMediaType(IPin *iface, int iPosition, AM_MEDIA_TYPE *pmt) static HRESULT WINAPI VfwPin_GetMediaType(BasePin *iface, int iPosition, AM_MEDIA_TYPE *pmt)
{ {
VfwPinImpl *This = (VfwPinImpl *)iface; VfwPinImpl *This = (VfwPinImpl *)iface;
AM_MEDIA_TYPE *vfw_pmt; AM_MEDIA_TYPE *vfw_pmt;
...@@ -664,12 +669,12 @@ static HRESULT WINAPI VfwPin_GetMediaType(IPin *iface, int iPosition, AM_MEDIA_T ...@@ -664,12 +669,12 @@ static HRESULT WINAPI VfwPin_GetMediaType(IPin *iface, int iPosition, AM_MEDIA_T
return hr; return hr;
} }
LONG WINAPI VfwPin_GetMediaTypeVersion(IPin *iface) LONG WINAPI VfwPin_GetMediaTypeVersion(BasePin *iface)
{ {
return 1; return 1;
} }
static HRESULT WINAPI VfwPin_DecideBufferSize(IPin *iface, IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest) static HRESULT WINAPI VfwPin_DecideBufferSize(BaseOutputPin *iface, IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest)
{ {
ALLOCATOR_PROPERTIES actual; ALLOCATOR_PROPERTIES actual;
...@@ -685,6 +690,15 @@ static HRESULT WINAPI VfwPin_DecideBufferSize(IPin *iface, IMemAllocator *pAlloc ...@@ -685,6 +690,15 @@ static HRESULT WINAPI VfwPin_DecideBufferSize(IPin *iface, IMemAllocator *pAlloc
return IMemAllocator_SetProperties(pAlloc, ppropInputRequest, &actual); return IMemAllocator_SetProperties(pAlloc, ppropInputRequest, &actual);
} }
static const BasePinFuncTable output_BaseFuncTable = {
NULL,
BaseOutputPinImpl_AttemptConnection
};
static const BaseOutputPinFuncTable output_BaseOutputFuncTable = {
VfwPin_DecideBufferSize
};
static HRESULT static HRESULT
VfwPin_Construct( IBaseFilter * pBaseFilter, LPCRITICAL_SECTION pCritSec, VfwPin_Construct( IBaseFilter * pBaseFilter, LPCRITICAL_SECTION pCritSec,
IPin ** ppPin ) IPin ** ppPin )
...@@ -700,7 +714,7 @@ VfwPin_Construct( IBaseFilter * pBaseFilter, LPCRITICAL_SECTION pCritSec, ...@@ -700,7 +714,7 @@ VfwPin_Construct( IBaseFilter * pBaseFilter, LPCRITICAL_SECTION pCritSec,
lstrcpyW(piOutput.achName, wszOutputPinName); lstrcpyW(piOutput.achName, wszOutputPinName);
ObjectRefCount(TRUE); ObjectRefCount(TRUE);
hr = BaseOutputPin_Construct(&VfwPin_Vtbl, sizeof(VfwPinImpl), &piOutput, VfwPin_DecideBufferSize, NULL, pCritSec, ppPin); hr = BaseOutputPin_Construct(&VfwPin_Vtbl, sizeof(VfwPinImpl), &piOutput, &output_BaseFuncTable, &output_BaseOutputFuncTable, pCritSec, ppPin);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
...@@ -770,7 +784,7 @@ VfwPin_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnum) ...@@ -770,7 +784,7 @@ VfwPin_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnum)
VfwPinImpl *This = (VfwPinImpl *)iface; VfwPinImpl *This = (VfwPinImpl *)iface;
hr = qcap_driver_get_format(This->driver_info, &pmt); hr = qcap_driver_get_format(This->driver_info, &pmt);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
hr = EnumMediaTypes_Construct(iface, VfwPin_GetMediaType, VfwPin_GetMediaTypeVersion, ppEnum); hr = EnumMediaTypes_Construct((BasePin*)iface, VfwPin_GetMediaType, VfwPin_GetMediaTypeVersion, ppEnum);
TRACE("%p -- %x\n", This, hr); TRACE("%p -- %x\n", This, hr);
DeleteMediaType(pmt); DeleteMediaType(pmt);
......
...@@ -207,9 +207,8 @@ static HRESULT DSoundRender_SendSampleData(DSoundRenderImpl* This, const BYTE *d ...@@ -207,9 +207,8 @@ static HRESULT DSoundRender_SendSampleData(DSoundRenderImpl* This, const BYTE *d
return hr; return hr;
} }
static HRESULT WINAPI DSoundRender_Receive(IPin *iface, IMediaSample * pSample) static HRESULT WINAPI DSoundRender_Receive(BaseInputPin *pin, IMediaSample * pSample)
{ {
BaseInputPin *pin = (BaseInputPin*)iface;
DSoundRenderImpl *This = (DSoundRenderImpl*)pin->pin.pinInfo.pFilter; DSoundRenderImpl *This = (DSoundRenderImpl*)pin->pin.pinInfo.pFilter;
LPBYTE pbSrcStream = NULL; LPBYTE pbSrcStream = NULL;
LONG cbSrcStream = 0; LONG cbSrcStream = 0;
...@@ -217,7 +216,7 @@ static HRESULT WINAPI DSoundRender_Receive(IPin *iface, IMediaSample * pSample) ...@@ -217,7 +216,7 @@ static HRESULT WINAPI DSoundRender_Receive(IPin *iface, IMediaSample * pSample)
HRESULT hr; HRESULT hr;
AM_MEDIA_TYPE *amt; AM_MEDIA_TYPE *amt;
TRACE("%p %p\n", iface, pSample); TRACE("%p %p\n", pin, pSample);
/* Slightly incorrect, Pause completes when a frame is received so we should signal /* Slightly incorrect, Pause completes when a frame is received so we should signal
* pause completion here, but for sound playing a single frame doesn't make sense * pause completion here, but for sound playing a single frame doesn't make sense
...@@ -341,7 +340,7 @@ static HRESULT WINAPI DSoundRender_Receive(IPin *iface, IMediaSample * pSample) ...@@ -341,7 +340,7 @@ static HRESULT WINAPI DSoundRender_Receive(IPin *iface, IMediaSample * pSample)
return hr; return hr;
} }
static HRESULT WINAPI DSoundRender_CheckMediaType(IPin *iface, const AM_MEDIA_TYPE * pmt) static HRESULT WINAPI DSoundRender_CheckMediaType(BasePin *iface, const AM_MEDIA_TYPE * pmt)
{ {
WAVEFORMATEX* format; WAVEFORMATEX* format;
...@@ -363,7 +362,7 @@ static HRESULT WINAPI DSoundRender_CheckMediaType(IPin *iface, const AM_MEDIA_TY ...@@ -363,7 +362,7 @@ static HRESULT WINAPI DSoundRender_CheckMediaType(IPin *iface, const AM_MEDIA_TY
return S_OK; return S_OK;
} }
static IPin* WINAPI DSoundRender_GetPin(IBaseFilter *iface, int pos) static IPin* WINAPI DSoundRender_GetPin(BaseFilter *iface, int pos)
{ {
DSoundRenderImpl *This = (DSoundRenderImpl *)iface; DSoundRenderImpl *This = (DSoundRenderImpl *)iface;
...@@ -374,12 +373,27 @@ static IPin* WINAPI DSoundRender_GetPin(IBaseFilter *iface, int pos) ...@@ -374,12 +373,27 @@ static IPin* WINAPI DSoundRender_GetPin(IBaseFilter *iface, int pos)
return (IPin*)This->pInputPin; return (IPin*)This->pInputPin;
} }
static LONG WINAPI DSoundRender_GetPinCount(IBaseFilter *iface) static LONG WINAPI DSoundRender_GetPinCount(BaseFilter *iface)
{ {
/* Our pins are static */ /* Our pins are static */
return 1; return 1;
} }
static const BaseFilterFuncTable BaseFuncTable = {
DSoundRender_GetPin,
DSoundRender_GetPinCount
};
static const BasePinFuncTable input_BaseFuncTable = {
DSoundRender_CheckMediaType,
NULL
};
static const BaseInputPinFuncTable input_BaseInputFuncTable = {
DSoundRender_Receive
};
HRESULT DSoundRender_create(IUnknown * pUnkOuter, LPVOID * ppv) HRESULT DSoundRender_create(IUnknown * pUnkOuter, LPVOID * ppv)
{ {
HRESULT hr; HRESULT hr;
...@@ -398,7 +412,7 @@ HRESULT DSoundRender_create(IUnknown * pUnkOuter, LPVOID * ppv) ...@@ -398,7 +412,7 @@ HRESULT DSoundRender_create(IUnknown * pUnkOuter, LPVOID * ppv)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
ZeroMemory(pDSoundRender, sizeof(DSoundRenderImpl)); ZeroMemory(pDSoundRender, sizeof(DSoundRenderImpl));
BaseFilter_Init(&pDSoundRender->filter, &DSoundRender_Vtbl, &CLSID_DSoundRender, (DWORD_PTR)(__FILE__ ": DSoundRenderImpl.csFilter"), DSoundRender_GetPin, DSoundRender_GetPinCount); BaseFilter_Init(&pDSoundRender->filter, &DSoundRender_Vtbl, &CLSID_DSoundRender, (DWORD_PTR)(__FILE__ ": DSoundRenderImpl.csFilter"), &BaseFuncTable);
pDSoundRender->IBasicAudio_vtbl = &IBasicAudio_Vtbl; pDSoundRender->IBasicAudio_vtbl = &IBasicAudio_Vtbl;
pDSoundRender->IReferenceClock_vtbl = &IReferenceClock_Vtbl; pDSoundRender->IReferenceClock_vtbl = &IReferenceClock_Vtbl;
...@@ -408,7 +422,7 @@ HRESULT DSoundRender_create(IUnknown * pUnkOuter, LPVOID * ppv) ...@@ -408,7 +422,7 @@ HRESULT DSoundRender_create(IUnknown * pUnkOuter, LPVOID * ppv)
piInput.dir = PINDIR_INPUT; piInput.dir = PINDIR_INPUT;
piInput.pFilter = (IBaseFilter *)pDSoundRender; piInput.pFilter = (IBaseFilter *)pDSoundRender;
lstrcpynW(piInput.achName, wcsInputPinName, sizeof(piInput.achName) / sizeof(piInput.achName[0])); lstrcpynW(piInput.achName, wcsInputPinName, sizeof(piInput.achName) / sizeof(piInput.achName[0]));
hr = BaseInputPin_Construct(&DSoundRender_InputPin_Vtbl, &piInput, DSoundRender_CheckMediaType, DSoundRender_Receive, &pDSoundRender->filter.csFilter, NULL, (IPin **)&pDSoundRender->pInputPin); hr = BaseInputPin_Construct(&DSoundRender_InputPin_Vtbl, &piInput, &input_BaseFuncTable, &input_BaseInputFuncTable, &pDSoundRender->filter.csFilter, NULL, (IPin **)&pDSoundRender->pInputPin);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
...@@ -694,7 +708,7 @@ static HRESULT WINAPI DSoundRender_InputPin_ReceiveConnection(IPin * iface, IPin ...@@ -694,7 +708,7 @@ static HRESULT WINAPI DSoundRender_InputPin_ReceiveConnection(IPin * iface, IPin
if (This->pin.pConnectedTo) if (This->pin.pConnectedTo)
hr = VFW_E_ALREADY_CONNECTED; hr = VFW_E_ALREADY_CONNECTED;
if (SUCCEEDED(hr) && This->fnCheckMediaType(iface, pmt) != S_OK) if (SUCCEEDED(hr) && This->pin.pFuncsTable->pfnCheckMediaType((BasePin*)This, pmt) != S_OK)
hr = VFW_E_TYPE_NOT_ACCEPTED; hr = VFW_E_TYPE_NOT_ACCEPTED;
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
......
...@@ -328,7 +328,7 @@ static HRESULT GetClassMediaFile(IAsyncReader * pReader, LPCOLESTR pszFileName, ...@@ -328,7 +328,7 @@ static HRESULT GetClassMediaFile(IAsyncReader * pReader, LPCOLESTR pszFileName,
return hr; return hr;
} }
static IPin* WINAPI AsyncReader_GetPin(IBaseFilter *iface, int pos) static IPin* WINAPI AsyncReader_GetPin(BaseFilter *iface, int pos)
{ {
AsyncReader *This = (AsyncReader *)iface; AsyncReader *This = (AsyncReader *)iface;
...@@ -339,7 +339,7 @@ static IPin* WINAPI AsyncReader_GetPin(IBaseFilter *iface, int pos) ...@@ -339,7 +339,7 @@ static IPin* WINAPI AsyncReader_GetPin(IBaseFilter *iface, int pos)
return This->pOutputPin; return This->pOutputPin;
} }
static LONG WINAPI AsyncReader_GetPinCount(IBaseFilter *iface) static LONG WINAPI AsyncReader_GetPinCount(BaseFilter *iface)
{ {
AsyncReader *This = (AsyncReader *)iface; AsyncReader *This = (AsyncReader *)iface;
...@@ -349,6 +349,11 @@ static LONG WINAPI AsyncReader_GetPinCount(IBaseFilter *iface) ...@@ -349,6 +349,11 @@ static LONG WINAPI AsyncReader_GetPinCount(IBaseFilter *iface)
return 1; return 1;
} }
static const BaseFilterFuncTable BaseFuncTable = {
AsyncReader_GetPin,
AsyncReader_GetPinCount
};
HRESULT AsyncReader_create(IUnknown * pUnkOuter, LPVOID * ppv) HRESULT AsyncReader_create(IUnknown * pUnkOuter, LPVOID * ppv)
{ {
AsyncReader *pAsyncRead; AsyncReader *pAsyncRead;
...@@ -361,7 +366,7 @@ HRESULT AsyncReader_create(IUnknown * pUnkOuter, LPVOID * ppv) ...@@ -361,7 +366,7 @@ HRESULT AsyncReader_create(IUnknown * pUnkOuter, LPVOID * ppv)
if (!pAsyncRead) if (!pAsyncRead)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
BaseFilter_Init(&pAsyncRead->filter, &AsyncReader_Vtbl, &CLSID_AsyncReader, (DWORD_PTR)(__FILE__ ": AsyncReader.csFilter"), AsyncReader_GetPin, AsyncReader_GetPinCount); BaseFilter_Init(&pAsyncRead->filter, &AsyncReader_Vtbl, &CLSID_AsyncReader, (DWORD_PTR)(__FILE__ ": AsyncReader.csFilter"), &BaseFuncTable);
pAsyncRead->lpVtblFSF = &FileSource_Vtbl; pAsyncRead->lpVtblFSF = &FileSource_Vtbl;
pAsyncRead->pOutputPin = NULL; pAsyncRead->pOutputPin = NULL;
...@@ -544,7 +549,7 @@ static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFi ...@@ -544,7 +549,7 @@ static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFi
/* create pin */ /* create pin */
hr = FileAsyncReader_Construct(hFile, (IBaseFilter *)&This->filter.lpVtbl, &This->filter.csFilter, &This->pOutputPin); hr = FileAsyncReader_Construct(hFile, (IBaseFilter *)&This->filter.lpVtbl, &This->filter.csFilter, &This->pOutputPin);
BaseFilterImpl_IncrementPinVersion((IBaseFilter *)&This->filter.lpVtbl); BaseFilterImpl_IncrementPinVersion((BaseFilter *)&This->filter.lpVtbl);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
hr = IPin_QueryInterface(This->pOutputPin, &IID_IAsyncReader, (LPVOID *)&pReader); hr = IPin_QueryInterface(This->pOutputPin, &IID_IAsyncReader, (LPVOID *)&pReader);
...@@ -690,7 +695,7 @@ static HRESULT WINAPI FileAsyncReaderPin_QueryAccept(IPin *iface, const AM_MEDIA ...@@ -690,7 +695,7 @@ static HRESULT WINAPI FileAsyncReaderPin_QueryAccept(IPin *iface, const AM_MEDIA
return S_FALSE; return S_FALSE;
} }
static HRESULT WINAPI FileAsyncReaderPin_GetMediaType(IPin *iface, int iPosition, AM_MEDIA_TYPE *pmt) static HRESULT WINAPI FileAsyncReaderPin_GetMediaType(BasePin *iface, int iPosition, AM_MEDIA_TYPE *pmt)
{ {
FileAsyncReader *This = (FileAsyncReader *)iface; FileAsyncReader *This = (FileAsyncReader *)iface;
if (iPosition < 0) if (iPosition < 0)
...@@ -759,7 +764,7 @@ static HRESULT WINAPI FileAsyncReaderPin_EnumMediaTypes(IPin * iface, IEnumMedia ...@@ -759,7 +764,7 @@ static HRESULT WINAPI FileAsyncReaderPin_EnumMediaTypes(IPin * iface, IEnumMedia
{ {
TRACE("(%p)\n", ppEnum); TRACE("(%p)\n", ppEnum);
return EnumMediaTypes_Construct(iface, FileAsyncReaderPin_GetMediaType, BasePinImpl_GetMediaTypeVersion, ppEnum); return EnumMediaTypes_Construct((BasePin*)iface, FileAsyncReaderPin_GetMediaType, BasePinImpl_GetMediaTypeVersion, ppEnum);
} }
static const IPinVtbl FileAsyncReaderPin_Vtbl = static const IPinVtbl FileAsyncReaderPin_Vtbl =
...@@ -788,7 +793,7 @@ static const IPinVtbl FileAsyncReaderPin_Vtbl = ...@@ -788,7 +793,7 @@ static const IPinVtbl FileAsyncReaderPin_Vtbl =
/* specific AM_MEDIA_TYPE - it cannot be NULL */ /* specific AM_MEDIA_TYPE - it cannot be NULL */
/* this differs from standard OutputPin_AttemptConnection only in that it /* this differs from standard OutputPin_AttemptConnection only in that it
* doesn't need the IMemInputPin interface on the receiving pin */ * doesn't need the IMemInputPin interface on the receiving pin */
static HRESULT WINAPI FileAsyncReaderPin_AttemptConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt) static HRESULT WINAPI FileAsyncReaderPin_AttemptConnection(BasePin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt)
{ {
BaseOutputPin *This = (BaseOutputPin *)iface; BaseOutputPin *This = (BaseOutputPin *)iface;
HRESULT hr; HRESULT hr;
...@@ -802,7 +807,7 @@ static HRESULT WINAPI FileAsyncReaderPin_AttemptConnection(IPin * iface, IPin * ...@@ -802,7 +807,7 @@ static HRESULT WINAPI FileAsyncReaderPin_AttemptConnection(IPin * iface, IPin *
IPin_AddRef(pReceivePin); IPin_AddRef(pReceivePin);
CopyMediaType(&This->pin.mtCurrent, pmt); CopyMediaType(&This->pin.mtCurrent, pmt);
hr = IPin_ReceiveConnection(pReceivePin, iface, pmt); hr = IPin_ReceiveConnection(pReceivePin, (IPin*)iface, pmt);
if (FAILED(hr)) if (FAILED(hr))
{ {
...@@ -815,7 +820,7 @@ static HRESULT WINAPI FileAsyncReaderPin_AttemptConnection(IPin * iface, IPin * ...@@ -815,7 +820,7 @@ static HRESULT WINAPI FileAsyncReaderPin_AttemptConnection(IPin * iface, IPin *
return hr; return hr;
} }
static HRESULT WINAPI FileAsyncReaderPin_DecideBufferSize(IPin *iface, IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest) static HRESULT WINAPI FileAsyncReaderPin_DecideBufferSize(BaseOutputPin *iface, IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest)
{ {
FileAsyncReader *This = (FileAsyncReader *)iface; FileAsyncReader *This = (FileAsyncReader *)iface;
ALLOCATOR_PROPERTIES actual; ALLOCATOR_PROPERTIES actual;
...@@ -832,6 +837,14 @@ static HRESULT WINAPI FileAsyncReaderPin_DecideBufferSize(IPin *iface, IMemAlloc ...@@ -832,6 +837,14 @@ static HRESULT WINAPI FileAsyncReaderPin_DecideBufferSize(IPin *iface, IMemAlloc
return IMemAllocator_SetProperties(pAlloc, &This->allocProps, &actual); return IMemAllocator_SetProperties(pAlloc, &This->allocProps, &actual);
} }
static const BasePinFuncTable output_BaseFuncTable = {
NULL,
FileAsyncReaderPin_AttemptConnection
};
static const BaseOutputPinFuncTable output_BaseOutputFuncTable = {
FileAsyncReaderPin_DecideBufferSize
};
static HRESULT FileAsyncReader_Construct(HANDLE hFile, IBaseFilter * pBaseFilter, LPCRITICAL_SECTION pCritSec, IPin ** ppPin) static HRESULT FileAsyncReader_Construct(HANDLE hFile, IBaseFilter * pBaseFilter, LPCRITICAL_SECTION pCritSec, IPin ** ppPin)
{ {
...@@ -842,7 +855,7 @@ static HRESULT FileAsyncReader_Construct(HANDLE hFile, IBaseFilter * pBaseFilter ...@@ -842,7 +855,7 @@ static HRESULT FileAsyncReader_Construct(HANDLE hFile, IBaseFilter * pBaseFilter
piOutput.dir = PINDIR_OUTPUT; piOutput.dir = PINDIR_OUTPUT;
piOutput.pFilter = pBaseFilter; piOutput.pFilter = pBaseFilter;
strcpyW(piOutput.achName, wszOutputPinName); strcpyW(piOutput.achName, wszOutputPinName);
hr = BaseOutputPin_Construct(&FileAsyncReaderPin_Vtbl, sizeof(FileAsyncReader), &piOutput, FileAsyncReaderPin_DecideBufferSize, FileAsyncReaderPin_AttemptConnection, pCritSec, ppPin); hr = BaseOutputPin_Construct(&FileAsyncReaderPin_Vtbl, sizeof(FileAsyncReader), &piOutput, &output_BaseFuncTable, &output_BaseOutputFuncTable, pCritSec, ppPin);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
......
...@@ -61,14 +61,13 @@ typedef struct NullRendererImpl ...@@ -61,14 +61,13 @@ typedef struct NullRendererImpl
BOOL bAggregatable; BOOL bAggregatable;
} NullRendererImpl; } NullRendererImpl;
static HRESULT WINAPI NullRenderer_Receive(IPin *iface, IMediaSample * pSample) static HRESULT WINAPI NullRenderer_Receive(BaseInputPin *pin, IMediaSample * pSample)
{ {
BaseInputPin *pin = (BaseInputPin*)iface;
NullRendererImpl *This = ((NullRendererImpl*)pin->pin.pinInfo.pFilter); NullRendererImpl *This = ((NullRendererImpl*)pin->pin.pinInfo.pFilter);
HRESULT hr = S_OK; HRESULT hr = S_OK;
REFERENCE_TIME start, stop; REFERENCE_TIME start, stop;
TRACE("%p %p\n", iface, pSample); TRACE("%p %p\n", pin, pSample);
if (SUCCEEDED(IMediaSample_GetTime(pSample, &start, &stop))) if (SUCCEEDED(IMediaSample_GetTime(pSample, &start, &stop)))
MediaSeekingPassThru_RegisterMediaTime(This->seekthru_unk, start); MediaSeekingPassThru_RegisterMediaTime(This->seekthru_unk, start);
...@@ -80,13 +79,13 @@ static HRESULT WINAPI NullRenderer_Receive(IPin *iface, IMediaSample * pSample) ...@@ -80,13 +79,13 @@ static HRESULT WINAPI NullRenderer_Receive(IPin *iface, IMediaSample * pSample)
return hr; return hr;
} }
static HRESULT WINAPI NullRenderer_CheckMediaType(IPin *iface, const AM_MEDIA_TYPE * pmt) static HRESULT WINAPI NullRenderer_CheckMediaType(BasePin *iface, const AM_MEDIA_TYPE * pmt)
{ {
TRACE("Not a stub!\n"); TRACE("Not a stub!\n");
return S_OK; return S_OK;
} }
static IPin* WINAPI NullRenderer_GetPin(IBaseFilter *iface, int pos) static IPin* WINAPI NullRenderer_GetPin(BaseFilter *iface, int pos)
{ {
NullRendererImpl *This = (NullRendererImpl *)iface; NullRendererImpl *This = (NullRendererImpl *)iface;
...@@ -97,11 +96,26 @@ static IPin* WINAPI NullRenderer_GetPin(IBaseFilter *iface, int pos) ...@@ -97,11 +96,26 @@ static IPin* WINAPI NullRenderer_GetPin(IBaseFilter *iface, int pos)
return (IPin *)This->pInputPin; return (IPin *)This->pInputPin;
} }
static LONG WINAPI NullRenderer_GetPinCount(IBaseFilter *iface) static LONG WINAPI NullRenderer_GetPinCount(BaseFilter *iface)
{ {
return 1; return 1;
} }
static const BaseFilterFuncTable BaseFuncTable = {
NullRenderer_GetPin,
NullRenderer_GetPinCount
};
static const BasePinFuncTable input_BaseFuncTable = {
NullRenderer_CheckMediaType,
NULL
};
static const BaseInputPinFuncTable input_BaseInputFuncTable = {
NullRenderer_Receive
};
HRESULT NullRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv) HRESULT NullRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
{ {
HRESULT hr; HRESULT hr;
...@@ -118,14 +132,14 @@ HRESULT NullRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv) ...@@ -118,14 +132,14 @@ HRESULT NullRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
pNullRenderer->bAggregatable = FALSE; pNullRenderer->bAggregatable = FALSE;
pNullRenderer->IInner_vtbl = &IInner_VTable; pNullRenderer->IInner_vtbl = &IInner_VTable;
BaseFilter_Init(&pNullRenderer->filter, &NullRenderer_Vtbl, &CLSID_NullRenderer, (DWORD_PTR)(__FILE__ ": NullRendererImpl.csFilter"), NullRenderer_GetPin, NullRenderer_GetPinCount); BaseFilter_Init(&pNullRenderer->filter, &NullRenderer_Vtbl, &CLSID_NullRenderer, (DWORD_PTR)(__FILE__ ": NullRendererImpl.csFilter"), &BaseFuncTable);
/* construct input pin */ /* construct input pin */
piInput.dir = PINDIR_INPUT; piInput.dir = PINDIR_INPUT;
piInput.pFilter = (IBaseFilter *)pNullRenderer; piInput.pFilter = (IBaseFilter *)pNullRenderer;
lstrcpynW(piInput.achName, wcsInputPinName, sizeof(piInput.achName) / sizeof(piInput.achName[0])); lstrcpynW(piInput.achName, wcsInputPinName, sizeof(piInput.achName) / sizeof(piInput.achName[0]));
hr = BaseInputPin_Construct(&NullRenderer_InputPin_Vtbl, &piInput, NullRenderer_CheckMediaType, NullRenderer_Receive, &pNullRenderer->filter.csFilter, NULL, (IPin **)&pNullRenderer->pInputPin); hr = BaseInputPin_Construct(&NullRenderer_InputPin_Vtbl, &piInput, &input_BaseFuncTable, &input_BaseInputFuncTable, &pNullRenderer->filter.csFilter, NULL, (IPin **)&pNullRenderer->pInputPin);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
......
...@@ -43,7 +43,7 @@ static const IPinVtbl Parser_InputPin_Vtbl; ...@@ -43,7 +43,7 @@ static const IPinVtbl Parser_InputPin_Vtbl;
static HRESULT WINAPI Parser_ChangeStart(IMediaSeeking *iface); static HRESULT WINAPI Parser_ChangeStart(IMediaSeeking *iface);
static HRESULT WINAPI Parser_ChangeStop(IMediaSeeking *iface); static HRESULT WINAPI Parser_ChangeStop(IMediaSeeking *iface);
static HRESULT WINAPI Parser_ChangeRate(IMediaSeeking *iface); static HRESULT WINAPI Parser_ChangeRate(IMediaSeeking *iface);
static HRESULT WINAPI Parser_OutputPin_DecideBufferSize(IPin *iface, IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest); static HRESULT WINAPI Parser_OutputPin_DecideBufferSize(BaseOutputPin *iface, IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest);
static inline ParserImpl *impl_from_IMediaSeeking( IMediaSeeking *iface ) static inline ParserImpl *impl_from_IMediaSeeking( IMediaSeeking *iface )
{ {
...@@ -51,7 +51,7 @@ static inline ParserImpl *impl_from_IMediaSeeking( IMediaSeeking *iface ) ...@@ -51,7 +51,7 @@ static inline ParserImpl *impl_from_IMediaSeeking( IMediaSeeking *iface )
} }
/* FIXME: WRONG */ /* FIXME: WRONG */
static IPin* WINAPI Parser_GetPin(IBaseFilter *iface, int pos) static IPin* WINAPI Parser_GetPin(BaseFilter *iface, int pos)
{ {
ParserImpl *This = (ParserImpl *)iface; ParserImpl *This = (ParserImpl *)iface;
...@@ -65,20 +65,25 @@ static IPin* WINAPI Parser_GetPin(IBaseFilter *iface, int pos) ...@@ -65,20 +65,25 @@ static IPin* WINAPI Parser_GetPin(IBaseFilter *iface, int pos)
return This->ppPins[pos]; return This->ppPins[pos];
} }
static LONG WINAPI Parser_GetPinCount(IBaseFilter *iface) static LONG WINAPI Parser_GetPinCount(BaseFilter *iface)
{ {
ParserImpl *This = (ParserImpl *)iface; ParserImpl *This = (ParserImpl *)iface;
return This->cStreams; return This->cStreams;
} }
static const BaseFilterFuncTable BaseFuncTable = {
Parser_GetPin,
Parser_GetPinCount
};
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, SourceSeeking_ChangeStop stop, SourceSeeking_ChangeStart start, SourceSeeking_ChangeRate rate) 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, SourceSeeking_ChangeStop stop, SourceSeeking_ChangeStart start, SourceSeeking_ChangeRate rate)
{ {
HRESULT hr; HRESULT hr;
PIN_INFO piInput; PIN_INFO piInput;
/* pTransformFilter is already allocated */ /* pTransformFilter is already allocated */
BaseFilter_Init(&pParser->filter, Parser_Vtbl, pClsid, (DWORD_PTR)(__FILE__ ": ParserImpl.csFilter"), Parser_GetPin, Parser_GetPinCount); BaseFilter_Init(&pParser->filter, Parser_Vtbl, pClsid, (DWORD_PTR)(__FILE__ ": ParserImpl.csFilter"), &BaseFuncTable);
pParser->fnDisconnect = fnDisconnect; pParser->fnDisconnect = fnDisconnect;
...@@ -402,6 +407,15 @@ HRESULT WINAPI Parser_QueryVendorInfo(IBaseFilter * iface, LPWSTR *pVendorInfo) ...@@ -402,6 +407,15 @@ HRESULT WINAPI Parser_QueryVendorInfo(IBaseFilter * iface, LPWSTR *pVendorInfo)
return BaseFilterImpl_QueryVendorInfo(iface, pVendorInfo); return BaseFilterImpl_QueryVendorInfo(iface, pVendorInfo);
} }
static const BasePinFuncTable output_BaseFuncTable = {
NULL,
BaseOutputPinImpl_AttemptConnection
};
static const BaseOutputPinFuncTable output_BaseOutputFuncTable = {
Parser_OutputPin_DecideBufferSize
};
HRESULT Parser_AddPin(ParserImpl * This, const PIN_INFO * piOutput, ALLOCATOR_PROPERTIES * props, const AM_MEDIA_TYPE * amt) HRESULT Parser_AddPin(ParserImpl * This, const PIN_INFO * piOutput, ALLOCATOR_PROPERTIES * props, const AM_MEDIA_TYPE * amt)
{ {
IPin ** ppOldPins; IPin ** ppOldPins;
...@@ -412,7 +426,7 @@ HRESULT Parser_AddPin(ParserImpl * This, const PIN_INFO * piOutput, ALLOCATOR_PR ...@@ -412,7 +426,7 @@ HRESULT Parser_AddPin(ParserImpl * This, const PIN_INFO * piOutput, ALLOCATOR_PR
This->ppPins = CoTaskMemAlloc((This->cStreams + 2) * sizeof(IPin *)); This->ppPins = CoTaskMemAlloc((This->cStreams + 2) * sizeof(IPin *));
memcpy(This->ppPins, ppOldPins, (This->cStreams + 1) * sizeof(IPin *)); memcpy(This->ppPins, ppOldPins, (This->cStreams + 1) * sizeof(IPin *));
hr = BaseOutputPin_Construct(&Parser_OutputPin_Vtbl, sizeof(Parser_OutputPin), piOutput, Parser_OutputPin_DecideBufferSize, NULL, &This->filter.csFilter, This->ppPins + (This->cStreams + 1)); hr = BaseOutputPin_Construct(&Parser_OutputPin_Vtbl, sizeof(Parser_OutputPin), piOutput, &output_BaseFuncTable, &output_BaseOutputFuncTable, &This->filter.csFilter, This->ppPins + (This->cStreams + 1));
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
...@@ -426,7 +440,7 @@ HRESULT Parser_AddPin(ParserImpl * This, const PIN_INFO * piOutput, ALLOCATOR_PR ...@@ -426,7 +440,7 @@ HRESULT Parser_AddPin(ParserImpl * This, const PIN_INFO * piOutput, ALLOCATOR_PR
pin->pin.custom_allocator = 1; pin->pin.custom_allocator = 1;
pin->allocProps = *props; pin->allocProps = *props;
This->cStreams++; This->cStreams++;
BaseFilterImpl_IncrementPinVersion((IBaseFilter*)This); BaseFilterImpl_IncrementPinVersion((BaseFilter*)This);
CoTaskMemFree(ppOldPins); CoTaskMemFree(ppOldPins);
} }
else else
...@@ -459,7 +473,7 @@ static HRESULT Parser_RemoveOutputPins(ParserImpl * This) ...@@ -459,7 +473,7 @@ static HRESULT Parser_RemoveOutputPins(ParserImpl * This)
IPin_Release(ppOldPins[i + 1]); IPin_Release(ppOldPins[i + 1]);
} }
BaseFilterImpl_IncrementPinVersion((IBaseFilter*)This); BaseFilterImpl_IncrementPinVersion((BaseFilter*)This);
This->cStreams = 0; This->cStreams = 0;
CoTaskMemFree(ppOldPins); CoTaskMemFree(ppOldPins);
...@@ -530,7 +544,7 @@ static const IMediaSeekingVtbl Parser_Seeking_Vtbl = ...@@ -530,7 +544,7 @@ static const IMediaSeekingVtbl Parser_Seeking_Vtbl =
SourceSeekingImpl_GetPreroll SourceSeekingImpl_GetPreroll
}; };
static HRESULT WINAPI Parser_OutputPin_DecideBufferSize(IPin *iface, IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest) static HRESULT WINAPI Parser_OutputPin_DecideBufferSize(BaseOutputPin *iface, IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest)
{ {
Parser_OutputPin *This = (Parser_OutputPin *)iface; Parser_OutputPin *This = (Parser_OutputPin *)iface;
ALLOCATOR_PROPERTIES actual; ALLOCATOR_PROPERTIES actual;
...@@ -547,7 +561,7 @@ static HRESULT WINAPI Parser_OutputPin_DecideBufferSize(IPin *iface, IMemAllocat ...@@ -547,7 +561,7 @@ static HRESULT WINAPI Parser_OutputPin_DecideBufferSize(IPin *iface, IMemAllocat
return IMemAllocator_SetProperties(pAlloc, &This->allocProps, &actual); return IMemAllocator_SetProperties(pAlloc, &This->allocProps, &actual);
} }
static HRESULT WINAPI Parser_OutputPin_GetMediaType(IPin *iface, int iPosition, AM_MEDIA_TYPE *pmt) static HRESULT WINAPI Parser_OutputPin_GetMediaType(BasePin *iface, int iPosition, AM_MEDIA_TYPE *pmt)
{ {
Parser_OutputPin *This = (Parser_OutputPin *)iface; Parser_OutputPin *This = (Parser_OutputPin *)iface;
if (iPosition < 0) if (iPosition < 0)
...@@ -610,7 +624,7 @@ static HRESULT WINAPI Parser_OutputPin_EnumMediaTypes(IPin * iface, IEnumMediaTy ...@@ -610,7 +624,7 @@ static HRESULT WINAPI Parser_OutputPin_EnumMediaTypes(IPin * iface, IEnumMediaTy
/* override this method to allow enumeration of your types */ /* override this method to allow enumeration of your types */
return EnumMediaTypes_Construct(iface, Parser_OutputPin_GetMediaType, BasePinImpl_GetMediaTypeVersion, ppEnum); return EnumMediaTypes_Construct((BasePin*)iface, Parser_OutputPin_GetMediaType, BasePinImpl_GetMediaTypeVersion, ppEnum);
} }
static HRESULT WINAPI Parser_OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt) static HRESULT WINAPI Parser_OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt)
......
...@@ -346,16 +346,15 @@ static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data, ...@@ -346,16 +346,15 @@ static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data,
return S_OK; return S_OK;
} }
static HRESULT WINAPI VideoRenderer_Receive(IPin* iface, IMediaSample * pSample) static HRESULT WINAPI VideoRenderer_Receive(BaseInputPin* pin, IMediaSample * pSample)
{ {
BaseInputPin* pin = (BaseInputPin*)iface;
VideoRendererImpl *This = (VideoRendererImpl *)pin->pin.pinInfo.pFilter; VideoRendererImpl *This = (VideoRendererImpl *)pin->pin.pinInfo.pFilter;
LPBYTE pbSrcStream = NULL; LPBYTE pbSrcStream = NULL;
LONG cbSrcStream = 0; LONG cbSrcStream = 0;
REFERENCE_TIME tStart, tStop; REFERENCE_TIME tStart, tStop;
HRESULT hr; HRESULT hr;
TRACE("(%p)->(%p)\n", iface, pSample); TRACE("(%p)->(%p)\n", pin, pSample);
EnterCriticalSection(&This->filter.csFilter); EnterCriticalSection(&This->filter.csFilter);
...@@ -484,7 +483,7 @@ static HRESULT WINAPI VideoRenderer_Receive(IPin* iface, IMediaSample * pSample) ...@@ -484,7 +483,7 @@ static HRESULT WINAPI VideoRenderer_Receive(IPin* iface, IMediaSample * pSample)
return S_OK; return S_OK;
} }
static HRESULT WINAPI VideoRenderer_CheckMediaType(IPin *iface, const AM_MEDIA_TYPE * pmt) static HRESULT WINAPI VideoRenderer_CheckMediaType(BasePin *iface, const AM_MEDIA_TYPE * pmt)
{ {
BaseInputPin* pin = (BaseInputPin*)iface; BaseInputPin* pin = (BaseInputPin*)iface;
VideoRendererImpl *This = (VideoRendererImpl *)pin->pin.pinInfo.pFilter; VideoRendererImpl *This = (VideoRendererImpl *)pin->pin.pinInfo.pFilter;
...@@ -534,7 +533,7 @@ static HRESULT WINAPI VideoRenderer_CheckMediaType(IPin *iface, const AM_MEDIA_T ...@@ -534,7 +533,7 @@ static HRESULT WINAPI VideoRenderer_CheckMediaType(IPin *iface, const AM_MEDIA_T
return S_FALSE; return S_FALSE;
} }
static IPin* WINAPI VideoRenderer_GetPin(IBaseFilter *iface, int pos) static IPin* WINAPI VideoRenderer_GetPin(BaseFilter *iface, int pos)
{ {
VideoRendererImpl *This = (VideoRendererImpl *)iface; VideoRendererImpl *This = (VideoRendererImpl *)iface;
...@@ -545,11 +544,25 @@ static IPin* WINAPI VideoRenderer_GetPin(IBaseFilter *iface, int pos) ...@@ -545,11 +544,25 @@ static IPin* WINAPI VideoRenderer_GetPin(IBaseFilter *iface, int pos)
return (IPin *)This->pInputPin; return (IPin *)This->pInputPin;
} }
static LONG WINAPI VideoRenderer_GetPinCount(IBaseFilter *iface) static LONG WINAPI VideoRenderer_GetPinCount(BaseFilter *iface)
{ {
return 1; return 1;
} }
static const BaseFilterFuncTable BaseFuncTable = {
VideoRenderer_GetPin,
VideoRenderer_GetPinCount
};
static const BasePinFuncTable input_BaseFuncTable = {
VideoRenderer_CheckMediaType,
NULL
};
static const BaseInputPinFuncTable input_BaseInputFuncTable = {
VideoRenderer_Receive
};
HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv) HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
{ {
HRESULT hr; HRESULT hr;
...@@ -567,7 +580,7 @@ HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv) ...@@ -567,7 +580,7 @@ HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
pVideoRenderer->bAggregatable = FALSE; pVideoRenderer->bAggregatable = FALSE;
pVideoRenderer->IInner_vtbl = &IInner_VTable; pVideoRenderer->IInner_vtbl = &IInner_VTable;
BaseFilter_Init(&pVideoRenderer->filter, &VideoRenderer_Vtbl, &CLSID_VideoRenderer, (DWORD_PTR)(__FILE__ ": VideoRendererImpl.csFilter"), VideoRenderer_GetPin, VideoRenderer_GetPinCount); BaseFilter_Init(&pVideoRenderer->filter, &VideoRenderer_Vtbl, &CLSID_VideoRenderer, (DWORD_PTR)(__FILE__ ": VideoRendererImpl.csFilter"), &BaseFuncTable);
pVideoRenderer->IBasicVideo_vtbl = &IBasicVideo_VTable; pVideoRenderer->IBasicVideo_vtbl = &IBasicVideo_VTable;
pVideoRenderer->IVideoWindow_vtbl = &IVideoWindow_VTable; pVideoRenderer->IVideoWindow_vtbl = &IVideoWindow_VTable;
...@@ -586,7 +599,7 @@ HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv) ...@@ -586,7 +599,7 @@ HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
piInput.pFilter = (IBaseFilter *)pVideoRenderer; piInput.pFilter = (IBaseFilter *)pVideoRenderer;
lstrcpynW(piInput.achName, wcsInputPinName, sizeof(piInput.achName) / sizeof(piInput.achName[0])); lstrcpynW(piInput.achName, wcsInputPinName, sizeof(piInput.achName) / sizeof(piInput.achName[0]));
hr = BaseInputPin_Construct(&VideoRenderer_InputPin_Vtbl, &piInput, VideoRenderer_CheckMediaType, VideoRenderer_Receive, &pVideoRenderer->filter.csFilter, NULL, (IPin **)&pVideoRenderer->pInputPin); hr = BaseInputPin_Construct(&VideoRenderer_InputPin_Vtbl, &piInput, &input_BaseFuncTable, &input_BaseInputFuncTable, &pVideoRenderer->filter.csFilter, NULL, (IPin **)&pVideoRenderer->pInputPin);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
......
...@@ -32,7 +32,7 @@ typedef struct IEnumPinsImpl ...@@ -32,7 +32,7 @@ typedef struct IEnumPinsImpl
const IEnumPinsVtbl * lpVtbl; const IEnumPinsVtbl * lpVtbl;
LONG refCount; LONG refCount;
ULONG uIndex; ULONG uIndex;
IBaseFilter *base; BaseFilter *base;
BaseFilter_GetPin receive_pin; BaseFilter_GetPin receive_pin;
BaseFilter_GetPinCount receive_pincount; BaseFilter_GetPinCount receive_pincount;
BaseFilter_GetPinVersion receive_version; BaseFilter_GetPinVersion receive_version;
...@@ -41,7 +41,7 @@ typedef struct IEnumPinsImpl ...@@ -41,7 +41,7 @@ typedef struct IEnumPinsImpl
static const struct IEnumPinsVtbl IEnumPinsImpl_Vtbl; static const struct IEnumPinsVtbl IEnumPinsImpl_Vtbl;
HRESULT WINAPI EnumPins_Construct(IBaseFilter *base, BaseFilter_GetPin receive_pin, BaseFilter_GetPinCount receive_pincount, BaseFilter_GetPinVersion receive_version, IEnumPins ** ppEnum) HRESULT WINAPI EnumPins_Construct(BaseFilter *base, BaseFilter_GetPin receive_pin, BaseFilter_GetPinCount receive_pincount, BaseFilter_GetPinVersion receive_version, IEnumPins ** ppEnum)
{ {
IEnumPinsImpl * pEnumPins; IEnumPinsImpl * pEnumPins;
...@@ -61,7 +61,7 @@ HRESULT WINAPI EnumPins_Construct(IBaseFilter *base, BaseFilter_GetPin receive_ ...@@ -61,7 +61,7 @@ HRESULT WINAPI EnumPins_Construct(IBaseFilter *base, BaseFilter_GetPin receive_
pEnumPins->receive_pincount = receive_pincount; pEnumPins->receive_pincount = receive_pincount;
pEnumPins->receive_version = receive_version; pEnumPins->receive_version = receive_version;
pEnumPins->base = base; pEnumPins->base = base;
IBaseFilter_AddRef(base); IBaseFilter_AddRef((IBaseFilter*)base);
*ppEnum = (IEnumPins *)(&pEnumPins->lpVtbl); *ppEnum = (IEnumPins *)(&pEnumPins->lpVtbl);
pEnumPins->Version = receive_version(base); pEnumPins->Version = receive_version(base);
...@@ -110,7 +110,7 @@ static ULONG WINAPI IEnumPinsImpl_Release(IEnumPins * iface) ...@@ -110,7 +110,7 @@ static ULONG WINAPI IEnumPinsImpl_Release(IEnumPins * iface)
if (!refCount) if (!refCount)
{ {
IBaseFilter_Release(This->base); IBaseFilter_Release((IBaseFilter*)This->base);
CoTaskMemFree(This); CoTaskMemFree(This);
return 0; return 0;
} }
......
...@@ -148,7 +148,7 @@ HRESULT WINAPI BaseFilterImpl_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum) ...@@ -148,7 +148,7 @@ HRESULT WINAPI BaseFilterImpl_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum)
TRACE("(%p)->(%p)\n", iface, ppEnum); TRACE("(%p)->(%p)\n", iface, ppEnum);
return EnumPins_Construct(iface, This->pfnGetPin, This->pfnGetPinCount, BaseFilterImpl_GetPinVersion, ppEnum); return EnumPins_Construct(This, This->pFuncsTable->pfnGetPin, This->pFuncsTable->pfnGetPinCount, BaseFilterImpl_GetPinVersion, ppEnum);
} }
...@@ -192,21 +192,19 @@ HRESULT WINAPI BaseFilterImpl_QueryVendorInfo(IBaseFilter * iface, LPWSTR *pVend ...@@ -192,21 +192,19 @@ HRESULT WINAPI BaseFilterImpl_QueryVendorInfo(IBaseFilter * iface, LPWSTR *pVend
return E_NOTIMPL; return E_NOTIMPL;
} }
LONG WINAPI BaseFilterImpl_GetPinVersion(IBaseFilter * iface) LONG WINAPI BaseFilterImpl_GetPinVersion(BaseFilter * This)
{ {
BaseFilter * This = (BaseFilter*)iface;
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
return This->pinVersion; return This->pinVersion;
} }
VOID WINAPI BaseFilterImpl_IncrementPinVersion(IBaseFilter * iface) VOID WINAPI BaseFilterImpl_IncrementPinVersion(BaseFilter * This)
{ {
BaseFilter * This = (BaseFilter*)iface;
InterlockedIncrement(&This->pinVersion); InterlockedIncrement(&This->pinVersion);
TRACE("(%p) -> New pinVersion %i\n", This,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) HRESULT WINAPI BaseFilter_Init(BaseFilter * This, const IBaseFilterVtbl *Vtbl, const CLSID *pClsid, DWORD_PTR DebugInfo, const BaseFilterFuncTable* pBaseFuncsTable)
{ {
This->lpVtbl = Vtbl; This->lpVtbl = Vtbl;
This->refCount = 1; This->refCount = 1;
...@@ -219,8 +217,7 @@ HRESULT WINAPI BaseFilter_Init(BaseFilter * This, const IBaseFilterVtbl *Vtbl, c ...@@ -219,8 +217,7 @@ HRESULT WINAPI BaseFilter_Init(BaseFilter * This, const IBaseFilterVtbl *Vtbl, c
This->csFilter.DebugInfo->Spare[0] = DebugInfo; This->csFilter.DebugInfo->Spare[0] = DebugInfo;
This->pinVersion = 1; This->pinVersion = 1;
This->pfnGetPin = pfGetPin; This->pFuncsTable = pBaseFuncsTable;
This->pfnGetPinCount = pfGetPinCount;
return S_OK; return S_OK;
} }
...@@ -87,7 +87,7 @@ typedef struct IEnumMediaTypesImpl ...@@ -87,7 +87,7 @@ typedef struct IEnumMediaTypesImpl
{ {
const IEnumMediaTypesVtbl * lpVtbl; const IEnumMediaTypesVtbl * lpVtbl;
LONG refCount; LONG refCount;
IPin *basePin; BasePin *basePin;
BasePin_GetMediaType enumMediaFunction; BasePin_GetMediaType enumMediaFunction;
BasePin_GetMediaTypeVersion mediaVersionFunction; BasePin_GetMediaTypeVersion mediaVersionFunction;
LONG currentVersion; LONG currentVersion;
...@@ -97,7 +97,7 @@ typedef struct IEnumMediaTypesImpl ...@@ -97,7 +97,7 @@ typedef struct IEnumMediaTypesImpl
static const struct IEnumMediaTypesVtbl IEnumMediaTypesImpl_Vtbl; static const struct IEnumMediaTypesVtbl IEnumMediaTypesImpl_Vtbl;
HRESULT WINAPI EnumMediaTypes_Construct(IPin *basePin, BasePin_GetMediaType enumFunc, BasePin_GetMediaTypeVersion versionFunc, IEnumMediaTypes ** ppEnum) HRESULT WINAPI EnumMediaTypes_Construct(BasePin *basePin, BasePin_GetMediaType enumFunc, BasePin_GetMediaTypeVersion versionFunc, IEnumMediaTypes ** ppEnum)
{ {
ULONG i; ULONG i;
IEnumMediaTypesImpl * pEnumMediaTypes = CoTaskMemAlloc(sizeof(IEnumMediaTypesImpl)); IEnumMediaTypesImpl * pEnumMediaTypes = CoTaskMemAlloc(sizeof(IEnumMediaTypesImpl));
...@@ -113,7 +113,7 @@ HRESULT WINAPI EnumMediaTypes_Construct(IPin *basePin, BasePin_GetMediaType enum ...@@ -113,7 +113,7 @@ HRESULT WINAPI EnumMediaTypes_Construct(IPin *basePin, BasePin_GetMediaType enum
pEnumMediaTypes->uIndex = 0; pEnumMediaTypes->uIndex = 0;
pEnumMediaTypes->enumMediaFunction = enumFunc; pEnumMediaTypes->enumMediaFunction = enumFunc;
pEnumMediaTypes->mediaVersionFunction = versionFunc; pEnumMediaTypes->mediaVersionFunction = versionFunc;
IPin_AddRef(basePin); IPin_AddRef((IPin*)basePin);
pEnumMediaTypes->basePin = basePin; pEnumMediaTypes->basePin = basePin;
i = 0; i = 0;
...@@ -183,7 +183,7 @@ static ULONG WINAPI IEnumMediaTypesImpl_Release(IEnumMediaTypes * iface) ...@@ -183,7 +183,7 @@ static ULONG WINAPI IEnumMediaTypesImpl_Release(IEnumMediaTypes * iface)
if (This->enumMediaDetails.pMediaTypes[i].pbFormat) if (This->enumMediaDetails.pMediaTypes[i].pbFormat)
CoTaskMemFree(This->enumMediaDetails.pMediaTypes[i].pbFormat); CoTaskMemFree(This->enumMediaDetails.pMediaTypes[i].pbFormat);
CoTaskMemFree(This->enumMediaDetails.pMediaTypes); CoTaskMemFree(This->enumMediaDetails.pMediaTypes);
IPin_Release(This->basePin); IPin_Release((IPin*)This->basePin);
CoTaskMemFree(This); CoTaskMemFree(This);
} }
return refCount; return refCount;
......
...@@ -45,7 +45,7 @@ static const IBaseFilterVtbl TransformFilter_Vtbl; ...@@ -45,7 +45,7 @@ static const IBaseFilterVtbl TransformFilter_Vtbl;
static const IPinVtbl TransformFilter_InputPin_Vtbl; static const IPinVtbl TransformFilter_InputPin_Vtbl;
static const IPinVtbl TransformFilter_OutputPin_Vtbl; static const IPinVtbl TransformFilter_OutputPin_Vtbl;
static HRESULT WINAPI TransformFilter_Input_CheckMediaType(IPin *iface, const AM_MEDIA_TYPE * pmt) static HRESULT WINAPI TransformFilter_Input_CheckMediaType(BasePin *iface, const AM_MEDIA_TYPE * pmt)
{ {
BaseInputPin* This = (BaseInputPin*) iface; BaseInputPin* This = (BaseInputPin*) iface;
TransformFilter * pTransform; TransformFilter * pTransform;
...@@ -60,12 +60,11 @@ static HRESULT WINAPI TransformFilter_Input_CheckMediaType(IPin *iface, const AM ...@@ -60,12 +60,11 @@ static HRESULT WINAPI TransformFilter_Input_CheckMediaType(IPin *iface, const AM
return S_OK; return S_OK;
} }
static HRESULT WINAPI TransformFilter_Input_Receive(IPin *iface, IMediaSample *pInSample) static HRESULT WINAPI TransformFilter_Input_Receive(BaseInputPin *This, IMediaSample *pInSample)
{ {
HRESULT hr = S_FALSE; HRESULT hr = S_FALSE;
BaseInputPin* This = (BaseInputPin*) iface;
TransformFilter * pTransform; TransformFilter * pTransform;
TRACE("%p\n", iface); TRACE("%p\n", This);
pTransform = (TransformFilter*)This->pin.pinInfo.pFilter; pTransform = (TransformFilter*)This->pin.pinInfo.pFilter;
EnterCriticalSection(&pTransform->filter.csFilter); EnterCriticalSection(&pTransform->filter.csFilter);
...@@ -103,14 +102,13 @@ static HRESULT WINAPI TransformFilter_Output_QueryAccept(IPin *iface, const AM_M ...@@ -103,14 +102,13 @@ static HRESULT WINAPI TransformFilter_Output_QueryAccept(IPin *iface, const AM_M
return S_FALSE; return S_FALSE;
} }
static HRESULT WINAPI TransformFilter_Output_DecideBufferSize(IPin *iface, IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest) static HRESULT WINAPI TransformFilter_Output_DecideBufferSize(BaseOutputPin *This, IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest)
{ {
BasePin *This = (BasePin *)iface; TransformFilter *pTransformFilter = (TransformFilter *)This->pin.pinInfo.pFilter;
TransformFilter *pTransformFilter = (TransformFilter *)This->pinInfo.pFilter;
return pTransformFilter->pFuncsTable->pfnDecideBufferSize(pTransformFilter, pAlloc, ppropInputRequest); return pTransformFilter->pFuncsTable->pfnDecideBufferSize(pTransformFilter, pAlloc, ppropInputRequest);
} }
static IPin* WINAPI TransformFilter_GetPin(IBaseFilter *iface, int pos) static IPin* WINAPI TransformFilter_GetPin(BaseFilter *iface, int pos)
{ {
TransformFilter *This = (TransformFilter *)iface; TransformFilter *This = (TransformFilter *)iface;
...@@ -121,20 +119,43 @@ static IPin* WINAPI TransformFilter_GetPin(IBaseFilter *iface, int pos) ...@@ -121,20 +119,43 @@ static IPin* WINAPI TransformFilter_GetPin(IBaseFilter *iface, int pos)
return This->ppPins[pos]; return This->ppPins[pos];
} }
static LONG WINAPI TransformFilter_GetPinCount(IBaseFilter *iface) static LONG WINAPI TransformFilter_GetPinCount(BaseFilter *iface)
{ {
TransformFilter *This = (TransformFilter *)iface; TransformFilter *This = (TransformFilter *)iface;
return (This->npins+1); return (This->npins+1);
} }
static const BaseFilterFuncTable tfBaseFuncTable = {
TransformFilter_GetPin,
TransformFilter_GetPinCount
};
static const BasePinFuncTable tf_input_BaseFuncTable = {
TransformFilter_Input_CheckMediaType,
NULL,
};
static const BaseInputPinFuncTable tf_input_BaseInputFuncTable = {
TransformFilter_Input_Receive
};
static const BasePinFuncTable tf_output_BaseFuncTable = {
NULL,
BaseOutputPinImpl_AttemptConnection,
};
static const BaseOutputPinFuncTable tf_output_BaseOutputFuncTable = {
TransformFilter_Output_DecideBufferSize
};
static HRESULT TransformFilter_Init(const IBaseFilterVtbl *pVtbl, const CLSID* pClsid, const TransformFilterFuncTable* pFuncsTable, TransformFilter* pTransformFilter) static HRESULT TransformFilter_Init(const IBaseFilterVtbl *pVtbl, const CLSID* pClsid, const TransformFilterFuncTable* pFuncsTable, TransformFilter* pTransformFilter)
{ {
HRESULT hr; HRESULT hr;
PIN_INFO piInput; PIN_INFO piInput;
PIN_INFO piOutput; PIN_INFO piOutput;
BaseFilter_Init(&pTransformFilter->filter, pVtbl, pClsid, (DWORD_PTR)(__FILE__ ": TransformFilter.csFilter"), TransformFilter_GetPin, TransformFilter_GetPinCount); BaseFilter_Init(&pTransformFilter->filter, pVtbl, pClsid, (DWORD_PTR)(__FILE__ ": TransformFilter.csFilter"), &tfBaseFuncTable);
/* pTransformFilter is already allocated */ /* pTransformFilter is already allocated */
pTransformFilter->pFuncsTable = pFuncsTable; pTransformFilter->pFuncsTable = pFuncsTable;
...@@ -151,11 +172,11 @@ static HRESULT TransformFilter_Init(const IBaseFilterVtbl *pVtbl, const CLSID* p ...@@ -151,11 +172,11 @@ static HRESULT TransformFilter_Init(const IBaseFilterVtbl *pVtbl, const CLSID* p
piOutput.pFilter = (IBaseFilter *)pTransformFilter; piOutput.pFilter = (IBaseFilter *)pTransformFilter;
lstrcpynW(piOutput.achName, wcsOutputPinName, sizeof(piOutput.achName) / sizeof(piOutput.achName[0])); lstrcpynW(piOutput.achName, wcsOutputPinName, sizeof(piOutput.achName) / sizeof(piOutput.achName[0]));
hr = BaseInputPin_Construct(&TransformFilter_InputPin_Vtbl, &piInput, TransformFilter_Input_CheckMediaType, TransformFilter_Input_Receive, &pTransformFilter->filter.csFilter, NULL, &pTransformFilter->ppPins[0]); hr = BaseInputPin_Construct(&TransformFilter_InputPin_Vtbl, &piInput, &tf_input_BaseFuncTable, &tf_input_BaseInputFuncTable, &pTransformFilter->filter.csFilter, NULL, &pTransformFilter->ppPins[0]);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
hr = BaseOutputPin_Construct(&TransformFilter_OutputPin_Vtbl, sizeof(BaseOutputPin), &piOutput, TransformFilter_Output_DecideBufferSize, NULL, &pTransformFilter->filter.csFilter, &pTransformFilter->ppPins[1]); hr = BaseOutputPin_Construct(&TransformFilter_OutputPin_Vtbl, sizeof(BaseOutputPin), &piOutput, &tf_output_BaseFuncTable, &tf_output_BaseOutputFuncTable, &pTransformFilter->filter.csFilter, &pTransformFilter->ppPins[1]);
if (FAILED(hr)) if (FAILED(hr))
ERR("Cannot create output pin (%x)\n", hr); ERR("Cannot create output pin (%x)\n", hr);
...@@ -487,9 +508,8 @@ static const IPinVtbl TransformFilter_InputPin_Vtbl = ...@@ -487,9 +508,8 @@ static const IPinVtbl TransformFilter_InputPin_Vtbl =
TransformFilter_InputPin_NewSegment TransformFilter_InputPin_NewSegment
}; };
static HRESULT WINAPI TransformFilter_Output_GetMediaType(IPin *iface, int iPosition, AM_MEDIA_TYPE *pmt) static HRESULT WINAPI TransformFilter_Output_GetMediaType(BasePin *This, int iPosition, AM_MEDIA_TYPE *pmt)
{ {
BasePin *This = (BasePin *)iface;
TransformFilter *pTransform = (TransformFilter *)This->pinInfo.pFilter; TransformFilter *pTransform = (TransformFilter *)This->pinInfo.pFilter;
if (iPosition < 0) if (iPosition < 0)
...@@ -505,7 +525,7 @@ static HRESULT WINAPI TransformFilter_Output_EnumMediaTypes(IPin * iface, IEnumM ...@@ -505,7 +525,7 @@ static HRESULT WINAPI TransformFilter_Output_EnumMediaTypes(IPin * iface, IEnumM
BasePin *This = (BasePin *)iface; BasePin *This = (BasePin *)iface;
TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum); TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
return EnumMediaTypes_Construct(iface, TransformFilter_Output_GetMediaType, BasePinImpl_GetMediaTypeVersion, ppEnum); return EnumMediaTypes_Construct(This, TransformFilter_Output_GetMediaType, BasePinImpl_GetMediaTypeVersion, ppEnum);
} }
static const IPinVtbl TransformFilter_OutputPin_Vtbl = static const IPinVtbl TransformFilter_OutputPin_Vtbl =
......
...@@ -24,22 +24,6 @@ void WINAPI FreeMediaType(AM_MEDIA_TYPE * pMediaType); ...@@ -24,22 +24,6 @@ void WINAPI FreeMediaType(AM_MEDIA_TYPE * pMediaType);
AM_MEDIA_TYPE * WINAPI CreateMediaType(AM_MEDIA_TYPE const * pSrc); AM_MEDIA_TYPE * WINAPI CreateMediaType(AM_MEDIA_TYPE const * pSrc);
void WINAPI DeleteMediaType(AM_MEDIA_TYPE * pMediaType); void WINAPI DeleteMediaType(AM_MEDIA_TYPE * pMediaType);
typedef HRESULT (WINAPI *BasePin_GetMediaType)(IPin* iface, int iPosition, AM_MEDIA_TYPE *amt);
typedef LONG (WINAPI *BasePin_GetMediaTypeVersion)(IPin* iface);
typedef HRESULT (WINAPI *BasePin_AttemptConnection)(IPin *iface, IPin *pReceivePin, const AM_MEDIA_TYPE *pmt);
typedef HRESULT (WINAPI *BasePin_CheckMediaType)(IPin *iface, const AM_MEDIA_TYPE *pmt);
typedef HRESULT (WINAPI *BaseOutputPin_DecideBufferSize)(IPin *iface, IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest);
typedef IPin* (WINAPI *BaseFilter_GetPin)(IBaseFilter* iface, int iPosition);
typedef LONG (WINAPI *BaseFilter_GetPinCount)(IBaseFilter* iface);
typedef LONG (WINAPI *BaseFilter_GetPinVersion)(IBaseFilter* iface);
typedef HRESULT (WINAPI *BaseInputPin_Receive)(IPin *This, IMediaSample *pSample);
HRESULT WINAPI EnumMediaTypes_Construct(IPin *iface, BasePin_GetMediaType enumFunc, BasePin_GetMediaTypeVersion versionFunc, IEnumMediaTypes ** ppEnum);
HRESULT WINAPI EnumPins_Construct(IBaseFilter *base, BaseFilter_GetPin receive_pin, BaseFilter_GetPinCount receive_pincount, BaseFilter_GetPinVersion receive_version, IEnumPins ** ppEnum);
/* Pin functions */ /* Pin functions */
typedef struct BasePin typedef struct BasePin
...@@ -50,21 +34,42 @@ typedef struct BasePin ...@@ -50,21 +34,42 @@ typedef struct BasePin
PIN_INFO pinInfo; PIN_INFO pinInfo;
IPin * pConnectedTo; IPin * pConnectedTo;
AM_MEDIA_TYPE mtCurrent; AM_MEDIA_TYPE mtCurrent;
const struct BasePinFuncTable* pFuncsTable;
} BasePin; } BasePin;
typedef HRESULT (WINAPI *BasePin_CheckMediaType)(BasePin *This, const AM_MEDIA_TYPE *pmt);
typedef HRESULT (WINAPI *BasePin_AttemptConnection)(BasePin *This, IPin *pReceivePin, const AM_MEDIA_TYPE *pmt);
typedef LONG (WINAPI *BasePin_GetMediaTypeVersion)(BasePin *This);
typedef HRESULT (WINAPI *BasePin_GetMediaType)(BasePin *This, int iPosition, AM_MEDIA_TYPE *amt);
typedef struct BasePinFuncTable {
/* Required for Input Pins*/
BasePin_CheckMediaType pfnCheckMediaType;
/* Required for Output Pins*/
BasePin_AttemptConnection pfnAttemptConnection;
} BasePinFuncTable;
typedef struct BaseOutputPin typedef struct BaseOutputPin
{ {
/* inheritance C style! */ /* inheritance C style! */
BasePin pin; BasePin pin;
IMemInputPin * pMemInputPin; IMemInputPin * pMemInputPin;
BasePin_AttemptConnection pAttemptConnection;
BaseOutputPin_DecideBufferSize pDecideBufferSize;
BOOL custom_allocator; BOOL custom_allocator;
IMemAllocator *alloc; IMemAllocator *alloc;
BOOL readonly; BOOL readonly;
const struct BaseOutputPinFuncTable* pFuncsTable;
} BaseOutputPin; } BaseOutputPin;
typedef HRESULT (WINAPI *BaseOutputPin_DecideBufferSize)(BaseOutputPin *This, IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest);
typedef struct BaseOutputPinFuncTable {
/* Required */
BaseOutputPin_DecideBufferSize pfnDecideBufferSize;
} BaseOutputPinFuncTable;
typedef struct BaseInputPin typedef struct BaseInputPin
{ {
/* inheritance C style! */ /* inheritance C style! */
...@@ -72,18 +77,25 @@ typedef struct BaseInputPin ...@@ -72,18 +77,25 @@ typedef struct BaseInputPin
const IMemInputPinVtbl * lpVtblMemInput; const IMemInputPinVtbl * lpVtblMemInput;
IMemAllocator * pAllocator; IMemAllocator * pAllocator;
BaseInputPin_Receive fnReceive;
BasePin_CheckMediaType fnCheckMediaType;
REFERENCE_TIME tStart; REFERENCE_TIME tStart;
REFERENCE_TIME tStop; REFERENCE_TIME tStop;
double dRate; double dRate;
BOOL flushing, end_of_stream; BOOL flushing, end_of_stream;
IMemAllocator *preferred_allocator; IMemAllocator *preferred_allocator;
const struct BaseInputPinFuncTable* pFuncsTable;
} BaseInputPin; } BaseInputPin;
typedef HRESULT (WINAPI *BaseInputPin_Receive)(BaseInputPin *This, IMediaSample *pSample);
typedef struct BaseInputPinFuncTable {
/* Optional */
BaseInputPin_Receive pfnReceive;
} BaseInputPinFuncTable;
/* Base Pin */ /* Base Pin */
HRESULT WINAPI BasePinImpl_GetMediaType(IPin *iface, int iPosition, AM_MEDIA_TYPE *pmt); HRESULT WINAPI BasePinImpl_GetMediaType(BasePin *This, int iPosition, AM_MEDIA_TYPE *pmt);
LONG WINAPI BasePinImpl_GetMediaTypeVersion(IPin *iface); LONG WINAPI BasePinImpl_GetMediaTypeVersion(BasePin *This);
ULONG WINAPI BasePinImpl_AddRef(IPin * iface); ULONG WINAPI BasePinImpl_AddRef(IPin * iface);
HRESULT WINAPI BasePinImpl_Disconnect(IPin * iface); HRESULT WINAPI BasePinImpl_Disconnect(IPin * iface);
HRESULT WINAPI BasePinImpl_ConnectedTo(IPin * iface, IPin ** ppPin); HRESULT WINAPI BasePinImpl_ConnectedTo(IPin * iface, IPin ** ppPin);
...@@ -113,8 +125,9 @@ HRESULT WINAPI BaseOutputPinImpl_Active(BaseOutputPin * This); ...@@ -113,8 +125,9 @@ HRESULT WINAPI BaseOutputPinImpl_Active(BaseOutputPin * This);
HRESULT WINAPI BaseOutputPinImpl_Inactive(BaseOutputPin * This); HRESULT WINAPI BaseOutputPinImpl_Inactive(BaseOutputPin * This);
HRESULT WINAPI BaseOutputPinImpl_InitAllocator(BaseOutputPin *This, IMemAllocator **pMemAlloc); HRESULT WINAPI BaseOutputPinImpl_InitAllocator(BaseOutputPin *This, IMemAllocator **pMemAlloc);
HRESULT WINAPI BaseOutputPinImpl_DecideAllocator(BaseOutputPin *This, IMemInputPin *pPin, IMemAllocator **pAlloc); HRESULT WINAPI BaseOutputPinImpl_DecideAllocator(BaseOutputPin *This, IMemInputPin *pPin, IMemAllocator **pAlloc);
HRESULT WINAPI BaseOutputPinImpl_AttemptConnection(BasePin *This, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
HRESULT WINAPI BaseOutputPin_Construct(const IPinVtbl *OutputPin_Vtbl, LONG outputpin_size, const PIN_INFO * pPinInfo, BaseOutputPin_DecideBufferSize pBufferProc, BasePin_AttemptConnection pConnectProc, LPCRITICAL_SECTION pCritSec, IPin ** ppPin); HRESULT WINAPI BaseOutputPin_Construct(const IPinVtbl *OutputPin_Vtbl, LONG outputpin_size, const PIN_INFO * pPinInfo, const BasePinFuncTable* pBaseFuncsTable, const BaseOutputPinFuncTable* pBaseOutputFuncsTable, LPCRITICAL_SECTION pCritSec, IPin ** ppPin);
/* Base Input Pin */ /* Base Input Pin */
HRESULT WINAPI BaseInputPinImpl_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv); HRESULT WINAPI BaseInputPinImpl_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv);
...@@ -127,7 +140,7 @@ HRESULT WINAPI BaseInputPinImpl_BeginFlush(IPin * iface); ...@@ -127,7 +140,7 @@ HRESULT WINAPI BaseInputPinImpl_BeginFlush(IPin * iface);
HRESULT WINAPI BaseInputPinImpl_EndFlush(IPin * iface); HRESULT WINAPI BaseInputPinImpl_EndFlush(IPin * iface);
HRESULT WINAPI BaseInputPinImpl_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate); HRESULT WINAPI BaseInputPinImpl_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, const PIN_INFO * pPinInfo, BasePin_CheckMediaType pQueryAccept, BaseInputPin_Receive pSampleProc, LPCRITICAL_SECTION pCritSec, IMemAllocator *, IPin ** ppPin); HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, const PIN_INFO * pPinInfo, const BasePinFuncTable* pBaseFuncsTable, const BaseInputPinFuncTable* pBaseInputFuncsTable, LPCRITICAL_SECTION pCritSec, IMemAllocator *, IPin ** ppPin);
typedef struct BaseFilter typedef struct BaseFilter
{ {
...@@ -142,9 +155,18 @@ typedef struct BaseFilter ...@@ -142,9 +155,18 @@ typedef struct BaseFilter
CLSID clsid; CLSID clsid;
LONG pinVersion; LONG pinVersion;
const struct BaseFilterFuncTable* pFuncsTable;
} BaseFilter;
typedef IPin* (WINAPI *BaseFilter_GetPin)(BaseFilter* iface, int iPosition);
typedef LONG (WINAPI *BaseFilter_GetPinCount)(BaseFilter* iface);
typedef LONG (WINAPI *BaseFilter_GetPinVersion)(BaseFilter* iface);
typedef struct BaseFilterFuncTable {
/* Required */
BaseFilter_GetPin pfnGetPin; BaseFilter_GetPin pfnGetPin;
BaseFilter_GetPinCount pfnGetPinCount; BaseFilter_GetPinCount pfnGetPinCount;
} BaseFilter; } BaseFilterFuncTable;
HRESULT WINAPI BaseFilterImpl_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv); HRESULT WINAPI BaseFilterImpl_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv);
ULONG WINAPI BaseFilterImpl_AddRef(IBaseFilter * iface); ULONG WINAPI BaseFilterImpl_AddRef(IBaseFilter * iface);
...@@ -158,10 +180,15 @@ HRESULT WINAPI BaseFilterImpl_QueryFilterInfo(IBaseFilter * iface, FILTER_INFO * ...@@ -158,10 +180,15 @@ HRESULT WINAPI BaseFilterImpl_QueryFilterInfo(IBaseFilter * iface, FILTER_INFO *
HRESULT WINAPI BaseFilterImpl_JoinFilterGraph(IBaseFilter * iface, IFilterGraph *pGraph, LPCWSTR pName ); HRESULT WINAPI BaseFilterImpl_JoinFilterGraph(IBaseFilter * iface, IFilterGraph *pGraph, LPCWSTR pName );
HRESULT WINAPI BaseFilterImpl_QueryVendorInfo(IBaseFilter * iface, LPWSTR *pVendorInfo); HRESULT WINAPI BaseFilterImpl_QueryVendorInfo(IBaseFilter * iface, LPWSTR *pVendorInfo);
LONG WINAPI BaseFilterImpl_GetPinVersion(IBaseFilter* This); LONG WINAPI BaseFilterImpl_GetPinVersion(BaseFilter* This);
VOID WINAPI BaseFilterImpl_IncrementPinVersion(IBaseFilter* This); VOID WINAPI BaseFilterImpl_IncrementPinVersion(BaseFilter* This);
HRESULT WINAPI BaseFilter_Init(BaseFilter * This, const IBaseFilterVtbl *Vtbl, const CLSID *pClsid, DWORD_PTR DebugInfo, const BaseFilterFuncTable* pBaseFuncsTable);
/* Enums */
HRESULT WINAPI EnumMediaTypes_Construct(BasePin *iface, BasePin_GetMediaType enumFunc, BasePin_GetMediaTypeVersion versionFunc, IEnumMediaTypes ** ppEnum);
HRESULT WINAPI BaseFilter_Init(BaseFilter * This, const IBaseFilterVtbl *Vtbl, const CLSID *pClsid, DWORD_PTR DebugInfo, BaseFilter_GetPin pfGetPin, BaseFilter_GetPinCount pfGetPinCount); HRESULT WINAPI EnumPins_Construct(BaseFilter *base, BaseFilter_GetPin receive_pin, BaseFilter_GetPinCount receive_pincount, BaseFilter_GetPinVersion receive_version, IEnumPins ** ppEnum);
/* Transform Filter */ /* Transform Filter */
typedef struct TransformFilter typedef struct TransformFilter
...@@ -190,18 +217,20 @@ typedef HRESULT (WINAPI *TransformFilter_NewSegment) (TransformFilter *iface, ...@@ -190,18 +217,20 @@ typedef HRESULT (WINAPI *TransformFilter_NewSegment) (TransformFilter *iface,
REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate); REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
typedef struct TransformFilterFuncTable { typedef struct TransformFilterFuncTable {
TransformFilter_DecideBufferSize pfnDecideBufferSize; /* Required */
TransformFilter_StartStreaming pfnStartStreaming; TransformFilter_DecideBufferSize pfnDecideBufferSize;
TransformFilter_Receive pfnReceive; /* Optional */
TransformFilter_StopStreaming pfnStopStreaming; TransformFilter_StartStreaming pfnStartStreaming;
TransformFilter_CheckInputType pfnCheckInputType; TransformFilter_Receive pfnReceive;
TransformFilter_SetMediaType pfnSetMediaType; TransformFilter_StopStreaming pfnStopStreaming;
TransformFilter_CompleteConnect pfnCompleteConnect; TransformFilter_CheckInputType pfnCheckInputType;
TransformFilter_BreakConnect pfnBreakConnect; TransformFilter_SetMediaType pfnSetMediaType;
TransformFilter_EndOfStream pfnEndOfStream; TransformFilter_CompleteConnect pfnCompleteConnect;
TransformFilter_BeginFlush pfnBeginFlush; TransformFilter_BreakConnect pfnBreakConnect;
TransformFilter_EndFlush pfnEndFlush; TransformFilter_EndOfStream pfnEndOfStream;
TransformFilter_NewSegment pfnNewSegment; TransformFilter_BeginFlush pfnBeginFlush;
TransformFilter_EndFlush pfnEndFlush;
TransformFilter_NewSegment pfnNewSegment;
} TransformFilterFuncTable; } TransformFilterFuncTable;
HRESULT WINAPI TransformFilterImpl_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv); HRESULT WINAPI TransformFilterImpl_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv);
......
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