Commit 2d5c9d06 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

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

parent 2adc44df
...@@ -59,7 +59,6 @@ static inline ACMWrapperImpl *impl_from_TransformFilter( TransformFilter *iface ...@@ -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 ...@@ -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 ...@@ -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) {
......
...@@ -105,7 +105,6 @@ static int AVIDec_DropSample(AVIDecImpl *This, REFERENCE_TIME tStart) { ...@@ -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) ...@@ -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) ...@@ -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);
......
...@@ -168,7 +168,7 @@ GstFlowReturn got_data(GstPad *pad, GstObject *parent, GstBuffer *buf) ...@@ -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) ...@@ -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))
......
...@@ -185,7 +185,7 @@ static void trackingCallback( ...@@ -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( ...@@ -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);
......
...@@ -206,16 +206,17 @@ HRESULT WINAPI EnumMediaTypes_Construct(BasePin *iface, BasePin_GetMediaType enu ...@@ -206,16 +206,17 @@ HRESULT WINAPI EnumMediaTypes_Construct(BasePin *iface, BasePin_GetMediaType enu
/* Transform Filter */ /* Transform Filter */
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;
const struct TransformFilterFuncTable * pFuncsTable; const struct TransformFilterFuncTable * pFuncsTable;
struct QualityControlImpl *qcimpl; struct QualityControlImpl *qcimpl;
/* IMediaSeeking and IMediaPosition are implemented by ISeekingPassThru */ /* IMediaSeeking and IMediaPosition are implemented by ISeekingPassThru */
IUnknown *seekthru_unk; IUnknown *seekthru_unk;
} TransformFilter; } TransformFilter;
typedef HRESULT (WINAPI *TransformFilter_DecideBufferSize) (TransformFilter *iface, IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest); typedef HRESULT (WINAPI *TransformFilter_DecideBufferSize) (TransformFilter *iface, IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest);
......
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