Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qcap/avico.c | 22 +++--- dlls/qcap/avimux.c | 115 +++++++++++--------------------- dlls/qcap/smartteefilter.c | 44 ++++++------ dlls/qcap/vfwcapture.c | 8 +-- dlls/quartz/avisplit.c | 12 ++-- dlls/quartz/filesource.c | 9 +-- dlls/quartz/mpegsplit.c | 12 ++-- dlls/quartz/parser.c | 32 ++++----- dlls/quartz/parser.h | 3 +- dlls/quartz/pin.c | 43 +++++------- dlls/quartz/pin.h | 4 +- dlls/quartz/waveparser.c | 15 ++--- dlls/strmbase/pin.c | 82 ++++++++++------------- dlls/strmbase/renderer.c | 10 +-- dlls/strmbase/transform.c | 18 ++--- dlls/winegstreamer/gstdemux.c | 59 ++++++++-------- dlls/wineqtdecoder/qtsplitter.c | 73 +++++++------------- include/wine/strmbase.h | 29 ++++---- 18 files changed, 232 insertions(+), 358 deletions(-)
diff --git a/dlls/qcap/avico.c b/dlls/qcap/avico.c index 5a2e35c7d11..918cabd8191 100644 --- a/dlls/qcap/avico.c +++ b/dlls/qcap/avico.c @@ -64,7 +64,7 @@ static inline AVICompressor *impl_from_IBaseFilter(IBaseFilter *iface)
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) @@ -315,8 +315,7 @@ static const IPersistPropertyBagVtbl PersistPropertyBagVtbl = {
static inline AVICompressor *impl_from_IPin(IPin *iface) { - BasePin *bp = CONTAINING_RECORD(iface, BasePin, IPin_iface); - return impl_from_IBaseFilter(bp->pinInfo.pFilter); + return impl_from_strmbase_filter(CONTAINING_RECORD(iface, BasePin, IPin_iface)->filter); }
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) { - AVICompressor *This = impl_from_IBaseFilter(base->pinInfo.pFilter); + AVICompressor *This = impl_from_strmbase_filter(base->filter);
TRACE("(%p)->(%d %p)\n", base, iPosition, amt);
@@ -591,8 +590,8 @@ static const BaseOutputPinFuncTable AVICompressorBaseOutputPinVtbl = {
IUnknown* WINAPI QCAP_createAVICompressor(IUnknown *outer, HRESULT *phr) { - PIN_INFO in_pin_info = {NULL, PINDIR_INPUT, {'I','n',0}}; - PIN_INFO out_pin_info = {NULL, PINDIR_OUTPUT, {'O','u','t',0}}; + static const WCHAR source_name[] = {'O','u','t',0}; + static const WCHAR sink_name[] = {'I','n',0}; AVICompressor *compressor;
compressor = heap_alloc_zero(sizeof(*compressor)); @@ -605,13 +604,10 @@ IUnknown* WINAPI QCAP_createAVICompressor(IUnknown *outer, HRESULT *phr)
compressor->IPersistPropertyBag_iface.lpVtbl = &PersistPropertyBagVtbl;
- in_pin_info.pFilter = &compressor->filter.IBaseFilter_iface; - strmbase_sink_init(&compressor->sink, &AVICompressorInputPinVtbl, &in_pin_info, - &AVICompressorBaseInputPinVtbl, &compressor->filter.csFilter, NULL); - - out_pin_info.pFilter = &compressor->filter.IBaseFilter_iface; - strmbase_source_init(&compressor->source, &AVICompressorOutputPinVtbl, &out_pin_info, - &AVICompressorBaseOutputPinVtbl, &compressor->filter.csFilter); + strmbase_sink_init(&compressor->sink, &AVICompressorInputPinVtbl, + &compressor->filter, sink_name, &AVICompressorBaseInputPinVtbl, NULL); + strmbase_source_init(&compressor->source, &AVICompressorOutputPinVtbl, + &compressor->filter, source_name, &AVICompressorBaseOutputPinVtbl);
*phr = S_OK; return &compressor->filter.IUnknown_inner; diff --git a/dlls/qcap/avimux.c b/dlls/qcap/avimux.c index 21532dde70a..adc848f6dda 100644 --- a/dlls/qcap/avimux.c +++ b/dlls/qcap/avimux.c @@ -1373,9 +1373,6 @@ static const IQualityControlVtbl AviMuxOut_QualityControlVtbl = {
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) && IsEqualIID(&pmt->formattype, &FORMAT_WaveFormatEx)) 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) { + AviMux *avimux = impl_from_strmbase_filter(base->pin.filter); AviMuxIn *avimuxin = CONTAINING_RECORD(base, AviMuxIn, pin); - AviMux *avimux = impl_from_IBaseFilter(base->pin.pinInfo.pFilter); REFERENCE_TIME start, stop; IMediaSample *sample; int frames_no; @@ -1407,7 +1404,7 @@ static HRESULT WINAPI AviMuxIn_Receive(BaseInputPin *base, IMediaSample *pSample DWORD flags; 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); if(SUCCEEDED(hr)) { @@ -1507,10 +1504,8 @@ static const BaseInputPinFuncTable AviMuxIn_BaseInputFuncTable = {
static inline AviMux* impl_from_in_IPin(IPin *iface) { - BasePin *bp = CONTAINING_RECORD(iface, BasePin, IPin_iface); - IBaseFilter *bf = bp->pinInfo.pFilter; - - return impl_from_IBaseFilter(bf); + BasePin *pin = CONTAINING_RECORD(iface, BasePin, IPin_iface); + return impl_from_strmbase_filter(pin->filter); }
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) { - AviMux *This = impl_from_in_IPin(iface); AviMuxIn *avimuxin = AviMuxIn_from_IPin(iface);
- TRACE("(%p:%s)->(%s %p)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName), - debugstr_guid(riid), ppv); + TRACE("pin %p, riid %s, ppv %p.\n", avimuxin, debugstr_guid(riid), ppv);
if(IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IPin)) *ppv = &avimuxin->pin.pin.IPin_iface; @@ -1555,8 +1548,7 @@ static HRESULT WINAPI AviMuxIn_ReceiveConnection(IPin *iface, AviMuxIn *avimuxin = AviMuxIn_from_IPin(iface); HRESULT hr;
- TRACE("(%p:%s)->(%p AM_MEDIA_TYPE(%p))\n", This, - debugstr_w(avimuxin->pin.pin.pinInfo.achName), pConnector, pmt); + TRACE("pin %p, pConnector %p, pmt %p.\n", avimuxin, pConnector, pmt); dump_AM_MEDIA_TYPE(pmt);
if(!pmt) @@ -1612,12 +1604,11 @@ static HRESULT WINAPI AviMuxIn_ReceiveConnection(IPin *iface,
static HRESULT WINAPI AviMuxIn_Disconnect(IPin *iface) { - AviMux *This = impl_from_in_IPin(iface); AviMuxIn *avimuxin = AviMuxIn_from_IPin(iface); IMediaSample **prev, *cur; HRESULT hr;
- TRACE("(%p:%s)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName)); + TRACE("pin %p.\n", avimuxin);
hr = BasePinImpl_Disconnect(iface); if(FAILED(hr)) @@ -1691,31 +1682,23 @@ static ULONG WINAPI AviMuxIn_AMStreamControl_Release(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); - 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); + FIXME("iface %p, start %p, cookie %#x, stub!\n", iface, start, cookie); return E_NOTIMPL; }
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); - 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); + FIXME("iface %p, stop %p, send_extra %d, cookie %#x, stub!\n", iface, stop, send_extra, cookie); return E_NOTIMPL; }
-static HRESULT WINAPI AviMuxIn_AMStreamControl_GetInfo( - IAMStreamControl *iface, AM_STREAM_INFO *pInfo) +static HRESULT WINAPI AviMuxIn_AMStreamControl_GetInfo(IAMStreamControl *iface, + AM_STREAM_INFO *info) { - AviMuxIn *avimuxin = AviMuxIn_from_IAMStreamControl(iface); - 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); + FIXME("iface %p, info %p, stub!\n", iface, info); return E_NOTIMPL; }
@@ -1759,9 +1742,8 @@ static HRESULT WINAPI AviMuxIn_MemInputPin_GetAllocator( IMemInputPin *iface, IMemAllocator **ppAllocator) { 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) return E_POINTER; @@ -1775,12 +1757,10 @@ static HRESULT WINAPI AviMuxIn_MemInputPin_NotifyAllocator( IMemInputPin *iface, IMemAllocator *pAllocator, BOOL bReadOnly) { AviMuxIn *avimuxin = AviMuxIn_from_IMemInputPin(iface); - AviMux *This = impl_from_in_IPin(&avimuxin->pin.pin.IPin_iface); ALLOCATOR_PROPERTIES props; HRESULT hr;
- TRACE("(%p:%s)->(%p %x)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName), - pAllocator, bReadOnly); + TRACE("pin %p, pAllocator %p, bReadOnly %d.\n", avimuxin, pAllocator, bReadOnly);
if(!pAllocator) return E_POINTER; @@ -1799,9 +1779,8 @@ static HRESULT WINAPI AviMuxIn_MemInputPin_GetAllocatorRequirements( IMemInputPin *iface, ALLOCATOR_PROPERTIES *pProps) { 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) return E_POINTER; @@ -1815,9 +1794,8 @@ static HRESULT WINAPI AviMuxIn_MemInputPin_Receive( IMemInputPin *iface, IMediaSample *pSample) { 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); } @@ -1826,11 +1804,10 @@ static HRESULT WINAPI AviMuxIn_MemInputPin_ReceiveMultiple(IMemInputPin *iface, IMediaSample **pSamples, LONG nSamples, LONG *nSamplesProcessed) { AviMuxIn *avimuxin = AviMuxIn_from_IMemInputPin(iface); - AviMux *This = impl_from_in_IPin(&avimuxin->pin.pin.IPin_iface); HRESULT hr = S_OK;
- TRACE("(%p:%s)->(%p %d %p)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName), - pSamples, nSamples, nSamplesProcessed); + TRACE("pin %p, pSamples %p, nSamples %d, nSamplesProcessed %p.\n", + avimuxin, pSamples, 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); HRESULT hr;
- TRACE("(%p:%s)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName)); + TRACE("avimuxin %p.\n", avimuxin);
if(!This->source.pMemInputPin) return S_FALSE; @@ -1896,22 +1873,18 @@ static ULONG WINAPI AviMuxIn_PropertyBag_Release(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); - AviMux *This = impl_from_in_IPin(&avimuxin->pin.pin.IPin_iface); - FIXME("(%p:%s)->(%s %p %p)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName), - debugstr_w(pszPropName), pVar, pErrorLog); + FIXME("iface %p, name %s, value %p, error_log %p, stub!\n", + iface, debugstr_w(name), value, error_log); return E_NOTIMPL; }
static HRESULT WINAPI AviMuxIn_PropertyBag_Write(IPropertyBag *iface, - LPCOLESTR pszPropName, VARIANT *pVar) + const WCHAR *name, VARIANT *value) { - AviMuxIn *avimuxin = AviMuxIn_from_IPropertyBag(iface); - AviMux *This = impl_from_in_IPin(&avimuxin->pin.pin.IPin_iface); - FIXME("(%p:%s)->(%s %p)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName), - debugstr_w(pszPropName), pVar); + FIXME("iface %p, name %s, value %s, stub!\n", + iface, debugstr_w(name), debugstr_variant(value)); return E_NOTIMPL; }
@@ -1950,23 +1923,17 @@ static ULONG WINAPI AviMuxIn_QualityControl_Release(IQualityControl *iface) }
static HRESULT WINAPI AviMuxIn_QualityControl_Notify(IQualityControl *iface, - IBaseFilter *pSelf, Quality q) + IBaseFilter *filter, Quality q) { - AviMuxIn *avimuxin = AviMuxIn_from_IQualityControl(iface); - AviMux *This = impl_from_in_IPin(&avimuxin->pin.pin.IPin_iface); - 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), + FIXME("iface %p, filter %p, type %u, proportion %d, late %s, timestamp %s, stub!\n", + iface, filter, q.Type, q.Proportion, wine_dbgstr_longlong(q.Late), wine_dbgstr_longlong(q.TimeStamp)); return E_NOTIMPL; }
-static HRESULT WINAPI AviMuxIn_QualityControl_SetSink( - IQualityControl *iface, IQualityControl *piqc) +static HRESULT WINAPI AviMuxIn_QualityControl_SetSink(IQualityControl *iface, IQualityControl *sink) { - AviMuxIn *avimuxin = AviMuxIn_from_IQualityControl(iface); - 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); + FIXME("iface %p, sink %p, stub!\n", iface, sink); return E_NOTIMPL; }
@@ -1980,25 +1947,21 @@ static const IQualityControlVtbl AviMuxIn_QualityControlVtbl = {
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; - PIN_INFO info; HRESULT hr;
if(avimux->input_pin_no >= MAX_PIN_NO-1) return E_FAIL;
- info.dir = PINDIR_INPUT; - info.pFilter = &avimux->filter.IBaseFilter_iface; - 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; + name[7] = '0' + (avimux->input_pin_no+1) % 10; + name[6] = '0' + (avimux->input_pin_no+1) / 10;
if (!(object = heap_alloc_zero(sizeof(*object)))) return E_OUTOFMEMORY;
- strmbase_sink_init(&object->pin, &AviMuxIn_PinVtbl, &info, - &AviMuxIn_BaseInputFuncTable, &avimux->filter.csFilter, NULL); + strmbase_sink_init(&object->pin, &AviMuxIn_PinVtbl, &avimux->filter, name, + &AviMuxIn_BaseInputFuncTable, NULL); object->pin.IMemInputPin_iface.lpVtbl = &AviMuxIn_MemInputPinVtbl; object->IAMStreamControl_iface.lpVtbl = &AviMuxIn_AMStreamControlVtbl; object->IPropertyBag_iface.lpVtbl = &AviMuxIn_PropertyBagVtbl; @@ -2054,8 +2017,8 @@ IUnknown * WINAPI QCAP_createAVIMux(IUnknown *outer, HRESULT *phr) info.dir = PINDIR_OUTPUT; info.pFilter = &avimux->filter.IBaseFilter_iface; lstrcpyW(info.achName, output_name); - strmbase_source_init(&avimux->source, &AviMuxOut_PinVtbl, &info, - &AviMuxOut_BaseOutputFuncTable, &avimux->filter.csFilter); + strmbase_source_init(&avimux->source, &AviMuxOut_PinVtbl, &avimux->filter, + output_name, &AviMuxOut_BaseOutputFuncTable); avimux->IQualityControl_iface.lpVtbl = &AviMuxOut_QualityControlVtbl; avimux->cur_stream = 0; avimux->cur_time = 0; diff --git a/dlls/qcap/smartteefilter.c b/dlls/qcap/smartteefilter.c index 6d452287f88..c53c7af9bbd 100644 --- a/dlls/qcap/smartteefilter.c +++ b/dlls/qcap/smartteefilter.c @@ -54,13 +54,12 @@ static inline SmartTeeFilter *impl_from_IBaseFilter(IBaseFilter *iface)
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) { - BasePin *bp = CONTAINING_RECORD(iface, BasePin, IPin_iface); - return impl_from_IBaseFilter(bp->pinInfo.pFilter); + return impl_from_strmbase_filter(CONTAINING_RECORD(iface, BasePin, IPin_iface)->filter); }
static HRESULT WINAPI SmartTeeFilter_Stop(IBaseFilter *iface) @@ -471,41 +470,36 @@ static const BaseOutputPinFuncTable SmartTeeFilterPreviewFuncs = { }; IUnknown* WINAPI QCAP_createSmartTeeFilter(IUnknown *outer, HRESULT *phr) { - PIN_INFO inputPinInfo = {NULL, PINDIR_INPUT, {'I','n','p','u','t',0}}; - PIN_INFO capturePinInfo = {NULL, PINDIR_OUTPUT, {'C','a','p','t','u','r','e',0}}; - PIN_INFO previewPinInfo = {NULL, PINDIR_OUTPUT, {'P','r','e','v','i','e','w',0}}; + static const WCHAR captureW[] = {'C','a','p','t','u','r','e',0}; + static const WCHAR previewW[] = {'P','r','e','v','i','e','w',0}; + static const WCHAR inputW[] = {'I','n','p','u','t',0}; + SmartTeeFilter *object; HRESULT hr; - SmartTeeFilter *This = NULL;
- This = CoTaskMemAlloc(sizeof(*This)); - if (This == NULL) { + if (!(object = CoTaskMemAlloc(sizeof(*object)))) + { *phr = E_OUTOFMEMORY; return NULL; } - memset(This, 0, sizeof(*This)); - - strmbase_filter_init(&This->filter, &SmartTeeFilterVtbl, outer, &CLSID_SmartTee, &filter_ops); + memset(object, 0, sizeof(*object));
- inputPinInfo.pFilter = &This->filter.IBaseFilter_iface; - strmbase_sink_init(&This->sink, &SmartTeeFilterInputVtbl, &inputPinInfo, - &SmartTeeFilterInputFuncs, &This->filter.csFilter, NULL); + strmbase_filter_init(&object->filter, &SmartTeeFilterVtbl, outer, &CLSID_SmartTee, &filter_ops); + strmbase_sink_init(&object->sink, &SmartTeeFilterInputVtbl, &object->filter, + inputW, &SmartTeeFilterInputFuncs, NULL); hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER, - &IID_IMemAllocator, (void**)&This->sink.pAllocator); + &IID_IMemAllocator, (void **)&object->sink.pAllocator); if (FAILED(hr)) { *phr = hr; - strmbase_filter_cleanup(&This->filter); + strmbase_filter_cleanup(&object->filter); return NULL; }
- capturePinInfo.pFilter = &This->filter.IBaseFilter_iface; - strmbase_source_init(&This->capture, &SmartTeeFilterCaptureVtbl, &capturePinInfo, - &SmartTeeFilterCaptureFuncs, &This->filter.csFilter); - - previewPinInfo.pFilter = &This->filter.IBaseFilter_iface; - strmbase_source_init(&This->preview, &SmartTeeFilterPreviewVtbl, &previewPinInfo, - &SmartTeeFilterPreviewFuncs, &This->filter.csFilter); + strmbase_source_init(&object->capture, &SmartTeeFilterCaptureVtbl, + &object->filter, captureW, &SmartTeeFilterCaptureFuncs); + strmbase_source_init(&object->preview, &SmartTeeFilterPreviewVtbl, + &object->filter, previewW, &SmartTeeFilterPreviewFuncs);
*phr = S_OK; - return &This->filter.IUnknown_inner; + return &object->filter.IUnknown_inner; } diff --git a/dlls/qcap/vfwcapture.c b/dlls/qcap/vfwcapture.c index 6010fad9c58..c4605ce10cc 100644 --- a/dlls/qcap/vfwcapture.c +++ b/dlls/qcap/vfwcapture.c @@ -635,7 +635,6 @@ IUnknown * WINAPI QCAP_createVFWCaptureFilter(IUnknown *outer, HRESULT *phr) { static const WCHAR source_name[] = {'O','u','t','p','u','t',0}; VfwCapture *object; - PIN_INFO pin_info;
if (!(object = CoTaskMemAlloc(sizeof(*object)))) { @@ -650,11 +649,8 @@ IUnknown * WINAPI QCAP_createVFWCaptureFilter(IUnknown *outer, HRESULT *phr) object->IPersistPropertyBag_iface.lpVtbl = &IPersistPropertyBag_VTable; object->init = FALSE;
- pin_info.dir = PINDIR_OUTPUT; - pin_info.pFilter = &object->filter.IBaseFilter_iface; - lstrcpyW(pin_info.achName, source_name); - strmbase_source_init(&object->source, &VfwPin_Vtbl, &pin_info, - &output_BaseOutputFuncTable, &object->filter.csFilter); + strmbase_source_init(&object->source, &VfwPin_Vtbl, &object->filter, + source_name, &output_BaseOutputFuncTable);
object->IKsPropertySet_iface.lpVtbl = &IKsPropertySet_VTable;
diff --git a/dlls/quartz/avisplit.c b/dlls/quartz/avisplit.c index 9d665b401c6..15627eeb08c 100644 --- a/dlls/quartz/avisplit.c +++ b/dlls/quartz/avisplit.c @@ -675,7 +675,6 @@ static HRESULT AVISplitter_ProcessOldIndex(AVISplitterImpl *This)
static HRESULT AVISplitter_ProcessStreamList(AVISplitterImpl * This, const BYTE * pData, DWORD cb, ALLOCATOR_PROPERTIES *props) { - PIN_INFO piOutput; const RIFFCHUNK * pChunk; HRESULT hr; AM_MEDIA_TYPE amt; @@ -685,11 +684,9 @@ static HRESULT AVISplitter_ProcessStreamList(AVISplitterImpl * This, const BYTE DWORD nstdindex = 0; static const WCHAR wszStreamTemplate[] = {'S','t','r','e','a','m',' ','%','0','2','d',0}; StreamData *stream; + WCHAR name[18];
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)); stream = This->streams + This->Parser.cStreams; ZeroMemory(stream, sizeof(*stream)); @@ -792,7 +789,7 @@ static HRESULT AVISplitter_ProcessStreamList(AVISplitterImpl * This, const BYTE case ckidSTREAMNAME: TRACE("processing stream name\n"); /* 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; case ckidSTREAMHANDLERDATA: 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->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);
@@ -1023,7 +1021,7 @@ static HRESULT AVISplitter_Disconnect(LPVOID iface); static HRESULT AVISplitter_InputPin_PreConnect(IPin * iface, IPin * pConnectPin, ALLOCATOR_PROPERTIES *props) { 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; RIFFLIST list; LONGLONG pos = 0; /* in bytes */ diff --git a/dlls/quartz/filesource.c b/dlls/quartz/filesource.c index 5e1880c84e1..f907401f050 100644 --- a/dlls/quartz/filesource.c +++ b/dlls/quartz/filesource.c @@ -469,7 +469,6 @@ static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFi { HANDLE hFile; AsyncReader *This = impl_from_IFileSourceFilter(iface); - PIN_INFO pin_info;
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()); }
- /* create pin */ - pin_info.dir = PINDIR_OUTPUT; - 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); + strmbase_source_init(&This->source, &FileAsyncReaderPin_Vtbl, &This->filter, + wszOutputPinName, &output_BaseOutputFuncTable); BaseFilterImpl_IncrementPinVersion(&This->filter);
This->file = hFile; diff --git a/dlls/quartz/mpegsplit.c b/dlls/quartz/mpegsplit.c index 48da7fb0b36..a34344cd3a3 100644 --- a/dlls/quartz/mpegsplit.c +++ b/dlls/quartz/mpegsplit.c @@ -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; int bitrate_index; @@ -369,9 +369,6 @@ static HRESULT MPEGSplitter_init_audio(MPEGSplitterImpl *This, const BYTE *heade int mode;
ZeroMemory(pamt, sizeof(*pamt)); - ppiOutput->dir = PINDIR_OUTPUT; - ppiOutput->pFilter = &This->Parser.filter.IBaseFilter_iface; - wsprintfW(ppiOutput->achName, wszAudioStream);
pamt->formattype = FORMAT_WaveFormatEx; 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) { 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; LONGLONG pos = 0; /* in bytes */ BYTE header[10]; int streamtype; LONGLONG total, avail; AM_MEDIA_TYPE amt; - PIN_INFO piOutput;
IAsyncReader_Length(pPin->pReader, &total, &avail); This->EndOfFile = total; @@ -570,7 +566,7 @@ static HRESULT MPEGSplitter_pre_connect(IPin *iface, IPin *pConnectPin, ALLOCATO LONGLONG duration = 0; WAVEFORMATEX *format;
- hr = MPEGSplitter_init_audio(This, header, &piOutput, &amt); + hr = MPEGSplitter_init_audio(This, header, &amt); if (SUCCEEDED(hr)) { format = (WAVEFORMATEX*)amt.pbFormat; @@ -581,7 +577,7 @@ static HRESULT MPEGSplitter_pre_connect(IPin *iface, IPin *pConnectPin, ALLOCATO props->cbBuffer = 0x4000 / format->nBlockAlign * format->nBlockAlign; props->cBuffers = 3; - hr = Parser_AddPin(&(This->Parser), &piOutput, props, &amt); + hr = Parser_AddPin(&This->Parser, wszAudioStream, props, &amt); }
if (FAILED(hr)) diff --git a/dlls/quartz/parser.c b/dlls/quartz/parser.c index 7382048eec2..309f26fb9ee 100644 --- a/dlls/quartz/parser.c +++ b/dlls/quartz/parser.c @@ -80,7 +80,6 @@ HRESULT Parser_Create(ParserImpl *pParser, const IBaseFilterVtbl *vtbl, IUnknown SourceSeeking_ChangeStart start, SourceSeeking_ChangeRate rate) { HRESULT hr; - PIN_INFO piInput;
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->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) 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);
- 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)) { @@ -346,7 +342,7 @@ static const BaseOutputPinFuncTable output_BaseOutputFuncTable = { 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) { 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])); filter->sources[filter->cStreams] = object;
- strmbase_source_init(&object->pin, &Parser_OutputPin_Vtbl, pin_info, - &output_BaseOutputFuncTable, &filter->filter.csFilter); + strmbase_source_init(&object->pin, &Parser_OutputPin_Vtbl, &filter->filter, + name, &output_BaseOutputFuncTable);
object->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)); CopyMediaType(object->pmt, mt); object->dwSamplesProcessed = 0; - - object->pin.pin.pinInfo.pFilter = &filter->filter.IBaseFilter_iface; object->allocProps = *props; filter->cStreams++; BaseFilterImpl_IncrementPinVersion(&filter->filter); @@ -539,7 +533,7 @@ static HRESULT WINAPI Parser_OutputPin_QueryInterface(IPin * iface, REFIID riid, *ppv = iface; /* The Parser filter does not support querying IMediaSeeking, return it directly */ 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) { @@ -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) { 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 */ EnterCriticalSection(This->pin.pin.pCritSec); @@ -610,7 +604,7 @@ static HRESULT WINAPI Parser_PullPin_QueryInterface(IPin * iface, REFIID riid, L * querying 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) { @@ -634,10 +628,10 @@ static HRESULT WINAPI Parser_PullPin_Disconnect(IPin * iface) if (This->pin.pConnectedTo) { 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); - hr = IBaseFilter_GetState(This->pin.pinInfo.pFilter, INFINITE, &state); + hr = IBaseFilter_GetState(&This->pin.filter->IBaseFilter_iface, INFINITE, &state); EnterCriticalSection(This->pin.pCritSec);
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); PullPin_Disconnect(iface); 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 hr = VFW_E_NOT_STOPPED; @@ -671,7 +665,7 @@ static HRESULT WINAPI Parser_PullPin_ReceiveConnection(IPin * iface, IPin * pRec BasePin *This = (BasePin *)iface;
EnterCriticalSection(This->pCritSec); - Parser_RemoveOutputPins(impl_from_IBaseFilter(This->pinInfo.pFilter)); + Parser_RemoveOutputPins(impl_from_IBaseFilter(&This->filter->IBaseFilter_iface)); LeaveCriticalSection(This->pCritSec); }
diff --git a/dlls/quartz/parser.h b/dlls/quartz/parser.h index 0caa8af831e..e0ea780e11f 100644 --- a/dlls/quartz/parser.h +++ b/dlls/quartz/parser.h @@ -50,7 +50,8 @@ struct ParserImpl 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, const CLSID *clsid, const struct strmbase_filter_ops *func_table, const WCHAR *sink_name, diff --git a/dlls/quartz/pin.c b/dlls/quartz/pin.c index 2930311e2ec..bcdd1c94735 100644 --- a/dlls/quartz/pin.c +++ b/dlls/quartz/pin.c @@ -166,19 +166,18 @@ static HRESULT deliver_newsegment(IPin *pin, LPVOID data)
/*** PullPin implementation ***/
-static HRESULT PullPin_Init(const IPinVtbl *PullPin_Vtbl, const PIN_INFO *info, - SAMPLEPROC_PULL pSampleProc, void *pUserData, QUERYACCEPTPROC pQueryAccept, - CLEANUPPROC pCleanUp, REQUESTPROC pCustomRequest, STOPPROCESSPROC pDone, - LPCRITICAL_SECTION pCritSec, PullPin *pPinImpl) +static HRESULT PullPin_Init(const IPinVtbl *PullPin_Vtbl, struct strmbase_filter *filter, + const WCHAR *name, SAMPLEPROC_PULL pSampleProc, void *pUserData, + QUERYACCEPTPROC pQueryAccept, CLEANUPPROC pCleanUp, REQUESTPROC pCustomRequest, + STOPPROCESSPROC pDone, PullPin *pPinImpl) { /* Common attributes */ pPinImpl->pin.IPin_iface.lpVtbl = PullPin_Vtbl; pPinImpl->pin.pConnectedTo = NULL; - pPinImpl->pin.pCritSec = pCritSec; - /* avoid copying uninitialized data */ - wcscpy(pPinImpl->pin.pinInfo.achName, info->achName); - pPinImpl->pin.pinInfo.dir = info->dir; - pPinImpl->pin.pinInfo.pFilter = info->pFilter; + pPinImpl->pin.pCritSec = &filter->csFilter; + wcscpy(pPinImpl->pin.name, name); + pPinImpl->pin.dir = PINDIR_INPUT; + pPinImpl->pin.filter = filter; ZeroMemory(&pPinImpl->pin.mtCurrent, sizeof(AM_MEDIA_TYPE));
/* Input pin attributes */ @@ -209,27 +208,22 @@ static HRESULT PullPin_Init(const IPinVtbl *PullPin_Vtbl, const PIN_INFO *info, 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, CLEANUPPROC pCleanUp, REQUESTPROC pCustomRequest, STOPPROCESSPROC pDone, - LPCRITICAL_SECTION pCritSec, IPin ** ppPin) + IPin ** ppPin) { PullPin * pPinImpl;
*ppPin = NULL;
- if (pPinInfo->dir != PINDIR_INPUT) - { - ERR("Pin direction(%x) != PINDIR_INPUT\n", pPinInfo->dir); - return E_INVALIDARG; - } - pPinImpl = CoTaskMemAlloc(sizeof(*pPinImpl));
if (!pPinImpl) 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; return S_OK; @@ -348,7 +342,7 @@ HRESULT WINAPI PullPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv) else if (IsEqualIID(riid, &IID_IMediaSeeking) || 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) @@ -525,7 +519,7 @@ static void PullPin_Thread_Stop(PullPin *This) SetEvent(This->hEventStateChanged); LeaveCriticalSection(This->pin.pCritSec);
- IBaseFilter_Release(This->pin.pinInfo.pFilter); + IPin_Release(&This->pin.IPin_iface);
CoUninitialize(); ExitThread(0); @@ -576,16 +570,13 @@ static HRESULT PullPin_InitProcessing(PullPin * This) assert(WaitForSingleObject(This->thread_sleepy, 0) == WAIT_TIMEOUT); This->state = Req_Sleepy;
- /* AddRef the filter to make sure it and its pins will be around - * as long as the thread */ - IBaseFilter_AddRef(This->pin.pinInfo.pFilter); - + IPin_AddRef(&This->pin.IPin_iface);
This->hThread = CreateThread(NULL, 0, PullPin_Thread_Main, This, 0, &dwThreadId); if (!This->hThread) { hr = HRESULT_FROM_WIN32(GetLastError()); - IBaseFilter_Release(This->pin.pinInfo.pFilter); + IPin_Release(&This->pin.IPin_iface); }
if (SUCCEEDED(hr)) @@ -769,7 +760,7 @@ HRESULT WINAPI PullPin_EndFlush(IPin * iface) if (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) PullPin_StartProcessing(This); diff --git a/dlls/quartz/pin.h b/dlls/quartz/pin.h index efed724c394..fb39d3a7e39 100644 --- a/dlls/quartz/pin.h +++ b/dlls/quartz/pin.h @@ -102,10 +102,10 @@ typedef struct PullPin #define Req_Pause 3
/*** 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, CLEANUPPROC pCleanUp, REQUESTPROC pCustomRequest, STOPPROCESSPROC pDone, - LPCRITICAL_SECTION pCritSec, IPin ** ppPin); + IPin **ppPin); void PullPin_destroy(PullPin *pin) DECLSPEC_HIDDEN;
/**************************/ diff --git a/dlls/quartz/waveparser.c b/dlls/quartz/waveparser.c index 03a39749cc6..43bfff060b5 100644 --- a/dlls/quartz/waveparser.c +++ b/dlls/quartz/waveparser.c @@ -51,9 +51,9 @@ static inline WAVEParserImpl *impl_from_IMediaSeeking( 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) @@ -246,13 +246,8 @@ static HRESULT WAVEParser_InputPin_PreConnect(IPin * iface, IPin * pConnectPin, RIFFLIST list; RIFFCHUNK chunk; LONGLONG pos = 0; /* in bytes */ - PIN_INFO piOutput; AM_MEDIA_TYPE amt; - WAVEParserImpl * pWAVEParser = impl_from_IBaseFilter(This->pin.pinInfo.pFilter); - - piOutput.dir = PINDIR_OUTPUT; - piOutput.pFilter = &pWAVEParser->Parser.filter.IBaseFilter_iface; - lstrcpynW(piOutput.achName, outputW, ARRAY_SIZE(piOutput.achName)); + WAVEParserImpl *pWAVEParser = impl_from_strmbase_filter(This->pin.filter);
hr = IAsyncReader_SyncRead(This->pReader, pos, sizeof(list), (BYTE *)&list); pos += sizeof(list); @@ -314,7 +309,7 @@ static HRESULT WAVEParser_InputPin_PreConnect(IPin * iface, IPin * pConnectPin, props->cBuffers = 3; pWAVEParser->nBlockAlign = ((WAVEFORMATEX*)amt.pbFormat)->nBlockAlign; 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);
pWAVEParser->Parser.sourceSeeking.llCurrent = 0; @@ -410,7 +405,7 @@ static const IBaseFilterVtbl WAVEParser_Vtbl =
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); }
diff --git a/dlls/strmbase/pin.c b/dlls/strmbase/pin.c index 1386f6ba6aa..fbb9451d563 100644 --- a/dlls/strmbase/pin.c +++ b/dlls/strmbase/pin.c @@ -135,14 +135,6 @@ out: 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) { if (!pmt) @@ -176,13 +168,13 @@ LONG WINAPI BasePinImpl_GetMediaTypeVersion(BasePin *iface) ULONG WINAPI BasePinImpl_AddRef(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) { 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) @@ -261,40 +253,40 @@ HRESULT WINAPI BasePinImpl_ConnectionMediaType(IPin * iface, AM_MEDIA_TYPE * pmt 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); - IBaseFilter_AddRef(pInfo->pFilter); + info->dir = pin->dir; + IBaseFilter_AddRef(info->pFilter = &pin->filter->IBaseFilter_iface); + lstrcpyW(info->achName, pin->name);
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; }
-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) + if (!(*id = CoTaskMemAlloc((lstrlenW(pin->name) + 1) * sizeof(WCHAR)))) return E_OUTOFMEMORY;
- lstrcpyW(*Id, This->pinInfo.achName); + lstrcpyW(*id, pin->name);
return S_OK; } @@ -362,7 +354,7 @@ HRESULT WINAPI BaseOutputPinImpl_QueryInterface(IPin * iface, REFIID riid, LPVOI else if (IsEqualIID(riid, &IID_IMediaSeeking) || 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) @@ -712,22 +704,17 @@ HRESULT WINAPI BaseOutputPinImpl_AttemptConnection(BaseOutputPin *This, IPin *pR return hr; }
-static void strmbase_pin_init(BasePin *pin, const IPinVtbl *vtbl, - const BasePinFuncTable *func_table, const PIN_INFO *info, CRITICAL_SECTION *cs) -{ - memset(pin, 0, sizeof(*pin)); - pin->IPin_iface.lpVtbl = vtbl; - pin->pCritSec = cs; - pin->dRate = 1.0; - Copy_PinInfo(&pin->pinInfo, info); - pin->pFuncsTable = func_table; -} - -void strmbase_source_init(BaseOutputPin *pin, const IPinVtbl *vtbl, - const PIN_INFO *info, const BaseOutputPinFuncTable *func_table, CRITICAL_SECTION *cs) +void strmbase_source_init(BaseOutputPin *pin, const IPinVtbl *vtbl, struct strmbase_filter *filter, + const WCHAR *name, const BaseOutputPinFuncTable *func_table) { 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_OUTPUT; + lstrcpyW(pin->pin.name, name); + pin->pin.pFuncsTable = &func_table->base; pin->pFuncsTable = func_table; }
@@ -762,7 +749,7 @@ HRESULT WINAPI BaseInputPinImpl_QueryInterface(IPin * iface, REFIID riid, LPVOID *ppv = &This->IMemInputPin_iface; 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) @@ -1045,12 +1032,17 @@ static const IMemInputPinVtbl MemInputPin_Vtbl = MemInputPin_ReceiveCanBlock };
-void strmbase_sink_init(BaseInputPin *pin, const IPinVtbl *vtbl, - const PIN_INFO *info, const BaseInputPinFuncTable *func_table, CRITICAL_SECTION *cs, - IMemAllocator *allocator) +void strmbase_sink_init(BaseInputPin *pin, const IPinVtbl *vtbl, struct strmbase_filter *filter, + const WCHAR *name, const BaseInputPinFuncTable *func_table, IMemAllocator *allocator) { 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->pAllocator = pin->preferred_allocator = allocator; if (pin->preferred_allocator) diff --git a/dlls/strmbase/renderer.c b/dlls/strmbase/renderer.c index d39700b7bcd..a74c975b9a9 100644 --- a/dlls/strmbase/renderer.c +++ b/dlls/strmbase/renderer.c @@ -236,7 +236,6 @@ HRESULT WINAPI strmbase_renderer_init(BaseRenderer *filter, const IBaseFilterVtb IUnknown *outer, const CLSID *clsid, const WCHAR *sink_name, const BaseRendererFuncTable *pBaseFuncsTable) { - PIN_INFO piInput; HRESULT hr;
memset(filter, 0, sizeof(*filter)); @@ -244,13 +243,8 @@ HRESULT WINAPI strmbase_renderer_init(BaseRenderer *filter, const IBaseFilterVtb
filter->pFuncsTable = pBaseFuncsTable;
- /* construct input pin */ - piInput.dir = PINDIR_INPUT; - 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); + strmbase_sink_init(&filter->sink, &BaseRenderer_InputPin_Vtbl, &filter->filter, + sink_name, &input_BaseInputFuncTable, NULL);
hr = CreatePosPassThru(outer ? outer : (IUnknown *)&filter->filter.IBaseFilter_iface, TRUE, &filter->sink.pin.IPin_iface, &filter->pPosition); diff --git a/dlls/strmbase/transform.c b/dlls/strmbase/transform.c index fdecc8d0d17..83a7ee1129e 100644 --- a/dlls/strmbase/transform.c +++ b/dlls/strmbase/transform.c @@ -275,8 +275,6 @@ static HRESULT strmbase_transform_init(IUnknown *outer, const CLSID *clsid, { ISeekingPassThru *passthru; HRESULT hr; - PIN_INFO piInput; - PIN_INFO piOutput;
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; ZeroMemory(&filter->pmt, sizeof(filter->pmt));
- /* construct input pin */ - piInput.dir = PINDIR_INPUT; - 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, &filter->filter, + wcsInputPinName, &tf_input_BaseInputFuncTable, NULL);
- strmbase_sink_init(&filter->sink, &TransformFilter_InputPin_Vtbl, &piInput, - &tf_input_BaseInputFuncTable, &filter->filter.csFilter, NULL); - - strmbase_source_init(&filter->source, &TransformFilter_OutputPin_Vtbl, - &piOutput, &tf_output_BaseOutputFuncTable, &filter->filter.csFilter); + strmbase_source_init(&filter->source, &TransformFilter_OutputPin_Vtbl, &filter->filter, + wcsOutputPinName, &tf_output_BaseOutputFuncTable);
QualityControlImpl_Create(&filter->sink.pin.IPin_iface, &filter->filter.IBaseFilter_iface, &filter->qcimpl); diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index 1a9aec8f033..8a85f290a12 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -95,6 +95,11 @@ static inline GSTImpl *impl_from_IBaseFilter(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";
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 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 WINAPI GST_ChangeCurrent(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) { 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; GstStructure *arg; const char *typename; @@ -471,7 +476,7 @@ static gboolean event_sink(GstPad *pad, GstObject *parent, GstEvent *event) IPin_EndOfStream(pin->pin.pin.pConnectedTo); return TRUE; 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 * our sink pins to receive a flush-start event when the * 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) { 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; BYTE *ptr = NULL; IMediaSample *sample; @@ -781,8 +786,6 @@ out:
static void init_new_decoded_pad(GstElement *bin, GstPad *pad, GSTImpl *This) { - HRESULT hr; - PIN_INFO piOutput; const char *typename; char *name; AM_MEDIA_TYPE amt = {{0}}; @@ -793,18 +796,17 @@ static void init_new_decoded_pad(GstElement *bin, GstPad *pad, GSTImpl *This) int ret; BOOL isvid = FALSE, isaud = FALSE; gchar my_name[1024]; + WCHAR nameW[128];
TRACE("%p %p %p\n", This, bin, pad);
- piOutput.dir = PINDIR_OUTPUT; - piOutput.pFilter = &This->filter.IBaseFilter_iface; 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); strcpy(my_name, "qz_sink_"); strcat(my_name, name); g_free(name); - piOutput.achName[ARRAY_SIZE(piOutput.achName) - 1] = 0;
caps = gst_pad_query_caps(pad, NULL); caps = gst_caps_make_writable(caps); @@ -825,7 +827,7 @@ static void init_new_decoded_pad(GstElement *bin, GstPad *pad, GSTImpl *This) return; }
- if (!create_pin(This, &piOutput, &amt)) + if (!create_pin(This, nameW, &amt)) { ERR("Failed to allocate memory.\n"); 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) { - GSTImpl *This = impl_from_IBaseFilter(pPin->pin.pinInfo.pFilter); + GSTImpl *This = impl_from_strmbase_filter(pPin->pin.filter); int ret, i; LONGLONG avail, duration; GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE( @@ -1194,7 +1196,7 @@ static inline GSTOutPin *impl_from_IMediaSeeking( IMediaSeeking *iface )
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) return &filter->pInputPin.pin.IPin_iface; @@ -1205,7 +1207,7 @@ static IPin *gstdemux_get_pin(struct strmbase_filter *base, unsigned int index)
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; HRESULT hr;
@@ -1249,7 +1251,6 @@ static const struct strmbase_filter_ops filter_ops =
IUnknown * CALLBACK Gstreamer_Splitter_create(IUnknown *outer, HRESULT *phr) { - PIN_INFO *piInput; GSTImpl *This;
if (!init_gstreamer()) @@ -1277,10 +1278,9 @@ IUnknown * CALLBACK Gstreamer_Splitter_create(IUnknown *outer, HRESULT *phr) This->push_event = CreateEventW(NULL, 0, 0, NULL); This->bus = NULL;
- piInput = &This->pInputPin.pin.pinInfo; - piInput->dir = PINDIR_INPUT; - piInput->pFilter = &This->filter.IBaseFilter_iface; - lstrcpynW(piInput->achName, wcsInputPinName, ARRAY_SIZE(piInput->achName)); + This->pInputPin.pin.dir = PINDIR_INPUT; + This->pInputPin.pin.filter = &This->filter; + lstrcpynW(This->pInputPin.pin.name, wcsInputPinName, ARRAY_SIZE(This->pInputPin.pin.name)); This->pInputPin.pin.IPin_iface.lpVtbl = &GST_InputPin_Vtbl; This->pInputPin.pin.pConnectedTo = NULL; This->pInputPin.pin.pCritSec = &This->filter.csFilter; @@ -1717,7 +1717,7 @@ static HRESULT WINAPI GSTOutPin_DecideBufferSize(BaseOutputPin *iface, IMemAlloc static HRESULT WINAPI GSTOutPin_DecideAllocator(BaseOutputPin *base, IMemInputPin *pPin, IMemAllocator **pAlloc) { 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;
TRACE("pin %p, peer %p, allocator %p.\n", pin, pPin, pAlloc); @@ -1806,7 +1806,7 @@ static const BaseOutputPinFuncTable output_BaseOutputFuncTable = { 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;
@@ -1817,8 +1817,8 @@ static BOOL create_pin(GSTImpl *filter, const PIN_INFO *pin_info, const AM_MEDIA if (!(pin = heap_alloc_zero(sizeof(*pin)))) return FALSE;
- strmbase_source_init(&pin->pin, &GST_OutputPin_Vtbl, pin_info, - &output_BaseOutputFuncTable, &filter->filter.csFilter); + strmbase_source_init(&pin->pin, &GST_OutputPin_Vtbl, &filter->filter, name, + &output_BaseOutputFuncTable); pin->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)); CopyMediaType(pin->pmt, mt); pin->caps_event = CreateEventW(NULL, FALSE, FALSE, NULL); @@ -1868,6 +1868,7 @@ static inline GSTInPin *impl_sink_from_IPin(IPin *iface) static HRESULT WINAPI GSTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin, const AM_MEDIA_TYPE *pmt) { GSTInPin *This = impl_sink_from_IPin(iface); + GSTImpl *filter = impl_from_strmbase_filter(This->pin.filter); PIN_DIRECTION pindirReceive; HRESULT hr = S_OK;
@@ -1899,7 +1900,7 @@ static HRESULT WINAPI GSTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin,
This->pReader = NULL; This->pAlloc = NULL; - ResetEvent(impl_from_IBaseFilter(This->pin.pinInfo.pFilter)->push_event); + ResetEvent(filter->push_event); if (SUCCEEDED(hr)) hr = IPin_QueryInterface(pReceivePin, &IID_IAsyncReader, (LPVOID *)&This->pReader); if (SUCCEEDED(hr)) @@ -1922,9 +1923,9 @@ static HRESULT WINAPI GSTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin, This->pin.pConnectedTo = pReceivePin; IPin_AddRef(pReceivePin); hr = IMemAllocator_Commit(This->pAlloc); - SetEvent(impl_from_IBaseFilter(This->pin.pinInfo.pFilter)->push_event); + SetEvent(filter->push_event); } else { - GST_RemoveOutputPins(impl_from_IBaseFilter(This->pin.pinInfo.pFilter)); + GST_RemoveOutputPins(filter); if (This->pReader) IAsyncReader_Release(This->pReader); This->pReader = NULL; @@ -1949,10 +1950,10 @@ static HRESULT WINAPI GSTInPin_Disconnect(IPin *iface)
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); 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) { IMemAllocator_Decommit(This->pAlloc); @@ -2022,7 +2023,7 @@ static HRESULT WINAPI GSTInPin_QueryInterface(IPin * iface, REFIID riid, LPVOID *ppv = iface; 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) diff --git a/dlls/wineqtdecoder/qtsplitter.c b/dlls/wineqtdecoder/qtsplitter.c index 3931452e525..1d845a9e8fb 100644 --- a/dlls/wineqtdecoder/qtsplitter.c +++ b/dlls/wineqtdecoder/qtsplitter.c @@ -176,7 +176,7 @@ static const IPinVtbl QT_InputPin_Vtbl; static const IBaseFilterVtbl QT_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 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) { - PIN_INFO *piInput; QTSplitter *This; 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->runEvent = CreateEventW(NULL, 0, 0, NULL);
- piInput = &This->pInputPin.pin.pinInfo; - piInput->dir = PINDIR_INPUT; - piInput->pFilter = &This->filter.IBaseFilter_iface; - lstrcpynW(piInput->achName, wcsInputPinName, ARRAY_SIZE(piInput->achName)); + This->pInputPin.pin.dir = PINDIR_INPUT; + This->pInputPin.pin.filter = &This->filter; + lstrcpynW(This->pInputPin.pin.name, wcsInputPinName, ARRAY_SIZE(This->pInputPin.pin.name)); This->pInputPin.pin.IPin_iface.lpVtbl = &QT_InputPin_Vtbl; This->pInputPin.pin.pConnectedTo = NULL; 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; VIDEOINFOHEADER * pvi; - PIN_INFO piOutput; HRESULT hr = S_OK; OSErr err; 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); pvi->AvgTimePerFrame = (100000.0 * sampleCount * timeScale) / duration;
- piOutput.dir = PINDIR_OUTPUT; - piOutput.pFilter = &filter->filter.IBaseFilter_iface; - lstrcpyW(piOutput.achName,szwVideoOut); - - hr = QT_AddPin(filter, &piOutput, &amt, TRUE); + hr = QT_AddPin(filter, szwVideoOut, &amt, TRUE); if (FAILED(hr)) ERR("Failed to add Video Track\n"); else @@ -930,7 +923,6 @@ static HRESULT QT_Process_Audio_Track(QTSplitter* filter, Track trk) { AM_MEDIA_TYPE amt; WAVEFORMATEX* pvi; - PIN_INFO piOutput; HRESULT hr = S_OK; static const WCHAR szwAudioOut[] = {'A','u','d','i','o',0}; Media audioMedia; @@ -967,11 +959,7 @@ static HRESULT QT_Process_Audio_Track(QTSplitter* filter, Track trk)
DisposeHandle((Handle)aDesc);
- piOutput.dir = PINDIR_OUTPUT; - piOutput.pFilter = &filter->filter.IBaseFilter_iface; - lstrcpyW(piOutput.achName,szwAudioOut); - - hr = QT_AddPin(filter, &piOutput, &amt, FALSE); + hr = QT_AddPin(filter, szwAudioOut, &amt, FALSE); if (FAILED(hr)) ERR("Failed to add Audio Track\n"); else @@ -1051,6 +1039,7 @@ static HRESULT WINAPI QTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin, HRESULT hr = S_OK; ALLOCATOR_PROPERTIES props; QTInPin *This = impl_from_IPin(iface); + QTSplitter *filter = impl_from_strmbase_filter(This->pin.filter); IMemAllocator *pAlloc;
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); - EnterCriticalSection(&impl_from_IBaseFilter(This->pin.pinInfo.pFilter)->filter.csFilter); - hr = QT_Process_Movie(impl_from_IBaseFilter(This->pin.pinInfo.pFilter)); + EnterCriticalSection(&filter->filter.csFilter); + hr = QT_Process_Movie(filter); if (FAILED(hr)) { IAsyncReader_Release(This->pReader); This->pReader = NULL; - LeaveCriticalSection(&impl_from_IBaseFilter(This->pin.pinInfo.pFilter)->filter.csFilter); + LeaveCriticalSection(&filter->filter.csFilter); TRACE("Unable to process movie\n"); return hr; } @@ -1099,7 +1088,7 @@ static HRESULT WINAPI QTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin, This->pAlloc = NULL; props.cBuffers = 8; props.cbAlign = 1; - props.cbBuffer = impl_from_IBaseFilter(This->pin.pinInfo.pFilter)->outputSize + props.cbAlign; + props.cbBuffer = filter->outputSize + props.cbAlign; props.cbPrefix = 0; hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC, &IID_IMemAllocator, (LPVOID *)&pAlloc); @@ -1122,7 +1111,7 @@ static HRESULT WINAPI QTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin, } else { - QT_RemoveOutputPins(impl_from_IBaseFilter(This->pin.pinInfo.pFilter)); + QT_RemoveOutputPins(filter); if (This->pReader) IAsyncReader_Release(This->pReader); This->pReader = NULL; @@ -1131,7 +1120,7 @@ static HRESULT WINAPI QTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin, This->pAlloc = NULL; } TRACE("Size: %i\n", props.cbBuffer); - LeaveCriticalSection(&impl_from_IBaseFilter(This->pin.pinInfo.pFilter)->filter.csFilter); + LeaveCriticalSection(&filter->filter.csFilter);
return hr; } @@ -1143,11 +1132,11 @@ static HRESULT WINAPI QTInPin_Disconnect(IPin *iface) FILTER_STATE state; 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); 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) { @@ -1182,38 +1171,26 @@ static HRESULT WINAPI QTInPin_QueryAccept(IPin *iface, const AM_MEDIA_TYPE *pmt)
static HRESULT WINAPI QTInPin_EndOfStream(IPin *iface) { - QTInPin *pin = impl_from_IPin(iface); - QTSplitter *This = impl_from_IBaseFilter(pin->pin.pinInfo.pFilter); - - FIXME("Propagate message on %p\n", This); + FIXME("iface %p, stub!\n", iface); return S_OK; }
static HRESULT WINAPI QTInPin_BeginFlush(IPin *iface) { - QTInPin *pin = impl_from_IPin(iface); - QTSplitter *This = impl_from_IBaseFilter(pin->pin.pinInfo.pFilter); - - FIXME("Propagate message on %p\n", This); + FIXME("iface %p, stub!\n", iface); return S_OK; }
static HRESULT WINAPI QTInPin_EndFlush(IPin *iface) { - QTInPin *pin = impl_from_IPin(iface); - QTSplitter *This = impl_from_IBaseFilter(pin->pin.pinInfo.pFilter); - - FIXME("Propagate message on %p\n", This); + FIXME("iface %p, stub!\n", iface); return S_OK; }
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); - FIXME("Propagate message on %p\n", This); + FIXME("iface %p, stub!\n", iface); return S_OK; }
@@ -1230,7 +1207,7 @@ static HRESULT WINAPI QTInPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * else if (IsEqualIID(riid, &IID_IPin)) *ppv = iface; 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) { @@ -1304,7 +1281,7 @@ static HRESULT WINAPI QTOutPin_QueryInterface(IPin *iface, REFIID riid, void **p else if (IsEqualIID(riid, &IID_IPin)) *ppv = iface; 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)) *ppv = &This->IQualityControl_iface;
@@ -1345,7 +1322,7 @@ static HRESULT WINAPI QTOutPin_DecideAllocator(BaseOutputPin *iface, IMemInputPi { HRESULT hr; 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; if (QTfilter->pInputPin.pAlloc) @@ -1444,7 +1421,7 @@ static const OutputQueueFuncTable output_OutputQueueFuncTable = { 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) { QTOutPin *pin; @@ -1457,8 +1434,8 @@ static HRESULT QT_AddPin(QTSplitter *filter, const PIN_INFO *pin_info, else filter->pAudio_Pin = pin;
- strmbase_source_init(&pin->pin, &QT_OutputPin_Vtbl, piOutput, - &output_BaseOutputFuncTable, &filter->filter.csFilter); + strmbase_source_init(&pin->pin, &QT_OutputPin_Vtbl, &filter->filter, name, + &output_BaseOutputFuncTable); pin->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)); CopyMediaType(pin->pmt, mt); pin->IQualityControl_iface.lpVtbl = &QTOutPin_QualityControl_Vtbl; diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h index 6bd00e14dd6..08e8b7cbb5d 100644 --- a/include/wine/strmbase.h +++ b/include/wine/strmbase.h @@ -30,16 +30,17 @@ void WINAPI DeleteMediaType(AM_MEDIA_TYPE * pMediaType);
typedef struct BasePin { - IPin IPin_iface; - LPCRITICAL_SECTION pCritSec; - PIN_INFO pinInfo; - IPin * pConnectedTo; - AM_MEDIA_TYPE mtCurrent; - REFERENCE_TIME tStart; - REFERENCE_TIME tStop; - double dRate; - - const struct BasePinFuncTable* pFuncsTable; + IPin IPin_iface; + CRITICAL_SECTION *pCritSec; + struct strmbase_filter *filter; + PIN_DIRECTION dir; + WCHAR name[128]; + IPin *pConnectedTo; + AM_MEDIA_TYPE mtCurrent; + REFERENCE_TIME tStart, tStop; + double dRate; + + const struct BasePinFuncTable* pFuncsTable; } BasePin;
typedef HRESULT (WINAPI *BasePin_CheckMediaType)(BasePin *This, const AM_MEDIA_TYPE *pmt); @@ -133,8 +134,8 @@ HRESULT WINAPI BaseOutputPinImpl_DecideAllocator(BaseOutputPin *This, IMemInputP HRESULT WINAPI BaseOutputPinImpl_AttemptConnection(BaseOutputPin *pin, IPin *peer, const AM_MEDIA_TYPE *mt);
void strmbase_source_cleanup(BaseOutputPin *pin); -void strmbase_source_init(BaseOutputPin *pin, const IPinVtbl *vtbl, const PIN_INFO *info, - const BaseOutputPinFuncTable *func_table, CRITICAL_SECTION *cs); +void strmbase_source_init(BaseOutputPin *pin, const IPinVtbl *vtbl, struct strmbase_filter *filter, + const WCHAR *name, const BaseOutputPinFuncTable *func_table);
/* Base Input Pin */ 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_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
-void strmbase_sink_init(BaseInputPin *pin, const IPinVtbl *vtbl, const PIN_INFO *info, - const BaseInputPinFuncTable *func_table, CRITICAL_SECTION *cs, IMemAllocator *allocator); +void strmbase_sink_init(BaseInputPin *pin, const IPinVtbl *vtbl, struct strmbase_filter *filter, + const WCHAR *name, const BaseInputPinFuncTable *func_table, IMemAllocator *allocator); void strmbase_sink_cleanup(BaseInputPin *pin);
struct strmbase_filter