Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qedit/tests/nullrenderer.c | 28 ++++++++++++++++++++++++++ dlls/qedit/tests/samplegrabber.c | 34 ++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+)
diff --git a/dlls/qedit/tests/nullrenderer.c b/dlls/qedit/tests/nullrenderer.c index d39b28d5779..3d5221b0a9e 100644 --- a/dlls/qedit/tests/nullrenderer.c +++ b/dlls/qedit/tests/nullrenderer.c @@ -352,6 +352,33 @@ static void test_aggregation(void) ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); }
+static void test_media_types(void) +{ + IBaseFilter *filter = create_null_renderer(); + AM_MEDIA_TYPE mt = {}, *pmt; + IEnumMediaTypes *enummt; + HRESULT hr; + ULONG ref; + IPin *pin; + + IBaseFilter_FindPin(filter, sink_id, &pin); + + hr = IPin_EnumMediaTypes(pin, &enummt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + IEnumMediaTypes_Release(enummt); + + hr = IPin_QueryAccept(pin, &mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + IPin_Release(pin); + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + START_TEST(nullrenderer) { IBaseFilter *filter; @@ -373,6 +400,7 @@ START_TEST(nullrenderer) test_find_pin(); test_pin_info(); test_aggregation(); + test_media_types();
CoUninitialize(); } diff --git a/dlls/qedit/tests/samplegrabber.c b/dlls/qedit/tests/samplegrabber.c index 8bc44b9c22f..9bb4eb4f01c 100644 --- a/dlls/qedit/tests/samplegrabber.c +++ b/dlls/qedit/tests/samplegrabber.c @@ -449,6 +449,39 @@ static void test_aggregation(void) ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); }
+static void test_media_types(void) +{ + IBaseFilter *filter = create_sample_grabber(); + IEnumMediaTypes *enummt; + AM_MEDIA_TYPE mt = {}; + HRESULT hr; + ULONG ref; + IPin *pin; + + IBaseFilter_FindPin(filter, sink_id, &pin); + + hr = IPin_EnumMediaTypes(pin, &enummt); + todo_wine ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr); + + hr = IPin_QueryAccept(pin, &mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + IPin_Release(pin); + + IBaseFilter_FindPin(filter, source_id, &pin); + + hr = IPin_EnumMediaTypes(pin, &enummt); + todo_wine ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr); + + hr = IPin_QueryAccept(pin, &mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + IPin_Release(pin); + + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + START_TEST(samplegrabber) { IBaseFilter *filter; @@ -470,6 +503,7 @@ START_TEST(samplegrabber) test_find_pin(); test_pin_info(); test_aggregation(); + test_media_types();
CoUninitialize(); }
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qedit/tests/nullrenderer.c | 45 +++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)
diff --git a/dlls/qedit/tests/nullrenderer.c b/dlls/qedit/tests/nullrenderer.c index 3d5221b0a9e..7841720cfe1 100644 --- a/dlls/qedit/tests/nullrenderer.c +++ b/dlls/qedit/tests/nullrenderer.c @@ -379,6 +379,50 @@ static void test_media_types(void) ok(!ref, "Got outstanding refcount %d.\n", ref); }
+static void test_enum_media_types(void) +{ + IBaseFilter *filter = create_null_renderer(); + IEnumMediaTypes *enum1, *enum2; + AM_MEDIA_TYPE *mts[2]; + ULONG ref, count; + HRESULT hr; + IPin *pin; + + IBaseFilter_FindPin(filter, sink_id, &pin); + + hr = IPin_EnumMediaTypes(pin, &enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enum1, 1, mts, &count); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(!count, "Got count %u.\n", count); + + hr = IEnumMediaTypes_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Clone(enum1, &enum2); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Skip(enum1, 1); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + IEnumMediaTypes_Release(enum1); + IEnumMediaTypes_Release(enum2); + IPin_Release(pin); + + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + START_TEST(nullrenderer) { IBaseFilter *filter; @@ -401,6 +445,7 @@ START_TEST(nullrenderer) test_pin_info(); test_aggregation(); test_media_types(); + test_enum_media_types();
CoUninitialize(); }
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/strmbase/mediatype.c | 43 ++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 26 deletions(-)
diff --git a/dlls/strmbase/mediatype.c b/dlls/strmbase/mediatype.c index 8ad2e22efc9..66b5fa1721b 100644 --- a/dlls/strmbase/mediatype.c +++ b/dlls/strmbase/mediatype.c @@ -172,44 +172,35 @@ static ULONG WINAPI IEnumMediaTypesImpl_Release(IEnumMediaTypes * iface) return ref; }
-static HRESULT WINAPI IEnumMediaTypesImpl_Next(IEnumMediaTypes * iface, ULONG cMediaTypes, AM_MEDIA_TYPE ** ppMediaTypes, ULONG * pcFetched) +static HRESULT WINAPI IEnumMediaTypesImpl_Next(IEnumMediaTypes *iface, + ULONG count, AM_MEDIA_TYPE **mts, ULONG *ret_count) { - ULONG cFetched; - IEnumMediaTypesImpl *This = impl_from_IEnumMediaTypes(iface); - - TRACE("(%p)->(%u, %p, %p)\n", iface, cMediaTypes, ppMediaTypes, pcFetched); + IEnumMediaTypesImpl *enummt = impl_from_IEnumMediaTypes(iface); + ULONG i;
- cFetched = min(This->count, This->uIndex + cMediaTypes) - This->uIndex; + TRACE("iface %p, count %u, mts %p, ret_count %p.\n", iface, count, mts, ret_count);
- if (This->currentVersion != This->mediaVersionFunction(This->basePin)) + if (enummt->currentVersion != enummt->mediaVersionFunction(enummt->basePin)) return VFW_E_ENUM_OUT_OF_SYNC;
- TRACE("Next uIndex: %u, cFetched: %u\n", This->uIndex, cFetched); - - if (cFetched > 0) + for (i = 0; i < count && enummt->uIndex + i < enummt->count; i++) { - ULONG i; - for (i = 0; i < cFetched; i++) + if (!(mts[i] = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE))) + || FAILED(enummt->enumMediaFunction(enummt->basePin, enummt->uIndex + i, mts[i]))) { - if (!(ppMediaTypes[i] = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE))) - || FAILED(This->enumMediaFunction(This->basePin, This->uIndex + i, ppMediaTypes[i]))) - { - while (i--) - DeleteMediaType(ppMediaTypes[i]); - *pcFetched = 0; - return E_OUTOFMEMORY; - } + while (i--) + DeleteMediaType(mts[i]); + *ret_count = 0; + return E_OUTOFMEMORY; } }
- if ((cMediaTypes != 1) || pcFetched) - *pcFetched = cFetched; + if ((count != 1) || ret_count) + *ret_count = i;
- This->uIndex += cFetched; + enummt->uIndex += i;
- if (cFetched != cMediaTypes) - return S_FALSE; - return S_OK; + return i == count ? S_OK : S_FALSE; }
static HRESULT WINAPI IEnumMediaTypesImpl_Skip(IEnumMediaTypes * iface, ULONG cMediaTypes)
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47291 Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qcap/tests/avico.c | 4 ++-- dlls/qcap/tests/avimux.c | 6 +++--- dlls/qcap/tests/smartteefilter.c | 2 +- dlls/qedit/tests/nullrenderer.c | 2 +- dlls/quartz/tests/avidec.c | 6 +++--- dlls/quartz/tests/avisplit.c | 6 +++--- dlls/quartz/tests/dsoundrender.c | 2 +- dlls/quartz/tests/filesource.c | 8 ++++---- dlls/quartz/tests/mpegsplit.c | 4 ++-- dlls/quartz/tests/videorenderer.c | 2 +- dlls/quartz/tests/vmr7.c | 2 +- dlls/quartz/tests/vmr9.c | 2 +- dlls/quartz/tests/waveparser.c | 6 +++--- dlls/strmbase/mediatype.c | 17 +++++++---------- 14 files changed, 33 insertions(+), 36 deletions(-)
diff --git a/dlls/qcap/tests/avico.c b/dlls/qcap/tests/avico.c index 10402897575..dbc15e3f15d 100644 --- a/dlls/qcap/tests/avico.c +++ b/dlls/qcap/tests/avico.c @@ -611,7 +611,7 @@ static void test_enum_media_types(IBaseFilter *filter) ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Clone(enum1, &enum2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Skip(enum1, 1); ok(hr == S_FALSE, "Got hr %#x.\n", hr); @@ -642,7 +642,7 @@ static void test_enum_media_types(IBaseFilter *filter) ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Clone(enum1, &enum2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Skip(enum1, 1); ok(hr == S_FALSE, "Got hr %#x.\n", hr); diff --git a/dlls/qcap/tests/avimux.c b/dlls/qcap/tests/avimux.c index 98a775433c6..85ebd5c82c7 100644 --- a/dlls/qcap/tests/avimux.c +++ b/dlls/qcap/tests/avimux.c @@ -613,13 +613,13 @@ static void test_enum_media_types(void) ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Skip(enum1, 1); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Skip(enum1, 1); ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL); - todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL); ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -648,7 +648,7 @@ static void test_enum_media_types(void) ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Clone(enum1, &enum2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Skip(enum1, 1); ok(hr == S_FALSE, "Got hr %#x.\n", hr); diff --git a/dlls/qcap/tests/smartteefilter.c b/dlls/qcap/tests/smartteefilter.c index 361b0603d85..487c8eca3c1 100644 --- a/dlls/qcap/tests/smartteefilter.c +++ b/dlls/qcap/tests/smartteefilter.c @@ -446,7 +446,7 @@ static void test_enum_media_types(void) ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Clone(enum1, &enum2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Skip(enum1, 1); ok(hr == S_FALSE, "Got hr %#x.\n", hr); diff --git a/dlls/qedit/tests/nullrenderer.c b/dlls/qedit/tests/nullrenderer.c index 7841720cfe1..45a0af16184 100644 --- a/dlls/qedit/tests/nullrenderer.c +++ b/dlls/qedit/tests/nullrenderer.c @@ -407,7 +407,7 @@ static void test_enum_media_types(void) ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Clone(enum1, &enum2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Skip(enum1, 1); ok(hr == S_FALSE, "Got hr %#x.\n", hr); diff --git a/dlls/quartz/tests/avidec.c b/dlls/quartz/tests/avidec.c index b53b64ec8ae..19997e3c172 100644 --- a/dlls/quartz/tests/avidec.c +++ b/dlls/quartz/tests/avidec.c @@ -571,7 +571,7 @@ static void test_enum_media_types(void) ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Clone(enum1, &enum2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Skip(enum1, 1); ok(hr == S_FALSE, "Got hr %#x.\n", hr); @@ -602,13 +602,13 @@ static void test_enum_media_types(void) todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Clone(enum1, &enum2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Skip(enum1, 1); ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL); - todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(hr == S_FALSE, "Got hr %#x.\n", hr);
IEnumMediaTypes_Release(enum1); IEnumMediaTypes_Release(enum2); diff --git a/dlls/quartz/tests/avisplit.c b/dlls/quartz/tests/avisplit.c index 7dc8b14c5e4..a1dadd481ad 100644 --- a/dlls/quartz/tests/avisplit.c +++ b/dlls/quartz/tests/avisplit.c @@ -685,7 +685,7 @@ static void test_enum_media_types(void) ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Clone(enum1, &enum2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Skip(enum1, 1); ok(hr == S_FALSE, "Got hr %#x.\n", hr); @@ -748,13 +748,13 @@ static void test_enum_media_types(void) ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Skip(enum1, 1); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Skip(enum1, 1); ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL); - todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL); ok(hr == S_OK, "Got hr %#x.\n", hr); diff --git a/dlls/quartz/tests/dsoundrender.c b/dlls/quartz/tests/dsoundrender.c index 925a49c5da7..ecf4a46facd 100644 --- a/dlls/quartz/tests/dsoundrender.c +++ b/dlls/quartz/tests/dsoundrender.c @@ -542,7 +542,7 @@ static void test_enum_media_types(void) ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Clone(enum1, &enum2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Skip(enum1, 2); ok(hr == S_FALSE, "Got hr %#x.\n", hr); diff --git a/dlls/quartz/tests/filesource.c b/dlls/quartz/tests/filesource.c index 8d1d977b95e..18a9bf1499a 100644 --- a/dlls/quartz/tests/filesource.c +++ b/dlls/quartz/tests/filesource.c @@ -1159,19 +1159,19 @@ static void test_enum_media_types(void) ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Skip(enum1, 1); - todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Reset(enum1); ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Skip(enum1, 2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Skip(enum1, 1); - todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL); - todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL); ok(hr == S_OK, "Got hr %#x.\n", hr); diff --git a/dlls/quartz/tests/mpegsplit.c b/dlls/quartz/tests/mpegsplit.c index 25c49438d06..5661c73e19a 100644 --- a/dlls/quartz/tests/mpegsplit.c +++ b/dlls/quartz/tests/mpegsplit.c @@ -876,7 +876,7 @@ static void test_enum_media_types(void) ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Clone(enum1, &enum2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Skip(enum1, 5); ok(hr == S_FALSE, "Got hr %#x.\n", hr); @@ -979,7 +979,7 @@ static void test_enum_media_types(void) ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL); - todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL); ok(hr == S_OK, "Got hr %#x.\n", hr); diff --git a/dlls/quartz/tests/videorenderer.c b/dlls/quartz/tests/videorenderer.c index 5b03a04e4e6..9e5c8eb281f 100644 --- a/dlls/quartz/tests/videorenderer.c +++ b/dlls/quartz/tests/videorenderer.c @@ -456,7 +456,7 @@ static void test_enum_media_types(void) ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Clone(enum1, &enum2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Skip(enum1, 1); ok(hr == S_FALSE, "Got hr %#x.\n", hr); diff --git a/dlls/quartz/tests/vmr7.c b/dlls/quartz/tests/vmr7.c index cb35590df2f..81b42243b88 100644 --- a/dlls/quartz/tests/vmr7.c +++ b/dlls/quartz/tests/vmr7.c @@ -759,7 +759,7 @@ static void test_enum_media_types(void) ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Clone(enum1, &enum2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Skip(enum1, 1); ok(hr == S_FALSE, "Got hr %#x.\n", hr); diff --git a/dlls/quartz/tests/vmr9.c b/dlls/quartz/tests/vmr9.c index 0a55201f6ad..8d07522ab06 100644 --- a/dlls/quartz/tests/vmr9.c +++ b/dlls/quartz/tests/vmr9.c @@ -763,7 +763,7 @@ static void test_enum_media_types(void) ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Clone(enum1, &enum2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Skip(enum1, 1); ok(hr == S_FALSE, "Got hr %#x.\n", hr); diff --git a/dlls/quartz/tests/waveparser.c b/dlls/quartz/tests/waveparser.c index a0df5ccc9b3..4bfa17a9e5f 100644 --- a/dlls/quartz/tests/waveparser.c +++ b/dlls/quartz/tests/waveparser.c @@ -673,7 +673,7 @@ static void test_enum_media_types(void) ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Clone(enum1, &enum2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Skip(enum1, 1); ok(hr == S_FALSE, "Got hr %#x.\n", hr); @@ -736,13 +736,13 @@ static void test_enum_media_types(void) ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Skip(enum1, 1); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Skip(enum1, 1); ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL); - todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL); ok(hr == S_OK, "Got hr %#x.\n", hr); diff --git a/dlls/strmbase/mediatype.c b/dlls/strmbase/mediatype.c index 66b5fa1721b..393264c094c 100644 --- a/dlls/strmbase/mediatype.c +++ b/dlls/strmbase/mediatype.c @@ -203,21 +203,18 @@ static HRESULT WINAPI IEnumMediaTypesImpl_Next(IEnumMediaTypes *iface, return i == count ? S_OK : S_FALSE; }
-static HRESULT WINAPI IEnumMediaTypesImpl_Skip(IEnumMediaTypes * iface, ULONG cMediaTypes) +static HRESULT WINAPI IEnumMediaTypesImpl_Skip(IEnumMediaTypes *iface, ULONG count) { - IEnumMediaTypesImpl *This = impl_from_IEnumMediaTypes(iface); + IEnumMediaTypesImpl *enummt = impl_from_IEnumMediaTypes(iface);
- TRACE("(%p)->(%u)\n", iface, cMediaTypes); + TRACE("iface %p, count %u.\n", iface, count);
- if (This->currentVersion != This->mediaVersionFunction(This->basePin)) + if (enummt->currentVersion != enummt->mediaVersionFunction(enummt->basePin)) return VFW_E_ENUM_OUT_OF_SYNC;
- if (This->uIndex + cMediaTypes < This->count) - { - This->uIndex += cMediaTypes; - return S_OK; - } - return S_FALSE; + enummt->uIndex += count; + + return enummt->uIndex > enummt->count ? S_FALSE : S_OK; }
static HRESULT WINAPI IEnumMediaTypesImpl_Reset(IEnumMediaTypes * iface)