Commit a80b603c authored by Jactry Zeng's avatar Jactry Zeng Committed by Alexandre Julliard

mfplat: Implement IMFAttributes::GetItemByIndex().

parent 50a57f86
......@@ -952,11 +952,24 @@ static HRESULT WINAPI mfattributes_GetCount(IMFAttributes *iface, UINT32 *items)
static HRESULT WINAPI mfattributes_GetItemByIndex(IMFAttributes *iface, UINT32 index, GUID *key, PROPVARIANT *value)
{
mfattributes *This = impl_from_IMFAttributes(iface);
struct attributes *attributes = impl_from_IMFAttributes(iface);
HRESULT hr = S_OK;
FIXME("%p, %d, %p, %p\n", This, index, key, value);
TRACE("%p, %u, %p, %p.\n", iface, index, key, value);
return E_NOTIMPL;
EnterCriticalSection(&attributes->cs);
if (index < attributes->count)
{
*key = attributes->attributes[index].key;
PropVariantCopy(value, &attributes->attributes[index].value);
}
else
hr = E_INVALIDARG;
LeaveCriticalSection(&attributes->cs);
return hr;
}
static HRESULT WINAPI mfattributes_CopyAllItems(IMFAttributes *iface, IMFAttributes *dest)
......
......@@ -504,6 +504,7 @@ static void test_MFCreateAttributes(void)
IMFAttributes *attributes;
UINT32 count;
HRESULT hr;
GUID key;
hr = MFCreateAttributes( &attributes, 3 );
ok(hr == S_OK, "got 0x%08x\n", hr);
......@@ -603,6 +604,15 @@ static void test_MFCreateAttributes(void)
PropVariantClear(&ret_propvar);
PropVariantClear(&propvar);
/* Item ordering is not consistent across Windows version. */
hr = IMFAttributes_GetItemByIndex(attributes, 0, &key, &ret_propvar);
ok(hr == S_OK, "Failed to get item, hr %#x.\n", hr);
PropVariantClear(&ret_propvar);
hr = IMFAttributes_GetItemByIndex(attributes, 100, &key, &ret_propvar);
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
PropVariantClear(&ret_propvar);
IMFAttributes_Release(attributes);
}
......
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