evr/tests: Add sample allocator test with surface-backed buffers.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
99c1f2a0a8
commit
7aad298f71
|
@ -1302,13 +1302,19 @@ static void test_MFCreateVideoSampleAllocator(void)
|
|||
IMFVideoSampleAllocatorCallback *allocator_cb;
|
||||
IMFMediaType *media_type, *video_type;
|
||||
IMFVideoSampleAllocator *allocator;
|
||||
IDirect3DDeviceManager9 *manager;
|
||||
IMFSample *sample, *sample2;
|
||||
IDirect3DSurface9 *surface;
|
||||
IDirect3DDevice9 *device;
|
||||
IMFMediaBuffer *buffer;
|
||||
unsigned int token;
|
||||
IMFGetService *gs;
|
||||
IDirect3D9 *d3d;
|
||||
IUnknown *unk;
|
||||
HWND window;
|
||||
HRESULT hr;
|
||||
LONG count;
|
||||
BYTE *data;
|
||||
|
||||
hr = MFCreateVideoSampleAllocator(&IID_IUnknown, (void **)&unk);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
@ -1387,8 +1393,6 @@ todo_wine
|
|||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
ok(count == 4, "Unexpected count %d.\n", count);
|
||||
|
||||
if (sample)
|
||||
{
|
||||
hr = IMFSample_QueryInterface(sample, &IID_IMFDesiredSample, (void **)&unk);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
IUnknown_Release(unk);
|
||||
|
@ -1418,17 +1422,75 @@ todo_wine
|
|||
IMFMediaBuffer_Release(buffer);
|
||||
|
||||
IMFSample_Release(sample);
|
||||
}
|
||||
|
||||
IMFVideoSampleAllocatorCallback_Release(allocator_cb);
|
||||
|
||||
IMFMediaType_Release(media_type);
|
||||
|
||||
IMFVideoSampleAllocator_Release(allocator);
|
||||
|
||||
hr = MFCreateVideoSampleAllocator(&IID_IMFVideoSampleAllocatorCallback, (void **)&unk);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
IUnknown_Release(unk);
|
||||
|
||||
/* Using device manager */
|
||||
window = create_window();
|
||||
d3d = Direct3DCreate9(D3D_SDK_VERSION);
|
||||
ok(!!d3d, "Failed to create a D3D object.\n");
|
||||
if (!(device = create_device(d3d, window)))
|
||||
{
|
||||
skip("Failed to create a D3D device, skipping tests.\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
hr = DXVA2CreateDirect3DDeviceManager9(&token, &manager);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
hr = IDirect3DDeviceManager9_ResetDevice(manager, device, token);
|
||||
ok(hr == S_OK, "Failed to set a device, hr %#x.\n", hr);
|
||||
|
||||
hr = MFCreateVideoSampleAllocator(&IID_IMFVideoSampleAllocator, (void **)&allocator);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IMFVideoSampleAllocator_SetDirectXManager(allocator, (IUnknown *)manager);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IMFMediaType_SetUINT64(video_type, &MF_MT_FRAME_SIZE, (UINT64) 320 << 32 | 240);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
hr = IMFVideoSampleAllocator_InitializeSampleAllocator(allocator, 0, video_type);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IMFVideoSampleAllocator_AllocateSample(allocator, &sample);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IMFSample_GetBufferByIndex(sample, 0, &buffer);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = MFGetService((IUnknown *)buffer, &MR_BUFFER_SERVICE, &IID_IDirect3DSurface9, (void **)&surface);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
IDirect3DSurface9_Release(surface);
|
||||
|
||||
hr = IMFMediaBuffer_QueryInterface(buffer, &IID_IMF2DBuffer, (void **)&unk);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
if (SUCCEEDED(hr))
|
||||
IUnknown_Release(unk);
|
||||
|
||||
hr = IMFMediaBuffer_Lock(buffer, &data, NULL, NULL);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IMFMediaBuffer_Unlock(buffer);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
IMFSample_Release(sample);
|
||||
|
||||
IMFVideoSampleAllocator_Release(allocator);
|
||||
|
||||
IMFMediaType_Release(media_type);
|
||||
IDirect3DDeviceManager9_Release(manager);
|
||||
IDirect3DDevice9_Release(device);
|
||||
done:
|
||||
IDirect3D9_Release(d3d);
|
||||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
struct test_host
|
||||
|
|
Loading…
Reference in New Issue