Signed-off-by: Nikolay Sivov nsivov@codeweavers.com ---
v2: fixed test failures and missing function hangs.
dlls/mfplat/main.c | 15 +++++++++++++-- dlls/mfplat/tests/mfplat.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 2 deletions(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index 94d5ab0f48..21240dfbeb 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -476,10 +476,21 @@ HRESULT WINAPI MFUnlockPlatform(void) return S_OK; }
+/*********************************************************************** + * MFCopyImage (mfplat.@) + */ 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); - return E_NOTIMPL; + TRACE("(%p, %d, %p, %d, %u, %u)\n", dest, deststride, src, srcstride, width, lines); + + while (lines--) + { + memcpy(dest, src, width); + dest += deststride; + src += srcstride; + } + + return S_OK; }
typedef struct _mfattributes diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 8b06e23375..a7b5620d32 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -36,6 +36,8 @@
#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 *pMFCreateMFByteStreamOnStream)(IStream *stream, IMFByteStream **bytestream); static HRESULT (WINAPI *pMFCreateMemoryBuffer)(DWORD max_length, IMFMediaBuffer **buffer); @@ -308,6 +310,7 @@ static void init_functions(void) HMODULE mod = GetModuleHandleA("mfplat.dll");
#define X(f) if (!(p##f = (void*)GetProcAddress(mod, #f))) return; + X(MFCopyImage); X(MFCreateSourceResolver); X(MFCreateMFByteStreamOnStream); X(MFCreateMemoryBuffer); @@ -877,6 +880,39 @@ static void test_allocate_queue(void) 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) { CoInitialize(NULL); @@ -895,6 +931,7 @@ START_TEST(mfplat) test_source_resolver(); test_MFCreateAsyncResult(); test_allocate_queue(); + test_MFCopyImage();
CoUninitialize(); }