strmbase/transform: Store the pins inline in the TransformFilter structure.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-06-20 20:13:17 -05:00 committed by Alexandre Julliard
parent 2adc44df2e
commit 2d5c9d0666
6 changed files with 79 additions and 144 deletions

View File

@ -59,7 +59,6 @@ static inline ACMWrapperImpl *impl_from_TransformFilter( TransformFilter *iface
static HRESULT WINAPI ACMWrapper_Receive(TransformFilter *tf, IMediaSample *pSample) static HRESULT WINAPI ACMWrapper_Receive(TransformFilter *tf, IMediaSample *pSample)
{ {
ACMWrapperImpl* This = impl_from_TransformFilter(tf); ACMWrapperImpl* This = impl_from_TransformFilter(tf);
AM_MEDIA_TYPE amt;
IMediaSample* pOutSample = NULL; IMediaSample* pOutSample = NULL;
DWORD cbDstStream, cbSrcStream; DWORD cbDstStream, cbSrcStream;
LPBYTE pbDstStream; LPBYTE pbDstStream;
@ -103,20 +102,12 @@ static HRESULT WINAPI ACMWrapper_Receive(TransformFilter *tf, IMediaSample *pSam
TRACE("Sample data ptr = %p, size = %d\n", pbSrcStream, cbSrcStream); TRACE("Sample data ptr = %p, size = %d\n", pbSrcStream, cbSrcStream);
hr = IPin_ConnectionMediaType(This->tf.ppPins[0], &amt);
if (FAILED(hr))
{
ERR("Unable to retrieve media type\n");
LeaveCriticalSection(&This->tf.csReceive);
return hr;
}
ash.pbSrc = pbSrcStream; ash.pbSrc = pbSrcStream;
ash.cbSrcLength = cbSrcStream; ash.cbSrcLength = cbSrcStream;
while(hr == S_OK && ash.cbSrcLength) while(hr == S_OK && ash.cbSrcLength)
{ {
hr = BaseOutputPinImpl_GetDeliveryBuffer((BaseOutputPin*)This->tf.ppPins[1], &pOutSample, NULL, NULL, 0); hr = BaseOutputPinImpl_GetDeliveryBuffer(&This->tf.source, &pOutSample, NULL, NULL, 0);
if (FAILED(hr)) if (FAILED(hr))
{ {
ERR("Unable to get delivery buffer (%x)\n", hr); ERR("Unable to get delivery buffer (%x)\n", hr);
@ -216,7 +207,7 @@ static HRESULT WINAPI ACMWrapper_Receive(TransformFilter *tf, IMediaSample *pSam
TRACE("Sample stop time: %u.%03u\n", (DWORD)(tStart/10000000), (DWORD)((tStart/10000)%1000)); TRACE("Sample stop time: %u.%03u\n", (DWORD)(tStart/10000000), (DWORD)((tStart/10000)%1000));
LeaveCriticalSection(&This->tf.csReceive); LeaveCriticalSection(&This->tf.csReceive);
hr = BaseOutputPinImpl_Deliver((BaseOutputPin*)This->tf.ppPins[1], pOutSample); hr = BaseOutputPinImpl_Deliver(&This->tf.source, pOutSample);
EnterCriticalSection(&This->tf.csReceive); EnterCriticalSection(&This->tf.csReceive);
if (hr != S_OK && hr != VFW_E_NOT_CONNECTED) { if (hr != S_OK && hr != VFW_E_NOT_CONNECTED) {

View File

@ -105,7 +105,6 @@ static int AVIDec_DropSample(AVIDecImpl *This, REFERENCE_TIME tStart) {
static HRESULT WINAPI AVIDec_Receive(TransformFilter *tf, IMediaSample *pSample) static HRESULT WINAPI AVIDec_Receive(TransformFilter *tf, IMediaSample *pSample)
{ {
AVIDecImpl* This = impl_from_TransformFilter(tf); AVIDecImpl* This = impl_from_TransformFilter(tf);
AM_MEDIA_TYPE amt;
HRESULT hr; HRESULT hr;
DWORD res; DWORD res;
IMediaSample* pOutSample = NULL; IMediaSample* pOutSample = NULL;
@ -128,16 +127,10 @@ static HRESULT WINAPI AVIDec_Receive(TransformFilter *tf, IMediaSample *pSample)
TRACE("Sample data ptr = %p, size = %d\n", pbSrcStream, cbSrcStream); TRACE("Sample data ptr = %p, size = %d\n", pbSrcStream, cbSrcStream);
hr = IPin_ConnectionMediaType(This->tf.ppPins[0], &amt);
if (FAILED(hr)) {
ERR("Unable to retrieve media type\n");
goto error;
}
/* Update input size to match sample size */ /* Update input size to match sample size */
This->pBihIn->biSizeImage = cbSrcStream; This->pBihIn->biSizeImage = cbSrcStream;
hr = BaseOutputPinImpl_GetDeliveryBuffer((BaseOutputPin*)This->tf.ppPins[1], &pOutSample, NULL, NULL, 0); hr = BaseOutputPinImpl_GetDeliveryBuffer(&This->tf.source, &pOutSample, NULL, NULL, 0);
if (FAILED(hr)) { if (FAILED(hr)) {
ERR("Unable to get delivery buffer (%x)\n", hr); ERR("Unable to get delivery buffer (%x)\n", hr);
goto error; goto error;
@ -195,7 +188,7 @@ static HRESULT WINAPI AVIDec_Receive(TransformFilter *tf, IMediaSample *pSample)
IMediaSample_SetMediaTime(pOutSample, NULL, NULL); IMediaSample_SetMediaTime(pOutSample, NULL, NULL);
LeaveCriticalSection(&This->tf.csReceive); LeaveCriticalSection(&This->tf.csReceive);
hr = BaseOutputPinImpl_Deliver((BaseOutputPin*)This->tf.ppPins[1], pOutSample); hr = BaseOutputPinImpl_Deliver(&This->tf.source, pOutSample);
EnterCriticalSection(&This->tf.csReceive); EnterCriticalSection(&This->tf.csReceive);
if (hr != S_OK && hr != VFW_E_NOT_CONNECTED) if (hr != S_OK && hr != VFW_E_NOT_CONNECTED)
ERR("Error sending sample (%x)\n", hr); ERR("Error sending sample (%x)\n", hr);

View File

@ -30,21 +30,6 @@ static const IPinVtbl TransformFilter_InputPin_Vtbl;
static const IPinVtbl TransformFilter_OutputPin_Vtbl; static const IPinVtbl TransformFilter_OutputPin_Vtbl;
static const IQualityControlVtbl TransformFilter_QualityControl_Vtbl; static const IQualityControlVtbl TransformFilter_QualityControl_Vtbl;
static inline BaseInputPin *impl_BaseInputPin_from_BasePin( BasePin *iface )
{
return CONTAINING_RECORD(iface, BaseInputPin, pin);
}
static inline BaseInputPin *impl_BaseInputPin_from_IPin( IPin *iface )
{
return CONTAINING_RECORD(iface, BaseInputPin, pin.IPin_iface);
}
static inline BaseOutputPin *impl_BaseOutputPin_from_IPin( IPin *iface )
{
return CONTAINING_RECORD(iface, BaseOutputPin, pin.IPin_iface);
}
static inline TransformFilter *impl_from_IBaseFilter( IBaseFilter *iface ) static inline TransformFilter *impl_from_IBaseFilter( IBaseFilter *iface )
{ {
return CONTAINING_RECORD(iface, TransformFilter, filter.IBaseFilter_iface); return CONTAINING_RECORD(iface, TransformFilter, filter.IBaseFilter_iface);
@ -55,13 +40,16 @@ static inline TransformFilter *impl_from_BaseFilter( BaseFilter *iface )
return CONTAINING_RECORD(iface, TransformFilter, filter); return CONTAINING_RECORD(iface, TransformFilter, filter);
} }
static inline TransformFilter *impl_from_sink_IPin(IPin *iface)
{
return CONTAINING_RECORD(iface, TransformFilter, sink.pin.IPin_iface);
}
static HRESULT WINAPI TransformFilter_Input_CheckMediaType(BasePin *iface, const AM_MEDIA_TYPE * pmt) static HRESULT WINAPI TransformFilter_Input_CheckMediaType(BasePin *iface, const AM_MEDIA_TYPE * pmt)
{ {
BaseInputPin* This = impl_BaseInputPin_from_BasePin(iface); TransformFilter *pTransform = impl_from_sink_IPin(&iface->IPin_iface);
TransformFilter * pTransform;
TRACE("%p\n", iface); TRACE("%p\n", iface);
pTransform = impl_from_IBaseFilter(This->pin.pinInfo.pFilter);
if (pTransform->pFuncsTable->pfnCheckInputType) if (pTransform->pFuncsTable->pfnCheckInputType)
return pTransform->pFuncsTable->pfnCheckInputType(pTransform, pmt); return pTransform->pFuncsTable->pfnCheckInputType(pTransform, pmt);
@ -72,10 +60,10 @@ static HRESULT WINAPI TransformFilter_Input_CheckMediaType(BasePin *iface, const
static HRESULT WINAPI TransformFilter_Input_Receive(BaseInputPin *This, IMediaSample *pInSample) static HRESULT WINAPI TransformFilter_Input_Receive(BaseInputPin *This, IMediaSample *pInSample)
{ {
TransformFilter *pTransform = impl_from_sink_IPin(&This->pin.IPin_iface);
HRESULT hr; HRESULT hr;
TransformFilter * pTransform;
TRACE("%p\n", This); TRACE("%p\n", This);
pTransform = impl_from_IBaseFilter(This->pin.pinInfo.pFilter);
EnterCriticalSection(&pTransform->csReceive); EnterCriticalSection(&pTransform->csReceive);
if (pTransform->filter.state == State_Stopped) if (pTransform->filter.state == State_Stopped)
@ -99,9 +87,14 @@ static HRESULT WINAPI TransformFilter_Input_Receive(BaseInputPin *This, IMediaSa
return hr; return hr;
} }
static inline TransformFilter *impl_from_source_IPin(IPin *iface)
{
return CONTAINING_RECORD(iface, TransformFilter, source.pin.IPin_iface);
}
static HRESULT WINAPI TransformFilter_Output_CheckMediaType(BasePin *This, const AM_MEDIA_TYPE *pmt) static HRESULT WINAPI TransformFilter_Output_CheckMediaType(BasePin *This, const AM_MEDIA_TYPE *pmt)
{ {
TransformFilter *pTransformFilter = impl_from_IBaseFilter(This->pinInfo.pFilter); TransformFilter *pTransformFilter = impl_from_source_IPin(&This->IPin_iface);
AM_MEDIA_TYPE* outpmt = &pTransformFilter->pmt; AM_MEDIA_TYPE* outpmt = &pTransformFilter->pmt;
if (IsEqualIID(&pmt->majortype, &outpmt->majortype) if (IsEqualIID(&pmt->majortype, &outpmt->majortype)
@ -112,13 +105,13 @@ static HRESULT WINAPI TransformFilter_Output_CheckMediaType(BasePin *This, const
static HRESULT WINAPI TransformFilter_Output_DecideBufferSize(BaseOutputPin *This, IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest) static HRESULT WINAPI TransformFilter_Output_DecideBufferSize(BaseOutputPin *This, IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest)
{ {
TransformFilter *pTransformFilter = impl_from_IBaseFilter(This->pin.pinInfo.pFilter); TransformFilter *pTransformFilter = impl_from_source_IPin(&This->pin.IPin_iface);
return pTransformFilter->pFuncsTable->pfnDecideBufferSize(pTransformFilter, pAlloc, ppropInputRequest); return pTransformFilter->pFuncsTable->pfnDecideBufferSize(pTransformFilter, pAlloc, ppropInputRequest);
} }
static HRESULT WINAPI TransformFilter_Output_GetMediaType(BasePin *This, int iPosition, AM_MEDIA_TYPE *pmt) static HRESULT WINAPI TransformFilter_Output_GetMediaType(BasePin *This, int iPosition, AM_MEDIA_TYPE *pmt)
{ {
TransformFilter *pTransform = impl_from_IBaseFilter(This->pinInfo.pFilter); TransformFilter *pTransform = impl_from_source_IPin(&This->IPin_iface);
if (iPosition < 0) if (iPosition < 0)
return E_INVALIDARG; return E_INVALIDARG;
@ -132,33 +125,27 @@ static IPin *transform_get_pin(BaseFilter *iface, unsigned int index)
{ {
TransformFilter *filter = impl_from_BaseFilter(iface); TransformFilter *filter = impl_from_BaseFilter(iface);
if (index >= 2) if (index == 0)
return &filter->sink.pin.IPin_iface;
else if (index == 1)
return &filter->source.pin.IPin_iface;
return NULL; return NULL;
return filter->ppPins[index];
} }
static void transform_destroy(BaseFilter *iface) static void transform_destroy(BaseFilter *iface)
{ {
TransformFilter *filter = impl_from_BaseFilter(iface); TransformFilter *filter = impl_from_BaseFilter(iface);
ULONG i;
for (i = 0; i < 2; ++i) if (filter->sink.pin.pConnectedTo)
{ IPin_Disconnect(filter->sink.pin.pConnectedTo);
IPin *peer; IPin_Disconnect(&filter->sink.pin.IPin_iface);
if (SUCCEEDED(IPin_ConnectedTo(filter->ppPins[i], &peer))) if (filter->source.pin.pConnectedTo)
{ IPin_Disconnect(filter->source.pin.pConnectedTo);
IPin_Disconnect(peer); IPin_Disconnect(&filter->source.pin.IPin_iface);
IPin_Release(peer);
}
IPin_Disconnect(filter->ppPins[i]);
}
BaseInputPin_Destroy(impl_BaseInputPin_from_IPin(filter->ppPins[0])); strmbase_sink_cleanup(&filter->sink);
BaseOutputPin_Destroy(impl_BaseOutputPin_from_IPin(filter->ppPins[1])); strmbase_source_cleanup(&filter->source);
CoTaskMemFree(filter->ppPins);
filter->csReceive.DebugInfo->Spare[0] = 0; filter->csReceive.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&filter->csReceive); DeleteCriticalSection(&filter->csReceive);
@ -205,7 +192,7 @@ static HRESULT WINAPI TransformFilterImpl_Stop(IBaseFilter *iface)
if (This->pFuncsTable->pfnStopStreaming) if (This->pFuncsTable->pfnStopStreaming)
hr = This->pFuncsTable->pfnStopStreaming(This); hr = This->pFuncsTable->pfnStopStreaming(This);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
hr = BaseOutputPinImpl_Inactive(impl_BaseOutputPin_from_IPin(This->ppPins[1])); hr = BaseOutputPinImpl_Inactive(&This->source);
} }
LeaveCriticalSection(&This->csReceive); LeaveCriticalSection(&This->csReceive);
@ -245,11 +232,11 @@ static HRESULT WINAPI TransformFilterImpl_Run(IBaseFilter *iface, REFERENCE_TIME
{ {
if (This->filter.state == State_Stopped) if (This->filter.state == State_Stopped)
{ {
impl_BaseInputPin_from_IPin(This->ppPins[0])->end_of_stream = FALSE; This->sink.end_of_stream = FALSE;
if (This->pFuncsTable->pfnStartStreaming) if (This->pFuncsTable->pfnStartStreaming)
hr = This->pFuncsTable->pfnStartStreaming(This); hr = This->pFuncsTable->pfnStartStreaming(This);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
hr = BaseOutputPinImpl_Active(impl_BaseOutputPin_from_IPin(This->ppPins[1])); hr = BaseOutputPinImpl_Active(&This->source);
} }
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
@ -285,6 +272,7 @@ static const IBaseFilterVtbl transform_vtbl =
static HRESULT strmbase_transform_init(IUnknown *outer, const CLSID *clsid, static HRESULT strmbase_transform_init(IUnknown *outer, const CLSID *clsid,
const TransformFilterFuncTable *func_table, TransformFilter *filter) const TransformFilterFuncTable *func_table, TransformFilter *filter)
{ {
ISeekingPassThru *passthru;
HRESULT hr; HRESULT hr;
PIN_INFO piInput; PIN_INFO piInput;
PIN_INFO piOutput; PIN_INFO piOutput;
@ -299,8 +287,6 @@ static HRESULT strmbase_transform_init(IUnknown *outer, const CLSID *clsid,
filter->pFuncsTable = func_table; filter->pFuncsTable = func_table;
ZeroMemory(&filter->pmt, sizeof(filter->pmt)); ZeroMemory(&filter->pmt, sizeof(filter->pmt));
filter->ppPins = CoTaskMemAlloc(2 * sizeof(IPin *));
/* construct input pin */ /* construct input pin */
piInput.dir = PINDIR_INPUT; piInput.dir = PINDIR_INPUT;
piInput.pFilter = &filter->filter.IBaseFilter_iface; piInput.pFilter = &filter->filter.IBaseFilter_iface;
@ -309,41 +295,30 @@ static HRESULT strmbase_transform_init(IUnknown *outer, const CLSID *clsid,
piOutput.pFilter = &filter->filter.IBaseFilter_iface; piOutput.pFilter = &filter->filter.IBaseFilter_iface;
lstrcpynW(piOutput.achName, wcsOutputPinName, ARRAY_SIZE(piOutput.achName)); lstrcpynW(piOutput.achName, wcsOutputPinName, ARRAY_SIZE(piOutput.achName));
hr = BaseInputPin_Construct(&TransformFilter_InputPin_Vtbl, sizeof(BaseInputPin), &piInput, strmbase_sink_init(&filter->sink, &TransformFilter_InputPin_Vtbl, &piInput,
&tf_input_BaseInputFuncTable, &filter->filter.csFilter, NULL, &filter->ppPins[0]); &tf_input_BaseInputFuncTable, &filter->filter.csFilter, NULL);
if (SUCCEEDED(hr)) strmbase_source_init(&filter->source, &TransformFilter_OutputPin_Vtbl,
{ &piOutput, &tf_output_BaseOutputFuncTable, &filter->filter.csFilter);
hr = BaseOutputPin_Construct(&TransformFilter_OutputPin_Vtbl, sizeof(BaseOutputPin),
&piOutput, &tf_output_BaseOutputFuncTable, &filter->filter.csFilter,
&filter->ppPins[1]);
if (FAILED(hr)) QualityControlImpl_Create(&filter->sink.pin.IPin_iface,
ERR("Cannot create output pin (%x)\n", hr);
else {
QualityControlImpl_Create(filter->ppPins[0],
&filter->filter.IBaseFilter_iface, &filter->qcimpl); &filter->filter.IBaseFilter_iface, &filter->qcimpl);
filter->qcimpl->IQualityControl_iface.lpVtbl = &TransformFilter_QualityControl_Vtbl; filter->qcimpl->IQualityControl_iface.lpVtbl = &TransformFilter_QualityControl_Vtbl;
}
}
if (SUCCEEDED(hr))
{
ISeekingPassThru *passthru;
filter->seekthru_unk = NULL; filter->seekthru_unk = NULL;
hr = CoCreateInstance(&CLSID_SeekingPassThru, (IUnknown *)&filter->filter.IBaseFilter_iface, hr = CoCreateInstance(&CLSID_SeekingPassThru, (IUnknown *)&filter->filter.IBaseFilter_iface,
CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&filter->seekthru_unk); CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&filter->seekthru_unk);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
IUnknown_QueryInterface(filter->seekthru_unk, &IID_ISeekingPassThru, (void **)&passthru); IUnknown_QueryInterface(filter->seekthru_unk, &IID_ISeekingPassThru, (void **)&passthru);
ISeekingPassThru_Init(passthru, FALSE, filter->ppPins[0]); ISeekingPassThru_Init(passthru, FALSE, &filter->sink.pin.IPin_iface);
ISeekingPassThru_Release(passthru); ISeekingPassThru_Release(passthru);
} }
}
if (FAILED(hr)) if (FAILED(hr))
{ {
CoTaskMemFree(filter->ppPins); strmbase_sink_cleanup(&filter->sink);
strmbase_source_cleanup(&filter->source);
strmbase_filter_cleanup(&filter->filter); strmbase_filter_cleanup(&filter->filter);
} }
@ -383,40 +358,22 @@ HRESULT WINAPI TransformFilterImpl_Notify(TransformFilter *iface, IBaseFilter *s
static HRESULT WINAPI TransformFilter_InputPin_EndOfStream(IPin * iface) static HRESULT WINAPI TransformFilter_InputPin_EndOfStream(IPin * iface)
{ {
BaseInputPin* This = impl_BaseInputPin_from_IPin(iface); TransformFilter *filter = impl_from_sink_IPin(iface);
TransformFilter* pTransform;
IPin* ppin;
HRESULT hr;
TRACE("(%p)->()\n", iface); TRACE("iface %p.\n", iface);
/* Since we process samples synchronously, just forward notification downstream */ if (filter->source.pin.pConnectedTo)
pTransform = impl_from_IBaseFilter(This->pin.pinInfo.pFilter); return IPin_EndOfStream(filter->source.pin.pConnectedTo);
if (!pTransform) return VFW_E_NOT_CONNECTED;
hr = E_FAIL;
else
hr = IPin_ConnectedTo(pTransform->ppPins[1], &ppin);
if (SUCCEEDED(hr))
{
hr = IPin_EndOfStream(ppin);
IPin_Release(ppin);
}
if (FAILED(hr))
ERR("%x\n", hr);
return hr;
} }
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)
{ {
BaseInputPin* This = impl_BaseInputPin_from_IPin(iface); TransformFilter *pTransform = impl_from_sink_IPin(iface);
TransformFilter* pTransform;
HRESULT hr = S_OK; HRESULT hr = S_OK;
TRACE("(%p)->(%p, %p)\n", iface, pReceivePin, pmt); TRACE("(%p)->(%p, %p)\n", iface, pReceivePin, pmt);
pTransform = impl_from_IBaseFilter(This->pin.pinInfo.pFilter);
if (pTransform->pFuncsTable->pfnSetMediaType) if (pTransform->pFuncsTable->pfnSetMediaType)
hr = pTransform->pFuncsTable->pfnSetMediaType(pTransform, PINDIR_INPUT, pmt); hr = pTransform->pFuncsTable->pfnSetMediaType(pTransform, PINDIR_INPUT, pmt);
@ -435,12 +392,10 @@ 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)
{ {
BaseInputPin* This = impl_BaseInputPin_from_IPin(iface); TransformFilter *pTransform = impl_from_sink_IPin(iface);
TransformFilter* pTransform;
TRACE("(%p)->()\n", iface); TRACE("(%p)->()\n", iface);
pTransform = impl_from_IBaseFilter(This->pin.pinInfo.pFilter);
if (pTransform->pFuncsTable->pfnBreakConnect) if (pTransform->pFuncsTable->pfnBreakConnect)
pTransform->pFuncsTable->pfnBreakConnect(pTransform, PINDIR_INPUT); pTransform->pFuncsTable->pfnBreakConnect(pTransform, PINDIR_INPUT);
@ -449,13 +404,11 @@ static HRESULT WINAPI TransformFilter_InputPin_Disconnect(IPin * iface)
static HRESULT WINAPI TransformFilter_InputPin_BeginFlush(IPin * iface) static HRESULT WINAPI TransformFilter_InputPin_BeginFlush(IPin * iface)
{ {
BaseInputPin* This = impl_BaseInputPin_from_IPin(iface); TransformFilter *pTransform = impl_from_sink_IPin(iface);
TransformFilter* pTransform;
HRESULT hr = S_OK; HRESULT hr = S_OK;
TRACE("(%p)->()\n", iface); TRACE("(%p)->()\n", iface);
pTransform = impl_from_IBaseFilter(This->pin.pinInfo.pFilter);
EnterCriticalSection(&pTransform->filter.csFilter); EnterCriticalSection(&pTransform->filter.csFilter);
if (pTransform->pFuncsTable->pfnBeginFlush) if (pTransform->pFuncsTable->pfnBeginFlush)
hr = pTransform->pFuncsTable->pfnBeginFlush(pTransform); hr = pTransform->pFuncsTable->pfnBeginFlush(pTransform);
@ -467,13 +420,11 @@ static HRESULT WINAPI TransformFilter_InputPin_BeginFlush(IPin * iface)
static HRESULT WINAPI TransformFilter_InputPin_EndFlush(IPin * iface) static HRESULT WINAPI TransformFilter_InputPin_EndFlush(IPin * iface)
{ {
BaseInputPin* This = impl_BaseInputPin_from_IPin(iface); TransformFilter *pTransform = impl_from_sink_IPin(iface);
TransformFilter* pTransform;
HRESULT hr = S_OK; HRESULT hr = S_OK;
TRACE("(%p)->()\n", iface); TRACE("(%p)->()\n", iface);
pTransform = impl_from_IBaseFilter(This->pin.pinInfo.pFilter);
EnterCriticalSection(&pTransform->filter.csFilter); EnterCriticalSection(&pTransform->filter.csFilter);
if (pTransform->pFuncsTable->pfnEndFlush) if (pTransform->pFuncsTable->pfnEndFlush)
hr = pTransform->pFuncsTable->pfnEndFlush(pTransform); hr = pTransform->pFuncsTable->pfnEndFlush(pTransform);
@ -485,13 +436,11 @@ static HRESULT WINAPI TransformFilter_InputPin_EndFlush(IPin * iface)
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)
{ {
BaseInputPin* This = impl_BaseInputPin_from_IPin(iface); TransformFilter *pTransform = impl_from_sink_IPin(iface);
TransformFilter* pTransform;
HRESULT hr = S_OK; HRESULT hr = S_OK;
TRACE("(%p)->(%s %s %e)\n", iface, wine_dbgstr_longlong(tStart), wine_dbgstr_longlong(tStop), dRate); TRACE("(%p)->(%s %s %e)\n", iface, wine_dbgstr_longlong(tStart), wine_dbgstr_longlong(tStop), dRate);
pTransform = impl_from_IBaseFilter(This->pin.pinInfo.pFilter);
EnterCriticalSection(&pTransform->filter.csFilter); EnterCriticalSection(&pTransform->filter.csFilter);
if (pTransform->pFuncsTable->pfnNewSegment) if (pTransform->pFuncsTable->pfnNewSegment)
hr = pTransform->pFuncsTable->pfnNewSegment(pTransform, tStart, tStop, dRate); hr = pTransform->pFuncsTable->pfnNewSegment(pTransform, tStart, tStop, dRate);
@ -525,7 +474,8 @@ static const IPinVtbl TransformFilter_InputPin_Vtbl =
static HRESULT WINAPI transform_source_QueryInterface(IPin *iface, REFIID iid, void **out) static HRESULT WINAPI transform_source_QueryInterface(IPin *iface, REFIID iid, void **out)
{ {
TransformFilter *filter = impl_from_IBaseFilter(impl_BaseOutputPin_from_IPin(iface)->pin.pinInfo.pFilter); TransformFilter *filter = impl_from_source_IPin(iface);
if (IsEqualGUID(iid, &IID_IUnknown) || IsEqualGUID(iid, &IID_IPin)) if (IsEqualGUID(iid, &IID_IUnknown) || IsEqualGUID(iid, &IID_IPin))
*out = iface; *out = iface;
else if (IsEqualGUID(iid, &IID_IQualityControl)) else if (IsEqualGUID(iid, &IID_IQualityControl))

View File

@ -168,7 +168,7 @@ GstFlowReturn got_data(GstPad *pad, GstObject *parent, GstBuffer *buf)
gst_buffer_map(buf, &info, GST_MAP_READ); gst_buffer_map(buf, &info, GST_MAP_READ);
hr = BaseOutputPinImpl_GetDeliveryBuffer((BaseOutputPin*)This->tf.ppPins[1], &sample, NULL, NULL, 0); hr = BaseOutputPinImpl_GetDeliveryBuffer(&This->tf.source, &sample, NULL, NULL, 0);
if (FAILED(hr)) { if (FAILED(hr)) {
ERR("Could not get output buffer: %08x\n", hr); ERR("Could not get output buffer: %08x\n", hr);
return GST_FLOW_FLUSHING; return GST_FLOW_FLUSHING;
@ -205,7 +205,7 @@ GstFlowReturn got_data(GstPad *pad, GstObject *parent, GstBuffer *buf)
IMediaSample_SetSyncPoint(sample, !GST_BUFFER_FLAG_IS_SET(buf, GST_BUFFER_FLAG_DELTA_UNIT)); IMediaSample_SetSyncPoint(sample, !GST_BUFFER_FLAG_IS_SET(buf, GST_BUFFER_FLAG_DELTA_UNIT));
IMediaSample_SetActualDataLength(sample, gst_buffer_get_size(buf)); IMediaSample_SetActualDataLength(sample, gst_buffer_get_size(buf));
hr = BaseOutputPinImpl_Deliver((BaseOutputPin*)This->tf.ppPins[1], sample); hr = BaseOutputPinImpl_Deliver(&This->tf.source, sample);
IMediaSample_Release(sample); IMediaSample_Release(sample);
gst_buffer_unref(buf); gst_buffer_unref(buf);
if (FAILED(hr)) if (FAILED(hr))

View File

@ -185,7 +185,7 @@ static void trackingCallback(
} }
EnterCriticalSection(&This->tf.csReceive); EnterCriticalSection(&This->tf.csReceive);
hr = BaseOutputPinImpl_GetDeliveryBuffer((BaseOutputPin*)This->tf.ppPins[1], &pOutSample, NULL, NULL, 0); hr = BaseOutputPinImpl_GetDeliveryBuffer(&This->tf.source, &pOutSample, NULL, NULL, 0);
if (FAILED(hr)) { if (FAILED(hr)) {
ERR("Unable to get delivery buffer (%x)\n", hr); ERR("Unable to get delivery buffer (%x)\n", hr);
goto error; goto error;
@ -236,7 +236,7 @@ static void trackingCallback(
} }
LeaveCriticalSection(&This->tf.csReceive); LeaveCriticalSection(&This->tf.csReceive);
hr = BaseOutputPinImpl_Deliver((BaseOutputPin*)This->tf.ppPins[1], pOutSample); hr = BaseOutputPinImpl_Deliver(&This->tf.source, pOutSample);
EnterCriticalSection(&This->tf.csReceive); EnterCriticalSection(&This->tf.csReceive);
if (hr != S_OK && hr != VFW_E_NOT_CONNECTED) if (hr != S_OK && hr != VFW_E_NOT_CONNECTED)
ERR("Error sending sample (%x)\n", hr); ERR("Error sending sample (%x)\n", hr);

View File

@ -207,8 +207,9 @@ HRESULT WINAPI EnumMediaTypes_Construct(BasePin *iface, BasePin_GetMediaType enu
typedef struct TransformFilter typedef struct TransformFilter
{ {
BaseFilter filter; BaseFilter filter;
BaseOutputPin source;
BaseInputPin sink;
IPin **ppPins;
AM_MEDIA_TYPE pmt; AM_MEDIA_TYPE pmt;
CRITICAL_SECTION csReceive; CRITICAL_SECTION csReceive;