strmbase: Use BasePinImpl_QueryInterface().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-09-25 22:36:23 -05:00 committed by Alexandre Julliard
parent fa280172e8
commit 8601e2243f
8 changed files with 58 additions and 35 deletions

View File

@ -88,7 +88,7 @@ static void test_interfaces(void)
check_interface(pin, &IID_IKsPropertySet, FALSE);
check_interface(pin, &IID_IMediaPosition, FALSE);
todo_wine check_interface(pin, &IID_IMediaSeeking, FALSE);
check_interface(pin, &IID_IMediaSeeking, FALSE);
IPin_Release(pin);
ref = IBaseFilter_Release(filter);

View File

@ -161,7 +161,7 @@ static void test_interfaces(void)
check_interface(pin, &IID_IAsyncReader, FALSE);
check_interface(pin, &IID_IMediaPosition, FALSE);
todo_wine check_interface(pin, &IID_IMediaSeeking, FALSE);
check_interface(pin, &IID_IMediaSeeking, FALSE);
IPin_Release(pin);
IBaseFilter_Release(filter);

View File

@ -93,7 +93,7 @@ static void test_interfaces(void)
check_interface(pin, &IID_IAsyncReader, FALSE);
check_interface(pin, &IID_IMediaPosition, FALSE);
todo_wine check_interface(pin, &IID_IMediaSeeking, FALSE);
check_interface(pin, &IID_IMediaSeeking, FALSE);
IPin_Release(pin);
IBaseFilter_Release(filter);

View File

@ -239,7 +239,7 @@ static void test_interfaces(void)
check_interface(pin, &IID_IKsPropertySet, FALSE);
check_interface(pin, &IID_IMediaPosition, FALSE);
todo_wine check_interface(pin, &IID_IMediaSeeking, FALSE);
check_interface(pin, &IID_IMediaSeeking, FALSE);
IPin_Release(pin);
@ -269,7 +269,7 @@ static void test_interfaces(void)
check_interface(pin, &IID_IKsPropertySet, FALSE);
check_interface(pin, &IID_IMediaPosition, FALSE);
todo_wine check_interface(pin, &IID_IMediaSeeking, FALSE);
check_interface(pin, &IID_IMediaSeeking, FALSE);
IPin_Release(pin);
@ -298,7 +298,7 @@ static void test_interfaces(void)
check_interface(pin, &IID_IKsPropertySet, FALSE);
check_interface(pin, &IID_IMediaPosition, FALSE);
todo_wine check_interface(pin, &IID_IMediaSeeking, FALSE);
check_interface(pin, &IID_IMediaSeeking, FALSE);
IPin_Release(pin);

View File

@ -232,7 +232,7 @@ static void test_interfaces(void)
check_interface(pin, &IID_IKsPropertySet, FALSE);
check_interface(pin, &IID_IMediaPosition, FALSE);
todo_wine check_interface(pin, &IID_IMediaSeeking, FALSE);
check_interface(pin, &IID_IMediaSeeking, FALSE);
IPin_Release(pin);
@ -262,7 +262,7 @@ static void test_interfaces(void)
check_interface(pin, &IID_IKsPropertySet, FALSE);
check_interface(pin, &IID_IMediaPosition, FALSE);
todo_wine check_interface(pin, &IID_IMediaSeeking, FALSE);
check_interface(pin, &IID_IMediaSeeking, FALSE);
IPin_Release(pin);
@ -291,7 +291,7 @@ static void test_interfaces(void)
check_interface(pin, &IID_IKsPropertySet, FALSE);
check_interface(pin, &IID_IMediaPosition, FALSE);
todo_wine check_interface(pin, &IID_IMediaSeeking, FALSE);
check_interface(pin, &IID_IMediaSeeking, FALSE);
IPin_Release(pin);

View File

@ -157,7 +157,7 @@ HRESULT strmbase_pin_get_media_type(struct strmbase_pin *iface, unsigned int ind
return VFW_S_NO_MORE_ITEMS;
}
HRESULT WINAPI BasePinImpl_QueryInterface(IPin *iface)
HRESULT WINAPI BasePinImpl_QueryInterface(IPin *iface, REFIID iid, void **out)
{
struct strmbase_pin *pin = impl_from_IPin(iface);
HRESULT hr;
@ -167,7 +167,7 @@ HRESULT WINAPI BasePinImpl_QueryInterface(IPin *iface)
*out = NULL;
if (pin->pFuncsTable->pin_query_interface
&& SUCCEEDED(hr = pin->pFuncsTable->pin_query_interface(filter, iid, out)))
&& SUCCEEDED(hr = pin->pFuncsTable->pin_query_interface(pin, iid, out)))
return hr;
if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IPin))

View File

@ -147,7 +147,7 @@ static HRESULT WINAPI BaseRenderer_InputPin_EndFlush(IPin * iface)
static const IPinVtbl BaseRenderer_InputPin_Vtbl =
{
BaseInputPinImpl_QueryInterface,
BasePinImpl_QueryInterface,
BasePinImpl_AddRef,
BasePinImpl_Release,
BaseInputPinImpl_Connect,
@ -217,6 +217,19 @@ static HRESULT sink_query_accept(struct strmbase_pin *pin, const AM_MEDIA_TYPE *
return filter->pFuncsTable->pfnCheckMediaType(filter, mt);
}
static HRESULT sink_query_interface(struct strmbase_pin *iface, REFIID iid, void **out)
{
BaseRenderer *filter = impl_from_IPin(&iface->IPin_iface);
if (IsEqualGUID(iid, &IID_IMemInputPin))
*out = &filter->sink.IMemInputPin_iface;
else
return E_NOINTERFACE;
IUnknown_AddRef((IUnknown *)*out);
return S_OK;
}
static HRESULT WINAPI BaseRenderer_Receive(BaseInputPin *pin, IMediaSample *sample)
{
BaseRenderer *filter = impl_from_IPin(&pin->pin.IPin_iface);
@ -226,6 +239,7 @@ static HRESULT WINAPI BaseRenderer_Receive(BaseInputPin *pin, IMediaSample *samp
static const BaseInputPinFuncTable input_BaseInputFuncTable =
{
.base.pin_query_accept = sink_query_accept,
.base.pin_query_interface = sink_query_interface,
.base.pin_get_media_type = strmbase_pin_get_media_type,
.pfnReceive = BaseRenderer_Receive,
};

View File

@ -161,17 +161,47 @@ static const struct strmbase_filter_ops filter_ops =
.filter_destroy = transform_destroy,
};
static HRESULT sink_query_interface(struct strmbase_pin *iface, REFIID iid, void **out)
{
TransformFilter *filter = impl_from_sink_IPin(&iface->IPin_iface);
if (IsEqualGUID(iid, &IID_IMemInputPin))
*out = &filter->sink.IMemInputPin_iface;
else
return E_NOINTERFACE;
IUnknown_AddRef((IUnknown *)*out);
return S_OK;
}
static const BaseInputPinFuncTable tf_input_BaseInputFuncTable =
{
.base.pin_query_accept = sink_query_accept,
.base.pin_get_media_type = strmbase_pin_get_media_type,
.base.pin_query_interface = sink_query_interface,
.pfnReceive = TransformFilter_Input_Receive,
};
static HRESULT source_query_interface(struct strmbase_pin *iface, REFIID iid, void **out)
{
TransformFilter *filter = impl_from_source_IPin(&iface->IPin_iface);
if (IsEqualGUID(iid, &IID_IQualityControl))
*out = &filter->qcimpl->IQualityControl_iface;
else if (IsEqualGUID(iid, &IID_IMediaSeeking))
return IUnknown_QueryInterface(filter->seekthru_unk, iid, out);
else
return E_NOINTERFACE;
IUnknown_AddRef((IUnknown *)*out);
return S_OK;
}
static const struct strmbase_source_ops source_ops =
{
.base.pin_query_accept = source_query_accept,
.base.pin_get_media_type = source_get_media_type,
.base.pin_query_interface = source_query_interface,
.pfnAttemptConnection = BaseOutputPinImpl_AttemptConnection,
.pfnDecideBufferSize = TransformFilter_Output_DecideBufferSize,
.pfnDecideAllocator = BaseOutputPinImpl_DecideAllocator,
@ -439,7 +469,7 @@ static HRESULT WINAPI TransformFilter_InputPin_NewSegment(IPin * iface, REFERENC
static const IPinVtbl TransformFilter_InputPin_Vtbl =
{
BaseInputPinImpl_QueryInterface,
BasePinImpl_QueryInterface,
BasePinImpl_AddRef,
BasePinImpl_Release,
BaseInputPinImpl_Connect,
@ -459,30 +489,9 @@ static const IPinVtbl TransformFilter_InputPin_Vtbl =
TransformFilter_InputPin_NewSegment
};
static HRESULT WINAPI transform_source_QueryInterface(IPin *iface, REFIID iid, void **out)
{
TransformFilter *filter = impl_from_source_IPin(iface);
if (IsEqualGUID(iid, &IID_IUnknown) || IsEqualGUID(iid, &IID_IPin))
*out = iface;
else if (IsEqualGUID(iid, &IID_IQualityControl))
*out = &filter->qcimpl->IQualityControl_iface;
else if (IsEqualGUID(iid, &IID_IMediaSeeking))
return IUnknown_QueryInterface(filter->seekthru_unk, iid, out);
else
{
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
*out = NULL;
return E_NOINTERFACE;
}
IUnknown_AddRef((IUnknown *)*out);
return S_OK;
}
static const IPinVtbl TransformFilter_OutputPin_Vtbl =
{
transform_source_QueryInterface,
BasePinImpl_QueryInterface,
BasePinImpl_AddRef,
BasePinImpl_Release,
BaseOutputPinImpl_Connect,