mfplat: Implement IMFAttributes::CopyAllItems().

Signed-off-by: Jactry Zeng <jzeng@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jactry Zeng 2019-03-15 13:56:46 +03:00 committed by Alexandre Julliard
parent 3bbbb876fa
commit 462d7ed1b6
2 changed files with 37 additions and 5 deletions

View File

@ -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 =

View File

@ -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)