Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- dlls/mfplat/tests/mfplat.c | 82 ++++++++++++++++++++++++++++---------- 1 file changed, 61 insertions(+), 21 deletions(-)
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 605fbc4fe27..6f7771bb79c 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -94,26 +94,6 @@ static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOO IUnknown_Release(unk); }
-#define check_service_interface(a, b, c, d) check_service_interface_(__LINE__, a, b, c, d) -static void check_service_interface_(unsigned int line, void *iface_ptr, REFGUID service, REFIID iid, BOOL supported) -{ - IUnknown *iface = iface_ptr; - HRESULT hr, expected_hr; - IMFGetService *gs; - IUnknown *unk; - - expected_hr = supported ? S_OK : E_NOINTERFACE; - - if (SUCCEEDED(hr = IUnknown_QueryInterface(iface, &IID_IMFGetService, (void **)&gs))) - { - hr = IMFGetService_GetService(gs, service, iid, (void **)&unk); - IMFGetService_Release(gs); - } - ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr); - if (SUCCEEDED(hr)) - IUnknown_Release(unk); -} - struct d3d11_resource_readback { ID3D11Resource *resource; @@ -656,6 +636,7 @@ static void test_source_resolver(void) IMFByteStream *stream; IMFGetService *get_service; IMFRateSupport *rate_support; + IMFRateControl *rate_control; WCHAR pathW[MAX_PATH]; int i, sample_count; WCHAR *filename; @@ -663,6 +644,7 @@ static void test_source_resolver(void) HRESULT hr; GUID guid; float rate; + BOOL thinning;
if (!pMFCreateSourceResolver) { @@ -804,7 +786,64 @@ todo_wine { ok(rate == 0.0f, "Unexpected slowest rate %f.\n", rate); }
- check_service_interface(mediasource, &MF_RATE_CONTROL_SERVICE, &IID_IMFRateControl, TRUE); + hr = IMFGetService_GetService(get_service, &MF_RATE_CONTROL_SERVICE, &IID_IMFRateControl, (void**)&rate_control); + ok(hr == S_OK, "Failed to get rate control interface, hr %#x.\n", hr); + + hr = IMFRateControl_GetRate(rate_control, &thinning, &rate); + ok(hr == S_OK, "Failed to get current rate, hr %#x.\n", hr); + ok(!thinning, "Unexpected thinning.\n", thinning); + ok(rate == 1.0f, "Unexpected rate %f.\n", rate); + + /* 1e6f + 0.06f == 1.0f + 1 ulp */ + hr = IMFRateControl_SetRate(rate_control, FALSE, 1e6f + 0.06f); + ok(hr == MF_E_UNSUPPORTED_RATE, "Unexpected hr %#x.\n", hr); + hr = IMFRateControl_GetRate(rate_control, &thinning, &rate); + ok(hr == S_OK, "Failed to get current rate, hr %#x.\n", hr); + ok(!thinning, "Unexpected thinning.\n", thinning); + ok(rate == 1.0f, "Unexpected rate %f.\n", rate); + + hr = IMFRateControl_SetRate(rate_control, FALSE, 1e6f); +todo_wine + ok(hr == S_OK, "Cannot set rate, hr %#x.\n", hr); + if (SUCCEEDED(hr)) + { + get_event((IMFMediaEventGenerator *)mediasource, MESourceRateChanged, &var); + ok(var.vt == VT_R4 && var.fltVal == 1e6f, "Unexpected rate in propvariant.\n"); + } + hr = IMFRateControl_GetRate(rate_control, &thinning, &rate); + ok(hr == S_OK, "Failed to get current rate, hr %#x.\n", hr); + ok(!thinning, "Unexpected thinning.\n", thinning); +todo_wine + ok(rate == 1e6f, "Unexpected rate %f.\n", rate); + + hr = IMFRateControl_SetRate(rate_control, FALSE, 0.0f); +todo_wine + ok(hr == S_OK, "Cannot set rate, hr %#x.\n", hr); + if (SUCCEEDED(hr)) + { + get_event((IMFMediaEventGenerator *)mediasource, MESourceRateChanged, &var); + ok(var.vt == VT_R4 && var.fltVal == 0.0f, "Unexpected rate in propvariant.\n"); + } + hr = IMFRateControl_GetRate(rate_control, &thinning, &rate); + ok(hr == S_OK, "Failed to get current rate, hr %#x.\n", hr); + ok(!thinning, "Unexpected thinning.\n", thinning); +todo_wine + ok(rate == 0.0f, "Unexpected rate %f.\n", rate); + + hr = IMFRateControl_SetRate(rate_control, FALSE, 1e-6f); +todo_wine + ok(hr == S_OK, "Cannot set rate, hr %#x.\n", hr); + if (SUCCEEDED(hr)) + { + get_event((IMFMediaEventGenerator *)mediasource, MESourceRateChanged, &var); + ok(var.vt == VT_R4 && var.fltVal == 1e-6f, "Unexpected rate in propvariant.\n"); + } + hr = IMFRateControl_GetRate(rate_control, &thinning, &rate); + ok(hr == S_OK, "Failed to get current rate, hr %#x.\n", hr); + ok(!thinning, "Unexpected thinning.\n", thinning); +todo_wine + ok(rate == 1e-6f, "Unexpected rate %f.\n", rate); + hr = IMFMediaSource_CreatePresentationDescriptor(mediasource, &descriptor); ok(hr == S_OK, "Failed to get presentation descriptor, hr %#x.\n", hr); ok(descriptor != NULL, "got %p\n", descriptor); @@ -917,6 +956,7 @@ todo_wine hr = IMFMediaSource_CreatePresentationDescriptor(mediasource, NULL); ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
+ IMFRateControl_Release(rate_control); IMFRateSupport_Release(rate_support); IMFGetService_Release(get_service); IMFMediaSource_Release(mediasource);