strmbase: Make the pin_get_media_type() callback optional.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
f65cfbfe9b
commit
38f5f36462
|
@ -57,11 +57,14 @@ static HRESULT enum_media_types_create(struct strmbase_pin *pin, IEnumMediaTypes
|
|||
object->pin = pin;
|
||||
IPin_AddRef(&pin->IPin_iface);
|
||||
|
||||
if (pin->ops->pin_get_media_type)
|
||||
{
|
||||
while (pin->ops->pin_get_media_type(pin, object->count, &mt) == S_OK)
|
||||
{
|
||||
FreeMediaType(&mt);
|
||||
++object->count;
|
||||
}
|
||||
}
|
||||
|
||||
TRACE("Created enumerator %p.\n", object);
|
||||
*out = &object->IEnumMediaTypes_iface;
|
||||
|
@ -121,6 +124,13 @@ static HRESULT WINAPI enum_media_types_Next(IEnumMediaTypes *iface, ULONG count,
|
|||
|
||||
TRACE("enummt %p, count %u, mts %p, ret_count %p.\n", enummt, count, mts, ret_count);
|
||||
|
||||
if (!enummt->pin->ops->pin_get_media_type)
|
||||
{
|
||||
if (ret_count)
|
||||
*ret_count = 0;
|
||||
return count ? S_FALSE : S_OK;
|
||||
}
|
||||
|
||||
for (i = 0; i < count; ++i)
|
||||
{
|
||||
if ((mts[i] = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE))))
|
||||
|
@ -169,11 +179,14 @@ static HRESULT WINAPI enum_media_types_Reset(IEnumMediaTypes *iface)
|
|||
TRACE("enummt %p.\n", enummt);
|
||||
|
||||
enummt->count = 0;
|
||||
if (enummt->pin->ops->pin_get_media_type)
|
||||
{
|
||||
while (enummt->pin->ops->pin_get_media_type(enummt->pin, enummt->count, &mt) == S_OK)
|
||||
{
|
||||
FreeMediaType(&mt);
|
||||
++enummt->count;
|
||||
}
|
||||
}
|
||||
|
||||
enummt->index = 0;
|
||||
|
||||
|
@ -397,10 +410,13 @@ static HRESULT WINAPI pin_EnumMediaTypes(IPin *iface, IEnumMediaTypes **enum_med
|
|||
TRACE("pin %p %s:%s, enum_media_types %p.\n", pin, debugstr_w(pin->filter->name),
|
||||
debugstr_w(pin->name), enum_media_types);
|
||||
|
||||
if (pin->ops->pin_get_media_type)
|
||||
{
|
||||
if (FAILED(hr = pin->ops->pin_get_media_type(pin, 0, &mt)))
|
||||
return hr;
|
||||
if (hr == S_OK)
|
||||
FreeMediaType(&mt);
|
||||
}
|
||||
|
||||
return enum_media_types_create(pin, enum_media_types);
|
||||
}
|
||||
|
|
|
@ -257,7 +257,6 @@ static const struct strmbase_sink_ops sink_ops =
|
|||
{
|
||||
.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,
|
||||
.sink_connect = sink_connect,
|
||||
.sink_disconnect = sink_disconnect,
|
||||
|
|
Loading…
Reference in New Issue