mfplat: Fix SetCurrentLength() for d3d11 buffer.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2021-03-24 12:37:19 +03:00 committed by Alexandre Julliard
parent ff056c3f86
commit dae643d2ed
2 changed files with 28 additions and 1 deletions

View File

@ -856,6 +856,17 @@ static HRESULT WINAPI dxgi_surface_buffer_Unlock(IMFMediaBuffer *iface)
return E_NOTIMPL;
}
static HRESULT WINAPI dxgi_surface_buffer_SetCurrentLength(IMFMediaBuffer *iface, DWORD current_length)
{
struct memory_buffer *buffer = impl_from_IMFMediaBuffer(iface);
TRACE("%p, %u.\n", iface, current_length);
buffer->current_length = current_length;
return S_OK;
}
static HRESULT WINAPI dxgi_surface_buffer_Lock2D(IMF2DBuffer2 *iface, BYTE **scanline0, LONG *pitch)
{
FIXME("%p, %p, %p.\n", iface, scanline0, pitch);
@ -977,7 +988,7 @@ static const IMFMediaBufferVtbl dxgi_surface_1d_buffer_vtbl =
dxgi_surface_buffer_Lock,
dxgi_surface_buffer_Unlock,
memory_buffer_GetCurrentLength,
memory_buffer_SetCurrentLength,
dxgi_surface_buffer_SetCurrentLength,
memory_buffer_GetMaxLength,
};

View File

@ -6350,6 +6350,22 @@ static void test_dxgi_surface_buffer(void)
check_interface(buffer, &IID_IMFDXGIBuffer, TRUE);
check_interface(buffer, &IID_IMFGetService, FALSE);
max_length = 0;
hr = IMFMediaBuffer_GetMaxLength(buffer, &max_length);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(!!max_length, "Unexpected length %u.\n", max_length);
hr = IMFMediaBuffer_GetCurrentLength(buffer, &cur_length);
ok(hr == S_OK, "Failed to get length, hr %#x.\n", hr);
ok(!cur_length, "Unexpected length %u.\n", cur_length);
hr = IMFMediaBuffer_SetCurrentLength(buffer, 2 * max_length);
ok(hr == S_OK, "Failed to get length, hr %#x.\n", hr);
hr = IMFMediaBuffer_GetCurrentLength(buffer, &cur_length);
ok(hr == S_OK, "Failed to get length, hr %#x.\n", hr);
ok(cur_length == 2 * max_length, "Unexpected length %u.\n", cur_length);
hr = IMFMediaBuffer_QueryInterface(buffer, &IID_IMFDXGIBuffer, (void **)&dxgi_buffer);
ok(hr == S_OK, "Failed to get interface, hr %#x.\n", hr);