Commit ff056c3f authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mfplat: Fix SetCurrentLength() for d3d9 buffer.

parent e66bfc83
......@@ -406,6 +406,17 @@ static HRESULT WINAPI d3d9_surface_buffer_Unlock(IMFMediaBuffer *iface)
return hr;
}
static HRESULT WINAPI d3d9_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 const IMFMediaBufferVtbl d3d9_surface_1d_buffer_vtbl =
{
memory_1d_2d_buffer_QueryInterface,
......@@ -414,7 +425,7 @@ static const IMFMediaBufferVtbl d3d9_surface_1d_buffer_vtbl =
d3d9_surface_buffer_Lock,
d3d9_surface_buffer_Unlock,
memory_buffer_GetCurrentLength,
memory_buffer_SetCurrentLength,
d3d9_surface_buffer_SetCurrentLength,
memory_buffer_GetMaxLength,
};
......
......@@ -5852,6 +5852,7 @@ static void test_MFCreateDXSurfaceBuffer(void)
{
IDirect3DSurface9 *backbuffer = NULL, *surface;
IDirect3DSwapChain9 *swapchain;
DWORD length, max_length;
IDirect3DDevice9 *device;
IMF2DBuffer2 *_2dbuffer2;
IMFMediaBuffer *buffer;
......@@ -5859,7 +5860,6 @@ static void test_MFCreateDXSurfaceBuffer(void)
BYTE *data, *data2;
IMFGetService *gs;
IDirect3D9 *d3d;
DWORD length;
HWND window;
HRESULT hr;
LONG pitch;
......@@ -5904,17 +5904,25 @@ static void test_MFCreateDXSurfaceBuffer(void)
IDirect3DSurface9_Release(surface);
IMFGetService_Release(gs);
length = 0;
hr = IMFMediaBuffer_GetMaxLength(buffer, &length);
max_length = 0;
hr = IMFMediaBuffer_GetMaxLength(buffer, &max_length);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(!!length, "Unexpected length %u.\n", length);
ok(!!max_length, "Unexpected length %u.\n", max_length);
hr = IMFMediaBuffer_GetCurrentLength(buffer, &length);
ok(hr == S_OK, "Failed to get length, hr %#x.\n", hr);
ok(!length, "Unexpected length %u.\n", length);
hr = IMFMediaBuffer_Lock(buffer, &data, NULL, NULL);
hr = IMFMediaBuffer_SetCurrentLength(buffer, 2 * max_length);
ok(hr == S_OK, "Failed to get length, hr %#x.\n", hr);
hr = IMFMediaBuffer_GetCurrentLength(buffer, &length);
ok(hr == S_OK, "Failed to get length, hr %#x.\n", hr);
ok(length == 2 * max_length, "Unexpected length %u.\n", length);
hr = IMFMediaBuffer_Lock(buffer, &data, NULL, &length);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(length == max_length, "Unexpected length.\n");
/* Unlock twice. */
hr = IMFMediaBuffer_Unlock(buffer);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment