Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/evr/evr.c | 4 ++-- dlls/qcap/audiorecord.c | 5 ++--- dlls/qcap/avico.c | 15 ++++----------- dlls/qcap/avimux.c | 15 ++++++++------- dlls/qcap/smartteefilter.c | 18 +++++------------- dlls/qcap/vfwcapture.c | 4 ++-- dlls/qedit/samplegrabber.c | 6 +++--- dlls/quartz/filesource.c | 6 ++---- dlls/quartz/parser.c | 14 +++++--------- dlls/strmbase/filter.c | 2 +- dlls/strmbase/renderer.c | 4 ++-- dlls/strmbase/transform.c | 4 ++-- dlls/winegstreamer/gstdemux.c | 10 ++++------ dlls/wineqtdecoder/qtsplitter.c | 2 +- include/wine/strmbase.h | 2 +- 15 files changed, 44 insertions(+), 67 deletions(-)
diff --git a/dlls/evr/evr.c b/dlls/evr/evr.c index 01e4ee4598..493696f465 100644 --- a/dlls/evr/evr.c +++ b/dlls/evr/evr.c @@ -191,9 +191,9 @@ static const IBaseFilterVtbl basefilter_vtbl = BaseFilterImpl_QueryVendorInfo };
-static IPin* WINAPI filter_GetPin(BaseFilter *iface, int position) +static IPin * WINAPI filter_GetPin(BaseFilter *iface, unsigned int index) { - FIXME("(%p, %d): stub!\n", iface, position); + FIXME("iface %p, index %u, stub!\n", iface, index); return NULL; }
diff --git a/dlls/qcap/audiorecord.c b/dlls/qcap/audiorecord.c index 373bc9a025..1e5aa43cfb 100644 --- a/dlls/qcap/audiorecord.c +++ b/dlls/qcap/audiorecord.c @@ -171,10 +171,9 @@ static const IBaseFilterVtbl AudioRecordVtbl = { BaseFilterImpl_QueryVendorInfo };
-static IPin* WINAPI AudioRecord_GetPin(BaseFilter *iface, int pos) +static IPin * WINAPI AudioRecord_GetPin(BaseFilter *iface, unsigned int index) { - AudioRecord *This = impl_from_BaseFilter(iface); - FIXME("(%p, %d): stub\n", This, pos); + FIXME("iface %p, index %u, stub!\n", iface, index); return NULL; }
diff --git a/dlls/qcap/avico.c b/dlls/qcap/avico.c index 5ea4016a65..770790da1c 100644 --- a/dlls/qcap/avico.c +++ b/dlls/qcap/avico.c @@ -244,24 +244,17 @@ static const IBaseFilterVtbl AVICompressorVtbl = { AVICompressor_QueryVendorInfo };
-static IPin* WINAPI AVICompressor_GetPin(BaseFilter *iface, int pos) +static IPin * WINAPI AVICompressor_GetPin(BaseFilter *iface, unsigned int index) { AVICompressor *This = impl_from_BaseFilter(iface); IPin *ret;
- TRACE("(%p)->(%d)\n", This, pos); - - switch(pos) { - case 0: + if (index == 0) ret = &This->in->pin.IPin_iface; - break; - case 1: + else if (index == 1) ret = &This->out->pin.IPin_iface; - break; - default: - TRACE("No pin %d\n", pos); + else return NULL; - };
IPin_AddRef(ret); return ret; diff --git a/dlls/qcap/avimux.c b/dlls/qcap/avimux.c index ff45fb0112..ccec60c0b5 100644 --- a/dlls/qcap/avimux.c +++ b/dlls/qcap/avimux.c @@ -116,18 +116,19 @@ static inline AviMux* impl_from_BaseFilter(BaseFilter *filter) return CONTAINING_RECORD(filter, AviMux, filter); }
-static IPin* WINAPI AviMux_GetPin(BaseFilter *iface, int pos) +static IPin * WINAPI AviMux_GetPin(BaseFilter *iface, unsigned int index) { AviMux *This = impl_from_BaseFilter(iface);
- TRACE("(%p)->(%d)\n", This, pos); - - if(pos == 0) { + if (!index) + { IPin_AddRef(&This->out->pin.pin.IPin_iface); return &This->out->pin.pin.IPin_iface; - }else if(pos>0 && pos<=This->input_pin_no) { - IPin_AddRef(&This->in[pos-1]->pin.pin.IPin_iface); - return &This->in[pos-1]->pin.pin.IPin_iface; + } + else if (index <= This->input_pin_no) + { + IPin_AddRef(&This->in[index - 1]->pin.pin.IPin_iface); + return &This->in[index - 1]->pin.pin.IPin_iface; }
return NULL; diff --git a/dlls/qcap/smartteefilter.c b/dlls/qcap/smartteefilter.c index cbcbc455ed..e16d08a759 100644 --- a/dlls/qcap/smartteefilter.c +++ b/dlls/qcap/smartteefilter.c @@ -199,27 +199,19 @@ static const IBaseFilterVtbl SmartTeeFilterVtbl = { BaseFilterImpl_QueryVendorInfo };
-static IPin* WINAPI SmartTeeFilter_GetPin(BaseFilter *iface, int pos) +static IPin * WINAPI SmartTeeFilter_GetPin(BaseFilter *iface, unsigned int index) { SmartTeeFilter *This = impl_from_BaseFilter(iface); IPin *ret;
- TRACE("(%p)->(%d)\n", This, pos); - - switch(pos) { - case 0: + if (index == 0) ret = &This->input->pin.IPin_iface; - break; - case 1: + else if (index == 1) ret = &This->capture->pin.IPin_iface; - break; - case 2: + else if (index == 2) ret = &This->preview->pin.IPin_iface; - break; - default: - TRACE("No pin %d\n", pos); + else return NULL; - }
IPin_AddRef(ret); return ret; diff --git a/dlls/qcap/vfwcapture.c b/dlls/qcap/vfwcapture.c index feb9c08e85..54d9e59786 100644 --- a/dlls/qcap/vfwcapture.c +++ b/dlls/qcap/vfwcapture.c @@ -192,11 +192,11 @@ static const IUnknownVtbl unknown_inner_vtbl = unknown_inner_Release, };
-static IPin* WINAPI VfwCapture_GetPin(BaseFilter *iface, int pos) +static IPin * WINAPI VfwCapture_GetPin(BaseFilter *iface, unsigned int index) { VfwCapture *This = impl_from_BaseFilter(iface);
- if (pos >= 1 || pos < 0) + if (index >= 1) return NULL;
IPin_AddRef(This->pOutputPin); diff --git a/dlls/qedit/samplegrabber.c b/dlls/qedit/samplegrabber.c index bc91f72af1..cbaca69962 100644 --- a/dlls/qedit/samplegrabber.c +++ b/dlls/qedit/samplegrabber.c @@ -339,14 +339,14 @@ static const IUnknownVtbl samplegrabber_vtbl = SampleGrabber_Release, };
-static IPin *WINAPI SampleGrabber_GetPin(BaseFilter *iface, int pos) +static IPin * WINAPI SampleGrabber_GetPin(BaseFilter *iface, unsigned int index) { SG_Impl *This = impl_from_BaseFilter(iface); IPin *pin;
- if (pos == 0) + if (index == 0) pin = &This->pin_in.IPin_iface; - else if (pos == 1) + else if (index == 1) pin = &This->pin_out.IPin_iface; else return NULL; diff --git a/dlls/quartz/filesource.c b/dlls/quartz/filesource.c index a331d3359a..f3a2c43c63 100644 --- a/dlls/quartz/filesource.c +++ b/dlls/quartz/filesource.c @@ -392,13 +392,11 @@ HRESULT GetClassMediaFile(IAsyncReader * pReader, LPCOLESTR pszFileName, GUID * return hr; }
-static IPin* WINAPI AsyncReader_GetPin(BaseFilter *iface, int pos) +static IPin * WINAPI AsyncReader_GetPin(BaseFilter *iface, unsigned int index) { AsyncReader *This = impl_from_BaseFilter(iface);
- TRACE("%p->(%d)\n", This, pos); - - if (pos >= 1 || !This->pOutputPin) + if (index >= 1 || !This->pOutputPin) return NULL;
IPin_AddRef(This->pOutputPin); diff --git a/dlls/quartz/parser.c b/dlls/quartz/parser.c index 2af8a1ff6d..e21908504a 100644 --- a/dlls/quartz/parser.c +++ b/dlls/quartz/parser.c @@ -62,19 +62,15 @@ static inline ParserImpl *impl_from_BaseFilter( BaseFilter *iface ) return CONTAINING_RECORD(iface, ParserImpl, filter); }
-/* FIXME: WRONG */ -static IPin* WINAPI Parser_GetPin(BaseFilter *iface, int pos) +static IPin * WINAPI Parser_GetPin(BaseFilter *iface, unsigned int index) { - ParserImpl *This = impl_from_BaseFilter(iface); + ParserImpl *filter = impl_from_BaseFilter(iface);
- TRACE("%p->(%x)\n", This, pos); - - /* Input pin also has a pin, hence the > and not >= */ - if (pos > This->cStreams || pos < 0) + if (index > filter->cStreams) return NULL;
- IPin_AddRef(This->ppPins[pos]); - return This->ppPins[pos]; + IPin_AddRef(filter->ppPins[index]); + return filter->ppPins[index]; }
static const BaseFilterFuncTable BaseFuncTable = { diff --git a/dlls/strmbase/filter.c b/dlls/strmbase/filter.c index 8bec368c15..c554097814 100644 --- a/dlls/strmbase/filter.c +++ b/dlls/strmbase/filter.c @@ -137,10 +137,10 @@ HRESULT WINAPI BaseFilterImpl_EnumPins(IBaseFilter *iface, IEnumPins **enum_pins HRESULT WINAPI BaseFilterImpl_FindPin(IBaseFilter *iface, const WCHAR *id, IPin **ret) { BaseFilter *This = impl_from_IBaseFilter(iface); + unsigned int i; PIN_INFO info; HRESULT hr; IPin *pin; - int i;
TRACE("(%p)->(%s, %p)\n", This, debugstr_w(id), ret);
diff --git a/dlls/strmbase/renderer.c b/dlls/strmbase/renderer.c index c6c7978235..cf6643befe 100644 --- a/dlls/strmbase/renderer.c +++ b/dlls/strmbase/renderer.c @@ -183,11 +183,11 @@ static const IPinVtbl BaseRenderer_InputPin_Vtbl = BaseInputPinImpl_NewSegment };
-static IPin* WINAPI BaseRenderer_GetPin(BaseFilter *iface, int pos) +static IPin * WINAPI BaseRenderer_GetPin(BaseFilter *iface, unsigned int index) { BaseRenderer *This = impl_from_BaseFilter(iface);
- if (pos >= 1 || pos < 0) + if (index >= 1) return NULL;
IPin_AddRef(&This->pInputPin->pin.IPin_iface); diff --git a/dlls/strmbase/transform.c b/dlls/strmbase/transform.c index b8eb60ce2e..8f156ae3de 100644 --- a/dlls/strmbase/transform.c +++ b/dlls/strmbase/transform.c @@ -128,11 +128,11 @@ static HRESULT WINAPI TransformFilter_Output_GetMediaType(BasePin *This, int iPo return S_OK; }
-static IPin *WINAPI TransformFilter_GetPin(BaseFilter *iface, int index) +static IPin *WINAPI TransformFilter_GetPin(BaseFilter *iface, unsigned int index) { TransformFilter *filter = impl_from_BaseFilter(iface);
- if (index >= 2 || index < 0) + if (index >= 2) return NULL;
IPin_AddRef(filter->ppPins[index]); diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index 3653f647c4..3e660216e8 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -1192,20 +1192,18 @@ static inline GSTOutPin *impl_from_IMediaSeeking( IMediaSeeking *iface ) return CONTAINING_RECORD(iface, GSTOutPin, seek.IMediaSeeking_iface); }
-static IPin* WINAPI GST_GetPin(BaseFilter *base, int pos) +static IPin* WINAPI GST_GetPin(BaseFilter *base, unsigned int index) { GSTImpl *This = impl_from_IBaseFilter(&base->IBaseFilter_iface); IPin *pin;
- TRACE("%p: Asking for pos %x\n", This, pos); - - if (pos > This->cStreams || pos < 0) + if (index > This->cStreams) return NULL;
- if (!pos) + if (!index) pin = &This->pInputPin.pin.IPin_iface; else - pin = &This->ppPins[pos - 1]->pin.pin.IPin_iface; + pin = &This->ppPins[index - 1]->pin.pin.IPin_iface;
IPin_AddRef(pin); return pin; diff --git a/dlls/wineqtdecoder/qtsplitter.c b/dlls/wineqtdecoder/qtsplitter.c index 651a4a8c6b..6fd4554056 100644 --- a/dlls/wineqtdecoder/qtsplitter.c +++ b/dlls/wineqtdecoder/qtsplitter.c @@ -202,7 +202,7 @@ static inline QTSplitter *impl_from_IBaseFilter( IBaseFilter *iface ) * Base Filter */
-static IPin * WINAPI QT_GetPin(BaseFilter *base, int index) +static IPin * WINAPI QT_GetPin(BaseFilter *base, unsigned int index) { QTSplitter *filter = impl_from_BaseFilter(base);
diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h index 2f150e8c48..c10e6e2123 100644 --- a/include/wine/strmbase.h +++ b/include/wine/strmbase.h @@ -168,7 +168,7 @@ typedef struct BaseFilter const struct BaseFilterFuncTable* pFuncsTable; } BaseFilter;
-typedef IPin* (WINAPI *BaseFilter_GetPin)(BaseFilter* iface, int iPosition); +typedef IPin * (WINAPI *BaseFilter_GetPin)(BaseFilter *iface, unsigned int index);
typedef struct BaseFilterFuncTable { /* Required */
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/evr/evr.c | 4 ++-- dlls/qcap/audiorecord.c | 4 ++-- dlls/qcap/avico.c | 4 ++-- dlls/qcap/avimux.c | 4 ++-- dlls/qcap/smartteefilter.c | 4 ++-- dlls/qcap/vfwcapture.c | 4 ++-- dlls/qedit/samplegrabber.c | 4 ++-- dlls/quartz/filesource.c | 4 ++-- dlls/quartz/parser.c | 4 ++-- dlls/strmbase/enumpins.c | 6 +++--- dlls/strmbase/filter.c | 2 +- dlls/strmbase/renderer.c | 4 ++-- dlls/strmbase/transform.c | 4 ++-- dlls/winegstreamer/gstdemux.c | 4 ++-- dlls/wineqtdecoder/qtsplitter.c | 4 ++-- include/wine/strmbase.h | 8 +++----- 16 files changed, 33 insertions(+), 35 deletions(-)
diff --git a/dlls/evr/evr.c b/dlls/evr/evr.c index 493696f465..612106848b 100644 --- a/dlls/evr/evr.c +++ b/dlls/evr/evr.c @@ -191,7 +191,7 @@ static const IBaseFilterVtbl basefilter_vtbl = BaseFilterImpl_QueryVendorInfo };
-static IPin * WINAPI filter_GetPin(BaseFilter *iface, unsigned int index) +static IPin * WINAPI evr_get_pin(BaseFilter *iface, unsigned int index) { FIXME("iface %p, index %u, stub!\n", iface, index); return NULL; @@ -199,7 +199,7 @@ static IPin * WINAPI filter_GetPin(BaseFilter *iface, unsigned int index)
static const BaseFilterFuncTable basefilter_functable = { - filter_GetPin, + .filter_get_pin = evr_get_pin, };
HRESULT evr_filter_create(IUnknown *outer_unk, void **ppv) diff --git a/dlls/qcap/audiorecord.c b/dlls/qcap/audiorecord.c index 1e5aa43cfb..d6b99ee6c3 100644 --- a/dlls/qcap/audiorecord.c +++ b/dlls/qcap/audiorecord.c @@ -171,14 +171,14 @@ static const IBaseFilterVtbl AudioRecordVtbl = { BaseFilterImpl_QueryVendorInfo };
-static IPin * WINAPI AudioRecord_GetPin(BaseFilter *iface, unsigned int index) +static IPin * WINAPI audio_record_get_pin(BaseFilter *iface, unsigned int index) { FIXME("iface %p, index %u, stub!\n", iface, index); return NULL; }
static const BaseFilterFuncTable AudioRecordFuncs = { - AudioRecord_GetPin, + .filter_get_pin = audio_record_get_pin, };
static HRESULT WINAPI PPB_QueryInterface(IPersistPropertyBag *iface, REFIID riid, LPVOID *ppv) diff --git a/dlls/qcap/avico.c b/dlls/qcap/avico.c index 770790da1c..2e147a5dc2 100644 --- a/dlls/qcap/avico.c +++ b/dlls/qcap/avico.c @@ -244,7 +244,7 @@ static const IBaseFilterVtbl AVICompressorVtbl = { AVICompressor_QueryVendorInfo };
-static IPin * WINAPI AVICompressor_GetPin(BaseFilter *iface, unsigned int index) +static IPin * WINAPI avi_compressor_get_pin(BaseFilter *iface, unsigned int index) { AVICompressor *This = impl_from_BaseFilter(iface); IPin *ret; @@ -261,7 +261,7 @@ static IPin * WINAPI AVICompressor_GetPin(BaseFilter *iface, unsigned int index) }
static const BaseFilterFuncTable filter_func_table = { - AVICompressor_GetPin, + .filter_get_pin = avi_compressor_get_pin, };
static AVICompressor *impl_from_IPersistPropertyBag(IPersistPropertyBag *iface) diff --git a/dlls/qcap/avimux.c b/dlls/qcap/avimux.c index ccec60c0b5..927296042b 100644 --- a/dlls/qcap/avimux.c +++ b/dlls/qcap/avimux.c @@ -116,7 +116,7 @@ static inline AviMux* impl_from_BaseFilter(BaseFilter *filter) return CONTAINING_RECORD(filter, AviMux, filter); }
-static IPin * WINAPI AviMux_GetPin(BaseFilter *iface, unsigned int index) +static IPin * WINAPI avi_mux_get_pin(BaseFilter *iface, unsigned int index) { AviMux *This = impl_from_BaseFilter(iface);
@@ -135,7 +135,7 @@ static IPin * WINAPI AviMux_GetPin(BaseFilter *iface, unsigned int index) }
static const BaseFilterFuncTable filter_func_table = { - AviMux_GetPin, + .filter_get_pin = avi_mux_get_pin, };
static inline AviMux* impl_from_IBaseFilter(IBaseFilter *iface) diff --git a/dlls/qcap/smartteefilter.c b/dlls/qcap/smartteefilter.c index e16d08a759..b3a874850b 100644 --- a/dlls/qcap/smartteefilter.c +++ b/dlls/qcap/smartteefilter.c @@ -199,7 +199,7 @@ static const IBaseFilterVtbl SmartTeeFilterVtbl = { BaseFilterImpl_QueryVendorInfo };
-static IPin * WINAPI SmartTeeFilter_GetPin(BaseFilter *iface, unsigned int index) +static IPin * WINAPI smart_tee_get_pin(BaseFilter *iface, unsigned int index) { SmartTeeFilter *This = impl_from_BaseFilter(iface); IPin *ret; @@ -218,7 +218,7 @@ static IPin * WINAPI SmartTeeFilter_GetPin(BaseFilter *iface, unsigned int index }
static const BaseFilterFuncTable SmartTeeFilterFuncs = { - SmartTeeFilter_GetPin, + .filter_get_pin = smart_tee_get_pin, };
static ULONG WINAPI SmartTeeFilterInput_AddRef(IPin *iface) diff --git a/dlls/qcap/vfwcapture.c b/dlls/qcap/vfwcapture.c index 54d9e59786..e5dfead325 100644 --- a/dlls/qcap/vfwcapture.c +++ b/dlls/qcap/vfwcapture.c @@ -192,7 +192,7 @@ static const IUnknownVtbl unknown_inner_vtbl = unknown_inner_Release, };
-static IPin * WINAPI VfwCapture_GetPin(BaseFilter *iface, unsigned int index) +static IPin * WINAPI vfw_capture_get_pin(BaseFilter *iface, unsigned int index) { VfwCapture *This = impl_from_BaseFilter(iface);
@@ -204,7 +204,7 @@ static IPin * WINAPI VfwCapture_GetPin(BaseFilter *iface, unsigned int index) }
static const BaseFilterFuncTable BaseFuncTable = { - VfwCapture_GetPin, + .filter_get_pin = vfw_capture_get_pin, };
IUnknown * WINAPI QCAP_createVFWCaptureFilter(IUnknown *pUnkOuter, HRESULT *phr) diff --git a/dlls/qedit/samplegrabber.c b/dlls/qedit/samplegrabber.c index cbaca69962..98775231a6 100644 --- a/dlls/qedit/samplegrabber.c +++ b/dlls/qedit/samplegrabber.c @@ -339,7 +339,7 @@ static const IUnknownVtbl samplegrabber_vtbl = SampleGrabber_Release, };
-static IPin * WINAPI SampleGrabber_GetPin(BaseFilter *iface, unsigned int index) +static IPin * WINAPI sample_grabber_get_pin(BaseFilter *iface, unsigned int index) { SG_Impl *This = impl_from_BaseFilter(iface); IPin *pin; @@ -356,7 +356,7 @@ static IPin * WINAPI SampleGrabber_GetPin(BaseFilter *iface, unsigned int index) }
static const BaseFilterFuncTable basefunc_vtbl = { - SampleGrabber_GetPin, + .filter_get_pin = sample_grabber_get_pin, };
/* Helper that buffers data and/or calls installed sample callbacks */ diff --git a/dlls/quartz/filesource.c b/dlls/quartz/filesource.c index f3a2c43c63..b10a7ffa75 100644 --- a/dlls/quartz/filesource.c +++ b/dlls/quartz/filesource.c @@ -392,7 +392,7 @@ HRESULT GetClassMediaFile(IAsyncReader * pReader, LPCOLESTR pszFileName, GUID * return hr; }
-static IPin * WINAPI AsyncReader_GetPin(BaseFilter *iface, unsigned int index) +static IPin * WINAPI async_reader_get_pin(BaseFilter *iface, unsigned int index) { AsyncReader *This = impl_from_BaseFilter(iface);
@@ -404,7 +404,7 @@ static IPin * WINAPI AsyncReader_GetPin(BaseFilter *iface, unsigned int index) }
static const BaseFilterFuncTable BaseFuncTable = { - AsyncReader_GetPin, + .filter_get_pin = async_reader_get_pin, };
HRESULT AsyncReader_create(IUnknown * pUnkOuter, LPVOID * ppv) diff --git a/dlls/quartz/parser.c b/dlls/quartz/parser.c index e21908504a..686394772a 100644 --- a/dlls/quartz/parser.c +++ b/dlls/quartz/parser.c @@ -62,7 +62,7 @@ static inline ParserImpl *impl_from_BaseFilter( BaseFilter *iface ) return CONTAINING_RECORD(iface, ParserImpl, filter); }
-static IPin * WINAPI Parser_GetPin(BaseFilter *iface, unsigned int index) +static IPin * WINAPI parser_get_pin(BaseFilter *iface, unsigned int index) { ParserImpl *filter = impl_from_BaseFilter(iface);
@@ -74,7 +74,7 @@ static IPin * WINAPI Parser_GetPin(BaseFilter *iface, unsigned int index) }
static const BaseFilterFuncTable BaseFuncTable = { - Parser_GetPin, + .filter_get_pin = parser_get_pin, };
HRESULT Parser_Create(ParserImpl *pParser, const IBaseFilterVtbl *Parser_Vtbl, diff --git a/dlls/strmbase/enumpins.c b/dlls/strmbase/enumpins.c index 4503a4705e..198c8397a3 100644 --- a/dlls/strmbase/enumpins.c +++ b/dlls/strmbase/enumpins.c @@ -59,7 +59,7 @@ HRESULT enum_pins_create(BaseFilter *base, IEnumPins **out) IBaseFilter_AddRef(&base->IBaseFilter_iface); object->Version = base->pin_version;
- while ((pin = base->pFuncsTable->pfnGetPin(base, object->count))) + while ((pin = base->pFuncsTable->filter_get_pin(base, object->count))) { IPin_Release(pin); ++object->count; @@ -141,7 +141,7 @@ static HRESULT WINAPI IEnumPinsImpl_Next(IEnumPins * iface, ULONG cPins, IPin ** while (i < cPins) { IPin *pin; - pin = This->base->pFuncsTable->pfnGetPin(This->base, This->uIndex + i); + pin = This->base->pFuncsTable->filter_get_pin(This->base, This->uIndex + i);
if (!pin) break; @@ -185,7 +185,7 @@ static HRESULT WINAPI IEnumPinsImpl_Reset(IEnumPins *iface) if (enum_pins->Version != enum_pins->base->pin_version) { enum_pins->count = 0; - while ((pin = enum_pins->base->pFuncsTable->pfnGetPin(enum_pins->base, enum_pins->count))) + while ((pin = enum_pins->base->pFuncsTable->filter_get_pin(enum_pins->base, enum_pins->count))) { IPin_Release(pin); ++enum_pins->count; diff --git a/dlls/strmbase/filter.c b/dlls/strmbase/filter.c index c554097814..f9dd72c73c 100644 --- a/dlls/strmbase/filter.c +++ b/dlls/strmbase/filter.c @@ -144,7 +144,7 @@ HRESULT WINAPI BaseFilterImpl_FindPin(IBaseFilter *iface, const WCHAR *id, IPin
TRACE("(%p)->(%s, %p)\n", This, debugstr_w(id), ret);
- for (i = 0; (pin = This->pFuncsTable->pfnGetPin(This, i)); ++i) + for (i = 0; (pin = This->pFuncsTable->filter_get_pin(This, i)); ++i) { hr = IPin_QueryPinInfo(pin, &info); if (FAILED(hr)) diff --git a/dlls/strmbase/renderer.c b/dlls/strmbase/renderer.c index cf6643befe..278bf0a346 100644 --- a/dlls/strmbase/renderer.c +++ b/dlls/strmbase/renderer.c @@ -183,7 +183,7 @@ static const IPinVtbl BaseRenderer_InputPin_Vtbl = BaseInputPinImpl_NewSegment };
-static IPin * WINAPI BaseRenderer_GetPin(BaseFilter *iface, unsigned int index) +static IPin * WINAPI renderer_get_pin(BaseFilter *iface, unsigned int index) { BaseRenderer *This = impl_from_BaseFilter(iface);
@@ -207,7 +207,7 @@ static HRESULT WINAPI BaseRenderer_Receive(BaseInputPin *pin, IMediaSample * pSa }
static const BaseFilterFuncTable RendererBaseFilterFuncTable = { - BaseRenderer_GetPin, + .filter_get_pin = renderer_get_pin, };
static const BaseInputPinFuncTable input_BaseInputFuncTable = { diff --git a/dlls/strmbase/transform.c b/dlls/strmbase/transform.c index 8f156ae3de..e19f3ef336 100644 --- a/dlls/strmbase/transform.c +++ b/dlls/strmbase/transform.c @@ -128,7 +128,7 @@ static HRESULT WINAPI TransformFilter_Output_GetMediaType(BasePin *This, int iPo return S_OK; }
-static IPin *WINAPI TransformFilter_GetPin(BaseFilter *iface, unsigned int index) +static IPin * WINAPI transform_get_pin(BaseFilter *iface, unsigned int index) { TransformFilter *filter = impl_from_BaseFilter(iface);
@@ -140,7 +140,7 @@ static IPin *WINAPI TransformFilter_GetPin(BaseFilter *iface, unsigned int index }
static const BaseFilterFuncTable tfBaseFuncTable = { - TransformFilter_GetPin, + .filter_get_pin = transform_get_pin, };
static const BaseInputPinFuncTable tf_input_BaseInputFuncTable = { diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index 3e660216e8..a4f1a8333d 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -1192,7 +1192,7 @@ static inline GSTOutPin *impl_from_IMediaSeeking( IMediaSeeking *iface ) return CONTAINING_RECORD(iface, GSTOutPin, seek.IMediaSeeking_iface); }
-static IPin* WINAPI GST_GetPin(BaseFilter *base, unsigned int index) +static IPin * WINAPI gstdemux_get_pin(BaseFilter *base, unsigned int index) { GSTImpl *This = impl_from_IBaseFilter(&base->IBaseFilter_iface); IPin *pin; @@ -1210,7 +1210,7 @@ static IPin* WINAPI GST_GetPin(BaseFilter *base, unsigned int index) }
static const BaseFilterFuncTable BaseFuncTable = { - GST_GetPin, + .filter_get_pin = gstdemux_get_pin, };
IUnknown * CALLBACK Gstreamer_Splitter_create(IUnknown *pUnkOuter, HRESULT *phr) diff --git a/dlls/wineqtdecoder/qtsplitter.c b/dlls/wineqtdecoder/qtsplitter.c index 6fd4554056..3b00a015fe 100644 --- a/dlls/wineqtdecoder/qtsplitter.c +++ b/dlls/wineqtdecoder/qtsplitter.c @@ -202,7 +202,7 @@ static inline QTSplitter *impl_from_IBaseFilter( IBaseFilter *iface ) * Base Filter */
-static IPin * WINAPI QT_GetPin(BaseFilter *base, unsigned int index) +static IPin * WINAPI qt_splitter_get_pin(BaseFilter *base, unsigned int index) { QTSplitter *filter = impl_from_BaseFilter(base);
@@ -234,7 +234,7 @@ static IPin * WINAPI QT_GetPin(BaseFilter *base, unsigned int index) }
static const BaseFilterFuncTable BaseFuncTable = { - QT_GetPin, + .filter_get_pin = qt_splitter_get_pin, };
IUnknown * CALLBACK QTSplitter_create(IUnknown *punkout, HRESULT *phr) diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h index c10e6e2123..17a58a1a62 100644 --- a/include/wine/strmbase.h +++ b/include/wine/strmbase.h @@ -168,11 +168,9 @@ typedef struct BaseFilter const struct BaseFilterFuncTable* pFuncsTable; } BaseFilter;
-typedef IPin * (WINAPI *BaseFilter_GetPin)(BaseFilter *iface, unsigned int index); - -typedef struct BaseFilterFuncTable { - /* Required */ - BaseFilter_GetPin pfnGetPin; +typedef struct BaseFilterFuncTable +{ + IPin *(WINAPI *filter_get_pin)(BaseFilter *iface, unsigned int index); } BaseFilterFuncTable;
HRESULT WINAPI BaseFilterImpl_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/evr/evr.c | 2 +- dlls/qcap/audiorecord.c | 2 +- dlls/qcap/avico.c | 2 +- dlls/qcap/avimux.c | 2 +- dlls/qcap/smartteefilter.c | 2 +- dlls/qcap/vfwcapture.c | 2 +- dlls/qedit/samplegrabber.c | 2 +- dlls/quartz/filesource.c | 2 +- dlls/quartz/parser.c | 2 +- dlls/strmbase/renderer.c | 2 +- dlls/strmbase/transform.c | 2 +- dlls/winegstreamer/gstdemux.c | 2 +- dlls/wineqtdecoder/qtsplitter.c | 2 +- include/wine/strmbase.h | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/dlls/evr/evr.c b/dlls/evr/evr.c index 612106848b..8341c40209 100644 --- a/dlls/evr/evr.c +++ b/dlls/evr/evr.c @@ -191,7 +191,7 @@ static const IBaseFilterVtbl basefilter_vtbl = BaseFilterImpl_QueryVendorInfo };
-static IPin * WINAPI evr_get_pin(BaseFilter *iface, unsigned int index) +static IPin *evr_get_pin(BaseFilter *iface, unsigned int index) { FIXME("iface %p, index %u, stub!\n", iface, index); return NULL; diff --git a/dlls/qcap/audiorecord.c b/dlls/qcap/audiorecord.c index d6b99ee6c3..bc1b452acb 100644 --- a/dlls/qcap/audiorecord.c +++ b/dlls/qcap/audiorecord.c @@ -171,7 +171,7 @@ static const IBaseFilterVtbl AudioRecordVtbl = { BaseFilterImpl_QueryVendorInfo };
-static IPin * WINAPI audio_record_get_pin(BaseFilter *iface, unsigned int index) +static IPin *audio_record_get_pin(BaseFilter *iface, unsigned int index) { FIXME("iface %p, index %u, stub!\n", iface, index); return NULL; diff --git a/dlls/qcap/avico.c b/dlls/qcap/avico.c index 2e147a5dc2..e2f21d08fc 100644 --- a/dlls/qcap/avico.c +++ b/dlls/qcap/avico.c @@ -244,7 +244,7 @@ static const IBaseFilterVtbl AVICompressorVtbl = { AVICompressor_QueryVendorInfo };
-static IPin * WINAPI avi_compressor_get_pin(BaseFilter *iface, unsigned int index) +static IPin *avi_compressor_get_pin(BaseFilter *iface, unsigned int index) { AVICompressor *This = impl_from_BaseFilter(iface); IPin *ret; diff --git a/dlls/qcap/avimux.c b/dlls/qcap/avimux.c index 927296042b..77e5898aee 100644 --- a/dlls/qcap/avimux.c +++ b/dlls/qcap/avimux.c @@ -116,7 +116,7 @@ static inline AviMux* impl_from_BaseFilter(BaseFilter *filter) return CONTAINING_RECORD(filter, AviMux, filter); }
-static IPin * WINAPI avi_mux_get_pin(BaseFilter *iface, unsigned int index) +static IPin *avi_mux_get_pin(BaseFilter *iface, unsigned int index) { AviMux *This = impl_from_BaseFilter(iface);
diff --git a/dlls/qcap/smartteefilter.c b/dlls/qcap/smartteefilter.c index b3a874850b..7496fe62a9 100644 --- a/dlls/qcap/smartteefilter.c +++ b/dlls/qcap/smartteefilter.c @@ -199,7 +199,7 @@ static const IBaseFilterVtbl SmartTeeFilterVtbl = { BaseFilterImpl_QueryVendorInfo };
-static IPin * WINAPI smart_tee_get_pin(BaseFilter *iface, unsigned int index) +static IPin *smart_tee_get_pin(BaseFilter *iface, unsigned int index) { SmartTeeFilter *This = impl_from_BaseFilter(iface); IPin *ret; diff --git a/dlls/qcap/vfwcapture.c b/dlls/qcap/vfwcapture.c index e5dfead325..a795a1e334 100644 --- a/dlls/qcap/vfwcapture.c +++ b/dlls/qcap/vfwcapture.c @@ -192,7 +192,7 @@ static const IUnknownVtbl unknown_inner_vtbl = unknown_inner_Release, };
-static IPin * WINAPI vfw_capture_get_pin(BaseFilter *iface, unsigned int index) +static IPin *vfw_capture_get_pin(BaseFilter *iface, unsigned int index) { VfwCapture *This = impl_from_BaseFilter(iface);
diff --git a/dlls/qedit/samplegrabber.c b/dlls/qedit/samplegrabber.c index 98775231a6..76dc3d7e92 100644 --- a/dlls/qedit/samplegrabber.c +++ b/dlls/qedit/samplegrabber.c @@ -339,7 +339,7 @@ static const IUnknownVtbl samplegrabber_vtbl = SampleGrabber_Release, };
-static IPin * WINAPI sample_grabber_get_pin(BaseFilter *iface, unsigned int index) +static IPin *sample_grabber_get_pin(BaseFilter *iface, unsigned int index) { SG_Impl *This = impl_from_BaseFilter(iface); IPin *pin; diff --git a/dlls/quartz/filesource.c b/dlls/quartz/filesource.c index b10a7ffa75..269fa271c6 100644 --- a/dlls/quartz/filesource.c +++ b/dlls/quartz/filesource.c @@ -392,7 +392,7 @@ HRESULT GetClassMediaFile(IAsyncReader * pReader, LPCOLESTR pszFileName, GUID * return hr; }
-static IPin * WINAPI async_reader_get_pin(BaseFilter *iface, unsigned int index) +static IPin *async_reader_get_pin(BaseFilter *iface, unsigned int index) { AsyncReader *This = impl_from_BaseFilter(iface);
diff --git a/dlls/quartz/parser.c b/dlls/quartz/parser.c index 686394772a..fdefa3d4b2 100644 --- a/dlls/quartz/parser.c +++ b/dlls/quartz/parser.c @@ -62,7 +62,7 @@ static inline ParserImpl *impl_from_BaseFilter( BaseFilter *iface ) return CONTAINING_RECORD(iface, ParserImpl, filter); }
-static IPin * WINAPI parser_get_pin(BaseFilter *iface, unsigned int index) +static IPin *parser_get_pin(BaseFilter *iface, unsigned int index) { ParserImpl *filter = impl_from_BaseFilter(iface);
diff --git a/dlls/strmbase/renderer.c b/dlls/strmbase/renderer.c index 278bf0a346..ea1be8b712 100644 --- a/dlls/strmbase/renderer.c +++ b/dlls/strmbase/renderer.c @@ -183,7 +183,7 @@ static const IPinVtbl BaseRenderer_InputPin_Vtbl = BaseInputPinImpl_NewSegment };
-static IPin * WINAPI renderer_get_pin(BaseFilter *iface, unsigned int index) +static IPin *renderer_get_pin(BaseFilter *iface, unsigned int index) { BaseRenderer *This = impl_from_BaseFilter(iface);
diff --git a/dlls/strmbase/transform.c b/dlls/strmbase/transform.c index e19f3ef336..6a7636c6e4 100644 --- a/dlls/strmbase/transform.c +++ b/dlls/strmbase/transform.c @@ -128,7 +128,7 @@ static HRESULT WINAPI TransformFilter_Output_GetMediaType(BasePin *This, int iPo return S_OK; }
-static IPin * WINAPI transform_get_pin(BaseFilter *iface, unsigned int index) +static IPin *transform_get_pin(BaseFilter *iface, unsigned int index) { TransformFilter *filter = impl_from_BaseFilter(iface);
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index a4f1a8333d..c347b89684 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -1192,7 +1192,7 @@ static inline GSTOutPin *impl_from_IMediaSeeking( IMediaSeeking *iface ) return CONTAINING_RECORD(iface, GSTOutPin, seek.IMediaSeeking_iface); }
-static IPin * WINAPI gstdemux_get_pin(BaseFilter *base, unsigned int index) +static IPin *gstdemux_get_pin(BaseFilter *base, unsigned int index) { GSTImpl *This = impl_from_IBaseFilter(&base->IBaseFilter_iface); IPin *pin; diff --git a/dlls/wineqtdecoder/qtsplitter.c b/dlls/wineqtdecoder/qtsplitter.c index 3b00a015fe..e900b91b41 100644 --- a/dlls/wineqtdecoder/qtsplitter.c +++ b/dlls/wineqtdecoder/qtsplitter.c @@ -202,7 +202,7 @@ static inline QTSplitter *impl_from_IBaseFilter( IBaseFilter *iface ) * Base Filter */
-static IPin * WINAPI qt_splitter_get_pin(BaseFilter *base, unsigned int index) +static IPin *qt_splitter_get_pin(BaseFilter *base, unsigned int index) { QTSplitter *filter = impl_from_BaseFilter(base);
diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h index 17a58a1a62..7c44b36cf1 100644 --- a/include/wine/strmbase.h +++ b/include/wine/strmbase.h @@ -170,7 +170,7 @@ typedef struct BaseFilter
typedef struct BaseFilterFuncTable { - IPin *(WINAPI *filter_get_pin)(BaseFilter *iface, unsigned int index); + IPin *(*filter_get_pin)(BaseFilter *iface, unsigned int index); } BaseFilterFuncTable;
HRESULT WINAPI BaseFilterImpl_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- In the long (or even short) term I'd like to move IBaseFilter methods into the filter function table (and, looking forward, probably IPin methods into the pin function table, and so on), and make the whole IBaseFilterVtbl the sole responsibility of strmbase. The idea is partly to decrease the API size for filters, partly to decrease the amount of boilerplate, partly to make state tracking done in a consistent manner (instead of e.g. having both filters and strmbase manage the filter state, depending on who needs to implement Run/Pause/Stop/GetState.) As such the methods probably won't even look exactly the same, e.g. my current idea is something like:
struct strmbase_filter_func_table { IPin *(*filter_get_pin)(BaseFilter *iface, unsigned int index); void (*filter_destroy)(BaseFilter *iface); HRESULT (*filter_query_interface)(BaseFilter *iface, REFIID iid, void **out); HRESULT (*stop)(BaseFilter *iface); HRESULT (*pause)(BaseFilter *iface); HRESULT (*run)(BaseFilter *iface); HRESULT (*wait_state)(BaseFilter *iface, DWORD timeout); };
where only the first two are mandatory, and the others are all optional.
In the somewhat shorter term this is aimed towards making it easier to support filter aggregation in strmbase.
dlls/strmbase/filter.c | 4 ++-- include/wine/strmbase.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/strmbase/filter.c b/dlls/strmbase/filter.c index f9dd72c73c..cf8000fc64 100644 --- a/dlls/strmbase/filter.c +++ b/dlls/strmbase/filter.c @@ -54,7 +54,7 @@ ULONG WINAPI BaseFilterImpl_AddRef(IBaseFilter * iface) return refCount; }
-ULONG WINAPI BaseFilterImpl_Release(IBaseFilter * iface) +ULONG WINAPI BaseFilterImpl_Release(IBaseFilter *iface) { BaseFilter *This = impl_from_IBaseFilter(iface); ULONG refCount = InterlockedDecrement(&This->refCount); @@ -62,7 +62,7 @@ ULONG WINAPI BaseFilterImpl_Release(IBaseFilter * iface) TRACE("(%p)->() Release from %d\n", This, refCount + 1);
if (!refCount) - strmbase_filter_cleanup(This); + This->pFuncsTable->filter_destroy(This);
return refCount; } diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h index 7c44b36cf1..307204e0e0 100644 --- a/include/wine/strmbase.h +++ b/include/wine/strmbase.h @@ -171,6 +171,7 @@ typedef struct BaseFilter typedef struct BaseFilterFuncTable { IPin *(*filter_get_pin)(BaseFilter *iface, unsigned int index); + void (*filter_destroy)(BaseFilter *iface); } BaseFilterFuncTable;
HRESULT WINAPI BaseFilterImpl_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/filesource.c | 59 ++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 33 deletions(-)
diff --git a/dlls/quartz/filesource.c b/dlls/quartz/filesource.c index 269fa271c6..bb0f162e18 100644 --- a/dlls/quartz/filesource.c +++ b/dlls/quartz/filesource.c @@ -403,8 +403,32 @@ static IPin *async_reader_get_pin(BaseFilter *iface, unsigned int index) return This->pOutputPin; }
-static const BaseFilterFuncTable BaseFuncTable = { +static void async_reader_destroy(BaseFilter *iface) +{ + AsyncReader *filter = impl_from_BaseFilter(iface); + + if (filter->pOutputPin) + { + IPin *peer; + if (SUCCEEDED(IPin_ConnectedTo(filter->pOutputPin, &peer))) + { + IPin_Disconnect(peer); + IPin_Release(peer); + } + IPin_Disconnect(filter->pOutputPin); + IPin_Release(filter->pOutputPin); + } + CoTaskMemFree(filter->pszFileName); + if (filter->pmt) + DeleteMediaType(filter->pmt); + strmbase_filter_cleanup(&filter->filter); + CoTaskMemFree(filter); +} + +static const BaseFilterFuncTable BaseFuncTable = +{ .filter_get_pin = async_reader_get_pin, + .filter_destroy = async_reader_destroy, };
HRESULT AsyncReader_create(IUnknown * pUnkOuter, LPVOID * ppv) @@ -468,37 +492,6 @@ static HRESULT WINAPI AsyncReader_QueryInterface(IBaseFilter * iface, REFIID rii return E_NOINTERFACE; }
-static ULONG WINAPI AsyncReader_Release(IBaseFilter * iface) -{ - AsyncReader *This = impl_from_IBaseFilter(iface); - ULONG refCount = InterlockedDecrement(&This->filter.refCount); - - TRACE("%p->() Release from %d\n", This, refCount + 1); - - if (!refCount) - { - if (This->pOutputPin) - { - IPin *pConnectedTo; - if(SUCCEEDED(IPin_ConnectedTo(This->pOutputPin, &pConnectedTo))) - { - IPin_Disconnect(pConnectedTo); - IPin_Release(pConnectedTo); - } - IPin_Disconnect(This->pOutputPin); - IPin_Release(This->pOutputPin); - } - CoTaskMemFree(This->pszFileName); - if (This->pmt) - DeleteMediaType(This->pmt); - strmbase_filter_cleanup(&This->filter); - CoTaskMemFree(This); - return 0; - } - else - return refCount; -} - /** IMediaFilter methods **/
static HRESULT WINAPI AsyncReader_Stop(IBaseFilter * iface) @@ -538,7 +531,7 @@ static const IBaseFilterVtbl AsyncReader_Vtbl = { AsyncReader_QueryInterface, BaseFilterImpl_AddRef, - AsyncReader_Release, + BaseFilterImpl_Release, BaseFilterImpl_GetClassID, AsyncReader_Stop, AsyncReader_Pause,