Commit 885d8dfa authored by Giovanni Mascellani's avatar Giovanni Mascellani Committed by Alexandre Julliard

mfplat/buffer: Implement IMF2DBuffer::ContiguousCopyTo().

parent 8c0a1dfb
......@@ -601,9 +601,28 @@ static HRESULT WINAPI memory_2d_buffer_GetContiguousLength(IMF2DBuffer2 *iface,
static HRESULT WINAPI memory_2d_buffer_ContiguousCopyTo(IMF2DBuffer2 *iface, BYTE *dest_buffer, DWORD dest_length)
{
FIXME("%p, %p, %lu.\n", iface, dest_buffer, dest_length);
struct buffer *buffer = impl_from_IMF2DBuffer2(iface);
BYTE *src_scanline0, *src_buffer_start;
DWORD src_length;
LONG src_pitch;
HRESULT hr;
return E_NOTIMPL;
TRACE("%p, %p, %lu.\n", iface, dest_buffer, dest_length);
if (dest_length < buffer->_2d.plane_size)
return E_INVALIDARG;
hr = IMF2DBuffer2_Lock2DSize(iface, MF2DBuffer_LockFlags_Read, &src_scanline0, &src_pitch, &src_buffer_start, &src_length);
if (SUCCEEDED(hr))
{
copy_image(buffer, dest_buffer, buffer->_2d.width, src_scanline0, src_pitch, buffer->_2d.width, buffer->_2d.height);
if (FAILED(IMF2DBuffer2_Unlock2D(iface)))
WARN("Couldn't unlock source buffer %p, hr %#lx.\n", iface, hr);
}
return S_OK;
}
static HRESULT WINAPI memory_2d_buffer_ContiguousCopyFrom(IMF2DBuffer2 *iface, const BYTE *src_buffer, DWORD src_length)
......
......@@ -6259,12 +6259,12 @@ static void test_MFCreate2DMediaBuffer(void)
ok(hr == S_OK, "Failed to unlock buffer, hr %#lx.\n", hr);
hr = IMF2DBuffer2_ContiguousCopyTo(_2dbuffer2, data2, ptr->contiguous_length - 1);
todo_wine ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
memset(data2, 0xff, ptr->contiguous_length + 16);
hr = IMF2DBuffer2_ContiguousCopyTo(_2dbuffer2, data2, ptr->contiguous_length + 16);
todo_wine ok(hr == S_OK, "Failed to copy to contiguous buffer, hr %#lx.\n", hr);
ok(hr == S_OK, "Failed to copy to contiguous buffer, hr %#lx.\n", hr);
for (j = 0; j < ptr->contiguous_length; j++)
{
......@@ -6278,12 +6278,12 @@ static void test_MFCreate2DMediaBuffer(void)
if (data2[j] != (j & 0x7f))
break;
}
todo_wine ok(j == ptr->contiguous_length, "Unexpected byte %02x instead of %02x at position %u.\n", data2[j], j & 0x7f, j);
ok(j == ptr->contiguous_length, "Unexpected byte %02x instead of %02x at position %u.\n", data2[j], j & 0x7f, j);
memset(data2, 0xff, ptr->contiguous_length + 16);
hr = IMF2DBuffer2_ContiguousCopyTo(_2dbuffer2, data2, ptr->contiguous_length);
todo_wine ok(hr == S_OK, "Failed to copy to contiguous buffer, hr %#lx.\n", hr);
ok(hr == S_OK, "Failed to copy to contiguous buffer, hr %#lx.\n", hr);
for (j = 0; j < ptr->contiguous_length; j++)
{
......@@ -6297,7 +6297,7 @@ static void test_MFCreate2DMediaBuffer(void)
if (data2[j] != (j & 0x7f))
break;
}
todo_wine ok(j == ptr->contiguous_length, "Unexpected byte %02x instead of %02x at position %u.\n", data2[j], j & 0x7f, j);
ok(j == ptr->contiguous_length, "Unexpected byte %02x instead of %02x at position %u.\n", data2[j], j & 0x7f, j);
free(data2);
......
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