strmbase: Don't increment the pin reference count in filter_get_pin().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
6edee72560
commit
690838a0e0
|
@ -180,18 +180,13 @@ static const IBaseFilterVtbl AVICompressorVtbl = {
|
||||||
|
|
||||||
static IPin *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);
|
AVICompressor *filter = impl_from_BaseFilter(iface);
|
||||||
IPin *ret;
|
|
||||||
|
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
ret = &This->in->pin.IPin_iface;
|
return &filter->in->pin.IPin_iface;
|
||||||
else if (index == 1)
|
else if (index == 1)
|
||||||
ret = &This->out->pin.IPin_iface;
|
return &filter->out->pin.IPin_iface;
|
||||||
else
|
return NULL;
|
||||||
return NULL;
|
|
||||||
|
|
||||||
IPin_AddRef(ret);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void avi_compressor_destroy(BaseFilter *iface)
|
static void avi_compressor_destroy(BaseFilter *iface)
|
||||||
|
|
|
@ -118,19 +118,12 @@ static inline AviMux* impl_from_BaseFilter(BaseFilter *filter)
|
||||||
|
|
||||||
static IPin *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);
|
AviMux *filter = impl_from_BaseFilter(iface);
|
||||||
|
|
||||||
if (!index)
|
if (!index)
|
||||||
{
|
return &filter->out->pin.pin.IPin_iface;
|
||||||
IPin_AddRef(&This->out->pin.pin.IPin_iface);
|
else if (index <= filter->input_pin_no)
|
||||||
return &This->out->pin.pin.IPin_iface;
|
return &filter->in[index - 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;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,20 +120,15 @@ static const IBaseFilterVtbl SmartTeeFilterVtbl = {
|
||||||
|
|
||||||
static IPin *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);
|
SmartTeeFilter *filter = impl_from_BaseFilter(iface);
|
||||||
IPin *ret;
|
|
||||||
|
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
ret = &This->input->pin.IPin_iface;
|
return &filter->input->pin.IPin_iface;
|
||||||
else if (index == 1)
|
else if (index == 1)
|
||||||
ret = &This->capture->pin.IPin_iface;
|
return &filter->capture->pin.IPin_iface;
|
||||||
else if (index == 2)
|
else if (index == 2)
|
||||||
ret = &This->preview->pin.IPin_iface;
|
return &filter->preview->pin.IPin_iface;
|
||||||
else
|
return NULL;
|
||||||
return NULL;
|
|
||||||
|
|
||||||
IPin_AddRef(ret);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void smart_tee_destroy(BaseFilter *iface)
|
static void smart_tee_destroy(BaseFilter *iface)
|
||||||
|
|
|
@ -104,7 +104,6 @@ static IPin *vfw_capture_get_pin(BaseFilter *iface, unsigned int index)
|
||||||
if (index >= 1)
|
if (index >= 1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
IPin_AddRef(This->pOutputPin);
|
|
||||||
return This->pOutputPin;
|
return This->pOutputPin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -275,18 +275,13 @@ static void SampleGrabber_cleanup(SG_Impl *This)
|
||||||
|
|
||||||
static IPin *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);
|
SG_Impl *filter = impl_from_BaseFilter(iface);
|
||||||
IPin *pin;
|
|
||||||
|
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
pin = &This->pin_in.IPin_iface;
|
return &filter->pin_in.IPin_iface;
|
||||||
else if (index == 1)
|
else if (index == 1)
|
||||||
pin = &This->pin_out.IPin_iface;
|
return &filter->pin_out.IPin_iface;
|
||||||
else
|
return NULL;
|
||||||
return NULL;
|
|
||||||
|
|
||||||
IPin_AddRef(pin);
|
|
||||||
return pin;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sample_grabber_destroy(BaseFilter *iface)
|
static void sample_grabber_destroy(BaseFilter *iface)
|
||||||
|
|
|
@ -394,13 +394,11 @@ HRESULT GetClassMediaFile(IAsyncReader * pReader, LPCOLESTR pszFileName, GUID *
|
||||||
|
|
||||||
static IPin *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);
|
AsyncReader *filter = impl_from_BaseFilter(iface);
|
||||||
|
|
||||||
if (index >= 1 || !This->pOutputPin)
|
if (!index && filter->pOutputPin)
|
||||||
return NULL;
|
return filter->pOutputPin;
|
||||||
|
return NULL;
|
||||||
IPin_AddRef(This->pOutputPin);
|
|
||||||
return This->pOutputPin;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void async_reader_destroy(BaseFilter *iface)
|
static void async_reader_destroy(BaseFilter *iface)
|
||||||
|
|
|
@ -66,11 +66,9 @@ IPin *parser_get_pin(BaseFilter *iface, unsigned int index)
|
||||||
{
|
{
|
||||||
ParserImpl *filter = impl_from_BaseFilter(iface);
|
ParserImpl *filter = impl_from_BaseFilter(iface);
|
||||||
|
|
||||||
if (index > filter->cStreams)
|
if (index <= filter->cStreams)
|
||||||
return NULL;
|
return filter->ppPins[index];
|
||||||
|
return NULL;
|
||||||
IPin_AddRef(filter->ppPins[index]);
|
|
||||||
return filter->ppPins[index];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT Parser_Create(ParserImpl *pParser, const IBaseFilterVtbl *vtbl, IUnknown *outer,
|
HRESULT Parser_Create(ParserImpl *pParser, const IBaseFilterVtbl *vtbl, IUnknown *outer,
|
||||||
|
|
|
@ -60,10 +60,7 @@ HRESULT enum_pins_create(BaseFilter *base, IEnumPins **out)
|
||||||
object->Version = base->pin_version;
|
object->Version = base->pin_version;
|
||||||
|
|
||||||
while ((pin = base->pFuncsTable->filter_get_pin(base, object->count)))
|
while ((pin = base->pFuncsTable->filter_get_pin(base, object->count)))
|
||||||
{
|
|
||||||
IPin_Release(pin);
|
|
||||||
++object->count;
|
++object->count;
|
||||||
}
|
|
||||||
|
|
||||||
TRACE("Created enumerator %p.\n", object);
|
TRACE("Created enumerator %p.\n", object);
|
||||||
*out = &object->IEnumPins_iface;
|
*out = &object->IEnumPins_iface;
|
||||||
|
@ -122,7 +119,7 @@ static ULONG WINAPI IEnumPinsImpl_Release(IEnumPins * iface)
|
||||||
static HRESULT WINAPI IEnumPinsImpl_Next(IEnumPins * iface, ULONG cPins, IPin ** ppPins, ULONG * pcFetched)
|
static HRESULT WINAPI IEnumPinsImpl_Next(IEnumPins * iface, ULONG cPins, IPin ** ppPins, ULONG * pcFetched)
|
||||||
{
|
{
|
||||||
IEnumPinsImpl *This = impl_from_IEnumPins(iface);
|
IEnumPinsImpl *This = impl_from_IEnumPins(iface);
|
||||||
ULONG i = 0;
|
ULONG i;
|
||||||
|
|
||||||
TRACE("(%p)->(%u, %p, %p)\n", iface, cPins, ppPins, pcFetched);
|
TRACE("(%p)->(%u, %p, %p)\n", iface, cPins, ppPins, pcFetched);
|
||||||
|
|
||||||
|
@ -138,16 +135,14 @@ static HRESULT WINAPI IEnumPinsImpl_Next(IEnumPins * iface, ULONG cPins, IPin **
|
||||||
if (This->Version != This->base->pin_version)
|
if (This->Version != This->base->pin_version)
|
||||||
return VFW_E_ENUM_OUT_OF_SYNC;
|
return VFW_E_ENUM_OUT_OF_SYNC;
|
||||||
|
|
||||||
while (i < cPins)
|
for (i = 0; i < cPins; ++i)
|
||||||
{
|
{
|
||||||
IPin *pin;
|
IPin *pin = This->base->pFuncsTable->filter_get_pin(This->base, This->uIndex + i);
|
||||||
pin = This->base->pFuncsTable->filter_get_pin(This->base, This->uIndex + i);
|
|
||||||
|
|
||||||
if (!pin)
|
if (!pin)
|
||||||
break;
|
break;
|
||||||
else
|
|
||||||
ppPins[i] = pin;
|
IPin_AddRef(ppPins[i] = pin);
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pcFetched)
|
if (pcFetched)
|
||||||
|
@ -186,10 +181,7 @@ static HRESULT WINAPI IEnumPinsImpl_Reset(IEnumPins *iface)
|
||||||
{
|
{
|
||||||
enum_pins->count = 0;
|
enum_pins->count = 0;
|
||||||
while ((pin = enum_pins->base->pFuncsTable->filter_get_pin(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;
|
++enum_pins->count;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum_pins->Version = enum_pins->base->pin_version;
|
enum_pins->Version = enum_pins->base->pin_version;
|
||||||
|
|
|
@ -194,19 +194,15 @@ HRESULT WINAPI BaseFilterImpl_FindPin(IBaseFilter *iface, const WCHAR *id, IPin
|
||||||
{
|
{
|
||||||
hr = IPin_QueryPinInfo(pin, &info);
|
hr = IPin_QueryPinInfo(pin, &info);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
|
||||||
IPin_Release(pin);
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
|
||||||
if (info.pFilter) IBaseFilter_Release(info.pFilter);
|
if (info.pFilter) IBaseFilter_Release(info.pFilter);
|
||||||
|
|
||||||
if (!lstrcmpW(id, info.achName))
|
if (!lstrcmpW(id, info.achName))
|
||||||
{
|
{
|
||||||
*ret = pin;
|
IPin_AddRef(*ret = pin);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPin_Release(pin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return VFW_E_NOT_FOUND;
|
return VFW_E_NOT_FOUND;
|
||||||
|
|
|
@ -190,7 +190,6 @@ static IPin *renderer_get_pin(BaseFilter *iface, unsigned int index)
|
||||||
if (index >= 1)
|
if (index >= 1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
IPin_AddRef(&This->pInputPin->pin.IPin_iface);
|
|
||||||
return &This->pInputPin->pin.IPin_iface;
|
return &This->pInputPin->pin.IPin_iface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,6 @@ static IPin *transform_get_pin(BaseFilter *iface, unsigned int index)
|
||||||
if (index >= 2)
|
if (index >= 2)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
IPin_AddRef(filter->ppPins[index]);
|
|
||||||
return filter->ppPins[index];
|
return filter->ppPins[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1198,19 +1198,13 @@ static inline GSTOutPin *impl_from_IMediaSeeking( IMediaSeeking *iface )
|
||||||
|
|
||||||
static IPin *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);
|
GSTImpl *filter = impl_from_IBaseFilter(&base->IBaseFilter_iface);
|
||||||
IPin *pin;
|
|
||||||
|
|
||||||
if (index > This->cStreams)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (!index)
|
if (!index)
|
||||||
pin = &This->pInputPin.pin.IPin_iface;
|
return &filter->pInputPin.pin.IPin_iface;
|
||||||
else
|
else if (index <= filter->cStreams)
|
||||||
pin = &This->ppPins[index - 1]->pin.pin.IPin_iface;
|
return &filter->ppPins[index - 1]->pin.pin.IPin_iface;
|
||||||
|
return NULL;
|
||||||
IPin_AddRef(pin);
|
|
||||||
return pin;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gstdemux_destroy(BaseFilter *iface)
|
static void gstdemux_destroy(BaseFilter *iface)
|
||||||
|
|
|
@ -207,28 +207,16 @@ static IPin *qt_splitter_get_pin(BaseFilter *base, unsigned int index)
|
||||||
QTSplitter *filter = impl_from_BaseFilter(base);
|
QTSplitter *filter = impl_from_BaseFilter(base);
|
||||||
|
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
{
|
|
||||||
IPin_AddRef(&filter->pInputPin.pin.IPin_iface);
|
|
||||||
return &filter->pInputPin.pin.IPin_iface;
|
return &filter->pInputPin.pin.IPin_iface;
|
||||||
}
|
|
||||||
else if (index == 1)
|
else if (index == 1)
|
||||||
{
|
{
|
||||||
if (filter->pVideo_Pin)
|
if (filter->pVideo_Pin)
|
||||||
{
|
|
||||||
IPin_AddRef(&filter->pVideo_Pin->pin.pin.IPin_iface);
|
|
||||||
return &filter->pVideo_Pin->pin.pin.IPin_iface;
|
return &filter->pVideo_Pin->pin.pin.IPin_iface;
|
||||||
}
|
|
||||||
else if (filter->pAudio_Pin)
|
else if (filter->pAudio_Pin)
|
||||||
{
|
|
||||||
IPin_AddRef(&filter->pAudio_Pin->pin.pin.IPin_iface);
|
|
||||||
return &filter->pAudio_Pin->pin.pin.IPin_iface;
|
return &filter->pAudio_Pin->pin.pin.IPin_iface;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (index == 2 && filter->pVideo_Pin && filter->pAudio_Pin)
|
else if (index == 2 && filter->pVideo_Pin && filter->pAudio_Pin)
|
||||||
{
|
|
||||||
IPin_AddRef(&filter->pAudio_Pin->pin.pin.IPin_iface);
|
|
||||||
return &filter->pAudio_Pin->pin.pin.IPin_iface;
|
return &filter->pAudio_Pin->pin.pin.IPin_iface;
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue