Jactry Zeng : mfplat: Implement IMFAttributes::CopyAllItems().
Alexandre Julliard
julliard at winehq.org
Fri Mar 15 15:20:01 CDT 2019
Module: wine
Branch: master
Commit: 462d7ed1b60aa90453d5642af83ee1baf49dde7d
URL: https://source.winehq.org/git/wine.git/?a=commit;h=462d7ed1b60aa90453d5642af83ee1baf49dde7d
Author: Jactry Zeng <jzeng at codeweavers.com>
Date: Fri Mar 15 13:56:46 2019 +0300
mfplat: Implement IMFAttributes::CopyAllItems().
Signed-off-by: Jactry Zeng <jzeng at codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mfplat/main.c | 25 ++++++++++++++++++++++---
dlls/mfplat/tests/mfplat.c | 17 +++++++++++++++--
2 files changed, 37 insertions(+), 5 deletions(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
index ea4387e..7c3bad3 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -1132,11 +1132,30 @@ static HRESULT WINAPI mfattributes_GetItemByIndex(IMFAttributes *iface, UINT32 i
static HRESULT WINAPI mfattributes_CopyAllItems(IMFAttributes *iface, IMFAttributes *dest)
{
- mfattributes *This = impl_from_IMFAttributes(iface);
+ struct attributes *attributes = impl_from_IMFAttributes(iface);
+ HRESULT hr = S_OK;
+ size_t i;
- FIXME("%p, %p\n", This, dest);
+ TRACE("%p, %p.\n", iface, dest);
- return E_NOTIMPL;
+ EnterCriticalSection(&attributes->cs);
+
+ IMFAttributes_LockStore(dest);
+
+ IMFAttributes_DeleteAllItems(dest);
+
+ for (i = 0; i < attributes->count; ++i)
+ {
+ hr = IMFAttributes_SetItem(dest, &attributes->attributes[i].key, &attributes->attributes[i].value);
+ if (FAILED(hr))
+ break;
+ }
+
+ IMFAttributes_UnlockStore(dest);
+
+ LeaveCriticalSection(&attributes->cs);
+
+ return hr;
}
static const IMFAttributesVtbl mfattributes_vtbl =
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c
index a999b9b..613c2aa 100644
--- a/dlls/mfplat/tests/mfplat.c
+++ b/dlls/mfplat/tests/mfplat.c
@@ -507,9 +507,9 @@ static void check_attr_count(IMFAttributes* obj, UINT32 expected, int line)
static void test_MFCreateAttributes(void)
{
static const WCHAR stringW[] = {'W','i','n','e',0};
+ IMFAttributes *attributes, *attributes1;
PROPVARIANT propvar, ret_propvar;
UINT32 value, string_length;
- IMFAttributes *attributes;
double double_value;
IUnknown *unk_value;
WCHAR bufferW[256];
@@ -714,11 +714,24 @@ static void test_MFCreateAttributes(void)
hr = IMFAttributes_GetUnknown(attributes, &DUMMY_CLSID, &IID_IUnknown, (void **)&unk_value);
ok(hr == MF_E_INVALIDTYPE, "Unexpected hr %#x.\n", hr);
- hr = IMFAttributes_DeleteAllItems(attributes);
+ /* CopyAllItems() */
+ hr = MFCreateAttributes(&attributes1, 0);
+ ok(hr == S_OK, "Failed to create attributes object, hr %#x.\n", hr);
+ hr = IMFAttributes_CopyAllItems(attributes, attributes1);
+ ok(hr == S_OK, "Failed to copy items, hr %#x.\n", hr);
+ CHECK_ATTR_COUNT(attributes, 5);
+ CHECK_ATTR_COUNT(attributes1, 5);
+
+ hr = IMFAttributes_DeleteAllItems(attributes1);
ok(hr == S_OK, "Failed to delete items, hr %#x.\n", hr);
+ CHECK_ATTR_COUNT(attributes1, 0);
+
+ hr = IMFAttributes_CopyAllItems(attributes1, attributes);
+ ok(hr == S_OK, "Failed to copy items, hr %#x.\n", hr);
CHECK_ATTR_COUNT(attributes, 0);
IMFAttributes_Release(attributes);
+ IMFAttributes_Release(attributes1);
}
static void test_MFCreateMFByteStreamOnStream(void)
More information about the wine-cvs
mailing list