strmbase: Add callbacks for sink (dis)connection.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
f595d9bdff
commit
d14d19661a
|
@ -291,7 +291,7 @@ static HRESULT WINAPI AVICompressorIn_ReceiveConnection(IPin *iface,
|
|||
|
||||
hres = fill_format_info(This, (VIDEOINFOHEADER*)pmt->pbFormat);
|
||||
if(FAILED(hres))
|
||||
BasePinImpl_Disconnect(iface);
|
||||
BaseInputPinImpl_Disconnect(iface);
|
||||
return hres;
|
||||
}
|
||||
|
||||
|
@ -302,7 +302,7 @@ static HRESULT WINAPI AVICompressorIn_Disconnect(IPin *iface)
|
|||
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
hres = BasePinImpl_Disconnect(iface);
|
||||
hres = BaseInputPinImpl_Disconnect(iface);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
|
|
|
@ -1469,7 +1469,7 @@ static HRESULT WINAPI AviMuxIn_ReceiveConnection(IPin *iface,
|
|||
if(SUCCEEDED(hr))
|
||||
hr = IMemAllocator_Commit(avimuxin->samples_allocator);
|
||||
if(FAILED(hr)) {
|
||||
BasePinImpl_Disconnect(iface);
|
||||
BaseInputPinImpl_Disconnect(iface);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
@ -1497,7 +1497,7 @@ static HRESULT WINAPI AviMuxIn_Disconnect(IPin *iface)
|
|||
|
||||
TRACE("pin %p.\n", avimuxin);
|
||||
|
||||
hr = BasePinImpl_Disconnect(iface);
|
||||
hr = BaseInputPinImpl_Disconnect(iface);
|
||||
if(FAILED(hr))
|
||||
return hr;
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ static const IPinVtbl SmartTeeFilterInputVtbl = {
|
|||
BasePinImpl_Release,
|
||||
BaseInputPinImpl_Connect,
|
||||
BaseInputPinImpl_ReceiveConnection,
|
||||
BasePinImpl_Disconnect,
|
||||
BaseInputPinImpl_Disconnect,
|
||||
BasePinImpl_ConnectedTo,
|
||||
BasePinImpl_ConnectionMediaType,
|
||||
BasePinImpl_QueryPinInfo,
|
||||
|
|
|
@ -523,7 +523,7 @@ static const IPinVtbl sink_vtbl =
|
|||
BasePinImpl_Release,
|
||||
BaseInputPinImpl_Connect,
|
||||
SampleGrabber_In_IPin_ReceiveConnection,
|
||||
BasePinImpl_Disconnect,
|
||||
BaseInputPinImpl_Disconnect,
|
||||
BasePinImpl_ConnectedTo,
|
||||
BasePinImpl_ConnectionMediaType,
|
||||
BasePinImpl_QueryPinInfo,
|
||||
|
|
|
@ -119,31 +119,6 @@ ULONG WINAPI BasePinImpl_Release(IPin *iface)
|
|||
return IBaseFilter_Release(&pin->filter->IBaseFilter_iface);
|
||||
}
|
||||
|
||||
HRESULT WINAPI BasePinImpl_Disconnect(IPin * iface)
|
||||
{
|
||||
struct strmbase_pin *This = impl_from_IPin(iface);
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p)->()\n", This);
|
||||
|
||||
EnterCriticalSection(&This->filter->csFilter);
|
||||
{
|
||||
if (This->peer)
|
||||
{
|
||||
IPin_Release(This->peer);
|
||||
This->peer = NULL;
|
||||
FreeMediaType(&This->mt);
|
||||
ZeroMemory(&This->mt, sizeof(This->mt));
|
||||
hr = S_OK;
|
||||
}
|
||||
else
|
||||
hr = S_FALSE;
|
||||
}
|
||||
LeaveCriticalSection(&This->filter->csFilter);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT WINAPI BasePinImpl_ConnectedTo(IPin * iface, IPin ** ppPin)
|
||||
{
|
||||
struct strmbase_pin *This = impl_from_IPin(iface);
|
||||
|
@ -685,6 +660,9 @@ HRESULT WINAPI BaseInputPinImpl_ReceiveConnection(IPin * iface, IPin * pReceiveP
|
|||
}
|
||||
}
|
||||
|
||||
if (SUCCEEDED(hr) && This->pFuncsTable->sink_connect)
|
||||
hr = This->pFuncsTable->sink_connect(This, pReceivePin, pmt);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
CopyMediaType(&This->pin.mt, pmt);
|
||||
|
@ -697,6 +675,34 @@ HRESULT WINAPI BaseInputPinImpl_ReceiveConnection(IPin * iface, IPin * pReceiveP
|
|||
return hr;
|
||||
}
|
||||
|
||||
HRESULT WINAPI BaseInputPinImpl_Disconnect(IPin *iface)
|
||||
{
|
||||
struct strmbase_sink *pin = impl_sink_from_IPin(iface);
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("pin %p.\n", pin);
|
||||
|
||||
EnterCriticalSection(&pin->pin.filter->csFilter);
|
||||
|
||||
if (pin->pin.peer)
|
||||
{
|
||||
if (pin->pFuncsTable->sink_disconnect)
|
||||
pin->pFuncsTable->sink_disconnect(pin);
|
||||
|
||||
IPin_Release(pin->pin.peer);
|
||||
pin->pin.peer = NULL;
|
||||
FreeMediaType(&pin->pin.mt);
|
||||
memset(&pin->pin.mt, 0, sizeof(AM_MEDIA_TYPE));
|
||||
hr = S_OK;
|
||||
}
|
||||
else
|
||||
hr = S_FALSE;
|
||||
|
||||
LeaveCriticalSection(&pin->pin.filter->csFilter);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT deliver_endofstream(IPin* pin, LPVOID unused)
|
||||
{
|
||||
return IPin_EndOfStream( pin );
|
||||
|
|
|
@ -68,7 +68,7 @@ static HRESULT WINAPI BaseRenderer_InputPin_Disconnect(IPin * iface)
|
|||
TRACE("iface %p.\n", iface);
|
||||
|
||||
EnterCriticalSection(&filter->filter.csFilter);
|
||||
hr = BasePinImpl_Disconnect(iface);
|
||||
hr = BaseInputPinImpl_Disconnect(iface);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
if (filter->pFuncsTable->pfnBreakConnect)
|
||||
|
|
|
@ -427,7 +427,7 @@ static HRESULT WINAPI TransformFilter_InputPin_Disconnect(IPin * iface)
|
|||
if (pTransform->pFuncsTable->pfnBreakConnect)
|
||||
pTransform->pFuncsTable->pfnBreakConnect(pTransform, PINDIR_INPUT);
|
||||
|
||||
return BasePinImpl_Disconnect(iface);
|
||||
return BaseInputPinImpl_Disconnect(iface);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI TransformFilter_InputPin_BeginFlush(IPin * iface)
|
||||
|
|
|
@ -91,9 +91,10 @@ typedef HRESULT (WINAPI *BaseInputPin_Receive)(struct strmbase_sink *This, IMedi
|
|||
|
||||
struct strmbase_sink_ops
|
||||
{
|
||||
BasePinFuncTable base;
|
||||
/* Optional */
|
||||
BaseInputPin_Receive pfnReceive;
|
||||
BasePinFuncTable base;
|
||||
BaseInputPin_Receive pfnReceive;
|
||||
HRESULT (*sink_connect)(struct strmbase_sink *pin, IPin *peer, const AM_MEDIA_TYPE *mt);
|
||||
void (*sink_disconnect)(struct strmbase_sink *pin);
|
||||
};
|
||||
|
||||
/* Base Pin */
|
||||
|
@ -102,7 +103,7 @@ LONG WINAPI BasePinImpl_GetMediaTypeVersion(struct strmbase_pin *pin);
|
|||
HRESULT WINAPI BasePinImpl_QueryInterface(IPin *iface, REFIID iid, void **out);
|
||||
ULONG WINAPI BasePinImpl_AddRef(IPin *iface);
|
||||
ULONG WINAPI BasePinImpl_Release(IPin *iface);
|
||||
HRESULT WINAPI BasePinImpl_Disconnect(IPin * iface);
|
||||
HRESULT WINAPI BaseInputPinImpl_Disconnect(IPin * iface);
|
||||
HRESULT WINAPI BasePinImpl_ConnectedTo(IPin * iface, IPin ** ppPin);
|
||||
HRESULT WINAPI BasePinImpl_ConnectionMediaType(IPin * iface, AM_MEDIA_TYPE * pmt);
|
||||
HRESULT WINAPI BasePinImpl_QueryPinInfo(IPin * iface, PIN_INFO * pInfo);
|
||||
|
|
Loading…
Reference in New Issue