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,10 +57,13 @@ static HRESULT enum_media_types_create(struct strmbase_pin *pin, IEnumMediaTypes
|
||||||
object->pin = pin;
|
object->pin = pin;
|
||||||
IPin_AddRef(&pin->IPin_iface);
|
IPin_AddRef(&pin->IPin_iface);
|
||||||
|
|
||||||
while (pin->ops->pin_get_media_type(pin, object->count, &mt) == S_OK)
|
if (pin->ops->pin_get_media_type)
|
||||||
{
|
{
|
||||||
FreeMediaType(&mt);
|
while (pin->ops->pin_get_media_type(pin, object->count, &mt) == S_OK)
|
||||||
++object->count;
|
{
|
||||||
|
FreeMediaType(&mt);
|
||||||
|
++object->count;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("Created enumerator %p.\n", object);
|
TRACE("Created enumerator %p.\n", object);
|
||||||
|
@ -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);
|
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)
|
for (i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
if ((mts[i] = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE))))
|
if ((mts[i] = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE))))
|
||||||
|
@ -169,10 +179,13 @@ static HRESULT WINAPI enum_media_types_Reset(IEnumMediaTypes *iface)
|
||||||
TRACE("enummt %p.\n", enummt);
|
TRACE("enummt %p.\n", enummt);
|
||||||
|
|
||||||
enummt->count = 0;
|
enummt->count = 0;
|
||||||
while (enummt->pin->ops->pin_get_media_type(enummt->pin, enummt->count, &mt) == S_OK)
|
if (enummt->pin->ops->pin_get_media_type)
|
||||||
{
|
{
|
||||||
FreeMediaType(&mt);
|
while (enummt->pin->ops->pin_get_media_type(enummt->pin, enummt->count, &mt) == S_OK)
|
||||||
++enummt->count;
|
{
|
||||||
|
FreeMediaType(&mt);
|
||||||
|
++enummt->count;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enummt->index = 0;
|
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),
|
TRACE("pin %p %s:%s, enum_media_types %p.\n", pin, debugstr_w(pin->filter->name),
|
||||||
debugstr_w(pin->name), enum_media_types);
|
debugstr_w(pin->name), enum_media_types);
|
||||||
|
|
||||||
if (FAILED(hr = pin->ops->pin_get_media_type(pin, 0, &mt)))
|
if (pin->ops->pin_get_media_type)
|
||||||
return hr;
|
{
|
||||||
if (hr == S_OK)
|
if (FAILED(hr = pin->ops->pin_get_media_type(pin, 0, &mt)))
|
||||||
FreeMediaType(&mt);
|
return hr;
|
||||||
|
if (hr == S_OK)
|
||||||
|
FreeMediaType(&mt);
|
||||||
|
}
|
||||||
|
|
||||||
return enum_media_types_create(pin, enum_media_types);
|
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_accept = sink_query_accept,
|
||||||
.base.pin_query_interface = sink_query_interface,
|
.base.pin_query_interface = sink_query_interface,
|
||||||
.base.pin_get_media_type = strmbase_pin_get_media_type,
|
|
||||||
.pfnReceive = BaseRenderer_Receive,
|
.pfnReceive = BaseRenderer_Receive,
|
||||||
.sink_connect = sink_connect,
|
.sink_connect = sink_connect,
|
||||||
.sink_disconnect = sink_disconnect,
|
.sink_disconnect = sink_disconnect,
|
||||||
|
|
Loading…
Reference in New Issue