evr/tests: Add more tests for supported service interfaces.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-11-16 17:50:22 +03:00 committed by Alexandre Julliard
parent 6ae872e855
commit c7ce8d5a52
1 changed files with 31 additions and 36 deletions

View File

@ -231,6 +231,21 @@ static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOO
IUnknown_Release(unk); 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;
IUnknown *unk;
expected_hr = supported ? S_OK : E_NOINTERFACE;
hr = MFGetService(iface, service, iid, (void **)&unk);
ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr);
if (SUCCEEDED(hr))
IUnknown_Release(unk);
}
static void test_interfaces(void) static void test_interfaces(void)
{ {
IBaseFilter *filter = create_evr(); IBaseFilter *filter = create_evr();
@ -449,7 +464,6 @@ static void test_default_mixer(void)
DXVA2_ValueRange range; DXVA2_ValueRange range;
DXVA2_Fixed32 dxva_value; DXVA2_Fixed32 dxva_value;
DWORD flags, value, count; DWORD flags, value, count;
IMFGetService *gs;
COLORREF color; COLORREF color;
unsigned int i; unsigned int i;
DWORD ids[16]; DWORD ids[16];
@ -471,22 +485,12 @@ static void test_default_mixer(void)
check_interface(transform, &IID_IMFVideoProcessor, TRUE); check_interface(transform, &IID_IMFVideoProcessor, TRUE);
check_interface(transform, &IID_IMFVideoMixerControl, TRUE); check_interface(transform, &IID_IMFVideoMixerControl, TRUE);
check_interface(transform, &IID_IMFVideoDeviceID, TRUE); check_interface(transform, &IID_IMFVideoDeviceID, TRUE);
check_service_interface(transform, &MR_VIDEO_MIXER_SERVICE, &IID_IMFVideoMixerBitmap, TRUE);
check_service_interface(transform, &MR_VIDEO_MIXER_SERVICE, &IID_IMFVideoProcessor, TRUE);
check_service_interface(transform, &MR_VIDEO_MIXER_SERVICE, &IID_IMFVideoMixerControl, TRUE);
check_service_interface(transform, &MR_VIDEO_MIXER_SERVICE, &IID_IMFVideoPositionMapper, TRUE);
hr = IMFTransform_QueryInterface(transform, &IID_IMFGetService, (void **)&gs); if (SUCCEEDED(MFGetService((IUnknown *)transform, &MR_VIDEO_MIXER_SERVICE, &IID_IMFVideoMixerControl2, (void **)&mixer_control2)))
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IMFGetService_GetService(gs, &MR_VIDEO_MIXER_SERVICE, &IID_IMFVideoMixerBitmap, (void **)&unk);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
IUnknown_Release(unk);
hr = IMFGetService_GetService(gs, &MR_VIDEO_MIXER_SERVICE, &IID_IMFVideoProcessor, (void **)&processor);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IMFGetService_GetService(gs, &MR_VIDEO_MIXER_SERVICE, &IID_IMFVideoMixerControl, (void **)&unk);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
IUnknown_Release(unk);
if (SUCCEEDED(IMFGetService_GetService(gs, &MR_VIDEO_MIXER_SERVICE, &IID_IMFVideoMixerControl2, (void **)&mixer_control2)))
{ {
hr = IMFVideoMixerControl2_GetMixingPrefs(mixer_control2, NULL); hr = IMFVideoMixerControl2_GetMixingPrefs(mixer_control2, NULL);
ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr); ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
@ -498,6 +502,9 @@ static void test_default_mixer(void)
IMFVideoMixerControl2_Release(mixer_control2); IMFVideoMixerControl2_Release(mixer_control2);
} }
hr = MFGetService((IUnknown *)transform, &MR_VIDEO_MIXER_SERVICE, &IID_IMFVideoProcessor, (void **)&processor);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IMFVideoProcessor_GetBackgroundColor(processor, NULL); hr = IMFVideoProcessor_GetBackgroundColor(processor, NULL);
ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr); ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
@ -527,12 +534,6 @@ todo_wine
IMFVideoProcessor_Release(processor); IMFVideoProcessor_Release(processor);
hr = IMFGetService_GetService(gs, &MR_VIDEO_MIXER_SERVICE, &IID_IMFVideoPositionMapper, (void **)&unk);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
IUnknown_Release(unk);
IMFGetService_Release(gs);
hr = IMFTransform_SetOutputBounds(transform, 100, 10); hr = IMFTransform_SetOutputBounds(transform, 100, 10);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
@ -1123,9 +1124,7 @@ static void test_default_presenter(void)
IMFRateSupport *rate_support; IMFRateSupport *rate_support;
IDirect3DDeviceManager9 *dm; IDirect3DDeviceManager9 *dm;
IMFVideoDeviceID *deviceid; IMFVideoDeviceID *deviceid;
IMFGetService *gs;
HWND hwnd, hwnd2; HWND hwnd, hwnd2;
IUnknown *unk;
DWORD flags; DWORD flags;
float rate; float rate;
HRESULT hr; HRESULT hr;
@ -1149,10 +1148,11 @@ static void test_default_presenter(void)
check_interface(presenter, &IID_IMFVideoPresenter, TRUE); check_interface(presenter, &IID_IMFVideoPresenter, TRUE);
check_interface(presenter, &IID_IMFVideoDeviceID, TRUE); check_interface(presenter, &IID_IMFVideoDeviceID, TRUE);
check_interface(presenter, &IID_IMFQualityAdvise, TRUE); check_interface(presenter, &IID_IMFQualityAdvise, TRUE);
check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoPositionMapper, TRUE);
hr = MFGetService((IUnknown *)presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoPositionMapper, (void **)&unk); check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoDisplayControl, TRUE);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr); todo_wine check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoPresenter, TRUE);
IUnknown_Release(unk); todo_wine check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFClockStateSink, TRUE);
check_service_interface(presenter, &MR_VIDEO_ACCELERATION_SERVICE, &IID_IDirect3DDeviceManager9, TRUE);
hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFVideoDeviceID, (void **)&deviceid); hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFVideoDeviceID, (void **)&deviceid);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
@ -1166,10 +1166,7 @@ static void test_default_presenter(void)
IMFVideoDeviceID_Release(deviceid); IMFVideoDeviceID_Release(deviceid);
hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFGetService, (void **)&gs); hr = MFGetService((IUnknown *)presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoDisplayControl, (void **)&display_control);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IMFGetService_GetService(gs, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoDisplayControl, (void **)&display_control);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IMFVideoDisplayControl_GetRenderingPrefs(display_control, NULL); hr = IMFVideoDisplayControl_GetRenderingPrefs(display_control, NULL);
@ -1182,7 +1179,7 @@ static void test_default_presenter(void)
IMFVideoDisplayControl_Release(display_control); IMFVideoDisplayControl_Release(display_control);
hr = IMFGetService_GetService(gs, &MR_VIDEO_ACCELERATION_SERVICE, &IID_IDirect3DDeviceManager9, (void **)&dm); hr = MFGetService((IUnknown *)presenter, &MR_VIDEO_ACCELERATION_SERVICE, &IID_IDirect3DDeviceManager9, (void **)&dm);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFVideoDisplayControl, (void **)&display_control); hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFVideoDisplayControl, (void **)&display_control);
@ -1461,9 +1458,7 @@ todo_wine
hr = IMFSample_GetBufferByIndex(sample, 0, &buffer); hr = IMFSample_GetBufferByIndex(sample, 0, &buffer);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = MFGetService((IUnknown *)buffer, &MR_BUFFER_SERVICE, &IID_IDirect3DSurface9, (void **)&surface); check_service_interface(buffer, &MR_BUFFER_SERVICE, &IID_IDirect3DSurface9, TRUE);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
IDirect3DSurface9_Release(surface);
hr = IMFMediaBuffer_QueryInterface(buffer, &IID_IMF2DBuffer, (void **)&unk); hr = IMFMediaBuffer_QueryInterface(buffer, &IID_IMF2DBuffer, (void **)&unk);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);