mfplat: Implement IMFAttributes::DeleteItem().

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-14 11:03:09 +03:00 committed by Alexandre Julliard
parent 7edec69cd7
commit 50a57f8613
2 changed files with 26 additions and 3 deletions

View File

@ -837,9 +837,29 @@ static HRESULT WINAPI mfattributes_SetItem(IMFAttributes *iface, REFGUID key, RE
static HRESULT WINAPI mfattributes_DeleteItem(IMFAttributes *iface, REFGUID key) static HRESULT WINAPI mfattributes_DeleteItem(IMFAttributes *iface, REFGUID key)
{ {
FIXME("%p, %s.\n", iface, debugstr_attr(key)); struct attributes *attributes = impl_from_IMFAttributes(iface);
struct attribute *attribute;
size_t index = 0;
return E_NOTIMPL; TRACE("%p, %s.\n", iface, debugstr_attr(key));
EnterCriticalSection(&attributes->cs);
if ((attribute = attributes_find_item(attributes, key, &index)))
{
size_t count;
PropVariantClear(&attribute->value);
attributes->count--;
count = attributes->count - index;
if (count)
memmove(&attributes->attributes[index], &attributes->attributes[index + 1], count * sizeof(*attributes->attributes));
}
LeaveCriticalSection(&attributes->cs);
return S_OK;
} }
static HRESULT WINAPI mfattributes_DeleteAllItems(IMFAttributes *iface) static HRESULT WINAPI mfattributes_DeleteAllItems(IMFAttributes *iface)

View File

@ -583,7 +583,10 @@ static void test_MFCreateAttributes(void)
ok(hr == S_OK, "Failed to set item, hr %#x.\n", hr); ok(hr == S_OK, "Failed to set item, hr %#x.\n", hr);
hr = IMFAttributes_DeleteItem(attributes, &DUMMY_GUID2); hr = IMFAttributes_DeleteItem(attributes, &DUMMY_GUID2);
todo_wine ok(hr == S_OK, "Failed to delete item, hr %#x.\n", hr); ok(hr == S_OK, "Failed to delete item, hr %#x.\n", hr);
hr = IMFAttributes_DeleteItem(attributes, &DUMMY_GUID2);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IMFAttributes_GetItem(attributes, &DUMMY_GUID3, &ret_propvar); hr = IMFAttributes_GetItem(attributes, &DUMMY_GUID3, &ret_propvar);
ok(hr == S_OK, "Failed to get item, hr %#x.\n", hr); ok(hr == S_OK, "Failed to get item, hr %#x.\n", hr);