[PATCH v3 8/8] mfplat: Implement IMFattributes::GetCount().
Jactry Zeng
jzeng at codeweavers.com
Sun Jan 6 09:39:22 CST 2019
Signed-off-by: Jactry Zeng <jzeng at codeweavers.com>
---
dlls/mfplat/main.c | 10 +++++++---
dlls/mfplat/tests/mfplat.c | 27 +++++++++++++++++----------
2 files changed, 24 insertions(+), 13 deletions(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
index 4dd2ce8d80..6cd230eff6 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -919,12 +919,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 = This->count;
- return E_NOTIMPL;
+ LeaveCriticalSection(&This->lock);
+
+ 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 f4107477fd..bf59c46651 100644
--- a/dlls/mfplat/tests/mfplat.c
+++ b/dlls/mfplat/tests/mfplat.c
@@ -423,28 +423,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);
@@ -458,6 +460,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);
@@ -800,8 +803,10 @@ static void test_IMFAttributes_item(void)
hr = IMFAttributes_SetItem(attributes, &DUMMY_GUID3, &propvar);
ok(hr == S_OK, "IMFAttributes_SetItem failed: 0x%08x.\n", hr);
+ CHECK_COUNT(attributes, 3);
hr = IMFAttributes_DeleteItem(attributes, &DUMMY_GUID2);
ok(hr == S_OK, "IMFAttributes_DeleteItem failed: 0x%08x.\n", hr);
+ CHECK_COUNT(attributes, 2);
if(is_prewin8())
hr = IMFAttributes_GetItemByIndex(attributes, 1, &key, &ret_propvar);
else
@@ -821,8 +826,10 @@ static void test_IMFAttributes_item(void)
ok(!PropVariantCompareEx(&propvar, &ret_propvar, 0, 0), "got wrong property.\n");
ok(IsEqualIID(&key, &DUMMY_GUID1), "got wrong key: %s.\n", wine_dbgstr_guid(&key));
+ CHECK_COUNT(attributes, 2);
hr = IMFAttributes_DeleteItem(attributes, &DUMMY_GUID2);
ok(hr == S_OK, "IMFAttributes_DeleteItem failed: 0x%08x.\n", hr);
+ CHECK_COUNT(attributes, 2);
IMFAttributes_Release(attributes);
}
--
2.20.1
More information about the wine-devel
mailing list