strmbase: Share pin and filter reference counts in base pin reference counting methods.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9ee197f2f6
commit
42b3fd84bb
|
@ -174,7 +174,6 @@ static HRESULT PullPin_Init(const IPinVtbl *PullPin_Vtbl, const PIN_INFO *info,
|
|||
{
|
||||
/* Common attributes */
|
||||
pPinImpl->pin.IPin_iface.lpVtbl = PullPin_Vtbl;
|
||||
pPinImpl->pin.refCount = 1;
|
||||
pPinImpl->pin.pConnectedTo = NULL;
|
||||
pPinImpl->pin.pCritSec = pCritSec;
|
||||
/* avoid copying uninitialized data */
|
||||
|
|
|
@ -173,14 +173,16 @@ LONG WINAPI BasePinImpl_GetMediaTypeVersion(BasePin *iface)
|
|||
return 1;
|
||||
}
|
||||
|
||||
ULONG WINAPI BasePinImpl_AddRef(IPin * iface)
|
||||
ULONG WINAPI BasePinImpl_AddRef(IPin *iface)
|
||||
{
|
||||
BasePin *This = impl_from_IPin(iface);
|
||||
ULONG refCount = InterlockedIncrement(&This->refCount);
|
||||
BasePin *pin = impl_from_IPin(iface);
|
||||
return IBaseFilter_AddRef(pin->pinInfo.pFilter);
|
||||
}
|
||||
|
||||
TRACE("(%p)->() AddRef from %d\n", iface, refCount - 1);
|
||||
|
||||
return refCount;
|
||||
ULONG WINAPI BasePinImpl_Release(IPin *iface)
|
||||
{
|
||||
BasePin *pin = impl_from_IPin(iface);
|
||||
return IBaseFilter_Release(pin->pinInfo.pFilter);
|
||||
}
|
||||
|
||||
HRESULT WINAPI BasePinImpl_Disconnect(IPin * iface)
|
||||
|
@ -379,19 +381,6 @@ HRESULT WINAPI BaseOutputPinImpl_QueryInterface(IPin * iface, REFIID riid, LPVOI
|
|||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
ULONG WINAPI BaseOutputPinImpl_Release(IPin * iface)
|
||||
{
|
||||
BaseOutputPin *This = impl_BaseOutputPin_from_IPin(iface);
|
||||
ULONG refCount = InterlockedDecrement(&This->pin.refCount);
|
||||
|
||||
TRACE("(%p)->() Release from %d\n", iface, refCount + 1);
|
||||
|
||||
if (!refCount)
|
||||
BaseOutputPin_Destroy(This);
|
||||
|
||||
return refCount;
|
||||
}
|
||||
|
||||
HRESULT WINAPI BaseOutputPinImpl_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
@ -733,7 +722,6 @@ static void strmbase_pin_init(BasePin *pin, const IPinVtbl *vtbl,
|
|||
{
|
||||
memset(pin, 0, sizeof(*pin));
|
||||
pin->IPin_iface.lpVtbl = vtbl;
|
||||
pin->refCount = 1;
|
||||
pin->pCritSec = cs;
|
||||
pin->dRate = 1.0;
|
||||
Copy_PinInfo(&pin->pinInfo, info);
|
||||
|
@ -825,19 +813,6 @@ HRESULT WINAPI BaseInputPinImpl_QueryInterface(IPin * iface, REFIID riid, LPVOID
|
|||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
ULONG WINAPI BaseInputPinImpl_Release(IPin * iface)
|
||||
{
|
||||
BaseInputPin *This = impl_BaseInputPin_from_IPin(iface);
|
||||
ULONG refCount = InterlockedDecrement(&This->pin.refCount);
|
||||
|
||||
TRACE("(%p)->() Release from %d\n", iface, refCount + 1);
|
||||
|
||||
if (!refCount)
|
||||
BaseInputPin_Destroy(This);
|
||||
|
||||
return refCount;
|
||||
}
|
||||
|
||||
HRESULT WINAPI BaseInputPinImpl_Connect(IPin *iface, IPin *pin, const AM_MEDIA_TYPE *pmt)
|
||||
{
|
||||
ERR("(%p)->(%p, %p) outgoing connection on an input pin!\n", iface, pin, pmt);
|
||||
|
|
|
@ -1286,7 +1286,6 @@ IUnknown * CALLBACK Gstreamer_Splitter_create(IUnknown *outer, HRESULT *phr)
|
|||
piInput->pFilter = &This->filter.IBaseFilter_iface;
|
||||
lstrcpynW(piInput->achName, wcsInputPinName, ARRAY_SIZE(piInput->achName));
|
||||
This->pInputPin.pin.IPin_iface.lpVtbl = &GST_InputPin_Vtbl;
|
||||
This->pInputPin.pin.refCount = 1;
|
||||
This->pInputPin.pin.pConnectedTo = NULL;
|
||||
This->pInputPin.pin.pCritSec = &This->filter.csFilter;
|
||||
ZeroMemory(&This->pInputPin.pin.mtCurrent, sizeof(AM_MEDIA_TYPE));
|
||||
|
|
|
@ -318,7 +318,6 @@ IUnknown * CALLBACK QTSplitter_create(IUnknown *outer, HRESULT *phr)
|
|||
piInput->pFilter = &This->filter.IBaseFilter_iface;
|
||||
lstrcpynW(piInput->achName, wcsInputPinName, ARRAY_SIZE(piInput->achName));
|
||||
This->pInputPin.pin.IPin_iface.lpVtbl = &QT_InputPin_Vtbl;
|
||||
This->pInputPin.pin.refCount = 1;
|
||||
This->pInputPin.pin.pConnectedTo = NULL;
|
||||
This->pInputPin.pin.pCritSec = &This->filter.csFilter;
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ void WINAPI DeleteMediaType(AM_MEDIA_TYPE * pMediaType);
|
|||
typedef struct BasePin
|
||||
{
|
||||
IPin IPin_iface;
|
||||
LONG refCount;
|
||||
LPCRITICAL_SECTION pCritSec;
|
||||
PIN_INFO pinInfo;
|
||||
IPin * pConnectedTo;
|
||||
|
@ -103,7 +102,8 @@ typedef struct BaseInputPinFuncTable {
|
|||
/* Base Pin */
|
||||
HRESULT WINAPI BasePinImpl_GetMediaType(BasePin *This, int iPosition, AM_MEDIA_TYPE *pmt);
|
||||
LONG WINAPI BasePinImpl_GetMediaTypeVersion(BasePin *This);
|
||||
ULONG WINAPI BasePinImpl_AddRef(IPin * iface);
|
||||
ULONG WINAPI BasePinImpl_AddRef(IPin *iface);
|
||||
ULONG WINAPI BasePinImpl_Release(IPin *iface);
|
||||
HRESULT WINAPI BasePinImpl_Disconnect(IPin * iface);
|
||||
HRESULT WINAPI BasePinImpl_ConnectedTo(IPin * iface, IPin ** ppPin);
|
||||
HRESULT WINAPI BasePinImpl_ConnectionMediaType(IPin * iface, AM_MEDIA_TYPE * pmt);
|
||||
|
@ -117,7 +117,6 @@ HRESULT WINAPI BasePinImpl_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFER
|
|||
|
||||
/* Base Output Pin */
|
||||
HRESULT WINAPI BaseOutputPinImpl_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv);
|
||||
ULONG WINAPI BaseOutputPinImpl_Release(IPin * iface);
|
||||
HRESULT WINAPI BaseOutputPinImpl_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
|
||||
HRESULT WINAPI BaseOutputPinImpl_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
|
||||
HRESULT WINAPI BaseOutputPinImpl_Disconnect(IPin * iface);
|
||||
|
@ -141,7 +140,6 @@ void strmbase_source_init(BaseOutputPin *pin, const IPinVtbl *vtbl, const PIN_IN
|
|||
|
||||
/* Base Input Pin */
|
||||
HRESULT WINAPI BaseInputPinImpl_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv);
|
||||
ULONG WINAPI BaseInputPinImpl_Release(IPin * iface);
|
||||
HRESULT WINAPI BaseInputPinImpl_Connect(IPin * iface, IPin * pConnector, const AM_MEDIA_TYPE * pmt);
|
||||
HRESULT WINAPI BaseInputPinImpl_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
|
||||
HRESULT WINAPI BaseInputPinImpl_QueryAccept(IPin * iface, const AM_MEDIA_TYPE * pmt);
|
||||
|
|
Loading…
Reference in New Issue