strmbase/transform: Get rid of superfluous npins field.

Also return the correct number of pins in TransformFilter_GetPinCount().

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-03-05 23:28:37 -06:00 committed by Alexandre Julliard
parent 36efe783af
commit 1cabe7e4a3
3 changed files with 7 additions and 13 deletions

View File

@ -182,11 +182,9 @@ todo_wine
ok(hr == S_OK, "Got hr %#x.\n", hr); ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumPins_Skip(enum1, 3); hr = IEnumPins_Skip(enum1, 3);
todo_wine
ok(hr == S_FALSE, "Got hr %#x.\n", hr); ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = IEnumPins_Skip(enum1, 2); hr = IEnumPins_Skip(enum1, 2);
todo_wine
ok(hr == S_OK, "Got hr %#x.\n", hr); ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumPins_Skip(enum1, 1); hr = IEnumPins_Skip(enum1, 1);

View File

@ -144,22 +144,20 @@ static HRESULT WINAPI TransformFilter_Output_GetMediaType(BasePin *This, int iPo
return S_OK; return S_OK;
} }
static IPin* WINAPI TransformFilter_GetPin(BaseFilter *iface, int pos) static IPin *WINAPI TransformFilter_GetPin(BaseFilter *iface, int index)
{ {
TransformFilter *This = impl_from_BaseFilter(iface); TransformFilter *filter = impl_from_BaseFilter(iface);
if (pos >= This->npins || pos < 0) if (index >= 2 || index < 0)
return NULL; return NULL;
IPin_AddRef(This->ppPins[pos]); IPin_AddRef(filter->ppPins[index]);
return This->ppPins[pos]; return filter->ppPins[index];
} }
static LONG WINAPI TransformFilter_GetPinCount(BaseFilter *iface) static LONG WINAPI TransformFilter_GetPinCount(BaseFilter *iface)
{ {
TransformFilter *This = impl_from_BaseFilter(iface); return 2;
return (This->npins+1);
} }
static const BaseFilterFuncTable tfBaseFuncTable = { static const BaseFilterFuncTable tfBaseFuncTable = {
@ -203,7 +201,6 @@ static HRESULT TransformFilter_Init(const IBaseFilterVtbl *pVtbl, const CLSID* p
/* pTransformFilter is already allocated */ /* pTransformFilter is already allocated */
pTransformFilter->pFuncsTable = pFuncsTable; pTransformFilter->pFuncsTable = pFuncsTable;
ZeroMemory(&pTransformFilter->pmt, sizeof(pTransformFilter->pmt)); ZeroMemory(&pTransformFilter->pmt, sizeof(pTransformFilter->pmt));
pTransformFilter->npins = 2;
pTransformFilter->ppPins = CoTaskMemAlloc(2 * sizeof(IPin *)); pTransformFilter->ppPins = CoTaskMemAlloc(2 * sizeof(IPin *));
@ -314,7 +311,7 @@ ULONG WINAPI TransformFilterImpl_Release(IBaseFilter * iface)
{ {
ULONG i; ULONG i;
for (i = 0; i < This->npins; i++) for (i = 0; i < 2; i++)
{ {
IPin *pConnectedTo; IPin *pConnectedTo;

View File

@ -212,7 +212,6 @@ typedef struct TransformFilter
BaseFilter filter; BaseFilter filter;
IPin **ppPins; IPin **ppPins;
ULONG npins;
AM_MEDIA_TYPE pmt; AM_MEDIA_TYPE pmt;
CRITICAL_SECTION csReceive; CRITICAL_SECTION csReceive;