[PATCH 05/11] mfplat: Implement IMFAttributes::GetItemByIndex().
Nikolay Sivov
nsivov at codeweavers.com
Thu Mar 14 03:03:10 CDT 2019
From: Jactry Zeng <jzeng at codeweavers.com>
Signed-off-by: Jactry Zeng <jzeng at codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/mfplat/main.c | 19 ++++++++++++++++---
dlls/mfplat/tests/mfplat.c | 10 ++++++++++
2 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
index e12847e90d..c339f23ff6 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -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)
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c
index 3a94d4bd17..273aa2684b 100644
--- a/dlls/mfplat/tests/mfplat.c
+++ b/dlls/mfplat/tests/mfplat.c
@@ -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);
}
--
2.20.1
More information about the wine-devel
mailing list