Commit 66e1ad8a authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

strmbase: Move InputPin implementation to strmbase.

parent 5c1409b5
...@@ -52,8 +52,9 @@ typedef struct ACMWrapperImpl ...@@ -52,8 +52,9 @@ typedef struct ACMWrapperImpl
LONGLONG lasttime_sent; LONGLONG lasttime_sent;
} ACMWrapperImpl; } ACMWrapperImpl;
static HRESULT ACMWrapper_ProcessSampleData(InputPin *pin, IMediaSample *pSample) static HRESULT WINAPI ACMWrapper_ProcessSampleData(IPin *iface, IMediaSample *pSample)
{ {
BaseInputPin *pin = (BaseInputPin*) iface;
ACMWrapperImpl* This = (ACMWrapperImpl*)pin->pin.pinInfo.pFilter; ACMWrapperImpl* This = (ACMWrapperImpl*)pin->pin.pinInfo.pFilter;
AM_MEDIA_TYPE amt; AM_MEDIA_TYPE amt;
IMediaSample* pOutSample = NULL; IMediaSample* pOutSample = NULL;
...@@ -234,7 +235,7 @@ error: ...@@ -234,7 +235,7 @@ error:
return hr; return hr;
} }
static HRESULT ACMWrapper_ConnectInput(InputPin *pin, const AM_MEDIA_TYPE * pmt) static HRESULT ACMWrapper_ConnectInput(BaseInputPin *pin, const AM_MEDIA_TYPE * pmt)
{ {
ACMWrapperImpl* This = (ACMWrapperImpl *)pin->pin.pinInfo.pFilter; ACMWrapperImpl* This = (ACMWrapperImpl *)pin->pin.pinInfo.pFilter;
MMRESULT res; MMRESULT res;
...@@ -286,7 +287,7 @@ static HRESULT ACMWrapper_ConnectInput(InputPin *pin, const AM_MEDIA_TYPE * pmt) ...@@ -286,7 +287,7 @@ static HRESULT ACMWrapper_ConnectInput(InputPin *pin, const AM_MEDIA_TYPE * pmt)
return VFW_E_TYPE_NOT_ACCEPTED; return VFW_E_TYPE_NOT_ACCEPTED;
} }
static HRESULT ACMWrapper_Cleanup(InputPin *pin) static HRESULT ACMWrapper_Cleanup(BaseInputPin *pin)
{ {
ACMWrapperImpl *This = (ACMWrapperImpl *)pin->pin.pinInfo.pFilter; ACMWrapperImpl *This = (ACMWrapperImpl *)pin->pin.pinInfo.pFilter;
......
...@@ -66,8 +66,9 @@ static HRESULT AVIDec_ProcessBegin(TransformFilterImpl* pTransformFilter) ...@@ -66,8 +66,9 @@ static HRESULT AVIDec_ProcessBegin(TransformFilterImpl* pTransformFilter)
return S_OK; return S_OK;
} }
static HRESULT AVIDec_ProcessSampleData(InputPin *pin, IMediaSample *pSample) static HRESULT WINAPI AVIDec_ProcessSampleData(IPin *iface, IMediaSample *pSample)
{ {
BaseInputPin *pin = (BaseInputPin*)iface;
AVIDecImpl* This = (AVIDecImpl *)pin->pin.pinInfo.pFilter; AVIDecImpl* This = (AVIDecImpl *)pin->pin.pinInfo.pFilter;
AM_MEDIA_TYPE amt; AM_MEDIA_TYPE amt;
HRESULT hr; HRESULT hr;
...@@ -182,7 +183,7 @@ static HRESULT AVIDec_ProcessEnd(TransformFilterImpl* pTransformFilter) ...@@ -182,7 +183,7 @@ static HRESULT AVIDec_ProcessEnd(TransformFilterImpl* pTransformFilter)
return S_OK; return S_OK;
} }
static HRESULT AVIDec_ConnectInput(InputPin *pin, const AM_MEDIA_TYPE * pmt) static HRESULT AVIDec_ConnectInput(BaseInputPin *pin, const AM_MEDIA_TYPE * pmt)
{ {
AVIDecImpl* This = (AVIDecImpl*)pin->pin.pinInfo.pFilter; AVIDecImpl* This = (AVIDecImpl*)pin->pin.pinInfo.pFilter;
HRESULT hr = VFW_E_TYPE_NOT_ACCEPTED; HRESULT hr = VFW_E_TYPE_NOT_ACCEPTED;
...@@ -283,7 +284,7 @@ failed: ...@@ -283,7 +284,7 @@ failed:
return hr; return hr;
} }
static HRESULT AVIDec_Cleanup(InputPin *pin) static HRESULT AVIDec_Cleanup(BaseInputPin *pin)
{ {
AVIDecImpl *This = (AVIDecImpl *)pin->pin.pinInfo.pFilter; AVIDecImpl *This = (AVIDecImpl *)pin->pin.pinInfo.pFilter;
......
...@@ -63,7 +63,7 @@ typedef struct DSoundRenderImpl ...@@ -63,7 +63,7 @@ typedef struct DSoundRenderImpl
IReferenceClock * pClock; IReferenceClock * pClock;
FILTER_INFO filterInfo; FILTER_INFO filterInfo;
InputPin * pInputPin; BaseInputPin * pInputPin;
IDirectSound8 *dsound; IDirectSound8 *dsound;
LPDIRECTSOUNDBUFFER dsbuffer; LPDIRECTSOUNDBUFFER dsbuffer;
...@@ -211,9 +211,10 @@ static HRESULT DSoundRender_SendSampleData(DSoundRenderImpl* This, const BYTE *d ...@@ -211,9 +211,10 @@ static HRESULT DSoundRender_SendSampleData(DSoundRenderImpl* This, const BYTE *d
return hr; return hr;
} }
static HRESULT DSoundRender_Sample(LPVOID iface, IMediaSample * pSample) static HRESULT WINAPI DSoundRender_Receive(IPin *iface, IMediaSample * pSample)
{ {
DSoundRenderImpl *This = iface; BaseInputPin *pin = (BaseInputPin*)iface;
DSoundRenderImpl *This = (DSoundRenderImpl*)pin->pin.pinInfo.pFilter;
LPBYTE pbSrcStream = NULL; LPBYTE pbSrcStream = NULL;
LONG cbSrcStream = 0; LONG cbSrcStream = 0;
REFERENCE_TIME tStart, tStop; REFERENCE_TIME tStart, tStop;
...@@ -344,7 +345,7 @@ static HRESULT DSoundRender_Sample(LPVOID iface, IMediaSample * pSample) ...@@ -344,7 +345,7 @@ static HRESULT DSoundRender_Sample(LPVOID iface, IMediaSample * pSample)
return hr; return hr;
} }
static HRESULT DSoundRender_QueryAccept(LPVOID iface, const AM_MEDIA_TYPE * pmt) static HRESULT WINAPI DSoundRender_CheckMediaType(IPin *iface, const AM_MEDIA_TYPE * pmt)
{ {
WAVEFORMATEX* format; WAVEFORMATEX* format;
...@@ -397,7 +398,7 @@ HRESULT DSoundRender_create(IUnknown * pUnkOuter, LPVOID * ppv) ...@@ -397,7 +398,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 = InputPin_Construct(&DSoundRender_InputPin_Vtbl, &piInput, DSoundRender_Sample, pDSoundRender, DSoundRender_QueryAccept, NULL, &pDSoundRender->csFilter, NULL, (IPin **)&pDSoundRender->pInputPin); hr = BaseInputPin_Construct(&DSoundRender_InputPin_Vtbl, &piInput, DSoundRender_CheckMediaType, DSoundRender_Receive, &pDSoundRender->csFilter, NULL, (IPin **)&pDSoundRender->pInputPin);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
...@@ -809,7 +810,7 @@ static const IBaseFilterVtbl DSoundRender_Vtbl = ...@@ -809,7 +810,7 @@ static const IBaseFilterVtbl DSoundRender_Vtbl =
static HRESULT WINAPI DSoundRender_InputPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt) static HRESULT WINAPI DSoundRender_InputPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt)
{ {
InputPin *This = (InputPin *)iface; BaseInputPin *This = (BaseInputPin *)iface;
PIN_DIRECTION pindirReceive; PIN_DIRECTION pindirReceive;
DSoundRenderImpl *DSImpl; DSoundRenderImpl *DSImpl;
HRESULT hr = S_OK; HRESULT hr = S_OK;
...@@ -825,7 +826,7 @@ static HRESULT WINAPI DSoundRender_InputPin_ReceiveConnection(IPin * iface, IPin ...@@ -825,7 +826,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->fnQueryAccept(This->pUserData, pmt) != S_OK) if (SUCCEEDED(hr) && This->fnCheckMediaType(iface, pmt) != S_OK)
hr = VFW_E_TYPE_NOT_ACCEPTED; hr = VFW_E_TYPE_NOT_ACCEPTED;
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
...@@ -914,7 +915,7 @@ static HRESULT WINAPI DSoundRender_InputPin_Disconnect(IPin * iface) ...@@ -914,7 +915,7 @@ static HRESULT WINAPI DSoundRender_InputPin_Disconnect(IPin * iface)
static HRESULT WINAPI DSoundRender_InputPin_EndOfStream(IPin * iface) static HRESULT WINAPI DSoundRender_InputPin_EndOfStream(IPin * iface)
{ {
InputPin* This = (InputPin*)iface; BaseInputPin* This = (BaseInputPin*)iface;
DSoundRenderImpl *me = (DSoundRenderImpl*)This->pin.pinInfo.pFilter; DSoundRenderImpl *me = (DSoundRenderImpl*)This->pin.pinInfo.pFilter;
IMediaEventSink* pEventSink; IMediaEventSink* pEventSink;
HRESULT hr; HRESULT hr;
...@@ -922,7 +923,7 @@ static HRESULT WINAPI DSoundRender_InputPin_EndOfStream(IPin * iface) ...@@ -922,7 +923,7 @@ static HRESULT WINAPI DSoundRender_InputPin_EndOfStream(IPin * iface)
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(This->pin.pCritSec);
TRACE("(%p/%p)->()\n", This, iface); TRACE("(%p/%p)->()\n", This, iface);
hr = InputPin_EndOfStream(iface); hr = BaseInputPinImpl_EndOfStream(iface);
if (hr != S_OK) if (hr != S_OK)
{ {
ERR("%08x\n", hr); ERR("%08x\n", hr);
...@@ -954,14 +955,14 @@ static HRESULT WINAPI DSoundRender_InputPin_EndOfStream(IPin * iface) ...@@ -954,14 +955,14 @@ static HRESULT WINAPI DSoundRender_InputPin_EndOfStream(IPin * iface)
static HRESULT WINAPI DSoundRender_InputPin_BeginFlush(IPin * iface) static HRESULT WINAPI DSoundRender_InputPin_BeginFlush(IPin * iface)
{ {
InputPin *This = (InputPin *)iface; BaseInputPin *This = (BaseInputPin *)iface;
DSoundRenderImpl *pFilter = (DSoundRenderImpl *)This->pin.pinInfo.pFilter; DSoundRenderImpl *pFilter = (DSoundRenderImpl *)This->pin.pinInfo.pFilter;
HRESULT hr; HRESULT hr;
TRACE("\n"); TRACE("\n");
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(This->pin.pCritSec);
hr = InputPin_BeginFlush(iface); hr = BaseInputPinImpl_BeginFlush(iface);
SetEvent(pFilter->blocked); SetEvent(pFilter->blocked);
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(This->pin.pCritSec);
...@@ -970,7 +971,7 @@ static HRESULT WINAPI DSoundRender_InputPin_BeginFlush(IPin * iface) ...@@ -970,7 +971,7 @@ static HRESULT WINAPI DSoundRender_InputPin_BeginFlush(IPin * iface)
static HRESULT WINAPI DSoundRender_InputPin_EndFlush(IPin * iface) static HRESULT WINAPI DSoundRender_InputPin_EndFlush(IPin * iface)
{ {
InputPin *This = (InputPin *)iface; BaseInputPin *This = (BaseInputPin *)iface;
DSoundRenderImpl *pFilter = (DSoundRenderImpl *)This->pin.pinInfo.pFilter; DSoundRenderImpl *pFilter = (DSoundRenderImpl *)This->pin.pinInfo.pFilter;
HRESULT hr; HRESULT hr;
...@@ -1002,7 +1003,7 @@ static HRESULT WINAPI DSoundRender_InputPin_EndFlush(IPin * iface) ...@@ -1002,7 +1003,7 @@ static HRESULT WINAPI DSoundRender_InputPin_EndFlush(IPin * iface)
memset(buffer, 0, size); memset(buffer, 0, size);
IDirectSoundBuffer_Unlock(pFilter->dsbuffer, buffer, size, NULL, 0); IDirectSoundBuffer_Unlock(pFilter->dsbuffer, buffer, size, NULL, 0);
} }
hr = InputPin_EndFlush(iface); hr = BaseInputPinImpl_EndFlush(iface);
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(This->pin.pCritSec);
MediaSeekingPassThru_ResetMediaTime(pFilter->seekthru_unk); MediaSeekingPassThru_ResetMediaTime(pFilter->seekthru_unk);
...@@ -1011,10 +1012,10 @@ static HRESULT WINAPI DSoundRender_InputPin_EndFlush(IPin * iface) ...@@ -1011,10 +1012,10 @@ static HRESULT WINAPI DSoundRender_InputPin_EndFlush(IPin * iface)
static const IPinVtbl DSoundRender_InputPin_Vtbl = static const IPinVtbl DSoundRender_InputPin_Vtbl =
{ {
InputPin_QueryInterface, BaseInputPinImpl_QueryInterface,
BasePinImpl_AddRef, BasePinImpl_AddRef,
InputPin_Release, BaseInputPinImpl_Release,
InputPin_Connect, BaseInputPinImpl_Connect,
DSoundRender_InputPin_ReceiveConnection, DSoundRender_InputPin_ReceiveConnection,
DSoundRender_InputPin_Disconnect, DSoundRender_InputPin_Disconnect,
BasePinImpl_ConnectedTo, BasePinImpl_ConnectedTo,
...@@ -1022,13 +1023,13 @@ static const IPinVtbl DSoundRender_InputPin_Vtbl = ...@@ -1022,13 +1023,13 @@ static const IPinVtbl DSoundRender_InputPin_Vtbl =
BasePinImpl_QueryPinInfo, BasePinImpl_QueryPinInfo,
BasePinImpl_QueryDirection, BasePinImpl_QueryDirection,
BasePinImpl_QueryId, BasePinImpl_QueryId,
InputPin_QueryAccept, BaseInputPinImpl_QueryAccept,
BasePinImpl_EnumMediaTypes, BasePinImpl_EnumMediaTypes,
BasePinImpl_QueryInternalConnections, BasePinImpl_QueryInternalConnections,
DSoundRender_InputPin_EndOfStream, DSoundRender_InputPin_EndOfStream,
DSoundRender_InputPin_BeginFlush, DSoundRender_InputPin_BeginFlush,
DSoundRender_InputPin_EndFlush, DSoundRender_InputPin_EndFlush,
InputPin_NewSegment BaseInputPinImpl_NewSegment
}; };
/*** IUnknown methods ***/ /*** IUnknown methods ***/
......
...@@ -62,15 +62,16 @@ typedef struct NullRendererImpl ...@@ -62,15 +62,16 @@ typedef struct NullRendererImpl
IReferenceClock * pClock; IReferenceClock * pClock;
FILTER_INFO filterInfo; FILTER_INFO filterInfo;
InputPin *pInputPin; BaseInputPin *pInputPin;
IUnknown * pUnkOuter; IUnknown * pUnkOuter;
BOOL bUnkOuterValid; BOOL bUnkOuterValid;
BOOL bAggregatable; BOOL bAggregatable;
} NullRendererImpl; } NullRendererImpl;
static HRESULT NullRenderer_Sample(LPVOID iface, IMediaSample * pSample) static HRESULT WINAPI NullRenderer_Receive(IPin *iface, IMediaSample * pSample)
{ {
NullRendererImpl *This = iface; BaseInputPin *pin = (BaseInputPin*)iface;
NullRendererImpl *This = ((NullRendererImpl*)pin->pin.pinInfo.pFilter);
HRESULT hr = S_OK; HRESULT hr = S_OK;
REFERENCE_TIME start, stop; REFERENCE_TIME start, stop;
...@@ -86,7 +87,7 @@ static HRESULT NullRenderer_Sample(LPVOID iface, IMediaSample * pSample) ...@@ -86,7 +87,7 @@ static HRESULT NullRenderer_Sample(LPVOID iface, IMediaSample * pSample)
return hr; return hr;
} }
static HRESULT NullRenderer_QueryAccept(LPVOID iface, const AM_MEDIA_TYPE * pmt) static HRESULT WINAPI NullRenderer_CheckMediaType(IPin *iface, const AM_MEDIA_TYPE * pmt)
{ {
TRACE("Not a stub!\n"); TRACE("Not a stub!\n");
return S_OK; return S_OK;
...@@ -121,7 +122,7 @@ HRESULT NullRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv) ...@@ -121,7 +122,7 @@ HRESULT NullRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
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 = InputPin_Construct(&NullRenderer_InputPin_Vtbl, &piInput, NullRenderer_Sample, (LPVOID)pNullRenderer, NullRenderer_QueryAccept, NULL, &pNullRenderer->csFilter, NULL, (IPin **)&pNullRenderer->pInputPin); hr = BaseInputPin_Construct(&NullRenderer_InputPin_Vtbl, &piInput, NullRenderer_CheckMediaType, NullRenderer_Receive, &pNullRenderer->csFilter, NULL, (IPin **)&pNullRenderer->pInputPin);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
...@@ -511,7 +512,7 @@ static const IBaseFilterVtbl NullRenderer_Vtbl = ...@@ -511,7 +512,7 @@ static const IBaseFilterVtbl NullRenderer_Vtbl =
static HRESULT WINAPI NullRenderer_InputPin_EndOfStream(IPin * iface) static HRESULT WINAPI NullRenderer_InputPin_EndOfStream(IPin * iface)
{ {
InputPin* This = (InputPin*)iface; BaseInputPin* This = (BaseInputPin*)iface;
IMediaEventSink* pEventSink; IMediaEventSink* pEventSink;
NullRendererImpl *pNull; NullRendererImpl *pNull;
IFilterGraph *graph; IFilterGraph *graph;
...@@ -519,7 +520,7 @@ static HRESULT WINAPI NullRenderer_InputPin_EndOfStream(IPin * iface) ...@@ -519,7 +520,7 @@ static HRESULT WINAPI NullRenderer_InputPin_EndOfStream(IPin * iface)
TRACE("(%p/%p)->()\n", This, iface); TRACE("(%p/%p)->()\n", This, iface);
InputPin_EndOfStream(iface); BaseInputPinImpl_EndOfStream(iface);
pNull = (NullRendererImpl*)This->pin.pinInfo.pFilter; pNull = (NullRendererImpl*)This->pin.pinInfo.pFilter;
graph = pNull->filterInfo.pGraph; graph = pNull->filterInfo.pGraph;
if (graph) if (graph)
...@@ -538,13 +539,13 @@ static HRESULT WINAPI NullRenderer_InputPin_EndOfStream(IPin * iface) ...@@ -538,13 +539,13 @@ static HRESULT WINAPI NullRenderer_InputPin_EndOfStream(IPin * iface)
static HRESULT WINAPI NullRenderer_InputPin_EndFlush(IPin * iface) static HRESULT WINAPI NullRenderer_InputPin_EndFlush(IPin * iface)
{ {
InputPin* This = (InputPin*)iface; BaseInputPin* This = (BaseInputPin*)iface;
NullRendererImpl *pNull; NullRendererImpl *pNull;
HRESULT hr = S_OK; HRESULT hr = S_OK;
TRACE("(%p/%p)->()\n", This, iface); TRACE("(%p/%p)->()\n", This, iface);
hr = InputPin_EndOfStream(iface); hr = BaseInputPinImpl_EndOfStream(iface);
pNull = (NullRendererImpl*)This->pin.pinInfo.pFilter; pNull = (NullRendererImpl*)This->pin.pinInfo.pFilter;
MediaSeekingPassThru_ResetMediaTime(pNull->seekthru_unk); MediaSeekingPassThru_ResetMediaTime(pNull->seekthru_unk);
return hr; return hr;
...@@ -552,22 +553,22 @@ static HRESULT WINAPI NullRenderer_InputPin_EndFlush(IPin * iface) ...@@ -552,22 +553,22 @@ static HRESULT WINAPI NullRenderer_InputPin_EndFlush(IPin * iface)
static const IPinVtbl NullRenderer_InputPin_Vtbl = static const IPinVtbl NullRenderer_InputPin_Vtbl =
{ {
InputPin_QueryInterface, BaseInputPinImpl_QueryInterface,
BasePinImpl_AddRef, BasePinImpl_AddRef,
InputPin_Release, BaseInputPinImpl_Release,
InputPin_Connect, BaseInputPinImpl_Connect,
InputPin_ReceiveConnection, BaseInputPinImpl_ReceiveConnection,
BasePinImpl_Disconnect, BasePinImpl_Disconnect,
BasePinImpl_ConnectedTo, BasePinImpl_ConnectedTo,
BasePinImpl_ConnectionMediaType, BasePinImpl_ConnectionMediaType,
BasePinImpl_QueryPinInfo, BasePinImpl_QueryPinInfo,
BasePinImpl_QueryDirection, BasePinImpl_QueryDirection,
BasePinImpl_QueryId, BasePinImpl_QueryId,
InputPin_QueryAccept, BaseInputPinImpl_QueryAccept,
BasePinImpl_EnumMediaTypes, BasePinImpl_EnumMediaTypes,
BasePinImpl_QueryInternalConnections, BasePinImpl_QueryInternalConnections,
NullRenderer_InputPin_EndOfStream, NullRenderer_InputPin_EndOfStream,
InputPin_BeginFlush, BaseInputPinImpl_BeginFlush,
NullRenderer_InputPin_EndFlush, NullRenderer_InputPin_EndFlush,
InputPin_NewSegment BaseInputPinImpl_NewSegment
}; };
...@@ -781,7 +781,7 @@ static const IPinVtbl Parser_InputPin_Vtbl = ...@@ -781,7 +781,7 @@ static const IPinVtbl Parser_InputPin_Vtbl =
PullPin_QueryInterface, PullPin_QueryInterface,
BasePinImpl_AddRef, BasePinImpl_AddRef,
PullPin_Release, PullPin_Release,
InputPin_Connect, BaseInputPinImpl_Connect,
Parser_PullPin_ReceiveConnection, Parser_PullPin_ReceiveConnection,
Parser_PullPin_Disconnect, Parser_PullPin_Disconnect,
BasePinImpl_ConnectedTo, BasePinImpl_ConnectedTo,
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
* Cookie is the cookie that was set when requesting the buffer, if you don't * Cookie is the cookie that was set when requesting the buffer, if you don't
* implement custom requesting, you can safely ignore this * implement custom requesting, you can safely ignore this
*/ */
typedef HRESULT (* SAMPLEPROC_PUSH)(LPVOID userdata, IMediaSample * pSample);
typedef HRESULT (* SAMPLEPROC_PULL)(LPVOID userdata, IMediaSample * pSample, DWORD_PTR cookie); typedef HRESULT (* SAMPLEPROC_PULL)(LPVOID userdata, IMediaSample * pSample, DWORD_PTR cookie);
/* This function will determine whether a type is supported or not. /* This function will determine whether a type is supported or not.
...@@ -66,24 +65,6 @@ typedef HRESULT (* STOPPROCESSPROC) (LPVOID userdata); ...@@ -66,24 +65,6 @@ typedef HRESULT (* STOPPROCESSPROC) (LPVOID userdata);
#define ALIGNDOWN(value,boundary) ((value)/(boundary)*(boundary)) #define ALIGNDOWN(value,boundary) ((value)/(boundary)*(boundary))
#define ALIGNUP(value,boundary) (ALIGNDOWN((value)+(boundary)-1, (boundary))) #define ALIGNUP(value,boundary) (ALIGNDOWN((value)+(boundary)-1, (boundary)))
typedef struct InputPin
{
/* inheritance C style! */
BasePin pin;
LPVOID pUserData;
const IMemInputPinVtbl * lpVtblMemInput;
IMemAllocator * pAllocator;
QUERYACCEPTPROC fnQueryAccept;
SAMPLEPROC_PUSH fnSampleProc;
CLEANUPPROC fnCleanProc;
REFERENCE_TIME tStart;
REFERENCE_TIME tStop;
double dRate;
BOOL flushing, end_of_stream;
IMemAllocator *preferred_allocator;
} InputPin;
typedef struct PullPin typedef struct PullPin
{ {
/* inheritance C style! */ /* inheritance C style! */
...@@ -120,23 +101,11 @@ typedef struct PullPin ...@@ -120,23 +101,11 @@ typedef struct PullPin
#define Req_Pause 3 #define Req_Pause 3
/*** Constructors ***/ /*** Constructors ***/
HRESULT InputPin_Construct(const IPinVtbl *InputPin_Vtbl, const PIN_INFO * pPinInfo, SAMPLEPROC_PUSH pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, CLEANUPPROC pCleanUp, LPCRITICAL_SECTION pCritSec, IMemAllocator *, IPin ** ppPin);
HRESULT PullPin_Construct(const IPinVtbl *PullPin_Vtbl, const PIN_INFO * pPinInfo, SAMPLEPROC_PULL pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, CLEANUPPROC pCleanUp, STOPPROCESSPROC, REQUESTPROC pCustomRequest, LPCRITICAL_SECTION pCritSec, IPin ** ppPin); HRESULT PullPin_Construct(const IPinVtbl *PullPin_Vtbl, const PIN_INFO * pPinInfo, SAMPLEPROC_PULL pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, CLEANUPPROC pCleanUp, STOPPROCESSPROC, REQUESTPROC pCustomRequest, LPCRITICAL_SECTION pCritSec, IPin ** ppPin);
/**************************/ /**************************/
/*** Pin Implementation ***/ /*** Pin Implementation ***/
/* Input Pin */
HRESULT WINAPI InputPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv);
ULONG WINAPI InputPin_Release(IPin * iface);
HRESULT WINAPI InputPin_Connect(IPin * iface, IPin * pConnector, const AM_MEDIA_TYPE * pmt);
HRESULT WINAPI InputPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
HRESULT WINAPI InputPin_QueryAccept(IPin * iface, const AM_MEDIA_TYPE * pmt);
HRESULT WINAPI InputPin_EndOfStream(IPin * iface);
HRESULT WINAPI InputPin_BeginFlush(IPin * iface);
HRESULT WINAPI InputPin_EndFlush(IPin * iface);
HRESULT WINAPI InputPin_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
/* Pull Pin */ /* Pull Pin */
HRESULT WINAPI PullPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt); HRESULT WINAPI PullPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
HRESULT WINAPI PullPin_Disconnect(IPin * iface); HRESULT WINAPI PullPin_Disconnect(IPin * iface);
......
...@@ -47,7 +47,7 @@ static const IBaseFilterVtbl TransformFilter_Vtbl; ...@@ -47,7 +47,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 TransformFilter_Input_QueryAccept(LPVOID iface, const AM_MEDIA_TYPE * pmt) static HRESULT WINAPI TransformFilter_Input_CheckMediaType(IPin *iface, const AM_MEDIA_TYPE * pmt)
{ {
TransformFilterImpl* This = (TransformFilterImpl *)((BasePin *)iface)->pinInfo.pFilter; TransformFilterImpl* This = (TransformFilterImpl *)((BasePin *)iface)->pinInfo.pFilter;
TRACE("%p\n", iface); TRACE("%p\n", iface);
...@@ -105,7 +105,7 @@ HRESULT TransformFilter_Create(TransformFilterImpl* pTransformFilter, const CLSI ...@@ -105,7 +105,7 @@ HRESULT TransformFilter_Create(TransformFilterImpl* pTransformFilter, const CLSI
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 = InputPin_Construct(&TransformFilter_InputPin_Vtbl, &piInput, (SAMPLEPROC_PUSH)pFuncsTable->pfnProcessSampleData, NULL, TransformFilter_Input_QueryAccept, NULL, &pTransformFilter->csFilter, NULL, &pTransformFilter->ppPins[0]); hr = BaseInputPin_Construct(&TransformFilter_InputPin_Vtbl, &piInput, TransformFilter_Input_CheckMediaType, pFuncsTable->pfnProcessSampleData, &pTransformFilter->csFilter, NULL, &pTransformFilter->ppPins[0]);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
...@@ -115,8 +115,6 @@ HRESULT TransformFilter_Create(TransformFilterImpl* pTransformFilter, const CLSI ...@@ -115,8 +115,6 @@ HRESULT TransformFilter_Create(TransformFilterImpl* pTransformFilter, const CLSI
props.cbBuffer = 0; /* Will be updated at connection time */ props.cbBuffer = 0; /* Will be updated at connection time */
props.cBuffers = 1; props.cBuffers = 1;
((InputPin *)pTransformFilter->ppPins[0])->pUserData = pTransformFilter->ppPins[0];
hr = BaseOutputPin_Construct(&TransformFilter_OutputPin_Vtbl, sizeof(BaseOutputPin), &piOutput, &props, NULL, &pTransformFilter->csFilter, &pTransformFilter->ppPins[1]); hr = BaseOutputPin_Construct(&TransformFilter_OutputPin_Vtbl, sizeof(BaseOutputPin), &piOutput, &props, NULL, &pTransformFilter->csFilter, &pTransformFilter->ppPins[1]);
if (FAILED(hr)) if (FAILED(hr))
...@@ -291,7 +289,7 @@ static HRESULT WINAPI TransformFilter_Run(IBaseFilter * iface, REFERENCE_TIME tS ...@@ -291,7 +289,7 @@ static HRESULT WINAPI TransformFilter_Run(IBaseFilter * iface, REFERENCE_TIME tS
{ {
if (This->state == State_Stopped) if (This->state == State_Stopped)
{ {
((InputPin *)This->ppPins[0])->end_of_stream = 0; ((BaseInputPin *)This->ppPins[0])->end_of_stream = 0;
if (This->pFuncsTable->pfnProcessBegin) if (This->pFuncsTable->pfnProcessBegin)
hr = This->pFuncsTable->pfnProcessBegin(This); hr = This->pFuncsTable->pfnProcessBegin(This);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
...@@ -467,7 +465,7 @@ static const IBaseFilterVtbl TransformFilter_Vtbl = ...@@ -467,7 +465,7 @@ static const IBaseFilterVtbl TransformFilter_Vtbl =
static HRESULT WINAPI TransformFilter_InputPin_EndOfStream(IPin * iface) static HRESULT WINAPI TransformFilter_InputPin_EndOfStream(IPin * iface)
{ {
InputPin* This = (InputPin*) iface; BaseInputPin* This = (BaseInputPin*) iface;
TransformFilterImpl* pTransform; TransformFilterImpl* pTransform;
IPin* ppin; IPin* ppin;
HRESULT hr; HRESULT hr;
...@@ -493,7 +491,7 @@ static HRESULT WINAPI TransformFilter_InputPin_EndOfStream(IPin * iface) ...@@ -493,7 +491,7 @@ static HRESULT WINAPI TransformFilter_InputPin_EndOfStream(IPin * iface)
static HRESULT WINAPI TransformFilter_InputPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt) static HRESULT WINAPI TransformFilter_InputPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt)
{ {
InputPin* This = (InputPin*) iface; BaseInputPin* This = (BaseInputPin*) iface;
TransformFilterImpl* pTransform; TransformFilterImpl* pTransform;
HRESULT hr; HRESULT hr;
...@@ -504,7 +502,7 @@ static HRESULT WINAPI TransformFilter_InputPin_ReceiveConnection(IPin * iface, I ...@@ -504,7 +502,7 @@ static HRESULT WINAPI TransformFilter_InputPin_ReceiveConnection(IPin * iface, I
hr = pTransform->pFuncsTable->pfnConnectInput(This, pmt); hr = pTransform->pFuncsTable->pfnConnectInput(This, pmt);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
hr = InputPin_ReceiveConnection(iface, pReceivePin, pmt); hr = BaseInputPinImpl_ReceiveConnection(iface, pReceivePin, pmt);
if (FAILED(hr)) if (FAILED(hr))
pTransform->pFuncsTable->pfnCleanup(This); pTransform->pFuncsTable->pfnCleanup(This);
} }
...@@ -514,7 +512,7 @@ static HRESULT WINAPI TransformFilter_InputPin_ReceiveConnection(IPin * iface, I ...@@ -514,7 +512,7 @@ static HRESULT WINAPI TransformFilter_InputPin_ReceiveConnection(IPin * iface, I
static HRESULT WINAPI TransformFilter_InputPin_Disconnect(IPin * iface) static HRESULT WINAPI TransformFilter_InputPin_Disconnect(IPin * iface)
{ {
InputPin* This = (InputPin*) iface; BaseInputPin* This = (BaseInputPin*) iface;
TransformFilterImpl* pTransform; TransformFilterImpl* pTransform;
TRACE("(%p)->()\n", iface); TRACE("(%p)->()\n", iface);
...@@ -527,7 +525,7 @@ static HRESULT WINAPI TransformFilter_InputPin_Disconnect(IPin * iface) ...@@ -527,7 +525,7 @@ static HRESULT WINAPI TransformFilter_InputPin_Disconnect(IPin * iface)
static HRESULT WINAPI TransformFilter_InputPin_BeginFlush(IPin * iface) static HRESULT WINAPI TransformFilter_InputPin_BeginFlush(IPin * iface)
{ {
InputPin* This = (InputPin*) iface; BaseInputPin* This = (BaseInputPin*) iface;
TransformFilterImpl* pTransform; TransformFilterImpl* pTransform;
HRESULT hr = S_OK; HRESULT hr = S_OK;
...@@ -538,14 +536,14 @@ static HRESULT WINAPI TransformFilter_InputPin_BeginFlush(IPin * iface) ...@@ -538,14 +536,14 @@ static HRESULT WINAPI TransformFilter_InputPin_BeginFlush(IPin * iface)
if (pTransform->pFuncsTable->pfnBeginFlush) if (pTransform->pFuncsTable->pfnBeginFlush)
hr = pTransform->pFuncsTable->pfnBeginFlush(This); hr = pTransform->pFuncsTable->pfnBeginFlush(This);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
hr = InputPin_BeginFlush(iface); hr = BaseInputPinImpl_BeginFlush(iface);
LeaveCriticalSection(&pTransform->csFilter); LeaveCriticalSection(&pTransform->csFilter);
return hr; return hr;
} }
static HRESULT WINAPI TransformFilter_InputPin_EndFlush(IPin * iface) static HRESULT WINAPI TransformFilter_InputPin_EndFlush(IPin * iface)
{ {
InputPin* This = (InputPin*) iface; BaseInputPin* This = (BaseInputPin*) iface;
TransformFilterImpl* pTransform; TransformFilterImpl* pTransform;
HRESULT hr = S_OK; HRESULT hr = S_OK;
...@@ -556,14 +554,14 @@ static HRESULT WINAPI TransformFilter_InputPin_EndFlush(IPin * iface) ...@@ -556,14 +554,14 @@ static HRESULT WINAPI TransformFilter_InputPin_EndFlush(IPin * iface)
if (pTransform->pFuncsTable->pfnEndFlush) if (pTransform->pFuncsTable->pfnEndFlush)
hr = pTransform->pFuncsTable->pfnEndFlush(This); hr = pTransform->pFuncsTable->pfnEndFlush(This);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
hr = InputPin_EndFlush(iface); hr = BaseInputPinImpl_EndFlush(iface);
LeaveCriticalSection(&pTransform->csFilter); LeaveCriticalSection(&pTransform->csFilter);
return hr; return hr;
} }
static HRESULT WINAPI TransformFilter_InputPin_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate) static HRESULT WINAPI TransformFilter_InputPin_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{ {
InputPin* This = (InputPin*) iface; BaseInputPin* This = (BaseInputPin*) iface;
TransformFilterImpl* pTransform; TransformFilterImpl* pTransform;
HRESULT hr = S_OK; HRESULT hr = S_OK;
...@@ -574,17 +572,17 @@ static HRESULT WINAPI TransformFilter_InputPin_NewSegment(IPin * iface, REFERENC ...@@ -574,17 +572,17 @@ static HRESULT WINAPI TransformFilter_InputPin_NewSegment(IPin * iface, REFERENC
if (pTransform->pFuncsTable->pfnNewSegment) if (pTransform->pFuncsTable->pfnNewSegment)
hr = pTransform->pFuncsTable->pfnNewSegment(This, tStart, tStop, dRate); hr = pTransform->pFuncsTable->pfnNewSegment(This, tStart, tStop, dRate);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
hr = InputPin_NewSegment(iface, tStart, tStop, dRate); hr = BaseInputPinImpl_NewSegment(iface, tStart, tStop, dRate);
LeaveCriticalSection(&pTransform->csFilter); LeaveCriticalSection(&pTransform->csFilter);
return hr; return hr;
} }
static const IPinVtbl TransformFilter_InputPin_Vtbl = static const IPinVtbl TransformFilter_InputPin_Vtbl =
{ {
InputPin_QueryInterface, BaseInputPinImpl_QueryInterface,
BasePinImpl_AddRef, BasePinImpl_AddRef,
InputPin_Release, BaseInputPinImpl_Release,
InputPin_Connect, BaseInputPinImpl_Connect,
TransformFilter_InputPin_ReceiveConnection, TransformFilter_InputPin_ReceiveConnection,
TransformFilter_InputPin_Disconnect, TransformFilter_InputPin_Disconnect,
BasePinImpl_ConnectedTo, BasePinImpl_ConnectedTo,
...@@ -592,7 +590,7 @@ static const IPinVtbl TransformFilter_InputPin_Vtbl = ...@@ -592,7 +590,7 @@ static const IPinVtbl TransformFilter_InputPin_Vtbl =
BasePinImpl_QueryPinInfo, BasePinImpl_QueryPinInfo,
BasePinImpl_QueryDirection, BasePinImpl_QueryDirection,
BasePinImpl_QueryId, BasePinImpl_QueryId,
InputPin_QueryAccept, BaseInputPinImpl_QueryAccept,
BasePinImpl_EnumMediaTypes, BasePinImpl_EnumMediaTypes,
BasePinImpl_QueryInternalConnections, BasePinImpl_QueryInternalConnections,
TransformFilter_InputPin_EndOfStream, TransformFilter_InputPin_EndOfStream,
......
...@@ -24,15 +24,15 @@ typedef struct TransformFilterImpl TransformFilterImpl; ...@@ -24,15 +24,15 @@ typedef struct TransformFilterImpl TransformFilterImpl;
typedef struct TransformFuncsTable { typedef struct TransformFuncsTable {
HRESULT (*pfnProcessBegin) (TransformFilterImpl *This); HRESULT (*pfnProcessBegin) (TransformFilterImpl *This);
HRESULT (*pfnProcessSampleData) (InputPin *pin, IMediaSample *pSample); BaseInputPin_Receive pfnProcessSampleData;
HRESULT (*pfnProcessEnd) (TransformFilterImpl *This); HRESULT (*pfnProcessEnd) (TransformFilterImpl *This);
HRESULT (*pfnQueryConnect) (TransformFilterImpl *This, const AM_MEDIA_TYPE * pmt); HRESULT (*pfnQueryConnect) (TransformFilterImpl *This, const AM_MEDIA_TYPE * pmt);
HRESULT (*pfnConnectInput) (InputPin *pin, const AM_MEDIA_TYPE * pmt); HRESULT (*pfnConnectInput) (BaseInputPin *pin, const AM_MEDIA_TYPE * pmt);
HRESULT (*pfnCleanup) (InputPin *pin); HRESULT (*pfnCleanup) (BaseInputPin *pin);
HRESULT (*pfnEndOfStream) (InputPin *pin); HRESULT (*pfnEndOfStream) (BaseInputPin *pin);
HRESULT (*pfnBeginFlush) (InputPin *pin); HRESULT (*pfnBeginFlush) (BaseInputPin *pin);
HRESULT (*pfnEndFlush) (InputPin *pin); HRESULT (*pfnEndFlush) (BaseInputPin *pin);
HRESULT (*pfnNewSegment) (InputPin *pin, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate); HRESULT (*pfnNewSegment) (BaseInputPin *pin, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
} TransformFuncsTable; } TransformFuncsTable;
struct TransformFilterImpl struct TransformFilterImpl
......
...@@ -68,7 +68,7 @@ typedef struct VideoRendererImpl ...@@ -68,7 +68,7 @@ typedef struct VideoRendererImpl
IReferenceClock * pClock; IReferenceClock * pClock;
FILTER_INFO filterInfo; FILTER_INFO filterInfo;
InputPin *pInputPin; BaseInputPin *pInputPin;
BOOL init; BOOL init;
HANDLE hThread; HANDLE hThread;
...@@ -354,9 +354,10 @@ static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data, ...@@ -354,9 +354,10 @@ static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data,
return S_OK; return S_OK;
} }
static HRESULT VideoRenderer_Sample(LPVOID iface, IMediaSample * pSample) static HRESULT WINAPI VideoRenderer_Receive(IPin* iface, IMediaSample * pSample)
{ {
VideoRendererImpl *This = iface; BaseInputPin* pin = (BaseInputPin*)iface;
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;
...@@ -491,8 +492,11 @@ static HRESULT VideoRenderer_Sample(LPVOID iface, IMediaSample * pSample) ...@@ -491,8 +492,11 @@ static HRESULT VideoRenderer_Sample(LPVOID iface, IMediaSample * pSample)
return S_OK; return S_OK;
} }
static HRESULT VideoRenderer_QueryAccept(LPVOID iface, const AM_MEDIA_TYPE * pmt) static HRESULT WINAPI VideoRenderer_CheckMediaType(IPin *iface, const AM_MEDIA_TYPE * pmt)
{ {
BaseInputPin* pin = (BaseInputPin*)iface;
VideoRendererImpl *This = (VideoRendererImpl *)pin->pin.pinInfo.pFilter;
if (!IsEqualIID(&pmt->majortype, &MEDIATYPE_Video)) if (!IsEqualIID(&pmt->majortype, &MEDIATYPE_Video))
return S_FALSE; return S_FALSE;
...@@ -501,7 +505,6 @@ static HRESULT VideoRenderer_QueryAccept(LPVOID iface, const AM_MEDIA_TYPE * pmt ...@@ -501,7 +505,6 @@ static HRESULT VideoRenderer_QueryAccept(LPVOID iface, const AM_MEDIA_TYPE * pmt
IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB565) || IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB565) ||
IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB8)) IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB8))
{ {
VideoRendererImpl* This = iface;
LONG height; LONG height;
if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo)) if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo))
...@@ -580,7 +583,7 @@ HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv) ...@@ -580,7 +583,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 = InputPin_Construct(&VideoRenderer_InputPin_Vtbl, &piInput, VideoRenderer_Sample, (LPVOID)pVideoRenderer, VideoRenderer_QueryAccept, NULL, &pVideoRenderer->csFilter, NULL, (IPin **)&pVideoRenderer->pInputPin); hr = BaseInputPin_Construct(&VideoRenderer_InputPin_Vtbl, &piInput, VideoRenderer_CheckMediaType, VideoRenderer_Receive, &pVideoRenderer->csFilter, NULL, (IPin **)&pVideoRenderer->pInputPin);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
...@@ -1010,7 +1013,7 @@ static const IBaseFilterVtbl VideoRenderer_Vtbl = ...@@ -1010,7 +1013,7 @@ static const IBaseFilterVtbl VideoRenderer_Vtbl =
static HRESULT WINAPI VideoRenderer_InputPin_EndOfStream(IPin * iface) static HRESULT WINAPI VideoRenderer_InputPin_EndOfStream(IPin * iface)
{ {
InputPin* This = (InputPin*)iface; BaseInputPin* This = (BaseInputPin*)iface;
VideoRendererImpl *pFilter; VideoRendererImpl *pFilter;
IMediaEventSink* pEventSink; IMediaEventSink* pEventSink;
HRESULT hr; HRESULT hr;
...@@ -1031,7 +1034,7 @@ static HRESULT WINAPI VideoRenderer_InputPin_EndOfStream(IPin * iface) ...@@ -1031,7 +1034,7 @@ static HRESULT WINAPI VideoRenderer_InputPin_EndOfStream(IPin * iface)
static HRESULT WINAPI VideoRenderer_InputPin_BeginFlush(IPin * iface) static HRESULT WINAPI VideoRenderer_InputPin_BeginFlush(IPin * iface)
{ {
InputPin* This = (InputPin*)iface; BaseInputPin* This = (BaseInputPin*)iface;
VideoRendererImpl *pVideoRenderer = (VideoRendererImpl *)This->pin.pinInfo.pFilter; VideoRendererImpl *pVideoRenderer = (VideoRendererImpl *)This->pin.pinInfo.pFilter;
HRESULT hr; HRESULT hr;
...@@ -1041,7 +1044,7 @@ static HRESULT WINAPI VideoRenderer_InputPin_BeginFlush(IPin * iface) ...@@ -1041,7 +1044,7 @@ static HRESULT WINAPI VideoRenderer_InputPin_BeginFlush(IPin * iface)
if (pVideoRenderer->state == State_Paused) if (pVideoRenderer->state == State_Paused)
SetEvent(pVideoRenderer->blocked); SetEvent(pVideoRenderer->blocked);
hr = InputPin_BeginFlush(iface); hr = BaseInputPinImpl_BeginFlush(iface);
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(This->pin.pCritSec);
return hr; return hr;
...@@ -1049,7 +1052,7 @@ static HRESULT WINAPI VideoRenderer_InputPin_BeginFlush(IPin * iface) ...@@ -1049,7 +1052,7 @@ static HRESULT WINAPI VideoRenderer_InputPin_BeginFlush(IPin * iface)
static HRESULT WINAPI VideoRenderer_InputPin_EndFlush(IPin * iface) static HRESULT WINAPI VideoRenderer_InputPin_EndFlush(IPin * iface)
{ {
InputPin* This = (InputPin*)iface; BaseInputPin* This = (BaseInputPin*)iface;
VideoRendererImpl *pVideoRenderer = (VideoRendererImpl *)This->pin.pinInfo.pFilter; VideoRendererImpl *pVideoRenderer = (VideoRendererImpl *)This->pin.pinInfo.pFilter;
HRESULT hr; HRESULT hr;
...@@ -1059,7 +1062,7 @@ static HRESULT WINAPI VideoRenderer_InputPin_EndFlush(IPin * iface) ...@@ -1059,7 +1062,7 @@ static HRESULT WINAPI VideoRenderer_InputPin_EndFlush(IPin * iface)
if (pVideoRenderer->state == State_Paused) if (pVideoRenderer->state == State_Paused)
ResetEvent(pVideoRenderer->blocked); ResetEvent(pVideoRenderer->blocked);
hr = InputPin_EndFlush(iface); hr = BaseInputPinImpl_EndFlush(iface);
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(This->pin.pCritSec);
MediaSeekingPassThru_ResetMediaTime(pVideoRenderer->seekthru_unk); MediaSeekingPassThru_ResetMediaTime(pVideoRenderer->seekthru_unk);
...@@ -1068,24 +1071,24 @@ static HRESULT WINAPI VideoRenderer_InputPin_EndFlush(IPin * iface) ...@@ -1068,24 +1071,24 @@ static HRESULT WINAPI VideoRenderer_InputPin_EndFlush(IPin * iface)
static const IPinVtbl VideoRenderer_InputPin_Vtbl = static const IPinVtbl VideoRenderer_InputPin_Vtbl =
{ {
InputPin_QueryInterface, BaseInputPinImpl_QueryInterface,
BasePinImpl_AddRef, BasePinImpl_AddRef,
InputPin_Release, BaseInputPinImpl_Release,
InputPin_Connect, BaseInputPinImpl_Connect,
InputPin_ReceiveConnection, BaseInputPinImpl_ReceiveConnection,
BasePinImpl_Disconnect, BasePinImpl_Disconnect,
BasePinImpl_ConnectedTo, BasePinImpl_ConnectedTo,
BasePinImpl_ConnectionMediaType, BasePinImpl_ConnectionMediaType,
BasePinImpl_QueryPinInfo, BasePinImpl_QueryPinInfo,
BasePinImpl_QueryDirection, BasePinImpl_QueryDirection,
BasePinImpl_QueryId, BasePinImpl_QueryId,
InputPin_QueryAccept, BaseInputPinImpl_QueryAccept,
BasePinImpl_EnumMediaTypes, BasePinImpl_EnumMediaTypes,
BasePinImpl_QueryInternalConnections, BasePinImpl_QueryInternalConnections,
VideoRenderer_InputPin_EndOfStream, VideoRenderer_InputPin_EndOfStream,
VideoRenderer_InputPin_BeginFlush, VideoRenderer_InputPin_BeginFlush,
VideoRenderer_InputPin_EndFlush, VideoRenderer_InputPin_EndFlush,
InputPin_NewSegment BaseInputPinImpl_NewSegment
}; };
/*** IUnknown methods ***/ /*** IUnknown methods ***/
......
...@@ -27,11 +27,14 @@ void WINAPI DeleteMediaType(AM_MEDIA_TYPE * pMediaType); ...@@ -27,11 +27,14 @@ void WINAPI DeleteMediaType(AM_MEDIA_TYPE * pMediaType);
typedef HRESULT (WINAPI *BasePin_GetMediaType)(IPin* iface, int iPosition, AM_MEDIA_TYPE *amt); typedef HRESULT (WINAPI *BasePin_GetMediaType)(IPin* iface, int iPosition, AM_MEDIA_TYPE *amt);
typedef LONG (WINAPI *BasePin_GetMediaTypeVersion)(IPin* iface); 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_AttemptConnection)(IPin *iface, IPin *pReceivePin, const AM_MEDIA_TYPE *pmt);
typedef HRESULT (WINAPI *BasePin_CheckMediaType)(IPin *iface, const AM_MEDIA_TYPE *pmt);
typedef IPin* (WINAPI *BaseFilter_GetPin)(IBaseFilter* iface, int iPosition); typedef IPin* (WINAPI *BaseFilter_GetPin)(IBaseFilter* iface, int iPosition);
typedef LONG (WINAPI *BaseFilter_GetPinCount)(IBaseFilter* iface); typedef LONG (WINAPI *BaseFilter_GetPinCount)(IBaseFilter* iface);
typedef LONG (WINAPI *BaseFilter_GetPinVersion)(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 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); HRESULT WINAPI EnumPins_Construct(IBaseFilter *base, BaseFilter_GetPin receive_pin, BaseFilter_GetPinCount receive_pincount, BaseFilter_GetPinVersion receive_version, IEnumPins ** ppEnum);
...@@ -61,6 +64,22 @@ typedef struct BaseOutputPin ...@@ -61,6 +64,22 @@ typedef struct BaseOutputPin
ALLOCATOR_PROPERTIES allocProps; ALLOCATOR_PROPERTIES allocProps;
} BaseOutputPin; } BaseOutputPin;
typedef struct BaseInputPin
{
/* inheritance C style! */
BasePin pin;
const IMemInputPinVtbl * lpVtblMemInput;
IMemAllocator * pAllocator;
BaseInputPin_Receive fnReceive;
BasePin_CheckMediaType fnCheckMediaType;
REFERENCE_TIME tStart;
REFERENCE_TIME tStop;
double dRate;
BOOL flushing, end_of_stream;
IMemAllocator *preferred_allocator;
} BaseInputPin;
/* Base Pin */ /* Base Pin */
HRESULT WINAPI BasePinImpl_GetMediaType(IPin *iface, int iPosition, AM_MEDIA_TYPE *pmt); HRESULT WINAPI BasePinImpl_GetMediaType(IPin *iface, int iPosition, AM_MEDIA_TYPE *pmt);
LONG WINAPI BasePinImpl_GetMediaTypeVersion(IPin *iface); LONG WINAPI BasePinImpl_GetMediaTypeVersion(IPin *iface);
...@@ -92,3 +111,16 @@ HRESULT WINAPI BaseOutputPinImpl_BreakConnect(BaseOutputPin * This); ...@@ -92,3 +111,16 @@ HRESULT WINAPI BaseOutputPinImpl_BreakConnect(BaseOutputPin * This);
HRESULT WINAPI BaseOutputPinImpl_Active(BaseOutputPin * This); HRESULT WINAPI BaseOutputPinImpl_Active(BaseOutputPin * This);
HRESULT WINAPI BaseOutputPinImpl_Inactive(BaseOutputPin * This); HRESULT WINAPI BaseOutputPinImpl_Inactive(BaseOutputPin * This);
HRESULT WINAPI BaseOutputPin_Construct(const IPinVtbl *OutputPin_Vtbl, LONG outputpin_size, const PIN_INFO * pPinInfo, ALLOCATOR_PROPERTIES *props, BasePin_AttemptConnection pConnectProc, LPCRITICAL_SECTION pCritSec, IPin ** ppPin); HRESULT WINAPI BaseOutputPin_Construct(const IPinVtbl *OutputPin_Vtbl, LONG outputpin_size, const PIN_INFO * pPinInfo, ALLOCATOR_PROPERTIES *props, BasePin_AttemptConnection pConnectProc, LPCRITICAL_SECTION pCritSec, IPin ** ppPin);
/* Base Input Pin */
HRESULT WINAPI BaseInputPinImpl_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv);
ULONG WINAPI BaseInputPinImpl_Release(IPin * iface);
HRESULT WINAPI BaseInputPinImpl_Connect(IPin * iface, IPin * pConnector, const AM_MEDIA_TYPE * pmt);
HRESULT WINAPI BaseInputPinImpl_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
HRESULT WINAPI BaseInputPinImpl_QueryAccept(IPin * iface, const AM_MEDIA_TYPE * pmt);
HRESULT WINAPI BaseInputPinImpl_EndOfStream(IPin * iface);
HRESULT WINAPI BaseInputPinImpl_BeginFlush(IPin * iface);
HRESULT WINAPI BaseInputPinImpl_EndFlush(IPin * iface);
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);
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