Commit 690838a0 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

strmbase: Don't increment the pin reference count in filter_get_pin().

parent 6edee725
......@@ -180,18 +180,13 @@ static const IBaseFilterVtbl AVICompressorVtbl = {
static IPin *avi_compressor_get_pin(BaseFilter *iface, unsigned int index)
{
AVICompressor *This = impl_from_BaseFilter(iface);
IPin *ret;
AVICompressor *filter = impl_from_BaseFilter(iface);
if (index == 0)
ret = &This->in->pin.IPin_iface;
return &filter->in->pin.IPin_iface;
else if (index == 1)
ret = &This->out->pin.IPin_iface;
else
return NULL;
IPin_AddRef(ret);
return ret;
return &filter->out->pin.IPin_iface;
return NULL;
}
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)
{
AviMux *This = impl_from_BaseFilter(iface);
AviMux *filter = impl_from_BaseFilter(iface);
if (!index)
{
IPin_AddRef(&This->out->pin.pin.IPin_iface);
return &This->out->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 &filter->out->pin.pin.IPin_iface;
else if (index <= filter->input_pin_no)
return &filter->in[index - 1]->pin.pin.IPin_iface;
return NULL;
}
......
......@@ -120,20 +120,15 @@ static const IBaseFilterVtbl SmartTeeFilterVtbl = {
static IPin *smart_tee_get_pin(BaseFilter *iface, unsigned int index)
{
SmartTeeFilter *This = impl_from_BaseFilter(iface);
IPin *ret;
SmartTeeFilter *filter = impl_from_BaseFilter(iface);
if (index == 0)
ret = &This->input->pin.IPin_iface;
return &filter->input->pin.IPin_iface;
else if (index == 1)
ret = &This->capture->pin.IPin_iface;
return &filter->capture->pin.IPin_iface;
else if (index == 2)
ret = &This->preview->pin.IPin_iface;
else
return NULL;
IPin_AddRef(ret);
return ret;
return &filter->preview->pin.IPin_iface;
return NULL;
}
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)
return NULL;
IPin_AddRef(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)
{
SG_Impl *This = impl_from_BaseFilter(iface);
IPin *pin;
SG_Impl *filter = impl_from_BaseFilter(iface);
if (index == 0)
pin = &This->pin_in.IPin_iface;
return &filter->pin_in.IPin_iface;
else if (index == 1)
pin = &This->pin_out.IPin_iface;
else
return NULL;
IPin_AddRef(pin);
return pin;
return &filter->pin_out.IPin_iface;
return NULL;
}
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)
{
AsyncReader *This = impl_from_BaseFilter(iface);
if (index >= 1 || !This->pOutputPin)
return NULL;
AsyncReader *filter = impl_from_BaseFilter(iface);
IPin_AddRef(This->pOutputPin);
return This->pOutputPin;
if (!index && filter->pOutputPin)
return filter->pOutputPin;
return NULL;
}
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);
if (index > filter->cStreams)
return NULL;
IPin_AddRef(filter->ppPins[index]);
return filter->ppPins[index];
if (index <= filter->cStreams)
return filter->ppPins[index];
return NULL;
}
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;
while ((pin = base->pFuncsTable->filter_get_pin(base, object->count)))
{
IPin_Release(pin);
++object->count;
}
TRACE("Created enumerator %p.\n", object);
*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)
{
IEnumPinsImpl *This = impl_from_IEnumPins(iface);
ULONG i = 0;
ULONG i;
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)
return VFW_E_ENUM_OUT_OF_SYNC;
while (i < cPins)
for (i = 0; i < cPins; ++i)
{
IPin *pin;
pin = This->base->pFuncsTable->filter_get_pin(This->base, This->uIndex + i);
if (!pin)
break;
else
ppPins[i] = pin;
++i;
IPin *pin = This->base->pFuncsTable->filter_get_pin(This->base, This->uIndex + i);
if (!pin)
break;
IPin_AddRef(ppPins[i] = pin);
}
if (pcFetched)
......@@ -186,10 +181,7 @@ static HRESULT WINAPI IEnumPinsImpl_Reset(IEnumPins *iface)
{
enum_pins->count = 0;
while ((pin = enum_pins->base->pFuncsTable->filter_get_pin(enum_pins->base, enum_pins->count)))
{
IPin_Release(pin);
++enum_pins->count;
}
}
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);
if (FAILED(hr))
{
IPin_Release(pin);
return hr;
}
if (info.pFilter) IBaseFilter_Release(info.pFilter);
if (!lstrcmpW(id, info.achName))
{
*ret = pin;
IPin_AddRef(*ret = pin);
return S_OK;
}
IPin_Release(pin);
}
return VFW_E_NOT_FOUND;
......
......@@ -190,7 +190,6 @@ static IPin *renderer_get_pin(BaseFilter *iface, unsigned int index)
if (index >= 1)
return NULL;
IPin_AddRef(&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)
return NULL;
IPin_AddRef(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)
{
GSTImpl *This = impl_from_IBaseFilter(&base->IBaseFilter_iface);
IPin *pin;
if (index > This->cStreams)
return NULL;
GSTImpl *filter = impl_from_IBaseFilter(&base->IBaseFilter_iface);
if (!index)
pin = &This->pInputPin.pin.IPin_iface;
else
pin = &This->ppPins[index - 1]->pin.pin.IPin_iface;
IPin_AddRef(pin);
return pin;
return &filter->pInputPin.pin.IPin_iface;
else if (index <= filter->cStreams)
return &filter->ppPins[index - 1]->pin.pin.IPin_iface;
return NULL;
}
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);
if (index == 0)
{
IPin_AddRef(&filter->pInputPin.pin.IPin_iface);
return &filter->pInputPin.pin.IPin_iface;
}
else if (index == 1)
{
if (filter->pVideo_Pin)
{
IPin_AddRef(&filter->pVideo_Pin->pin.pin.IPin_iface);
return &filter->pVideo_Pin->pin.pin.IPin_iface;
}
else if (filter->pAudio_Pin)
{
IPin_AddRef(&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)
{
IPin_AddRef(&filter->pAudio_Pin->pin.pin.IPin_iface);
return &filter->pAudio_Pin->pin.pin.IPin_iface;
}
return NULL;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment