Commit 9fdb1fd9 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mfplat: Add trivial implementation of MFCopyImage().

parent 1fb58ab2
...@@ -476,10 +476,21 @@ HRESULT WINAPI MFUnlockPlatform(void) ...@@ -476,10 +476,21 @@ HRESULT WINAPI MFUnlockPlatform(void)
return S_OK; return S_OK;
} }
/***********************************************************************
* MFCopyImage (mfplat.@)
*/
HRESULT WINAPI MFCopyImage(BYTE *dest, LONG deststride, const BYTE *src, LONG srcstride, DWORD width, DWORD lines) HRESULT WINAPI MFCopyImage(BYTE *dest, LONG deststride, const BYTE *src, LONG srcstride, DWORD width, DWORD lines)
{ {
FIXME("(%p, %d, %p, %d, %d, %d) stub\n", dest, deststride, src, srcstride, width, lines); TRACE("(%p, %d, %p, %d, %u, %u)\n", dest, deststride, src, srcstride, width, lines);
return E_NOTIMPL;
while (lines--)
{
memcpy(dest, src, width);
dest += deststride;
src += srcstride;
}
return S_OK;
} }
typedef struct _mfattributes typedef struct _mfattributes
......
...@@ -36,6 +36,8 @@ ...@@ -36,6 +36,8 @@
#include "wine/test.h" #include "wine/test.h"
static HRESULT (WINAPI *pMFCopyImage)(BYTE *dest, LONG deststride, const BYTE *src, LONG srcstride,
DWORD width, DWORD lines);
static HRESULT (WINAPI *pMFCreateSourceResolver)(IMFSourceResolver **resolver); static HRESULT (WINAPI *pMFCreateSourceResolver)(IMFSourceResolver **resolver);
static HRESULT (WINAPI *pMFCreateMFByteStreamOnStream)(IStream *stream, IMFByteStream **bytestream); static HRESULT (WINAPI *pMFCreateMFByteStreamOnStream)(IStream *stream, IMFByteStream **bytestream);
static HRESULT (WINAPI *pMFCreateMemoryBuffer)(DWORD max_length, IMFMediaBuffer **buffer); static HRESULT (WINAPI *pMFCreateMemoryBuffer)(DWORD max_length, IMFMediaBuffer **buffer);
...@@ -308,6 +310,7 @@ static void init_functions(void) ...@@ -308,6 +310,7 @@ static void init_functions(void)
HMODULE mod = GetModuleHandleA("mfplat.dll"); HMODULE mod = GetModuleHandleA("mfplat.dll");
#define X(f) if (!(p##f = (void*)GetProcAddress(mod, #f))) return; #define X(f) if (!(p##f = (void*)GetProcAddress(mod, #f))) return;
X(MFCopyImage);
X(MFCreateSourceResolver); X(MFCreateSourceResolver);
X(MFCreateMFByteStreamOnStream); X(MFCreateMFByteStreamOnStream);
X(MFCreateMemoryBuffer); X(MFCreateMemoryBuffer);
...@@ -877,6 +880,39 @@ static void test_allocate_queue(void) ...@@ -877,6 +880,39 @@ static void test_allocate_queue(void)
ok(hr == S_OK, "Failed to shutdown, hr %#x.\n", hr); ok(hr == S_OK, "Failed to shutdown, hr %#x.\n", hr);
} }
static void test_MFCopyImage(void)
{
BYTE dest[16], src[16];
HRESULT hr;
if (!pMFCopyImage)
{
win_skip("MFCopyImage() is not available.\n");
return;
}
memset(dest, 0xaa, sizeof(dest));
memset(src, 0x11, sizeof(src));
hr = pMFCopyImage(dest, 8, src, 8, 4, 1);
ok(hr == S_OK, "Failed to copy image %#x.\n", hr);
ok(!memcmp(dest, src, 4) && dest[4] == 0xaa, "Unexpected buffer contents.\n");
memset(dest, 0xaa, sizeof(dest));
memset(src, 0x11, sizeof(src));
hr = pMFCopyImage(dest, 8, src, 8, 16, 1);
ok(hr == S_OK, "Failed to copy image %#x.\n", hr);
ok(!memcmp(dest, src, 16), "Unexpected buffer contents.\n");
memset(dest, 0xaa, sizeof(dest));
memset(src, 0x11, sizeof(src));
hr = pMFCopyImage(dest, 8, src, 8, 8, 2);
ok(hr == S_OK, "Failed to copy image %#x.\n", hr);
ok(!memcmp(dest, src, 16), "Unexpected buffer contents.\n");
}
START_TEST(mfplat) START_TEST(mfplat)
{ {
CoInitialize(NULL); CoInitialize(NULL);
...@@ -895,6 +931,7 @@ START_TEST(mfplat) ...@@ -895,6 +931,7 @@ START_TEST(mfplat)
test_source_resolver(); test_source_resolver();
test_MFCreateAsyncResult(); test_MFCreateAsyncResult();
test_allocate_queue(); test_allocate_queue();
test_MFCopyImage();
CoUninitialize(); CoUninitialize();
} }
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