qedit/samplegrabber: Use BaseOutputPinImpl_AttemptConnection().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-02-06 16:49:11 -06:00 committed by Alexandre Julliard
parent 44c91bcbb0
commit a1a587a83a
1 changed files with 6 additions and 21 deletions

View File

@ -575,16 +575,12 @@ static HRESULT sample_grabber_source_get_media_type(struct strmbase_pin *iface,
return VFW_S_NO_MORE_ITEMS; return VFW_S_NO_MORE_ITEMS;
} }
static HRESULT WINAPI sample_grabber_source_AttemptConnection(struct strmbase_source *iface, static HRESULT WINAPI sample_grabber_source_DecideAllocator(struct strmbase_source *iface,
IPin *peer, const AM_MEDIA_TYPE *mt) IMemInputPin *peer, IMemAllocator **allocator)
{ {
SG_Impl *filter = impl_from_source_pin(&iface->pin); SG_Impl *filter = impl_from_source_pin(&iface->pin);
HRESULT hr; const AM_MEDIA_TYPE *mt = &iface->pin.mt;
if (filter->source.pin.peer)
return VFW_E_ALREADY_CONNECTED;
if (filter->filter.state != State_Stopped)
return VFW_E_NOT_STOPPED;
if (!IsEqualGUID(&mt->majortype, &filter->mtype.majortype)) if (!IsEqualGUID(&mt->majortype, &filter->mtype.majortype))
return VFW_E_TYPE_NOT_ACCEPTED; return VFW_E_TYPE_NOT_ACCEPTED;
if (!IsEqualGUID(&mt->subtype, &filter->mtype.subtype)) if (!IsEqualGUID(&mt->subtype, &filter->mtype.subtype))
@ -598,19 +594,7 @@ static HRESULT WINAPI sample_grabber_source_AttemptConnection(struct strmbase_so
&& !mt->pbFormat) && !mt->pbFormat)
return VFW_E_TYPE_NOT_ACCEPTED; return VFW_E_TYPE_NOT_ACCEPTED;
IPin_AddRef(filter->source.pin.peer = peer); return S_OK;
CopyMediaType(&filter->source.pin.mt, mt);
if (SUCCEEDED(hr = IPin_ReceiveConnection(peer, &filter->source.pin.IPin_iface, mt)))
hr = IPin_QueryInterface(peer, &IID_IMemInputPin, (void **)&filter->source.pMemInputPin);
if (FAILED(hr))
{
IPin_Release(filter->source.pin.peer);
filter->source.pin.peer = NULL;
FreeMediaType(&filter->source.pin.mt);
}
return hr;
} }
static const struct strmbase_source_ops source_ops = static const struct strmbase_source_ops source_ops =
@ -618,7 +602,8 @@ static const struct strmbase_source_ops source_ops =
.base.pin_query_interface = sample_grabber_source_query_interface, .base.pin_query_interface = sample_grabber_source_query_interface,
.base.pin_query_accept = sample_grabber_source_query_accept, .base.pin_query_accept = sample_grabber_source_query_accept,
.base.pin_get_media_type = sample_grabber_source_get_media_type, .base.pin_get_media_type = sample_grabber_source_get_media_type,
.pfnAttemptConnection = sample_grabber_source_AttemptConnection, .pfnAttemptConnection = BaseOutputPinImpl_AttemptConnection,
.pfnDecideAllocator = sample_grabber_source_DecideAllocator,
}; };
HRESULT SampleGrabber_create(IUnknown *outer, void **out) HRESULT SampleGrabber_create(IUnknown *outer, void **out)