[PATCH 06/11] mfplat: Implement IMFattributes::GetCount().
Jactry Zeng
jzeng at codeweavers.com
Fri Dec 28 09:43:11 CST 2018
Signed-off-by: Jactry Zeng <jzeng at codeweavers.com>
---
dlls/mfplat/main.c | 10 +++++++---
dlls/mfplat/tests/mfplat.c | 23 +++++++++++++----------
2 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
index 1d8b110a09..bc3b385b14 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -881,12 +881,16 @@ static HRESULT WINAPI mfattributes_GetCount(IMFAttributes *iface, UINT32 *items)
{
mfattributes *This = impl_from_IMFAttributes(iface);
- FIXME("%p, %p\n", This, items);
+ TRACE("(%p, %p)\n", This, items);
+ EnterCriticalSection(&This->lock);
+
if(items)
- *items = 0;
+ *items = list_count(&This->attributes);
+
+ LeaveCriticalSection(&This->lock);
- return E_NOTIMPL;
+ return S_OK;
}
static HRESULT WINAPI mfattributes_GetItemByIndex(IMFAttributes *iface, UINT32 index, GUID *key, PROPVARIANT *value)
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c
index 7ae87c2fc1..01cb1a3377 100644
--- a/dlls/mfplat/tests/mfplat.c
+++ b/dlls/mfplat/tests/mfplat.c
@@ -408,28 +408,30 @@ static void test_MFCreateMediaEvent(void)
IMFMediaEvent_Release(mediaevent);
}
+#define CHECK_COUNT(obj,expected) _check_count(obj, expected, __LINE__)
+static void _check_count(IMFAttributes* obj, ULONG expected, int line)
+{
+ UINT32 count = 9999;
+ HRESULT hr;
+ hr = IMFAttributes_GetCount(obj, &count);
+ ok_(__FILE__,line)(hr == S_OK, "IMFAttributes_GetCount failed: 0x%08x.\n", hr);
+ ok_(__FILE__,line)(count == expected, "got %d, expected %d.\n", count, expected);
+}
+
static void test_MFCreateAttributes(void)
{
IMFAttributes *attributes;
HRESULT hr;
- UINT32 count;
UINT32 uint32_value;
UINT64 uint64_value;
hr = MFCreateAttributes( &attributes, 3 );
ok(hr == S_OK, "got 0x%08x\n", hr);
-
- count = 88;
- hr = IMFAttributes_GetCount(attributes, &count);
- todo_wine ok(hr == S_OK, "got 0x%08x\n", hr);
- ok(count == 0, "got %d\n", count);
+ CHECK_COUNT(attributes, 0);
hr = IMFAttributes_SetUINT32(attributes, &MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, 123);
ok(hr == S_OK, "IMFAttributes_SetUINT32 failed: 0x%08x.\n", hr);
-
- hr = IMFAttributes_GetCount(attributes, &count);
- todo_wine ok(hr == S_OK, "got 0x%08x\n", hr);
- todo_wine ok(count == 1, "got %d\n", count);
+ CHECK_COUNT(attributes, 1);
uint32_value = 0xdeadbeef;
hr = IMFAttributes_GetUINT32(attributes, &MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, &uint32_value);
@@ -443,6 +445,7 @@ static void test_MFCreateAttributes(void)
hr = IMFAttributes_SetUINT64(attributes, &MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, 65536);
ok(hr == S_OK, "IMFAttributes_SetUINT64 failed: 0x%08x.\n", hr);
+ CHECK_COUNT(attributes, 1);
hr = IMFAttributes_GetUINT64(attributes, &MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, &uint64_value);
ok(hr == S_OK, "IMFAttributes_GetUINT64 failed: 0x%08x.\n", hr);
--
2.19.2
More information about the wine-devel
mailing list