Commit 750efd19 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

strmbase: Get rid of the "enumMediaFunction" field from IEnumMediaTypesImpl.

parent bf01248c
......@@ -82,7 +82,6 @@ typedef struct IEnumMediaTypesImpl
IEnumMediaTypes IEnumMediaTypes_iface;
LONG refCount;
BasePin *basePin;
BasePin_GetMediaType enumMediaFunction;
ULONG count;
ULONG uIndex;
} IEnumMediaTypesImpl;
......@@ -94,11 +93,9 @@ static inline IEnumMediaTypesImpl *impl_from_IEnumMediaTypes(IEnumMediaTypes *if
static const struct IEnumMediaTypesVtbl IEnumMediaTypesImpl_Vtbl;
HRESULT WINAPI EnumMediaTypes_Construct(BasePin *basePin, BasePin_GetMediaType enumFunc, IEnumMediaTypes **ppEnum)
HRESULT enum_media_types_create(BasePin *basePin, IEnumMediaTypes **ppEnum)
{
ULONG i;
IEnumMediaTypesImpl * pEnumMediaTypes = CoTaskMemAlloc(sizeof(IEnumMediaTypesImpl));
AM_MEDIA_TYPE amt;
*ppEnum = NULL;
......@@ -108,18 +105,11 @@ HRESULT WINAPI EnumMediaTypes_Construct(BasePin *basePin, BasePin_GetMediaType e
pEnumMediaTypes->IEnumMediaTypes_iface.lpVtbl = &IEnumMediaTypesImpl_Vtbl;
pEnumMediaTypes->refCount = 1;
pEnumMediaTypes->uIndex = 0;
pEnumMediaTypes->enumMediaFunction = enumFunc;
IPin_AddRef(&basePin->IPin_iface);
pEnumMediaTypes->basePin = basePin;
i = 0;
while (enumFunc(basePin, i, &amt) == S_OK)
{
FreeMediaType(&amt);
i++;
}
IEnumMediaTypes_Reset(&pEnumMediaTypes->IEnumMediaTypes_iface);
pEnumMediaTypes->count = i;
*ppEnum = &pEnumMediaTypes->IEnumMediaTypes_iface;
return S_OK;
}
......@@ -179,7 +169,7 @@ static HRESULT WINAPI IEnumMediaTypesImpl_Next(IEnumMediaTypes *iface,
for (i = 0; i < count && enummt->uIndex + i < enummt->count; i++)
{
if (!(mts[i] = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)))
|| FAILED(enummt->enumMediaFunction(enummt->basePin, enummt->uIndex + i, mts[i])))
|| FAILED(enummt->basePin->pFuncsTable->pfnGetMediaType(enummt->basePin, enummt->uIndex + i, mts[i])))
{
while (i--)
DeleteMediaType(mts[i]);
......@@ -216,7 +206,7 @@ static HRESULT WINAPI IEnumMediaTypesImpl_Reset(IEnumMediaTypes * iface)
TRACE("(%p)->()\n", iface);
i = 0;
while (This->enumMediaFunction(This->basePin, i, &amt) == S_OK)
while (This->basePin->pFuncsTable->pfnGetMediaType(This->basePin, i, &amt) == S_OK)
{
FreeMediaType(&amt);
i++;
......@@ -234,7 +224,7 @@ static HRESULT WINAPI IEnumMediaTypesImpl_Clone(IEnumMediaTypes * iface, IEnumMe
TRACE("(%p)->(%p)\n", iface, ppEnum);
hr = EnumMediaTypes_Construct(This->basePin, This->enumMediaFunction, ppEnum);
hr = enum_media_types_create(This->basePin, ppEnum);
if (FAILED(hr))
return hr;
return IEnumMediaTypes_Skip(*ppEnum, This->uIndex);
......
......@@ -301,7 +301,7 @@ HRESULT WINAPI BasePinImpl_EnumMediaTypes(IPin *iface, IEnumMediaTypes **enum_me
TRACE("iface %p, enum_media_types %p.\n", iface, enum_media_types);
return EnumMediaTypes_Construct(pin, pin->pFuncsTable->pfnGetMediaType, enum_media_types);
return enum_media_types_create(pin, enum_media_types);
}
HRESULT WINAPI BasePinImpl_QueryInternalConnections(IPin * iface, IPin ** apPin, ULONG * cPin)
......
......@@ -63,8 +63,7 @@ void QualityControlRender_BeginRender(QualityControlImpl *This, REFERENCE_TIME s
void QualityControlRender_EndRender(QualityControlImpl *This);
HRESULT enum_pins_create(struct strmbase_filter *filter, IEnumPins **enum_pins);
HRESULT WINAPI EnumMediaTypes_Construct(BasePin *pin, BasePin_GetMediaType enumFunc,
IEnumMediaTypes **enum_media_types) DECLSPEC_HIDDEN;
HRESULT enum_media_types_create(BasePin *pin, IEnumMediaTypes **enum_media_types) DECLSPEC_HIDDEN;
HRESULT WINAPI RendererPosPassThru_RegisterMediaTime(IUnknown *iface, REFERENCE_TIME start);
HRESULT WINAPI RendererPosPassThru_ResetMediaTime(IUnknown *iface);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment