strmbase: Store the filter as a strmbase_filter pointer in the BasePin 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-09-05 19:02:15 -05:00 committed by Alexandre Julliard
parent 85e559fadb
commit 28a511554c
18 changed files with 231 additions and 357 deletions

View File

@ -64,7 +64,7 @@ static inline AVICompressor *impl_from_IBaseFilter(IBaseFilter *iface)
static inline AVICompressor *impl_from_BasePin(BasePin *pin) static inline AVICompressor *impl_from_BasePin(BasePin *pin)
{ {
return impl_from_IBaseFilter(pin->pinInfo.pFilter); return impl_from_strmbase_filter(pin->filter);
} }
static HRESULT ensure_driver(AVICompressor *This) static HRESULT ensure_driver(AVICompressor *This)
@ -315,8 +315,7 @@ static const IPersistPropertyBagVtbl PersistPropertyBagVtbl = {
static inline AVICompressor *impl_from_IPin(IPin *iface) static inline AVICompressor *impl_from_IPin(IPin *iface)
{ {
BasePin *bp = CONTAINING_RECORD(iface, BasePin, IPin_iface); return impl_from_strmbase_filter(CONTAINING_RECORD(iface, BasePin, IPin_iface)->filter);
return impl_from_IBaseFilter(bp->pinInfo.pFilter);
} }
static HRESULT WINAPI AVICompressorIn_QueryInterface(IPin *iface, REFIID riid, void **ppv) static HRESULT WINAPI AVICompressorIn_QueryInterface(IPin *iface, REFIID riid, void **ppv)
@ -536,7 +535,7 @@ static const IPinVtbl AVICompressorOutputPinVtbl = {
static HRESULT WINAPI AVICompressorOut_GetMediaType(BasePin *base, int iPosition, AM_MEDIA_TYPE *amt) static HRESULT WINAPI AVICompressorOut_GetMediaType(BasePin *base, int iPosition, AM_MEDIA_TYPE *amt)
{ {
AVICompressor *This = impl_from_IBaseFilter(base->pinInfo.pFilter); AVICompressor *This = impl_from_strmbase_filter(base->filter);
TRACE("(%p)->(%d %p)\n", base, iPosition, amt); TRACE("(%p)->(%d %p)\n", base, iPosition, amt);
@ -591,8 +590,8 @@ static const BaseOutputPinFuncTable AVICompressorBaseOutputPinVtbl = {
IUnknown* WINAPI QCAP_createAVICompressor(IUnknown *outer, HRESULT *phr) IUnknown* WINAPI QCAP_createAVICompressor(IUnknown *outer, HRESULT *phr)
{ {
PIN_INFO in_pin_info = {NULL, PINDIR_INPUT, {'I','n',0}}; static const WCHAR source_name[] = {'O','u','t',0};
PIN_INFO out_pin_info = {NULL, PINDIR_OUTPUT, {'O','u','t',0}}; static const WCHAR sink_name[] = {'I','n',0};
AVICompressor *compressor; AVICompressor *compressor;
compressor = heap_alloc_zero(sizeof(*compressor)); compressor = heap_alloc_zero(sizeof(*compressor));
@ -605,13 +604,10 @@ IUnknown* WINAPI QCAP_createAVICompressor(IUnknown *outer, HRESULT *phr)
compressor->IPersistPropertyBag_iface.lpVtbl = &PersistPropertyBagVtbl; compressor->IPersistPropertyBag_iface.lpVtbl = &PersistPropertyBagVtbl;
in_pin_info.pFilter = &compressor->filter.IBaseFilter_iface; strmbase_sink_init(&compressor->sink, &AVICompressorInputPinVtbl,
strmbase_sink_init(&compressor->sink, &AVICompressorInputPinVtbl, &in_pin_info, &compressor->filter, sink_name, &AVICompressorBaseInputPinVtbl, NULL);
&AVICompressorBaseInputPinVtbl, &compressor->filter.csFilter, NULL); strmbase_source_init(&compressor->source, &AVICompressorOutputPinVtbl,
&compressor->filter, source_name, &AVICompressorBaseOutputPinVtbl);
out_pin_info.pFilter = &compressor->filter.IBaseFilter_iface;
strmbase_source_init(&compressor->source, &AVICompressorOutputPinVtbl, &out_pin_info,
&AVICompressorBaseOutputPinVtbl, &compressor->filter.csFilter);
*phr = S_OK; *phr = S_OK;
return &compressor->filter.IUnknown_inner; return &compressor->filter.IUnknown_inner;

View File

@ -1373,9 +1373,6 @@ static const IQualityControlVtbl AviMuxOut_QualityControlVtbl = {
static HRESULT WINAPI AviMuxIn_CheckMediaType(BasePin *base, const AM_MEDIA_TYPE *pmt) static HRESULT WINAPI AviMuxIn_CheckMediaType(BasePin *base, const AM_MEDIA_TYPE *pmt)
{ {
TRACE("(%p:%s)->(AM_MEDIA_TYPE(%p))\n", base, debugstr_w(base->pinInfo.achName), pmt);
dump_AM_MEDIA_TYPE(pmt);
if(IsEqualIID(&pmt->majortype, &MEDIATYPE_Audio) && if(IsEqualIID(&pmt->majortype, &MEDIATYPE_Audio) &&
IsEqualIID(&pmt->formattype, &FORMAT_WaveFormatEx)) IsEqualIID(&pmt->formattype, &FORMAT_WaveFormatEx))
return S_OK; return S_OK;
@ -1396,8 +1393,8 @@ static HRESULT WINAPI AviMuxIn_GetMediaType(BasePin *base, int iPosition, AM_MED
static HRESULT WINAPI AviMuxIn_Receive(BaseInputPin *base, IMediaSample *pSample) static HRESULT WINAPI AviMuxIn_Receive(BaseInputPin *base, IMediaSample *pSample)
{ {
AviMux *avimux = impl_from_strmbase_filter(base->pin.filter);
AviMuxIn *avimuxin = CONTAINING_RECORD(base, AviMuxIn, pin); AviMuxIn *avimuxin = CONTAINING_RECORD(base, AviMuxIn, pin);
AviMux *avimux = impl_from_IBaseFilter(base->pin.pinInfo.pFilter);
REFERENCE_TIME start, stop; REFERENCE_TIME start, stop;
IMediaSample *sample; IMediaSample *sample;
int frames_no; int frames_no;
@ -1407,7 +1404,7 @@ static HRESULT WINAPI AviMuxIn_Receive(BaseInputPin *base, IMediaSample *pSample
DWORD flags; DWORD flags;
HRESULT hr; HRESULT hr;
TRACE("(%p:%s)->(%p)\n", base, debugstr_w(base->pin.pinInfo.achName), pSample); TRACE("pin %p, pSample %p.\n", avimuxin, pSample);
hr = IMediaSample_QueryInterface(pSample, &IID_IMediaSample2, (void**)&ms2); hr = IMediaSample_QueryInterface(pSample, &IID_IMediaSample2, (void**)&ms2);
if(SUCCEEDED(hr)) { if(SUCCEEDED(hr)) {
@ -1507,10 +1504,8 @@ static const BaseInputPinFuncTable AviMuxIn_BaseInputFuncTable = {
static inline AviMux* impl_from_in_IPin(IPin *iface) static inline AviMux* impl_from_in_IPin(IPin *iface)
{ {
BasePin *bp = CONTAINING_RECORD(iface, BasePin, IPin_iface); BasePin *pin = CONTAINING_RECORD(iface, BasePin, IPin_iface);
IBaseFilter *bf = bp->pinInfo.pFilter; return impl_from_strmbase_filter(pin->filter);
return impl_from_IBaseFilter(bf);
} }
static inline AviMuxIn* AviMuxIn_from_IPin(IPin *iface) static inline AviMuxIn* AviMuxIn_from_IPin(IPin *iface)
@ -1522,11 +1517,9 @@ static inline AviMuxIn* AviMuxIn_from_IPin(IPin *iface)
static HRESULT WINAPI AviMuxIn_QueryInterface(IPin *iface, REFIID riid, void **ppv) static HRESULT WINAPI AviMuxIn_QueryInterface(IPin *iface, REFIID riid, void **ppv)
{ {
AviMux *This = impl_from_in_IPin(iface);
AviMuxIn *avimuxin = AviMuxIn_from_IPin(iface); AviMuxIn *avimuxin = AviMuxIn_from_IPin(iface);
TRACE("(%p:%s)->(%s %p)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName), TRACE("pin %p, riid %s, ppv %p.\n", avimuxin, debugstr_guid(riid), ppv);
debugstr_guid(riid), ppv);
if(IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IPin)) if(IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IPin))
*ppv = &avimuxin->pin.pin.IPin_iface; *ppv = &avimuxin->pin.pin.IPin_iface;
@ -1555,8 +1548,7 @@ static HRESULT WINAPI AviMuxIn_ReceiveConnection(IPin *iface,
AviMuxIn *avimuxin = AviMuxIn_from_IPin(iface); AviMuxIn *avimuxin = AviMuxIn_from_IPin(iface);
HRESULT hr; HRESULT hr;
TRACE("(%p:%s)->(%p AM_MEDIA_TYPE(%p))\n", This, TRACE("pin %p, pConnector %p, pmt %p.\n", avimuxin, pConnector, pmt);
debugstr_w(avimuxin->pin.pin.pinInfo.achName), pConnector, pmt);
dump_AM_MEDIA_TYPE(pmt); dump_AM_MEDIA_TYPE(pmt);
if(!pmt) if(!pmt)
@ -1612,12 +1604,11 @@ static HRESULT WINAPI AviMuxIn_ReceiveConnection(IPin *iface,
static HRESULT WINAPI AviMuxIn_Disconnect(IPin *iface) static HRESULT WINAPI AviMuxIn_Disconnect(IPin *iface)
{ {
AviMux *This = impl_from_in_IPin(iface);
AviMuxIn *avimuxin = AviMuxIn_from_IPin(iface); AviMuxIn *avimuxin = AviMuxIn_from_IPin(iface);
IMediaSample **prev, *cur; IMediaSample **prev, *cur;
HRESULT hr; HRESULT hr;
TRACE("(%p:%s)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName)); TRACE("pin %p.\n", avimuxin);
hr = BasePinImpl_Disconnect(iface); hr = BasePinImpl_Disconnect(iface);
if(FAILED(hr)) if(FAILED(hr))
@ -1691,31 +1682,23 @@ static ULONG WINAPI AviMuxIn_AMStreamControl_Release(IAMStreamControl *iface)
} }
static HRESULT WINAPI AviMuxIn_AMStreamControl_StartAt(IAMStreamControl *iface, static HRESULT WINAPI AviMuxIn_AMStreamControl_StartAt(IAMStreamControl *iface,
const REFERENCE_TIME *ptStart, DWORD dwCookie) const REFERENCE_TIME *start, DWORD cookie)
{ {
AviMuxIn *avimuxin = AviMuxIn_from_IAMStreamControl(iface); FIXME("iface %p, start %p, cookie %#x, stub!\n", iface, start, cookie);
AviMux *This = impl_from_in_IPin(&avimuxin->pin.pin.IPin_iface);
FIXME("(%p:%s)->(%p %x)\n", This,
debugstr_w(avimuxin->pin.pin.pinInfo.achName), ptStart, dwCookie);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI AviMuxIn_AMStreamControl_StopAt(IAMStreamControl *iface, static HRESULT WINAPI AviMuxIn_AMStreamControl_StopAt(IAMStreamControl *iface,
const REFERENCE_TIME *ptStop, BOOL bSendExtra, DWORD dwCookie) const REFERENCE_TIME *stop, BOOL send_extra, DWORD cookie)
{ {
AviMuxIn *avimuxin = AviMuxIn_from_IAMStreamControl(iface); FIXME("iface %p, stop %p, send_extra %d, cookie %#x, stub!\n", iface, stop, send_extra, cookie);
AviMux *This = impl_from_in_IPin(&avimuxin->pin.pin.IPin_iface);
FIXME("(%p:%s)->(%p %x %x)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName),
ptStop, bSendExtra, dwCookie);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI AviMuxIn_AMStreamControl_GetInfo( static HRESULT WINAPI AviMuxIn_AMStreamControl_GetInfo(IAMStreamControl *iface,
IAMStreamControl *iface, AM_STREAM_INFO *pInfo) AM_STREAM_INFO *info)
{ {
AviMuxIn *avimuxin = AviMuxIn_from_IAMStreamControl(iface); FIXME("iface %p, info %p, stub!\n", iface, info);
AviMux *This = impl_from_in_IPin(&avimuxin->pin.pin.IPin_iface);
FIXME("(%p:%s)->(%p)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName), pInfo);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -1759,9 +1742,8 @@ static HRESULT WINAPI AviMuxIn_MemInputPin_GetAllocator(
IMemInputPin *iface, IMemAllocator **ppAllocator) IMemInputPin *iface, IMemAllocator **ppAllocator)
{ {
AviMuxIn *avimuxin = AviMuxIn_from_IMemInputPin(iface); AviMuxIn *avimuxin = AviMuxIn_from_IMemInputPin(iface);
AviMux *This = impl_from_in_IPin(&avimuxin->pin.pin.IPin_iface);
TRACE("(%p:%s)->(%p)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName), ppAllocator); TRACE("pin %p, ppAllocator %p.\n", avimuxin, ppAllocator);
if(!ppAllocator) if(!ppAllocator)
return E_POINTER; return E_POINTER;
@ -1775,12 +1757,10 @@ static HRESULT WINAPI AviMuxIn_MemInputPin_NotifyAllocator(
IMemInputPin *iface, IMemAllocator *pAllocator, BOOL bReadOnly) IMemInputPin *iface, IMemAllocator *pAllocator, BOOL bReadOnly)
{ {
AviMuxIn *avimuxin = AviMuxIn_from_IMemInputPin(iface); AviMuxIn *avimuxin = AviMuxIn_from_IMemInputPin(iface);
AviMux *This = impl_from_in_IPin(&avimuxin->pin.pin.IPin_iface);
ALLOCATOR_PROPERTIES props; ALLOCATOR_PROPERTIES props;
HRESULT hr; HRESULT hr;
TRACE("(%p:%s)->(%p %x)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName), TRACE("pin %p, pAllocator %p, bReadOnly %d.\n", avimuxin, pAllocator, bReadOnly);
pAllocator, bReadOnly);
if(!pAllocator) if(!pAllocator)
return E_POINTER; return E_POINTER;
@ -1799,9 +1779,8 @@ static HRESULT WINAPI AviMuxIn_MemInputPin_GetAllocatorRequirements(
IMemInputPin *iface, ALLOCATOR_PROPERTIES *pProps) IMemInputPin *iface, ALLOCATOR_PROPERTIES *pProps)
{ {
AviMuxIn *avimuxin = AviMuxIn_from_IMemInputPin(iface); AviMuxIn *avimuxin = AviMuxIn_from_IMemInputPin(iface);
AviMux *This = impl_from_in_IPin(&avimuxin->pin.pin.IPin_iface);
TRACE("(%p:%s)->(%p)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName), pProps); TRACE("pin %p, pProps %p.\n", avimuxin, pProps);
if(!pProps) if(!pProps)
return E_POINTER; return E_POINTER;
@ -1815,9 +1794,8 @@ static HRESULT WINAPI AviMuxIn_MemInputPin_Receive(
IMemInputPin *iface, IMediaSample *pSample) IMemInputPin *iface, IMediaSample *pSample)
{ {
AviMuxIn *avimuxin = AviMuxIn_from_IMemInputPin(iface); AviMuxIn *avimuxin = AviMuxIn_from_IMemInputPin(iface);
AviMux *This = impl_from_in_IPin(&avimuxin->pin.pin.IPin_iface);
TRACE("(%p:%s)->(%p)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName), pSample); TRACE("pin %p, pSample %p.\n", avimuxin, pSample);
return avimuxin->pin.pFuncsTable->pfnReceive(&avimuxin->pin, pSample); return avimuxin->pin.pFuncsTable->pfnReceive(&avimuxin->pin, pSample);
} }
@ -1826,11 +1804,10 @@ static HRESULT WINAPI AviMuxIn_MemInputPin_ReceiveMultiple(IMemInputPin *iface,
IMediaSample **pSamples, LONG nSamples, LONG *nSamplesProcessed) IMediaSample **pSamples, LONG nSamples, LONG *nSamplesProcessed)
{ {
AviMuxIn *avimuxin = AviMuxIn_from_IMemInputPin(iface); AviMuxIn *avimuxin = AviMuxIn_from_IMemInputPin(iface);
AviMux *This = impl_from_in_IPin(&avimuxin->pin.pin.IPin_iface);
HRESULT hr = S_OK; HRESULT hr = S_OK;
TRACE("(%p:%s)->(%p %d %p)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName), TRACE("pin %p, pSamples %p, nSamples %d, nSamplesProcessed %p.\n",
pSamples, nSamples, nSamplesProcessed); avimuxin, pSamples, nSamples, nSamplesProcessed);
for(*nSamplesProcessed=0; *nSamplesProcessed<nSamples; (*nSamplesProcessed)++) for(*nSamplesProcessed=0; *nSamplesProcessed<nSamples; (*nSamplesProcessed)++)
{ {
@ -1848,7 +1825,7 @@ static HRESULT WINAPI AviMuxIn_MemInputPin_ReceiveCanBlock(IMemInputPin *iface)
AviMux *This = impl_from_in_IPin(&avimuxin->pin.pin.IPin_iface); AviMux *This = impl_from_in_IPin(&avimuxin->pin.pin.IPin_iface);
HRESULT hr; HRESULT hr;
TRACE("(%p:%s)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName)); TRACE("avimuxin %p.\n", avimuxin);
if(!This->source.pMemInputPin) if(!This->source.pMemInputPin)
return S_FALSE; return S_FALSE;
@ -1896,22 +1873,18 @@ static ULONG WINAPI AviMuxIn_PropertyBag_Release(IPropertyBag *iface)
} }
static HRESULT WINAPI AviMuxIn_PropertyBag_Read(IPropertyBag *iface, static HRESULT WINAPI AviMuxIn_PropertyBag_Read(IPropertyBag *iface,
LPCOLESTR pszPropName, VARIANT *pVar, IErrorLog *pErrorLog) const WCHAR *name, VARIANT *value, IErrorLog *error_log)
{ {
AviMuxIn *avimuxin = AviMuxIn_from_IPropertyBag(iface); FIXME("iface %p, name %s, value %p, error_log %p, stub!\n",
AviMux *This = impl_from_in_IPin(&avimuxin->pin.pin.IPin_iface); iface, debugstr_w(name), value, error_log);
FIXME("(%p:%s)->(%s %p %p)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName),
debugstr_w(pszPropName), pVar, pErrorLog);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI AviMuxIn_PropertyBag_Write(IPropertyBag *iface, static HRESULT WINAPI AviMuxIn_PropertyBag_Write(IPropertyBag *iface,
LPCOLESTR pszPropName, VARIANT *pVar) const WCHAR *name, VARIANT *value)
{ {
AviMuxIn *avimuxin = AviMuxIn_from_IPropertyBag(iface); FIXME("iface %p, name %s, value %s, stub!\n",
AviMux *This = impl_from_in_IPin(&avimuxin->pin.pin.IPin_iface); iface, debugstr_w(name), debugstr_variant(value));
FIXME("(%p:%s)->(%s %p)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName),
debugstr_w(pszPropName), pVar);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -1950,23 +1923,17 @@ static ULONG WINAPI AviMuxIn_QualityControl_Release(IQualityControl *iface)
} }
static HRESULT WINAPI AviMuxIn_QualityControl_Notify(IQualityControl *iface, static HRESULT WINAPI AviMuxIn_QualityControl_Notify(IQualityControl *iface,
IBaseFilter *pSelf, Quality q) IBaseFilter *filter, Quality q)
{ {
AviMuxIn *avimuxin = AviMuxIn_from_IQualityControl(iface); FIXME("iface %p, filter %p, type %u, proportion %d, late %s, timestamp %s, stub!\n",
AviMux *This = impl_from_in_IPin(&avimuxin->pin.pin.IPin_iface); iface, filter, q.Type, q.Proportion, wine_dbgstr_longlong(q.Late),
FIXME("(%p:%s)->(%p { 0x%x %u %s %s })\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName), pSelf,
q.Type, q.Proportion,
wine_dbgstr_longlong(q.Late),
wine_dbgstr_longlong(q.TimeStamp)); wine_dbgstr_longlong(q.TimeStamp));
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI AviMuxIn_QualityControl_SetSink( static HRESULT WINAPI AviMuxIn_QualityControl_SetSink(IQualityControl *iface, IQualityControl *sink)
IQualityControl *iface, IQualityControl *piqc)
{ {
AviMuxIn *avimuxin = AviMuxIn_from_IQualityControl(iface); FIXME("iface %p, sink %p, stub!\n", iface, sink);
AviMux *This = impl_from_in_IPin(&avimuxin->pin.pin.IPin_iface);
FIXME("(%p:%s)->(%p)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName), piqc);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -1980,25 +1947,21 @@ static const IQualityControlVtbl AviMuxIn_QualityControlVtbl = {
static HRESULT create_input_pin(AviMux *avimux) static HRESULT create_input_pin(AviMux *avimux)
{ {
static const WCHAR name[] = {'I','n','p','u','t',' ','0','0',0}; WCHAR name[] = {'I','n','p','u','t',' ','0','0',0};
AviMuxIn *object; AviMuxIn *object;
PIN_INFO info;
HRESULT hr; HRESULT hr;
if(avimux->input_pin_no >= MAX_PIN_NO-1) if(avimux->input_pin_no >= MAX_PIN_NO-1)
return E_FAIL; return E_FAIL;
info.dir = PINDIR_INPUT; name[7] = '0' + (avimux->input_pin_no+1) % 10;
info.pFilter = &avimux->filter.IBaseFilter_iface; name[6] = '0' + (avimux->input_pin_no+1) / 10;
memcpy(info.achName, name, sizeof(name));
info.achName[7] = '0' + (avimux->input_pin_no+1) % 10;
info.achName[6] = '0' + (avimux->input_pin_no+1) / 10;
if (!(object = heap_alloc_zero(sizeof(*object)))) if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
strmbase_sink_init(&object->pin, &AviMuxIn_PinVtbl, &info, strmbase_sink_init(&object->pin, &AviMuxIn_PinVtbl, &avimux->filter, name,
&AviMuxIn_BaseInputFuncTable, &avimux->filter.csFilter, NULL); &AviMuxIn_BaseInputFuncTable, NULL);
object->pin.IMemInputPin_iface.lpVtbl = &AviMuxIn_MemInputPinVtbl; object->pin.IMemInputPin_iface.lpVtbl = &AviMuxIn_MemInputPinVtbl;
object->IAMStreamControl_iface.lpVtbl = &AviMuxIn_AMStreamControlVtbl; object->IAMStreamControl_iface.lpVtbl = &AviMuxIn_AMStreamControlVtbl;
object->IPropertyBag_iface.lpVtbl = &AviMuxIn_PropertyBagVtbl; object->IPropertyBag_iface.lpVtbl = &AviMuxIn_PropertyBagVtbl;
@ -2054,8 +2017,8 @@ IUnknown * WINAPI QCAP_createAVIMux(IUnknown *outer, HRESULT *phr)
info.dir = PINDIR_OUTPUT; info.dir = PINDIR_OUTPUT;
info.pFilter = &avimux->filter.IBaseFilter_iface; info.pFilter = &avimux->filter.IBaseFilter_iface;
lstrcpyW(info.achName, output_name); lstrcpyW(info.achName, output_name);
strmbase_source_init(&avimux->source, &AviMuxOut_PinVtbl, &info, strmbase_source_init(&avimux->source, &AviMuxOut_PinVtbl, &avimux->filter,
&AviMuxOut_BaseOutputFuncTable, &avimux->filter.csFilter); output_name, &AviMuxOut_BaseOutputFuncTable);
avimux->IQualityControl_iface.lpVtbl = &AviMuxOut_QualityControlVtbl; avimux->IQualityControl_iface.lpVtbl = &AviMuxOut_QualityControlVtbl;
avimux->cur_stream = 0; avimux->cur_stream = 0;
avimux->cur_time = 0; avimux->cur_time = 0;

View File

@ -54,13 +54,12 @@ static inline SmartTeeFilter *impl_from_IBaseFilter(IBaseFilter *iface)
static inline SmartTeeFilter *impl_from_BasePin(BasePin *pin) static inline SmartTeeFilter *impl_from_BasePin(BasePin *pin)
{ {
return impl_from_IBaseFilter(pin->pinInfo.pFilter); return impl_from_strmbase_filter(pin->filter);
} }
static inline SmartTeeFilter *impl_from_IPin(IPin *iface) static inline SmartTeeFilter *impl_from_IPin(IPin *iface)
{ {
BasePin *bp = CONTAINING_RECORD(iface, BasePin, IPin_iface); return impl_from_strmbase_filter(CONTAINING_RECORD(iface, BasePin, IPin_iface)->filter);
return impl_from_IBaseFilter(bp->pinInfo.pFilter);
} }
static HRESULT WINAPI SmartTeeFilter_Stop(IBaseFilter *iface) static HRESULT WINAPI SmartTeeFilter_Stop(IBaseFilter *iface)
@ -471,41 +470,36 @@ static const BaseOutputPinFuncTable SmartTeeFilterPreviewFuncs = {
}; };
IUnknown* WINAPI QCAP_createSmartTeeFilter(IUnknown *outer, HRESULT *phr) IUnknown* WINAPI QCAP_createSmartTeeFilter(IUnknown *outer, HRESULT *phr)
{ {
PIN_INFO inputPinInfo = {NULL, PINDIR_INPUT, {'I','n','p','u','t',0}}; static const WCHAR captureW[] = {'C','a','p','t','u','r','e',0};
PIN_INFO capturePinInfo = {NULL, PINDIR_OUTPUT, {'C','a','p','t','u','r','e',0}}; static const WCHAR previewW[] = {'P','r','e','v','i','e','w',0};
PIN_INFO previewPinInfo = {NULL, PINDIR_OUTPUT, {'P','r','e','v','i','e','w',0}}; static const WCHAR inputW[] = {'I','n','p','u','t',0};
SmartTeeFilter *object;
HRESULT hr; HRESULT hr;
SmartTeeFilter *This = NULL;
This = CoTaskMemAlloc(sizeof(*This)); if (!(object = CoTaskMemAlloc(sizeof(*object))))
if (This == NULL) { {
*phr = E_OUTOFMEMORY; *phr = E_OUTOFMEMORY;
return NULL; return NULL;
} }
memset(This, 0, sizeof(*This)); memset(object, 0, sizeof(*object));
strmbase_filter_init(&This->filter, &SmartTeeFilterVtbl, outer, &CLSID_SmartTee, &filter_ops); strmbase_filter_init(&object->filter, &SmartTeeFilterVtbl, outer, &CLSID_SmartTee, &filter_ops);
strmbase_sink_init(&object->sink, &SmartTeeFilterInputVtbl, &object->filter,
inputPinInfo.pFilter = &This->filter.IBaseFilter_iface; inputW, &SmartTeeFilterInputFuncs, NULL);
strmbase_sink_init(&This->sink, &SmartTeeFilterInputVtbl, &inputPinInfo,
&SmartTeeFilterInputFuncs, &This->filter.csFilter, NULL);
hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER, hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER,
&IID_IMemAllocator, (void**)&This->sink.pAllocator); &IID_IMemAllocator, (void **)&object->sink.pAllocator);
if (FAILED(hr)) if (FAILED(hr))
{ {
*phr = hr; *phr = hr;
strmbase_filter_cleanup(&This->filter); strmbase_filter_cleanup(&object->filter);
return NULL; return NULL;
} }
capturePinInfo.pFilter = &This->filter.IBaseFilter_iface; strmbase_source_init(&object->capture, &SmartTeeFilterCaptureVtbl,
strmbase_source_init(&This->capture, &SmartTeeFilterCaptureVtbl, &capturePinInfo, &object->filter, captureW, &SmartTeeFilterCaptureFuncs);
&SmartTeeFilterCaptureFuncs, &This->filter.csFilter); strmbase_source_init(&object->preview, &SmartTeeFilterPreviewVtbl,
&object->filter, previewW, &SmartTeeFilterPreviewFuncs);
previewPinInfo.pFilter = &This->filter.IBaseFilter_iface;
strmbase_source_init(&This->preview, &SmartTeeFilterPreviewVtbl, &previewPinInfo,
&SmartTeeFilterPreviewFuncs, &This->filter.csFilter);
*phr = S_OK; *phr = S_OK;
return &This->filter.IUnknown_inner; return &object->filter.IUnknown_inner;
} }

View File

@ -635,7 +635,6 @@ IUnknown * WINAPI QCAP_createVFWCaptureFilter(IUnknown *outer, HRESULT *phr)
{ {
static const WCHAR source_name[] = {'O','u','t','p','u','t',0}; static const WCHAR source_name[] = {'O','u','t','p','u','t',0};
VfwCapture *object; VfwCapture *object;
PIN_INFO pin_info;
if (!(object = CoTaskMemAlloc(sizeof(*object)))) if (!(object = CoTaskMemAlloc(sizeof(*object))))
{ {
@ -650,11 +649,8 @@ IUnknown * WINAPI QCAP_createVFWCaptureFilter(IUnknown *outer, HRESULT *phr)
object->IPersistPropertyBag_iface.lpVtbl = &IPersistPropertyBag_VTable; object->IPersistPropertyBag_iface.lpVtbl = &IPersistPropertyBag_VTable;
object->init = FALSE; object->init = FALSE;
pin_info.dir = PINDIR_OUTPUT; strmbase_source_init(&object->source, &VfwPin_Vtbl, &object->filter,
pin_info.pFilter = &object->filter.IBaseFilter_iface; source_name, &output_BaseOutputFuncTable);
lstrcpyW(pin_info.achName, source_name);
strmbase_source_init(&object->source, &VfwPin_Vtbl, &pin_info,
&output_BaseOutputFuncTable, &object->filter.csFilter);
object->IKsPropertySet_iface.lpVtbl = &IKsPropertySet_VTable; object->IKsPropertySet_iface.lpVtbl = &IKsPropertySet_VTable;

View File

@ -675,7 +675,6 @@ static HRESULT AVISplitter_ProcessOldIndex(AVISplitterImpl *This)
static HRESULT AVISplitter_ProcessStreamList(AVISplitterImpl * This, const BYTE * pData, DWORD cb, ALLOCATOR_PROPERTIES *props) static HRESULT AVISplitter_ProcessStreamList(AVISplitterImpl * This, const BYTE * pData, DWORD cb, ALLOCATOR_PROPERTIES *props)
{ {
PIN_INFO piOutput;
const RIFFCHUNK * pChunk; const RIFFCHUNK * pChunk;
HRESULT hr; HRESULT hr;
AM_MEDIA_TYPE amt; AM_MEDIA_TYPE amt;
@ -685,11 +684,9 @@ static HRESULT AVISplitter_ProcessStreamList(AVISplitterImpl * This, const BYTE
DWORD nstdindex = 0; DWORD nstdindex = 0;
static const WCHAR wszStreamTemplate[] = {'S','t','r','e','a','m',' ','%','0','2','d',0}; static const WCHAR wszStreamTemplate[] = {'S','t','r','e','a','m',' ','%','0','2','d',0};
StreamData *stream; StreamData *stream;
WCHAR name[18];
ZeroMemory(&amt, sizeof(amt)); ZeroMemory(&amt, sizeof(amt));
piOutput.dir = PINDIR_OUTPUT;
piOutput.pFilter = &This->Parser.filter.IBaseFilter_iface;
wsprintfW(piOutput.achName, wszStreamTemplate, This->Parser.cStreams);
This->streams = CoTaskMemRealloc(This->streams, sizeof(StreamData) * (This->Parser.cStreams+1)); This->streams = CoTaskMemRealloc(This->streams, sizeof(StreamData) * (This->Parser.cStreams+1));
stream = This->streams + This->Parser.cStreams; stream = This->streams + This->Parser.cStreams;
ZeroMemory(stream, sizeof(*stream)); ZeroMemory(stream, sizeof(*stream));
@ -792,7 +789,7 @@ static HRESULT AVISplitter_ProcessStreamList(AVISplitterImpl * This, const BYTE
case ckidSTREAMNAME: case ckidSTREAMNAME:
TRACE("processing stream name\n"); TRACE("processing stream name\n");
/* FIXME: this doesn't exactly match native version (we omit the "##)" prefix), but hey... */ /* FIXME: this doesn't exactly match native version (we omit the "##)" prefix), but hey... */
MultiByteToWideChar(CP_ACP, 0, (LPCSTR)(pChunk + 1), pChunk->cb, piOutput.achName, ARRAY_SIZE(piOutput.achName)); MultiByteToWideChar(CP_ACP, 0, (LPCSTR)(pChunk + 1), pChunk->cb, name, ARRAY_SIZE(name));
break; break;
case ckidSTREAMHANDLERDATA: case ckidSTREAMHANDLERDATA:
FIXME("process stream handler data\n"); FIXME("process stream handler data\n");
@ -872,7 +869,8 @@ static HRESULT AVISplitter_ProcessStreamList(AVISplitterImpl * This, const BYTE
stream->dwLength = dwLength; /* TODO: Use this for mediaseeking */ stream->dwLength = dwLength; /* TODO: Use this for mediaseeking */
stream->packet_queued = CreateEventW(NULL, 0, 0, NULL); stream->packet_queued = CreateEventW(NULL, 0, 0, NULL);
hr = Parser_AddPin(&(This->Parser), &piOutput, props, &amt); swprintf(name, ARRAY_SIZE(name), wszStreamTemplate, This->Parser.cStreams);
hr = Parser_AddPin(&This->Parser, name, props, &amt);
CoTaskMemFree(amt.pbFormat); CoTaskMemFree(amt.pbFormat);
@ -1023,7 +1021,7 @@ static HRESULT AVISplitter_Disconnect(LPVOID iface);
static HRESULT AVISplitter_InputPin_PreConnect(IPin * iface, IPin * pConnectPin, ALLOCATOR_PROPERTIES *props) static HRESULT AVISplitter_InputPin_PreConnect(IPin * iface, IPin * pConnectPin, ALLOCATOR_PROPERTIES *props)
{ {
PullPin *This = impl_PullPin_from_IPin(iface); PullPin *This = impl_PullPin_from_IPin(iface);
AVISplitterImpl *pAviSplit = impl_from_IBaseFilter(This->pin.pinInfo.pFilter); AVISplitterImpl *pAviSplit = impl_from_IBaseFilter(&This->pin.filter->IBaseFilter_iface);
HRESULT hr; HRESULT hr;
RIFFLIST list; RIFFLIST list;
LONGLONG pos = 0; /* in bytes */ LONGLONG pos = 0; /* in bytes */

View File

@ -469,7 +469,6 @@ static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFi
{ {
HANDLE hFile; HANDLE hFile;
AsyncReader *This = impl_from_IFileSourceFilter(iface); AsyncReader *This = impl_from_IFileSourceFilter(iface);
PIN_INFO pin_info;
TRACE("%p->(%s, %p)\n", This, debugstr_w(pszFileName), pmt); TRACE("%p->(%s, %p)\n", This, debugstr_w(pszFileName), pmt);
@ -485,12 +484,8 @@ static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFi
return HRESULT_FROM_WIN32(GetLastError()); return HRESULT_FROM_WIN32(GetLastError());
} }
/* create pin */ strmbase_source_init(&This->source, &FileAsyncReaderPin_Vtbl, &This->filter,
pin_info.dir = PINDIR_OUTPUT; wszOutputPinName, &output_BaseOutputFuncTable);
pin_info.pFilter = &This->filter.IBaseFilter_iface;
lstrcpyW(pin_info.achName, wszOutputPinName);
strmbase_source_init(&This->source, &FileAsyncReaderPin_Vtbl, &pin_info,
&output_BaseOutputFuncTable, &This->filter.csFilter);
BaseFilterImpl_IncrementPinVersion(&This->filter); BaseFilterImpl_IncrementPinVersion(&This->filter);
This->file = hFile; This->file = hFile;

View File

@ -355,7 +355,7 @@ static HRESULT MPEGSplitter_query_accept(LPVOID iface, const AM_MEDIA_TYPE *pmt)
} }
static HRESULT MPEGSplitter_init_audio(MPEGSplitterImpl *This, const BYTE *header, PIN_INFO *ppiOutput, AM_MEDIA_TYPE *pamt) static HRESULT MPEGSplitter_init_audio(MPEGSplitterImpl *This, const BYTE *header, AM_MEDIA_TYPE *pamt)
{ {
WAVEFORMATEX *format; WAVEFORMATEX *format;
int bitrate_index; int bitrate_index;
@ -369,9 +369,6 @@ static HRESULT MPEGSplitter_init_audio(MPEGSplitterImpl *This, const BYTE *heade
int mode; int mode;
ZeroMemory(pamt, sizeof(*pamt)); ZeroMemory(pamt, sizeof(*pamt));
ppiOutput->dir = PINDIR_OUTPUT;
ppiOutput->pFilter = &This->Parser.filter.IBaseFilter_iface;
wsprintfW(ppiOutput->achName, wszAudioStream);
pamt->formattype = FORMAT_WaveFormatEx; pamt->formattype = FORMAT_WaveFormatEx;
pamt->majortype = MEDIATYPE_Audio; pamt->majortype = MEDIATYPE_Audio;
@ -480,14 +477,13 @@ static HRESULT MPEGSplitter_init_audio(MPEGSplitterImpl *This, const BYTE *heade
static HRESULT MPEGSplitter_pre_connect(IPin *iface, IPin *pConnectPin, ALLOCATOR_PROPERTIES *props) static HRESULT MPEGSplitter_pre_connect(IPin *iface, IPin *pConnectPin, ALLOCATOR_PROPERTIES *props)
{ {
PullPin *pPin = impl_PullPin_from_IPin(iface); PullPin *pPin = impl_PullPin_from_IPin(iface);
MPEGSplitterImpl *This = impl_from_IBaseFilter(pPin->pin.pinInfo.pFilter); MPEGSplitterImpl *This = impl_from_IBaseFilter(&pPin->pin.filter->IBaseFilter_iface);
HRESULT hr; HRESULT hr;
LONGLONG pos = 0; /* in bytes */ LONGLONG pos = 0; /* in bytes */
BYTE header[10]; BYTE header[10];
int streamtype; int streamtype;
LONGLONG total, avail; LONGLONG total, avail;
AM_MEDIA_TYPE amt; AM_MEDIA_TYPE amt;
PIN_INFO piOutput;
IAsyncReader_Length(pPin->pReader, &total, &avail); IAsyncReader_Length(pPin->pReader, &total, &avail);
This->EndOfFile = total; This->EndOfFile = total;
@ -570,7 +566,7 @@ static HRESULT MPEGSplitter_pre_connect(IPin *iface, IPin *pConnectPin, ALLOCATO
LONGLONG duration = 0; LONGLONG duration = 0;
WAVEFORMATEX *format; WAVEFORMATEX *format;
hr = MPEGSplitter_init_audio(This, header, &piOutput, &amt); hr = MPEGSplitter_init_audio(This, header, &amt);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
format = (WAVEFORMATEX*)amt.pbFormat; format = (WAVEFORMATEX*)amt.pbFormat;
@ -581,7 +577,7 @@ static HRESULT MPEGSplitter_pre_connect(IPin *iface, IPin *pConnectPin, ALLOCATO
props->cbBuffer = 0x4000 / format->nBlockAlign * props->cbBuffer = 0x4000 / format->nBlockAlign *
format->nBlockAlign; format->nBlockAlign;
props->cBuffers = 3; props->cBuffers = 3;
hr = Parser_AddPin(&(This->Parser), &piOutput, props, &amt); hr = Parser_AddPin(&This->Parser, wszAudioStream, props, &amt);
} }
if (FAILED(hr)) if (FAILED(hr))

View File

@ -80,7 +80,6 @@ HRESULT Parser_Create(ParserImpl *pParser, const IBaseFilterVtbl *vtbl, IUnknown
SourceSeeking_ChangeStart start, SourceSeeking_ChangeRate rate) SourceSeeking_ChangeStart start, SourceSeeking_ChangeRate rate)
{ {
HRESULT hr; HRESULT hr;
PIN_INFO piInput;
strmbase_filter_init(&pParser->filter, vtbl, outer, clsid, func_table); strmbase_filter_init(&pParser->filter, vtbl, outer, clsid, func_table);
@ -89,11 +88,6 @@ HRESULT Parser_Create(ParserImpl *pParser, const IBaseFilterVtbl *vtbl, IUnknown
pParser->cStreams = 0; pParser->cStreams = 0;
pParser->sources = CoTaskMemAlloc(0 * sizeof(IPin *)); pParser->sources = CoTaskMemAlloc(0 * sizeof(IPin *));
/* construct input pin */
piInput.dir = PINDIR_INPUT;
piInput.pFilter = &pParser->filter.IBaseFilter_iface;
lstrcpynW(piInput.achName, sink_name, ARRAY_SIZE(piInput.achName));
if (!start) if (!start)
start = Parser_ChangeStart; start = Parser_ChangeStart;
@ -105,7 +99,9 @@ HRESULT Parser_Create(ParserImpl *pParser, const IBaseFilterVtbl *vtbl, IUnknown
SourceSeeking_Init(&pParser->sourceSeeking, &Parser_Seeking_Vtbl, stop, start, rate, &pParser->filter.csFilter); SourceSeeking_Init(&pParser->sourceSeeking, &Parser_Seeking_Vtbl, stop, start, rate, &pParser->filter.csFilter);
hr = PullPin_Construct(&Parser_InputPin_Vtbl, &piInput, fnProcessSample, (LPVOID)pParser, fnQueryAccept, fnCleanup, fnRequest, fnDone, &pParser->filter.csFilter, (IPin **)&pParser->pInputPin); hr = PullPin_Construct(&Parser_InputPin_Vtbl, &pParser->filter, sink_name,
fnProcessSample, (void *)pParser, fnQueryAccept, fnCleanup, fnRequest,
fnDone, (IPin **)&pParser->pInputPin);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
@ -346,7 +342,7 @@ static const BaseOutputPinFuncTable output_BaseOutputFuncTable = {
Parser_OutputPin_DecideAllocator, Parser_OutputPin_DecideAllocator,
}; };
HRESULT Parser_AddPin(ParserImpl *filter, const PIN_INFO *pin_info, HRESULT Parser_AddPin(ParserImpl *filter, const WCHAR *name,
ALLOCATOR_PROPERTIES *props, const AM_MEDIA_TYPE *mt) ALLOCATOR_PROPERTIES *props, const AM_MEDIA_TYPE *mt)
{ {
Parser_OutputPin **old_sources; Parser_OutputPin **old_sources;
@ -361,14 +357,12 @@ HRESULT Parser_AddPin(ParserImpl *filter, const PIN_INFO *pin_info,
memcpy(filter->sources, old_sources, filter->cStreams * sizeof(filter->sources[0])); memcpy(filter->sources, old_sources, filter->cStreams * sizeof(filter->sources[0]));
filter->sources[filter->cStreams] = object; filter->sources[filter->cStreams] = object;
strmbase_source_init(&object->pin, &Parser_OutputPin_Vtbl, pin_info, strmbase_source_init(&object->pin, &Parser_OutputPin_Vtbl, &filter->filter,
&output_BaseOutputFuncTable, &filter->filter.csFilter); name, &output_BaseOutputFuncTable);
object->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)); object->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
CopyMediaType(object->pmt, mt); CopyMediaType(object->pmt, mt);
object->dwSamplesProcessed = 0; object->dwSamplesProcessed = 0;
object->pin.pin.pinInfo.pFilter = &filter->filter.IBaseFilter_iface;
object->allocProps = *props; object->allocProps = *props;
filter->cStreams++; filter->cStreams++;
BaseFilterImpl_IncrementPinVersion(&filter->filter); BaseFilterImpl_IncrementPinVersion(&filter->filter);
@ -539,7 +533,7 @@ static HRESULT WINAPI Parser_OutputPin_QueryInterface(IPin * iface, REFIID riid,
*ppv = iface; *ppv = iface;
/* The Parser filter does not support querying IMediaSeeking, return it directly */ /* The Parser filter does not support querying IMediaSeeking, return it directly */
else if (IsEqualIID(riid, &IID_IMediaSeeking)) else if (IsEqualIID(riid, &IID_IMediaSeeking))
*ppv = &impl_from_IBaseFilter(This->pin.pin.pinInfo.pFilter)->sourceSeeking; *ppv = &impl_from_IBaseFilter(&This->pin.pin.filter->IBaseFilter_iface)->sourceSeeking;
if (*ppv) if (*ppv)
{ {
@ -555,7 +549,7 @@ static HRESULT WINAPI Parser_OutputPin_QueryInterface(IPin * iface, REFIID riid,
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)
{ {
Parser_OutputPin *This = unsafe_impl_Parser_OutputPin_from_IPin(iface); Parser_OutputPin *This = unsafe_impl_Parser_OutputPin_from_IPin(iface);
ParserImpl *parser = impl_from_IBaseFilter(This->pin.pin.pinInfo.pFilter); ParserImpl *parser = impl_from_IBaseFilter(&This->pin.pin.filter->IBaseFilter_iface);
/* Set the allocator to our input pin's */ /* Set the allocator to our input pin's */
EnterCriticalSection(This->pin.pin.pCritSec); EnterCriticalSection(This->pin.pin.pCritSec);
@ -610,7 +604,7 @@ static HRESULT WINAPI Parser_PullPin_QueryInterface(IPin * iface, REFIID riid, L
* querying IMediaSeeking * querying IMediaSeeking
*/ */
if (IsEqualIID(riid, &IID_IMediaSeeking)) if (IsEqualIID(riid, &IID_IMediaSeeking))
*ppv = &impl_from_IBaseFilter(This->pin.pinInfo.pFilter)->sourceSeeking; *ppv = &impl_from_IBaseFilter(&This->pin.filter->IBaseFilter_iface)->sourceSeeking;
if (*ppv) if (*ppv)
{ {
@ -634,10 +628,10 @@ static HRESULT WINAPI Parser_PullPin_Disconnect(IPin * iface)
if (This->pin.pConnectedTo) if (This->pin.pConnectedTo)
{ {
FILTER_STATE state; FILTER_STATE state;
ParserImpl *Parser = impl_from_IBaseFilter(This->pin.pinInfo.pFilter); ParserImpl *Parser = impl_from_IBaseFilter(&This->pin.filter->IBaseFilter_iface);
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(This->pin.pCritSec);
hr = IBaseFilter_GetState(This->pin.pinInfo.pFilter, INFINITE, &state); hr = IBaseFilter_GetState(&This->pin.filter->IBaseFilter_iface, INFINITE, &state);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(This->pin.pCritSec);
if (SUCCEEDED(hr) && (state == State_Stopped) && SUCCEEDED(Parser->fnDisconnect(Parser))) if (SUCCEEDED(hr) && (state == State_Stopped) && SUCCEEDED(Parser->fnDisconnect(Parser)))
@ -645,7 +639,7 @@ static HRESULT WINAPI Parser_PullPin_Disconnect(IPin * iface)
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(This->pin.pCritSec);
PullPin_Disconnect(iface); PullPin_Disconnect(iface);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(This->pin.pCritSec);
hr = Parser_RemoveOutputPins(impl_from_IBaseFilter(This->pin.pinInfo.pFilter)); hr = Parser_RemoveOutputPins(impl_from_IBaseFilter(&This->pin.filter->IBaseFilter_iface));
} }
else else
hr = VFW_E_NOT_STOPPED; hr = VFW_E_NOT_STOPPED;
@ -671,7 +665,7 @@ static HRESULT WINAPI Parser_PullPin_ReceiveConnection(IPin * iface, IPin * pRec
BasePin *This = (BasePin *)iface; BasePin *This = (BasePin *)iface;
EnterCriticalSection(This->pCritSec); EnterCriticalSection(This->pCritSec);
Parser_RemoveOutputPins(impl_from_IBaseFilter(This->pinInfo.pFilter)); Parser_RemoveOutputPins(impl_from_IBaseFilter(&This->filter->IBaseFilter_iface));
LeaveCriticalSection(This->pCritSec); LeaveCriticalSection(This->pCritSec);
} }

View File

@ -50,7 +50,8 @@ struct ParserImpl
SourceSeeking sourceSeeking; SourceSeeking sourceSeeking;
}; };
extern HRESULT Parser_AddPin(ParserImpl * This, const PIN_INFO * piOutput, ALLOCATOR_PROPERTIES * props, const AM_MEDIA_TYPE * amt); extern HRESULT Parser_AddPin(ParserImpl *filter, const WCHAR *name,
ALLOCATOR_PROPERTIES *props, const AM_MEDIA_TYPE *mt);
HRESULT Parser_Create(ParserImpl *parser, const IBaseFilterVtbl *vtbl, IUnknown *outer, HRESULT Parser_Create(ParserImpl *parser, const IBaseFilterVtbl *vtbl, IUnknown *outer,
const CLSID *clsid, const struct strmbase_filter_ops *func_table, const WCHAR *sink_name, const CLSID *clsid, const struct strmbase_filter_ops *func_table, const WCHAR *sink_name,

View File

@ -166,19 +166,18 @@ static HRESULT deliver_newsegment(IPin *pin, LPVOID data)
/*** PullPin implementation ***/ /*** PullPin implementation ***/
static HRESULT PullPin_Init(const IPinVtbl *PullPin_Vtbl, const PIN_INFO *info, static HRESULT PullPin_Init(const IPinVtbl *PullPin_Vtbl, struct strmbase_filter *filter,
SAMPLEPROC_PULL pSampleProc, void *pUserData, QUERYACCEPTPROC pQueryAccept, const WCHAR *name, SAMPLEPROC_PULL pSampleProc, void *pUserData,
CLEANUPPROC pCleanUp, REQUESTPROC pCustomRequest, STOPPROCESSPROC pDone, QUERYACCEPTPROC pQueryAccept, CLEANUPPROC pCleanUp, REQUESTPROC pCustomRequest,
LPCRITICAL_SECTION pCritSec, PullPin *pPinImpl) STOPPROCESSPROC pDone, PullPin *pPinImpl)
{ {
/* Common attributes */ /* Common attributes */
pPinImpl->pin.IPin_iface.lpVtbl = PullPin_Vtbl; pPinImpl->pin.IPin_iface.lpVtbl = PullPin_Vtbl;
pPinImpl->pin.pConnectedTo = NULL; pPinImpl->pin.pConnectedTo = NULL;
pPinImpl->pin.pCritSec = pCritSec; pPinImpl->pin.pCritSec = &filter->csFilter;
/* avoid copying uninitialized data */ wcscpy(pPinImpl->pin.name, name);
wcscpy(pPinImpl->pin.pinInfo.achName, info->achName); pPinImpl->pin.dir = PINDIR_INPUT;
pPinImpl->pin.pinInfo.dir = info->dir; pPinImpl->pin.filter = filter;
pPinImpl->pin.pinInfo.pFilter = info->pFilter;
ZeroMemory(&pPinImpl->pin.mtCurrent, sizeof(AM_MEDIA_TYPE)); ZeroMemory(&pPinImpl->pin.mtCurrent, sizeof(AM_MEDIA_TYPE));
/* Input pin attributes */ /* Input pin attributes */
@ -209,27 +208,22 @@ static HRESULT PullPin_Init(const IPinVtbl *PullPin_Vtbl, const PIN_INFO *info,
return S_OK; return S_OK;
} }
HRESULT PullPin_Construct(const IPinVtbl *PullPin_Vtbl, const PIN_INFO * pPinInfo, HRESULT PullPin_Construct(const IPinVtbl *PullPin_Vtbl, struct strmbase_filter *filter, const WCHAR *name,
SAMPLEPROC_PULL pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, SAMPLEPROC_PULL pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept,
CLEANUPPROC pCleanUp, REQUESTPROC pCustomRequest, STOPPROCESSPROC pDone, CLEANUPPROC pCleanUp, REQUESTPROC pCustomRequest, STOPPROCESSPROC pDone,
LPCRITICAL_SECTION pCritSec, IPin ** ppPin) IPin ** ppPin)
{ {
PullPin * pPinImpl; PullPin * pPinImpl;
*ppPin = NULL; *ppPin = NULL;
if (pPinInfo->dir != PINDIR_INPUT)
{
ERR("Pin direction(%x) != PINDIR_INPUT\n", pPinInfo->dir);
return E_INVALIDARG;
}
pPinImpl = CoTaskMemAlloc(sizeof(*pPinImpl)); pPinImpl = CoTaskMemAlloc(sizeof(*pPinImpl));
if (!pPinImpl) if (!pPinImpl)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
if (SUCCEEDED(PullPin_Init(PullPin_Vtbl, pPinInfo, pSampleProc, pUserData, pQueryAccept, pCleanUp, pCustomRequest, pDone, pCritSec, pPinImpl))) if (SUCCEEDED(PullPin_Init(PullPin_Vtbl, filter, name, pSampleProc, pUserData,
pQueryAccept, pCleanUp, pCustomRequest, pDone, pPinImpl)))
{ {
*ppPin = &pPinImpl->pin.IPin_iface; *ppPin = &pPinImpl->pin.IPin_iface;
return S_OK; return S_OK;
@ -348,7 +342,7 @@ HRESULT WINAPI PullPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv)
else if (IsEqualIID(riid, &IID_IMediaSeeking) || else if (IsEqualIID(riid, &IID_IMediaSeeking) ||
IsEqualIID(riid, &IID_IQualityControl)) IsEqualIID(riid, &IID_IQualityControl))
{ {
return IBaseFilter_QueryInterface(This->pin.pinInfo.pFilter, riid, ppv); return IBaseFilter_QueryInterface(&This->pin.filter->IBaseFilter_iface, riid, ppv);
} }
if (*ppv) if (*ppv)
@ -525,7 +519,7 @@ static void PullPin_Thread_Stop(PullPin *This)
SetEvent(This->hEventStateChanged); SetEvent(This->hEventStateChanged);
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(This->pin.pCritSec);
IBaseFilter_Release(This->pin.pinInfo.pFilter); IPin_Release(&This->pin.IPin_iface);
CoUninitialize(); CoUninitialize();
ExitThread(0); ExitThread(0);
@ -576,16 +570,13 @@ static HRESULT PullPin_InitProcessing(PullPin * This)
assert(WaitForSingleObject(This->thread_sleepy, 0) == WAIT_TIMEOUT); assert(WaitForSingleObject(This->thread_sleepy, 0) == WAIT_TIMEOUT);
This->state = Req_Sleepy; This->state = Req_Sleepy;
/* AddRef the filter to make sure it and its pins will be around IPin_AddRef(&This->pin.IPin_iface);
* as long as the thread */
IBaseFilter_AddRef(This->pin.pinInfo.pFilter);
This->hThread = CreateThread(NULL, 0, PullPin_Thread_Main, This, 0, &dwThreadId); This->hThread = CreateThread(NULL, 0, PullPin_Thread_Main, This, 0, &dwThreadId);
if (!This->hThread) if (!This->hThread)
{ {
hr = HRESULT_FROM_WIN32(GetLastError()); hr = HRESULT_FROM_WIN32(GetLastError());
IBaseFilter_Release(This->pin.pinInfo.pFilter); IPin_Release(&This->pin.IPin_iface);
} }
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
@ -769,7 +760,7 @@ HRESULT WINAPI PullPin_EndFlush(IPin * iface)
if (This->pReader) if (This->pReader)
IAsyncReader_EndFlush(This->pReader); IAsyncReader_EndFlush(This->pReader);
IBaseFilter_GetState(This->pin.pinInfo.pFilter, INFINITE, &state); IBaseFilter_GetState(&This->pin.filter->IBaseFilter_iface, INFINITE, &state);
if (state != State_Stopped) if (state != State_Stopped)
PullPin_StartProcessing(This); PullPin_StartProcessing(This);

View File

@ -102,10 +102,10 @@ typedef struct PullPin
#define Req_Pause 3 #define Req_Pause 3
/*** Constructors ***/ /*** Constructors ***/
HRESULT PullPin_Construct(const IPinVtbl *PullPin_Vtbl, const PIN_INFO * pPinInfo, HRESULT PullPin_Construct(const IPinVtbl *PullPin_Vtbl, struct strmbase_filter *filter, const WCHAR *name,
SAMPLEPROC_PULL pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, SAMPLEPROC_PULL pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept,
CLEANUPPROC pCleanUp, REQUESTPROC pCustomRequest, STOPPROCESSPROC pDone, CLEANUPPROC pCleanUp, REQUESTPROC pCustomRequest, STOPPROCESSPROC pDone,
LPCRITICAL_SECTION pCritSec, IPin ** ppPin); IPin **ppPin);
void PullPin_destroy(PullPin *pin) DECLSPEC_HIDDEN; void PullPin_destroy(PullPin *pin) DECLSPEC_HIDDEN;
/**************************/ /**************************/

View File

@ -51,9 +51,9 @@ static inline WAVEParserImpl *impl_from_IMediaSeeking( IMediaSeeking *iface )
return CONTAINING_RECORD(iface, WAVEParserImpl, Parser.sourceSeeking.IMediaSeeking_iface); return CONTAINING_RECORD(iface, WAVEParserImpl, Parser.sourceSeeking.IMediaSeeking_iface);
} }
static inline WAVEParserImpl *impl_from_IBaseFilter( IBaseFilter *iface ) static inline WAVEParserImpl *impl_from_strmbase_filter(struct strmbase_filter *iface)
{ {
return CONTAINING_RECORD(iface, WAVEParserImpl, Parser.filter.IBaseFilter_iface); return CONTAINING_RECORD(iface, WAVEParserImpl, Parser.filter);
} }
static LONGLONG bytepos_to_duration(WAVEParserImpl *This, LONGLONG bytepos) static LONGLONG bytepos_to_duration(WAVEParserImpl *This, LONGLONG bytepos)
@ -246,13 +246,8 @@ static HRESULT WAVEParser_InputPin_PreConnect(IPin * iface, IPin * pConnectPin,
RIFFLIST list; RIFFLIST list;
RIFFCHUNK chunk; RIFFCHUNK chunk;
LONGLONG pos = 0; /* in bytes */ LONGLONG pos = 0; /* in bytes */
PIN_INFO piOutput;
AM_MEDIA_TYPE amt; AM_MEDIA_TYPE amt;
WAVEParserImpl * pWAVEParser = impl_from_IBaseFilter(This->pin.pinInfo.pFilter); WAVEParserImpl *pWAVEParser = impl_from_strmbase_filter(This->pin.filter);
piOutput.dir = PINDIR_OUTPUT;
piOutput.pFilter = &pWAVEParser->Parser.filter.IBaseFilter_iface;
lstrcpynW(piOutput.achName, outputW, ARRAY_SIZE(piOutput.achName));
hr = IAsyncReader_SyncRead(This->pReader, pos, sizeof(list), (BYTE *)&list); hr = IAsyncReader_SyncRead(This->pReader, pos, sizeof(list), (BYTE *)&list);
pos += sizeof(list); pos += sizeof(list);
@ -314,7 +309,7 @@ static HRESULT WAVEParser_InputPin_PreConnect(IPin * iface, IPin * pConnectPin,
props->cBuffers = 3; props->cBuffers = 3;
pWAVEParser->nBlockAlign = ((WAVEFORMATEX*)amt.pbFormat)->nBlockAlign; pWAVEParser->nBlockAlign = ((WAVEFORMATEX*)amt.pbFormat)->nBlockAlign;
pWAVEParser->nAvgBytesPerSec = ((WAVEFORMATEX*)amt.pbFormat)->nAvgBytesPerSec; pWAVEParser->nAvgBytesPerSec = ((WAVEFORMATEX*)amt.pbFormat)->nAvgBytesPerSec;
hr = Parser_AddPin(&(pWAVEParser->Parser), &piOutput, props, &amt); hr = Parser_AddPin(&pWAVEParser->Parser, outputW, props, &amt);
CoTaskMemFree(amt.pbFormat); CoTaskMemFree(amt.pbFormat);
pWAVEParser->Parser.sourceSeeking.llCurrent = 0; pWAVEParser->Parser.sourceSeeking.llCurrent = 0;
@ -410,7 +405,7 @@ static const IBaseFilterVtbl WAVEParser_Vtbl =
static void wave_parser_destroy(struct strmbase_filter *iface) static void wave_parser_destroy(struct strmbase_filter *iface)
{ {
WAVEParserImpl *filter = impl_from_IBaseFilter(&iface->IBaseFilter_iface); WAVEParserImpl *filter = impl_from_strmbase_filter(iface);
Parser_Destroy(&filter->Parser); Parser_Destroy(&filter->Parser);
} }

View File

@ -135,14 +135,6 @@ out:
return hr; return hr;
} }
static void Copy_PinInfo(PIN_INFO * pDest, const PIN_INFO * pSrc)
{
/* avoid copying uninitialized data */
lstrcpyW(pDest->achName, pSrc->achName);
pDest->dir = pSrc->dir;
pDest->pFilter = pSrc->pFilter;
}
static void dump_AM_MEDIA_TYPE(const AM_MEDIA_TYPE * pmt) static void dump_AM_MEDIA_TYPE(const AM_MEDIA_TYPE * pmt)
{ {
if (!pmt) if (!pmt)
@ -176,13 +168,13 @@ LONG WINAPI BasePinImpl_GetMediaTypeVersion(BasePin *iface)
ULONG WINAPI BasePinImpl_AddRef(IPin *iface) ULONG WINAPI BasePinImpl_AddRef(IPin *iface)
{ {
BasePin *pin = impl_from_IPin(iface); BasePin *pin = impl_from_IPin(iface);
return IBaseFilter_AddRef(pin->pinInfo.pFilter); return IBaseFilter_AddRef(&pin->filter->IBaseFilter_iface);
} }
ULONG WINAPI BasePinImpl_Release(IPin *iface) ULONG WINAPI BasePinImpl_Release(IPin *iface)
{ {
BasePin *pin = impl_from_IPin(iface); BasePin *pin = impl_from_IPin(iface);
return IBaseFilter_Release(pin->pinInfo.pFilter); return IBaseFilter_Release(&pin->filter->IBaseFilter_iface);
} }
HRESULT WINAPI BasePinImpl_Disconnect(IPin * iface) HRESULT WINAPI BasePinImpl_Disconnect(IPin * iface)
@ -261,40 +253,40 @@ HRESULT WINAPI BasePinImpl_ConnectionMediaType(IPin * iface, AM_MEDIA_TYPE * pmt
return hr; return hr;
} }
HRESULT WINAPI BasePinImpl_QueryPinInfo(IPin * iface, PIN_INFO * pInfo) HRESULT WINAPI BasePinImpl_QueryPinInfo(IPin *iface, PIN_INFO *info)
{ {
BasePin *This = impl_from_IPin(iface); BasePin *pin = impl_from_IPin(iface);
TRACE("(%p)->(%p)\n", This, pInfo); TRACE("pin %p, info %p.\n", pin, info);
Copy_PinInfo(pInfo, &This->pinInfo); info->dir = pin->dir;
IBaseFilter_AddRef(pInfo->pFilter); IBaseFilter_AddRef(info->pFilter = &pin->filter->IBaseFilter_iface);
lstrcpyW(info->achName, pin->name);
return S_OK; return S_OK;
} }
HRESULT WINAPI BasePinImpl_QueryDirection(IPin * iface, PIN_DIRECTION * pPinDir) HRESULT WINAPI BasePinImpl_QueryDirection(IPin *iface, PIN_DIRECTION *dir)
{ {
BasePin *This = impl_from_IPin(iface); BasePin *pin = impl_from_IPin(iface);
TRACE("(%p)->(%p)\n", This, pPinDir); TRACE("pin %p, dir %p.\n", pin, dir);
*pPinDir = This->pinInfo.dir; *dir = pin->dir;
return S_OK; return S_OK;
} }
HRESULT WINAPI BasePinImpl_QueryId(IPin * iface, LPWSTR * Id) HRESULT WINAPI BasePinImpl_QueryId(IPin *iface, WCHAR **id)
{ {
BasePin *This = impl_from_IPin(iface); BasePin *pin = impl_from_IPin(iface);
TRACE("(%p)->(%p)\n", This, Id); TRACE("pin %p, id %p.\n", pin, id);
*Id = CoTaskMemAlloc((lstrlenW(This->pinInfo.achName) + 1) * sizeof(WCHAR)); if (!(*id = CoTaskMemAlloc((lstrlenW(pin->name) + 1) * sizeof(WCHAR))))
if (!*Id)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
lstrcpyW(*Id, This->pinInfo.achName); lstrcpyW(*id, pin->name);
return S_OK; return S_OK;
} }
@ -362,7 +354,7 @@ HRESULT WINAPI BaseOutputPinImpl_QueryInterface(IPin * iface, REFIID riid, LPVOI
else if (IsEqualIID(riid, &IID_IMediaSeeking) || else if (IsEqualIID(riid, &IID_IMediaSeeking) ||
IsEqualIID(riid, &IID_IQualityControl)) IsEqualIID(riid, &IID_IQualityControl))
{ {
return IBaseFilter_QueryInterface(This->pin.pinInfo.pFilter, riid, ppv); return IBaseFilter_QueryInterface(&This->pin.filter->IBaseFilter_iface, riid, ppv);
} }
if (*ppv) if (*ppv)
@ -712,22 +704,17 @@ HRESULT WINAPI BaseOutputPinImpl_AttemptConnection(BaseOutputPin *This, IPin *pR
return hr; return hr;
} }
static void strmbase_pin_init(BasePin *pin, const IPinVtbl *vtbl, void strmbase_source_init(BaseOutputPin *pin, const IPinVtbl *vtbl, struct strmbase_filter *filter,
const BasePinFuncTable *func_table, const PIN_INFO *info, CRITICAL_SECTION *cs) const WCHAR *name, const BaseOutputPinFuncTable *func_table)
{ {
memset(pin, 0, sizeof(*pin)); memset(pin, 0, sizeof(*pin));
pin->IPin_iface.lpVtbl = vtbl; pin->pin.IPin_iface.lpVtbl = vtbl;
pin->pCritSec = cs; pin->pin.pCritSec = &filter->csFilter;
pin->dRate = 1.0; pin->pin.dRate = 1.0;
Copy_PinInfo(&pin->pinInfo, info); pin->pin.filter = filter;
pin->pFuncsTable = func_table; pin->pin.dir = PINDIR_OUTPUT;
} lstrcpyW(pin->pin.name, name);
pin->pin.pFuncsTable = &func_table->base;
void strmbase_source_init(BaseOutputPin *pin, const IPinVtbl *vtbl,
const PIN_INFO *info, const BaseOutputPinFuncTable *func_table, CRITICAL_SECTION *cs)
{
memset(pin, 0, sizeof(*pin));
strmbase_pin_init(&pin->pin, vtbl, &func_table->base, info, cs);
pin->pFuncsTable = func_table; pin->pFuncsTable = func_table;
} }
@ -762,7 +749,7 @@ HRESULT WINAPI BaseInputPinImpl_QueryInterface(IPin * iface, REFIID riid, LPVOID
*ppv = &This->IMemInputPin_iface; *ppv = &This->IMemInputPin_iface;
else if (IsEqualIID(riid, &IID_IMediaSeeking)) else if (IsEqualIID(riid, &IID_IMediaSeeking))
{ {
return IBaseFilter_QueryInterface(This->pin.pinInfo.pFilter, &IID_IMediaSeeking, ppv); return IBaseFilter_QueryInterface(&This->pin.filter->IBaseFilter_iface, &IID_IMediaSeeking, ppv);
} }
if (*ppv) if (*ppv)
@ -1045,12 +1032,17 @@ static const IMemInputPinVtbl MemInputPin_Vtbl =
MemInputPin_ReceiveCanBlock MemInputPin_ReceiveCanBlock
}; };
void strmbase_sink_init(BaseInputPin *pin, const IPinVtbl *vtbl, void strmbase_sink_init(BaseInputPin *pin, const IPinVtbl *vtbl, struct strmbase_filter *filter,
const PIN_INFO *info, const BaseInputPinFuncTable *func_table, CRITICAL_SECTION *cs, const WCHAR *name, const BaseInputPinFuncTable *func_table, IMemAllocator *allocator)
IMemAllocator *allocator)
{ {
memset(pin, 0, sizeof(*pin)); memset(pin, 0, sizeof(*pin));
strmbase_pin_init(&pin->pin, vtbl, &func_table->base, info, cs); pin->pin.IPin_iface.lpVtbl = vtbl;
pin->pin.pCritSec = &filter->csFilter;
pin->pin.dRate = 1.0;
pin->pin.filter = filter;
pin->pin.dir = PINDIR_INPUT;
lstrcpyW(pin->pin.name, name);
pin->pin.pFuncsTable = &func_table->base;
pin->pFuncsTable = func_table; pin->pFuncsTable = func_table;
pin->pAllocator = pin->preferred_allocator = allocator; pin->pAllocator = pin->preferred_allocator = allocator;
if (pin->preferred_allocator) if (pin->preferred_allocator)

View File

@ -236,7 +236,6 @@ HRESULT WINAPI strmbase_renderer_init(BaseRenderer *filter, const IBaseFilterVtb
IUnknown *outer, const CLSID *clsid, const WCHAR *sink_name, IUnknown *outer, const CLSID *clsid, const WCHAR *sink_name,
const BaseRendererFuncTable *pBaseFuncsTable) const BaseRendererFuncTable *pBaseFuncsTable)
{ {
PIN_INFO piInput;
HRESULT hr; HRESULT hr;
memset(filter, 0, sizeof(*filter)); memset(filter, 0, sizeof(*filter));
@ -244,13 +243,8 @@ HRESULT WINAPI strmbase_renderer_init(BaseRenderer *filter, const IBaseFilterVtb
filter->pFuncsTable = pBaseFuncsTable; filter->pFuncsTable = pBaseFuncsTable;
/* construct input pin */ strmbase_sink_init(&filter->sink, &BaseRenderer_InputPin_Vtbl, &filter->filter,
piInput.dir = PINDIR_INPUT; sink_name, &input_BaseInputFuncTable, NULL);
piInput.pFilter = &filter->filter.IBaseFilter_iface;
lstrcpynW(piInput.achName, sink_name, ARRAY_SIZE(piInput.achName));
strmbase_sink_init(&filter->sink, &BaseRenderer_InputPin_Vtbl, &piInput,
&input_BaseInputFuncTable, &filter->filter.csFilter, NULL);
hr = CreatePosPassThru(outer ? outer : (IUnknown *)&filter->filter.IBaseFilter_iface, TRUE, hr = CreatePosPassThru(outer ? outer : (IUnknown *)&filter->filter.IBaseFilter_iface, TRUE,
&filter->sink.pin.IPin_iface, &filter->pPosition); &filter->sink.pin.IPin_iface, &filter->pPosition);

View File

@ -275,8 +275,6 @@ static HRESULT strmbase_transform_init(IUnknown *outer, const CLSID *clsid,
{ {
ISeekingPassThru *passthru; ISeekingPassThru *passthru;
HRESULT hr; HRESULT hr;
PIN_INFO piInput;
PIN_INFO piOutput;
strmbase_filter_init(&filter->filter, &transform_vtbl, outer, clsid, &filter_ops); strmbase_filter_init(&filter->filter, &transform_vtbl, outer, clsid, &filter_ops);
@ -287,19 +285,11 @@ 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));
/* construct input pin */ strmbase_sink_init(&filter->sink, &TransformFilter_InputPin_Vtbl, &filter->filter,
piInput.dir = PINDIR_INPUT; wcsInputPinName, &tf_input_BaseInputFuncTable, NULL);
piInput.pFilter = &filter->filter.IBaseFilter_iface;
lstrcpynW(piInput.achName, wcsInputPinName, ARRAY_SIZE(piInput.achName));
piOutput.dir = PINDIR_OUTPUT;
piOutput.pFilter = &filter->filter.IBaseFilter_iface;
lstrcpynW(piOutput.achName, wcsOutputPinName, ARRAY_SIZE(piOutput.achName));
strmbase_sink_init(&filter->sink, &TransformFilter_InputPin_Vtbl, &piInput, strmbase_source_init(&filter->source, &TransformFilter_OutputPin_Vtbl, &filter->filter,
&tf_input_BaseInputFuncTable, &filter->filter.csFilter, NULL); wcsOutputPinName, &tf_output_BaseOutputFuncTable);
strmbase_source_init(&filter->source, &TransformFilter_OutputPin_Vtbl,
&piOutput, &tf_output_BaseOutputFuncTable, &filter->filter.csFilter);
QualityControlImpl_Create(&filter->sink.pin.IPin_iface, QualityControlImpl_Create(&filter->sink.pin.IPin_iface,
&filter->filter.IBaseFilter_iface, &filter->qcimpl); &filter->filter.IBaseFilter_iface, &filter->qcimpl);

View File

@ -95,6 +95,11 @@ static inline GSTImpl *impl_from_IBaseFilter(IBaseFilter *iface)
return CONTAINING_RECORD(iface, GSTImpl, filter.IBaseFilter_iface); return CONTAINING_RECORD(iface, GSTImpl, filter.IBaseFilter_iface);
} }
static inline GSTImpl *impl_from_strmbase_filter(struct strmbase_filter *iface)
{
return CONTAINING_RECORD(iface, GSTImpl, filter);
}
const char* media_quark_string = "media-sample"; const char* media_quark_string = "media-sample";
static const WCHAR wcsInputPinName[] = {'i','n','p','u','t',' ','p','i','n',0}; static const WCHAR wcsInputPinName[] = {'i','n','p','u','t',' ','p','i','n',0};
@ -104,7 +109,7 @@ static const IPinVtbl GST_InputPin_Vtbl;
static const IBaseFilterVtbl GST_Vtbl; static const IBaseFilterVtbl GST_Vtbl;
static const IQualityControlVtbl GSTOutPin_QualityControl_Vtbl; static const IQualityControlVtbl GSTOutPin_QualityControl_Vtbl;
static BOOL create_pin(GSTImpl *filter, const PIN_INFO *pin_info, const AM_MEDIA_TYPE *mt); static BOOL create_pin(GSTImpl *filter, const WCHAR *name, const AM_MEDIA_TYPE *mt);
static HRESULT GST_RemoveOutputPins(GSTImpl *This); static HRESULT GST_RemoveOutputPins(GSTImpl *This);
static HRESULT WINAPI GST_ChangeCurrent(IMediaSeeking *iface); static HRESULT WINAPI GST_ChangeCurrent(IMediaSeeking *iface);
static HRESULT WINAPI GST_ChangeStop(IMediaSeeking *iface); static HRESULT WINAPI GST_ChangeStop(IMediaSeeking *iface);
@ -293,7 +298,7 @@ static gboolean accept_caps_sink(GstPad *pad, GstCaps *caps)
static gboolean setcaps_sink(GstPad *pad, GstCaps *caps) static gboolean setcaps_sink(GstPad *pad, GstCaps *caps)
{ {
GSTOutPin *pin = gst_pad_get_element_private(pad); GSTOutPin *pin = gst_pad_get_element_private(pad);
GSTImpl *This = impl_from_IBaseFilter(pin->pin.pin.pinInfo.pFilter); GSTImpl *This = impl_from_strmbase_filter(pin->pin.pin.filter);
AM_MEDIA_TYPE amt; AM_MEDIA_TYPE amt;
GstStructure *arg; GstStructure *arg;
const char *typename; const char *typename;
@ -471,7 +476,7 @@ static gboolean event_sink(GstPad *pad, GstObject *parent, GstEvent *event)
IPin_EndOfStream(pin->pin.pin.pConnectedTo); IPin_EndOfStream(pin->pin.pin.pConnectedTo);
return TRUE; return TRUE;
case GST_EVENT_FLUSH_START: case GST_EVENT_FLUSH_START:
if (impl_from_IBaseFilter(pin->pin.pin.pinInfo.pFilter)->ignore_flush) { if (impl_from_strmbase_filter(pin->pin.pin.filter)->ignore_flush) {
/* gst-plugins-base prior to 1.7 contains a bug which causes /* gst-plugins-base prior to 1.7 contains a bug which causes
* our sink pins to receive a flush-start event when the * our sink pins to receive a flush-start event when the
* decodebin changes from PAUSED to READY (including * decodebin changes from PAUSED to READY (including
@ -606,7 +611,7 @@ static DWORD CALLBACK push_data(LPVOID iface)
static GstFlowReturn got_data_sink(GstPad *pad, GstObject *parent, GstBuffer *buf) static GstFlowReturn got_data_sink(GstPad *pad, GstObject *parent, GstBuffer *buf)
{ {
GSTOutPin *pin = gst_pad_get_element_private(pad); GSTOutPin *pin = gst_pad_get_element_private(pad);
GSTImpl *This = impl_from_IBaseFilter(pin->pin.pin.pinInfo.pFilter); GSTImpl *This = impl_from_strmbase_filter(pin->pin.pin.filter);
HRESULT hr; HRESULT hr;
BYTE *ptr = NULL; BYTE *ptr = NULL;
IMediaSample *sample; IMediaSample *sample;
@ -781,8 +786,6 @@ out:
static void init_new_decoded_pad(GstElement *bin, GstPad *pad, GSTImpl *This) static void init_new_decoded_pad(GstElement *bin, GstPad *pad, GSTImpl *This)
{ {
HRESULT hr;
PIN_INFO piOutput;
const char *typename; const char *typename;
char *name; char *name;
AM_MEDIA_TYPE amt = {{0}}; AM_MEDIA_TYPE amt = {{0}};
@ -793,18 +796,17 @@ static void init_new_decoded_pad(GstElement *bin, GstPad *pad, GSTImpl *This)
int ret; int ret;
BOOL isvid = FALSE, isaud = FALSE; BOOL isvid = FALSE, isaud = FALSE;
gchar my_name[1024]; gchar my_name[1024];
WCHAR nameW[128];
TRACE("%p %p %p\n", This, bin, pad); TRACE("%p %p %p\n", This, bin, pad);
piOutput.dir = PINDIR_OUTPUT;
piOutput.pFilter = &This->filter.IBaseFilter_iface;
name = gst_pad_get_name(pad); name = gst_pad_get_name(pad);
MultiByteToWideChar(CP_UNIXCP, 0, name, -1, piOutput.achName, ARRAY_SIZE(piOutput.achName) - 1); MultiByteToWideChar(CP_UNIXCP, 0, name, -1, nameW, ARRAY_SIZE(nameW) - 1);
nameW[ARRAY_SIZE(nameW) - 1] = 0;
TRACE("Name: %s\n", name); TRACE("Name: %s\n", name);
strcpy(my_name, "qz_sink_"); strcpy(my_name, "qz_sink_");
strcat(my_name, name); strcat(my_name, name);
g_free(name); g_free(name);
piOutput.achName[ARRAY_SIZE(piOutput.achName) - 1] = 0;
caps = gst_pad_query_caps(pad, NULL); caps = gst_pad_query_caps(pad, NULL);
caps = gst_caps_make_writable(caps); caps = gst_caps_make_writable(caps);
@ -825,7 +827,7 @@ static void init_new_decoded_pad(GstElement *bin, GstPad *pad, GSTImpl *This)
return; return;
} }
if (!create_pin(This, &piOutput, &amt)) if (!create_pin(This, nameW, &amt))
{ {
ERR("Failed to allocate memory.\n"); ERR("Failed to allocate memory.\n");
return; return;
@ -1098,7 +1100,7 @@ static void unknown_type(GstElement *bin, GstPad *pad, GstCaps *caps, gpointer u
static HRESULT GST_Connect(GSTInPin *pPin, IPin *pConnectPin, ALLOCATOR_PROPERTIES *props) static HRESULT GST_Connect(GSTInPin *pPin, IPin *pConnectPin, ALLOCATOR_PROPERTIES *props)
{ {
GSTImpl *This = impl_from_IBaseFilter(pPin->pin.pinInfo.pFilter); GSTImpl *This = impl_from_strmbase_filter(pPin->pin.filter);
int ret, i; int ret, i;
LONGLONG avail, duration; LONGLONG avail, duration;
GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE( GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE(
@ -1198,7 +1200,7 @@ static inline GSTOutPin *impl_from_IMediaSeeking( IMediaSeeking *iface )
static IPin *gstdemux_get_pin(struct strmbase_filter *base, unsigned int index) static IPin *gstdemux_get_pin(struct strmbase_filter *base, unsigned int index)
{ {
GSTImpl *filter = impl_from_IBaseFilter(&base->IBaseFilter_iface); GSTImpl *filter = impl_from_strmbase_filter(base);
if (!index) if (!index)
return &filter->pInputPin.pin.IPin_iface; return &filter->pInputPin.pin.IPin_iface;
@ -1209,7 +1211,7 @@ static IPin *gstdemux_get_pin(struct strmbase_filter *base, unsigned int index)
static void gstdemux_destroy(struct strmbase_filter *iface) static void gstdemux_destroy(struct strmbase_filter *iface)
{ {
GSTImpl *filter = impl_from_IBaseFilter(&iface->IBaseFilter_iface); GSTImpl *filter = impl_from_strmbase_filter(iface);
IPin *connected = NULL; IPin *connected = NULL;
HRESULT hr; HRESULT hr;
@ -1253,7 +1255,6 @@ static const struct strmbase_filter_ops filter_ops =
IUnknown * CALLBACK Gstreamer_Splitter_create(IUnknown *outer, HRESULT *phr) IUnknown * CALLBACK Gstreamer_Splitter_create(IUnknown *outer, HRESULT *phr)
{ {
PIN_INFO *piInput;
GSTImpl *This; GSTImpl *This;
if (!init_gstreamer()) if (!init_gstreamer())
@ -1281,10 +1282,9 @@ IUnknown * CALLBACK Gstreamer_Splitter_create(IUnknown *outer, HRESULT *phr)
This->push_event = CreateEventW(NULL, 0, 0, NULL); This->push_event = CreateEventW(NULL, 0, 0, NULL);
This->bus = NULL; This->bus = NULL;
piInput = &This->pInputPin.pin.pinInfo; This->pInputPin.pin.dir = PINDIR_INPUT;
piInput->dir = PINDIR_INPUT; This->pInputPin.pin.filter = &This->filter;
piInput->pFilter = &This->filter.IBaseFilter_iface; lstrcpynW(This->pInputPin.pin.name, wcsInputPinName, ARRAY_SIZE(This->pInputPin.pin.name));
lstrcpynW(piInput->achName, wcsInputPinName, ARRAY_SIZE(piInput->achName));
This->pInputPin.pin.IPin_iface.lpVtbl = &GST_InputPin_Vtbl; This->pInputPin.pin.IPin_iface.lpVtbl = &GST_InputPin_Vtbl;
This->pInputPin.pin.pConnectedTo = NULL; This->pInputPin.pin.pConnectedTo = NULL;
This->pInputPin.pin.pCritSec = &This->filter.csFilter; This->pInputPin.pin.pCritSec = &This->filter.csFilter;
@ -1721,7 +1721,7 @@ static HRESULT WINAPI GSTOutPin_DecideBufferSize(BaseOutputPin *iface, IMemAlloc
static HRESULT WINAPI GSTOutPin_DecideAllocator(BaseOutputPin *base, IMemInputPin *pPin, IMemAllocator **pAlloc) static HRESULT WINAPI GSTOutPin_DecideAllocator(BaseOutputPin *base, IMemInputPin *pPin, IMemAllocator **pAlloc)
{ {
GSTOutPin *pin = impl_source_from_IPin(&base->pin.IPin_iface); GSTOutPin *pin = impl_source_from_IPin(&base->pin.IPin_iface);
GSTImpl *GSTfilter = impl_from_IBaseFilter(pin->pin.pin.pinInfo.pFilter); GSTImpl *GSTfilter = impl_from_strmbase_filter(pin->pin.pin.filter);
HRESULT hr; HRESULT hr;
TRACE("pin %p, peer %p, allocator %p.\n", pin, pPin, pAlloc); TRACE("pin %p, peer %p, allocator %p.\n", pin, pPin, pAlloc);
@ -1810,7 +1810,7 @@ static const BaseOutputPinFuncTable output_BaseOutputFuncTable = {
GSTOutPin_DecideAllocator, GSTOutPin_DecideAllocator,
}; };
static BOOL create_pin(GSTImpl *filter, const PIN_INFO *pin_info, const AM_MEDIA_TYPE *mt) static BOOL create_pin(GSTImpl *filter, const WCHAR *name, const AM_MEDIA_TYPE *mt)
{ {
GSTOutPin *pin, **new_array; GSTOutPin *pin, **new_array;
@ -1821,8 +1821,8 @@ static BOOL create_pin(GSTImpl *filter, const PIN_INFO *pin_info, const AM_MEDIA
if (!(pin = heap_alloc_zero(sizeof(*pin)))) if (!(pin = heap_alloc_zero(sizeof(*pin))))
return FALSE; return FALSE;
strmbase_source_init(&pin->pin, &GST_OutputPin_Vtbl, pin_info, strmbase_source_init(&pin->pin, &GST_OutputPin_Vtbl, &filter->filter, name,
&output_BaseOutputFuncTable, &filter->filter.csFilter); &output_BaseOutputFuncTable);
pin->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)); pin->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
CopyMediaType(pin->pmt, mt); CopyMediaType(pin->pmt, mt);
pin->caps_event = CreateEventW(NULL, FALSE, FALSE, NULL); pin->caps_event = CreateEventW(NULL, FALSE, FALSE, NULL);
@ -1872,6 +1872,7 @@ static inline GSTInPin *impl_sink_from_IPin(IPin *iface)
static HRESULT WINAPI GSTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin, const AM_MEDIA_TYPE *pmt) static HRESULT WINAPI GSTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
{ {
GSTInPin *This = impl_sink_from_IPin(iface); GSTInPin *This = impl_sink_from_IPin(iface);
GSTImpl *filter = impl_from_strmbase_filter(This->pin.filter);
PIN_DIRECTION pindirReceive; PIN_DIRECTION pindirReceive;
HRESULT hr = S_OK; HRESULT hr = S_OK;
@ -1903,7 +1904,7 @@ static HRESULT WINAPI GSTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin,
This->pReader = NULL; This->pReader = NULL;
This->pAlloc = NULL; This->pAlloc = NULL;
ResetEvent(impl_from_IBaseFilter(This->pin.pinInfo.pFilter)->push_event); ResetEvent(filter->push_event);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
hr = IPin_QueryInterface(pReceivePin, &IID_IAsyncReader, (LPVOID *)&This->pReader); hr = IPin_QueryInterface(pReceivePin, &IID_IAsyncReader, (LPVOID *)&This->pReader);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
@ -1926,9 +1927,9 @@ static HRESULT WINAPI GSTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin,
This->pin.pConnectedTo = pReceivePin; This->pin.pConnectedTo = pReceivePin;
IPin_AddRef(pReceivePin); IPin_AddRef(pReceivePin);
hr = IMemAllocator_Commit(This->pAlloc); hr = IMemAllocator_Commit(This->pAlloc);
SetEvent(impl_from_IBaseFilter(This->pin.pinInfo.pFilter)->push_event); SetEvent(filter->push_event);
} else { } else {
GST_RemoveOutputPins(impl_from_IBaseFilter(This->pin.pinInfo.pFilter)); GST_RemoveOutputPins(filter);
if (This->pReader) if (This->pReader)
IAsyncReader_Release(This->pReader); IAsyncReader_Release(This->pReader);
This->pReader = NULL; This->pReader = NULL;
@ -1953,10 +1954,10 @@ static HRESULT WINAPI GSTInPin_Disconnect(IPin *iface)
mark_wine_thread(); mark_wine_thread();
hr = IBaseFilter_GetState(This->pin.pinInfo.pFilter, INFINITE, &state); hr = IBaseFilter_GetState(&This->pin.filter->IBaseFilter_iface, INFINITE, &state);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(This->pin.pCritSec);
if (This->pin.pConnectedTo) { if (This->pin.pConnectedTo) {
GSTImpl *Parser = impl_from_IBaseFilter(This->pin.pinInfo.pFilter); GSTImpl *Parser = impl_from_strmbase_filter(This->pin.filter);
if (SUCCEEDED(hr) && state == State_Stopped) { if (SUCCEEDED(hr) && state == State_Stopped) {
IMemAllocator_Decommit(This->pAlloc); IMemAllocator_Decommit(This->pAlloc);
@ -2026,7 +2027,7 @@ static HRESULT WINAPI GSTInPin_QueryInterface(IPin * iface, REFIID riid, LPVOID
*ppv = iface; *ppv = iface;
else if (IsEqualIID(riid, &IID_IMediaSeeking)) else if (IsEqualIID(riid, &IID_IMediaSeeking))
{ {
return IBaseFilter_QueryInterface(This->pin.pinInfo.pFilter, &IID_IMediaSeeking, ppv); return IBaseFilter_QueryInterface(&This->pin.filter->IBaseFilter_iface, &IID_IMediaSeeking, ppv);
} }
if (*ppv) if (*ppv)

View File

@ -176,7 +176,7 @@ static const IPinVtbl QT_InputPin_Vtbl;
static const IBaseFilterVtbl QT_Vtbl; static const IBaseFilterVtbl QT_Vtbl;
static const IMediaSeekingVtbl QT_Seeking_Vtbl; static const IMediaSeekingVtbl QT_Seeking_Vtbl;
static HRESULT QT_AddPin(QTSplitter *This, const PIN_INFO *piOutput, const AM_MEDIA_TYPE *amt, BOOL video); static HRESULT QT_AddPin(QTSplitter *filter, const WCHAR *name, const AM_MEDIA_TYPE *mt, BOOL video);
static HRESULT QT_RemoveOutputPins(QTSplitter *This); static HRESULT QT_RemoveOutputPins(QTSplitter *This);
static HRESULT WINAPI QTSplitter_ChangeStart(IMediaSeeking *iface); static HRESULT WINAPI QTSplitter_ChangeStart(IMediaSeeking *iface);
@ -286,7 +286,6 @@ static const struct strmbase_filter_ops filter_ops =
IUnknown * CALLBACK QTSplitter_create(IUnknown *outer, HRESULT *phr) IUnknown * CALLBACK QTSplitter_create(IUnknown *outer, HRESULT *phr)
{ {
PIN_INFO *piInput;
QTSplitter *This; QTSplitter *This;
static const WCHAR wcsInputPinName[] = {'I','n','p','u','t',' ','P','i','n',0}; static const WCHAR wcsInputPinName[] = {'I','n','p','u','t',' ','P','i','n',0};
@ -313,10 +312,9 @@ IUnknown * CALLBACK QTSplitter_create(IUnknown *outer, HRESULT *phr)
This->aSession = NULL; This->aSession = NULL;
This->runEvent = CreateEventW(NULL, 0, 0, NULL); This->runEvent = CreateEventW(NULL, 0, 0, NULL);
piInput = &This->pInputPin.pin.pinInfo; This->pInputPin.pin.dir = PINDIR_INPUT;
piInput->dir = PINDIR_INPUT; This->pInputPin.pin.filter = &This->filter;
piInput->pFilter = &This->filter.IBaseFilter_iface; lstrcpynW(This->pInputPin.pin.name, wcsInputPinName, ARRAY_SIZE(This->pInputPin.pin.name));
lstrcpynW(piInput->achName, wcsInputPinName, ARRAY_SIZE(piInput->achName));
This->pInputPin.pin.IPin_iface.lpVtbl = &QT_InputPin_Vtbl; This->pInputPin.pin.IPin_iface.lpVtbl = &QT_InputPin_Vtbl;
This->pInputPin.pin.pConnectedTo = NULL; This->pInputPin.pin.pConnectedTo = NULL;
This->pInputPin.pin.pCritSec = &This->filter.csFilter; This->pInputPin.pin.pCritSec = &This->filter.csFilter;
@ -825,7 +823,6 @@ static HRESULT QT_Process_Video_Track(QTSplitter* filter, Track trk)
{ {
AM_MEDIA_TYPE amt; AM_MEDIA_TYPE amt;
VIDEOINFOHEADER * pvi; VIDEOINFOHEADER * pvi;
PIN_INFO piOutput;
HRESULT hr = S_OK; HRESULT hr = S_OK;
OSErr err; OSErr err;
static const WCHAR szwVideoOut[] = {'V','i','d','e','o',0}; static const WCHAR szwVideoOut[] = {'V','i','d','e','o',0};
@ -913,11 +910,7 @@ static HRESULT QT_Process_Video_Track(QTSplitter* filter, Track trk)
duration = GetMediaDisplayDuration(videoMedia); duration = GetMediaDisplayDuration(videoMedia);
pvi->AvgTimePerFrame = (100000.0 * sampleCount * timeScale) / duration; pvi->AvgTimePerFrame = (100000.0 * sampleCount * timeScale) / duration;
piOutput.dir = PINDIR_OUTPUT; hr = QT_AddPin(filter, szwVideoOut, &amt, TRUE);
piOutput.pFilter = &filter->filter.IBaseFilter_iface;
lstrcpyW(piOutput.achName,szwVideoOut);
hr = QT_AddPin(filter, &piOutput, &amt, TRUE);
if (FAILED(hr)) if (FAILED(hr))
ERR("Failed to add Video Track\n"); ERR("Failed to add Video Track\n");
else else
@ -930,7 +923,6 @@ static HRESULT QT_Process_Audio_Track(QTSplitter* filter, Track trk)
{ {
AM_MEDIA_TYPE amt; AM_MEDIA_TYPE amt;
WAVEFORMATEX* pvi; WAVEFORMATEX* pvi;
PIN_INFO piOutput;
HRESULT hr = S_OK; HRESULT hr = S_OK;
static const WCHAR szwAudioOut[] = {'A','u','d','i','o',0}; static const WCHAR szwAudioOut[] = {'A','u','d','i','o',0};
Media audioMedia; Media audioMedia;
@ -967,11 +959,7 @@ static HRESULT QT_Process_Audio_Track(QTSplitter* filter, Track trk)
DisposeHandle((Handle)aDesc); DisposeHandle((Handle)aDesc);
piOutput.dir = PINDIR_OUTPUT; hr = QT_AddPin(filter, szwAudioOut, &amt, FALSE);
piOutput.pFilter = &filter->filter.IBaseFilter_iface;
lstrcpyW(piOutput.achName,szwAudioOut);
hr = QT_AddPin(filter, &piOutput, &amt, FALSE);
if (FAILED(hr)) if (FAILED(hr))
ERR("Failed to add Audio Track\n"); ERR("Failed to add Audio Track\n");
else else
@ -1051,6 +1039,7 @@ static HRESULT WINAPI QTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin,
HRESULT hr = S_OK; HRESULT hr = S_OK;
ALLOCATOR_PROPERTIES props; ALLOCATOR_PROPERTIES props;
QTInPin *This = impl_from_IPin(iface); QTInPin *This = impl_from_IPin(iface);
QTSplitter *filter = impl_from_strmbase_filter(This->pin.filter);
IMemAllocator *pAlloc; IMemAllocator *pAlloc;
TRACE("(%p/%p)->(%p, %p)\n", This, iface, pReceivePin, pmt); TRACE("(%p/%p)->(%p, %p)\n", This, iface, pReceivePin, pmt);
@ -1085,13 +1074,13 @@ static HRESULT WINAPI QTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin,
} }
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(This->pin.pCritSec);
EnterCriticalSection(&impl_from_IBaseFilter(This->pin.pinInfo.pFilter)->filter.csFilter); EnterCriticalSection(&filter->filter.csFilter);
hr = QT_Process_Movie(impl_from_IBaseFilter(This->pin.pinInfo.pFilter)); hr = QT_Process_Movie(filter);
if (FAILED(hr)) if (FAILED(hr))
{ {
IAsyncReader_Release(This->pReader); IAsyncReader_Release(This->pReader);
This->pReader = NULL; This->pReader = NULL;
LeaveCriticalSection(&impl_from_IBaseFilter(This->pin.pinInfo.pFilter)->filter.csFilter); LeaveCriticalSection(&filter->filter.csFilter);
TRACE("Unable to process movie\n"); TRACE("Unable to process movie\n");
return hr; return hr;
} }
@ -1099,7 +1088,7 @@ static HRESULT WINAPI QTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin,
This->pAlloc = NULL; This->pAlloc = NULL;
props.cBuffers = 8; props.cBuffers = 8;
props.cbAlign = 1; props.cbAlign = 1;
props.cbBuffer = impl_from_IBaseFilter(This->pin.pinInfo.pFilter)->outputSize + props.cbAlign; props.cbBuffer = filter->outputSize + props.cbAlign;
props.cbPrefix = 0; props.cbPrefix = 0;
hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC, hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC,
&IID_IMemAllocator, (LPVOID *)&pAlloc); &IID_IMemAllocator, (LPVOID *)&pAlloc);
@ -1122,7 +1111,7 @@ static HRESULT WINAPI QTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin,
} }
else else
{ {
QT_RemoveOutputPins(impl_from_IBaseFilter(This->pin.pinInfo.pFilter)); QT_RemoveOutputPins(filter);
if (This->pReader) if (This->pReader)
IAsyncReader_Release(This->pReader); IAsyncReader_Release(This->pReader);
This->pReader = NULL; This->pReader = NULL;
@ -1131,7 +1120,7 @@ static HRESULT WINAPI QTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin,
This->pAlloc = NULL; This->pAlloc = NULL;
} }
TRACE("Size: %i\n", props.cbBuffer); TRACE("Size: %i\n", props.cbBuffer);
LeaveCriticalSection(&impl_from_IBaseFilter(This->pin.pinInfo.pFilter)->filter.csFilter); LeaveCriticalSection(&filter->filter.csFilter);
return hr; return hr;
} }
@ -1143,11 +1132,11 @@ static HRESULT WINAPI QTInPin_Disconnect(IPin *iface)
FILTER_STATE state; FILTER_STATE state;
TRACE("()\n"); TRACE("()\n");
hr = IBaseFilter_GetState(This->pin.pinInfo.pFilter, INFINITE, &state); hr = IBaseFilter_GetState(&This->pin.filter->IBaseFilter_iface, INFINITE, &state);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(This->pin.pCritSec);
if (This->pin.pConnectedTo) if (This->pin.pConnectedTo)
{ {
QTSplitter *Parser = impl_from_IBaseFilter(This->pin.pinInfo.pFilter); QTSplitter *Parser = impl_from_strmbase_filter(This->pin.filter);
if (SUCCEEDED(hr) && state == State_Stopped) if (SUCCEEDED(hr) && state == State_Stopped)
{ {
@ -1182,38 +1171,26 @@ static HRESULT WINAPI QTInPin_QueryAccept(IPin *iface, const AM_MEDIA_TYPE *pmt)
static HRESULT WINAPI QTInPin_EndOfStream(IPin *iface) static HRESULT WINAPI QTInPin_EndOfStream(IPin *iface)
{ {
QTInPin *pin = impl_from_IPin(iface); FIXME("iface %p, stub!\n", iface);
QTSplitter *This = impl_from_IBaseFilter(pin->pin.pinInfo.pFilter);
FIXME("Propagate message on %p\n", This);
return S_OK; return S_OK;
} }
static HRESULT WINAPI QTInPin_BeginFlush(IPin *iface) static HRESULT WINAPI QTInPin_BeginFlush(IPin *iface)
{ {
QTInPin *pin = impl_from_IPin(iface); FIXME("iface %p, stub!\n", iface);
QTSplitter *This = impl_from_IBaseFilter(pin->pin.pinInfo.pFilter);
FIXME("Propagate message on %p\n", This);
return S_OK; return S_OK;
} }
static HRESULT WINAPI QTInPin_EndFlush(IPin *iface) static HRESULT WINAPI QTInPin_EndFlush(IPin *iface)
{ {
QTInPin *pin = impl_from_IPin(iface); FIXME("iface %p, stub!\n", iface);
QTSplitter *This = impl_from_IBaseFilter(pin->pin.pinInfo.pFilter);
FIXME("Propagate message on %p\n", This);
return S_OK; return S_OK;
} }
static HRESULT WINAPI QTInPin_NewSegment(IPin *iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate) static HRESULT WINAPI QTInPin_NewSegment(IPin *iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{ {
QTInPin *pin = impl_from_IPin(iface);
QTSplitter *This = impl_from_IBaseFilter(pin->pin.pinInfo.pFilter);
BasePinImpl_NewSegment(iface, tStart, tStop, dRate); BasePinImpl_NewSegment(iface, tStart, tStop, dRate);
FIXME("Propagate message on %p\n", This); FIXME("iface %p, stub!\n", iface);
return S_OK; return S_OK;
} }
@ -1230,7 +1207,7 @@ static HRESULT WINAPI QTInPin_QueryInterface(IPin * iface, REFIID riid, LPVOID *
else if (IsEqualIID(riid, &IID_IPin)) else if (IsEqualIID(riid, &IID_IPin))
*ppv = iface; *ppv = iface;
else if (IsEqualIID(riid, &IID_IMediaSeeking)) else if (IsEqualIID(riid, &IID_IMediaSeeking))
return IBaseFilter_QueryInterface(This->pin.pinInfo.pFilter, &IID_IMediaSeeking, ppv); return IBaseFilter_QueryInterface(&This->pin.filter->IBaseFilter_iface, &IID_IMediaSeeking, ppv);
if (*ppv) if (*ppv)
{ {
@ -1304,7 +1281,7 @@ static HRESULT WINAPI QTOutPin_QueryInterface(IPin *iface, REFIID riid, void **p
else if (IsEqualIID(riid, &IID_IPin)) else if (IsEqualIID(riid, &IID_IPin))
*ppv = iface; *ppv = iface;
else if (IsEqualIID(riid, &IID_IMediaSeeking)) else if (IsEqualIID(riid, &IID_IMediaSeeking))
return IBaseFilter_QueryInterface(This->pin.pin.pinInfo.pFilter, &IID_IMediaSeeking, ppv); return IBaseFilter_QueryInterface(&This->pin.pin.filter->IBaseFilter_iface, &IID_IMediaSeeking, ppv);
else if (IsEqualIID(riid, &IID_IQualityControl)) else if (IsEqualIID(riid, &IID_IQualityControl))
*ppv = &This->IQualityControl_iface; *ppv = &This->IQualityControl_iface;
@ -1345,7 +1322,7 @@ static HRESULT WINAPI QTOutPin_DecideAllocator(BaseOutputPin *iface, IMemInputPi
{ {
HRESULT hr; HRESULT hr;
QTOutPin *This = impl_QTOutPin_from_BaseOutputPin(iface); QTOutPin *This = impl_QTOutPin_from_BaseOutputPin(iface);
QTSplitter *QTfilter = impl_from_IBaseFilter(This->pin.pin.pinInfo.pFilter); QTSplitter *QTfilter = impl_from_strmbase_filter(This->pin.pin.filter);
*pAlloc = NULL; *pAlloc = NULL;
if (QTfilter->pInputPin.pAlloc) if (QTfilter->pInputPin.pAlloc)
@ -1444,7 +1421,7 @@ static const OutputQueueFuncTable output_OutputQueueFuncTable = {
OutputQueueImpl_ThreadProc OutputQueueImpl_ThreadProc
}; };
static HRESULT QT_AddPin(QTSplitter *filter, const PIN_INFO *pin_info, static HRESULT QT_AddPin(QTSplitter *filter, const WCHAR *name,
const AM_MEDIA_TYPE *mt, BOOL video) const AM_MEDIA_TYPE *mt, BOOL video)
{ {
QTOutPin *pin; QTOutPin *pin;
@ -1457,8 +1434,8 @@ static HRESULT QT_AddPin(QTSplitter *filter, const PIN_INFO *pin_info,
else else
filter->pAudio_Pin = pin; filter->pAudio_Pin = pin;
strmbase_source_init(&pin->pin, &QT_OutputPin_Vtbl, piOutput, strmbase_source_init(&pin->pin, &QT_OutputPin_Vtbl, &filter->filter, name,
&output_BaseOutputFuncTable, &filter->filter.csFilter); &output_BaseOutputFuncTable);
pin->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)); pin->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
CopyMediaType(pin->pmt, mt); CopyMediaType(pin->pmt, mt);
pin->IQualityControl_iface.lpVtbl = &QTOutPin_QualityControl_Vtbl; pin->IQualityControl_iface.lpVtbl = &QTOutPin_QualityControl_Vtbl;

View File

@ -31,12 +31,13 @@ void WINAPI DeleteMediaType(AM_MEDIA_TYPE * pMediaType);
typedef struct BasePin typedef struct BasePin
{ {
IPin IPin_iface; IPin IPin_iface;
LPCRITICAL_SECTION pCritSec; CRITICAL_SECTION *pCritSec;
PIN_INFO pinInfo; struct strmbase_filter *filter;
IPin * pConnectedTo; PIN_DIRECTION dir;
WCHAR name[128];
IPin *pConnectedTo;
AM_MEDIA_TYPE mtCurrent; AM_MEDIA_TYPE mtCurrent;
REFERENCE_TIME tStart; REFERENCE_TIME tStart, tStop;
REFERENCE_TIME tStop;
double dRate; double dRate;
const struct BasePinFuncTable* pFuncsTable; const struct BasePinFuncTable* pFuncsTable;
@ -133,8 +134,8 @@ HRESULT WINAPI BaseOutputPinImpl_DecideAllocator(BaseOutputPin *This, IMemInputP
HRESULT WINAPI BaseOutputPinImpl_AttemptConnection(BaseOutputPin *pin, IPin *peer, const AM_MEDIA_TYPE *mt); HRESULT WINAPI BaseOutputPinImpl_AttemptConnection(BaseOutputPin *pin, IPin *peer, const AM_MEDIA_TYPE *mt);
void strmbase_source_cleanup(BaseOutputPin *pin); void strmbase_source_cleanup(BaseOutputPin *pin);
void strmbase_source_init(BaseOutputPin *pin, const IPinVtbl *vtbl, const PIN_INFO *info, void strmbase_source_init(BaseOutputPin *pin, const IPinVtbl *vtbl, struct strmbase_filter *filter,
const BaseOutputPinFuncTable *func_table, CRITICAL_SECTION *cs); const WCHAR *name, const BaseOutputPinFuncTable *func_table);
/* 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);
@ -146,8 +147,8 @@ 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);
void strmbase_sink_init(BaseInputPin *pin, const IPinVtbl *vtbl, const PIN_INFO *info, void strmbase_sink_init(BaseInputPin *pin, const IPinVtbl *vtbl, struct strmbase_filter *filter,
const BaseInputPinFuncTable *func_table, CRITICAL_SECTION *cs, IMemAllocator *allocator); const WCHAR *name, const BaseInputPinFuncTable *func_table, IMemAllocator *allocator);
void strmbase_sink_cleanup(BaseInputPin *pin); void strmbase_sink_cleanup(BaseInputPin *pin);
struct strmbase_filter struct strmbase_filter