Jactry Zeng : mfplat: Implement IMFAttributes::{SetDouble, GetDouble}.

Alexandre Julliard julliard at winehq.org
Thu Mar 14 18:33:20 CDT 2019


Module: wine
Branch: master
Commit: 535ec306a4c3d45520108f6e88db13d6dc8a49e8
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=535ec306a4c3d45520108f6e88db13d6dc8a49e8

Author: Jactry Zeng <jzeng at codeweavers.com>
Date:   Thu Mar 14 11:03:13 2019 +0300

mfplat: Implement IMFAttributes::{SetDouble, GetDouble}.

Signed-off-by: Jactry Zeng <jzeng at codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mfplat/main.c         | 22 ++++++++++++++++++----
 dlls/mfplat/tests/mfplat.c | 10 ++++++++++
 2 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
index 7bb09d6..6fb917e 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -762,9 +762,18 @@ static HRESULT WINAPI mfattributes_GetUINT64(IMFAttributes *iface, REFGUID key,
 
 static HRESULT WINAPI mfattributes_GetDouble(IMFAttributes *iface, REFGUID key, double *value)
 {
-    FIXME("%p, %s, %p.\n", iface, debugstr_attr(key), value);
+    struct attributes *attributes = impl_from_IMFAttributes(iface);
+    PROPVARIANT attrval;
+    HRESULT hr;
 
-    return E_NOTIMPL;
+    TRACE("%p, %s, %p.\n", iface, debugstr_attr(key), value);
+
+    PropVariantInit(&attrval);
+    attrval.vt = VT_R8;
+    hr = attributes_get_item(attributes, key, &attrval);
+    if (SUCCEEDED(hr))
+        hr = PropVariantToDouble(&attrval, value);
+    return hr;
 }
 
 static HRESULT WINAPI mfattributes_GetGUID(IMFAttributes *iface, REFGUID key, GUID *value)
@@ -940,9 +949,14 @@ static HRESULT WINAPI mfattributes_SetUINT64(IMFAttributes *iface, REFGUID key,
 
 static HRESULT WINAPI mfattributes_SetDouble(IMFAttributes *iface, REFGUID key, double value)
 {
-    FIXME("%p, %s, %f.\n", iface, debugstr_attr(key), value);
+    struct attributes *attributes = impl_from_IMFAttributes(iface);
+    PROPVARIANT attrval;
 
-    return E_NOTIMPL;
+    TRACE("%p, %s, %f.\n", iface, debugstr_attr(key), value);
+
+    attrval.vt = VT_R8;
+    attrval.u.dblVal = value;
+    return attributes_set_item(attributes, key, &attrval);
 }
 
 static HRESULT WINAPI mfattributes_SetGUID(IMFAttributes *iface, REFGUID key, REFGUID value)
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c
index 361584f..e6a3f4b 100644
--- a/dlls/mfplat/tests/mfplat.c
+++ b/dlls/mfplat/tests/mfplat.c
@@ -507,6 +507,7 @@ static void test_MFCreateAttributes(void)
 {
     PROPVARIANT propvar, ret_propvar;
     IMFAttributes *attributes;
+    double double_value;
     UINT64 value64;
     UINT32 value;
     HRESULT hr;
@@ -639,6 +640,15 @@ static void test_MFCreateAttributes(void)
     ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
     PropVariantClear(&ret_propvar);
 
+    hr = IMFAttributes_SetDouble(attributes, &GUID_NULL, 22.0);
+    ok(hr == S_OK, "Failed to set double value, hr %#x.\n", hr);
+    CHECK_ATTR_COUNT(attributes, 3);
+
+    double_value = 0xdeadbeef;
+    hr = IMFAttributes_GetDouble(attributes, &GUID_NULL, &double_value);
+    ok(hr == S_OK, "Failed to get double value, hr %#x.\n", hr);
+    ok(double_value == 22.0, "Unexpected value: %f, expected: 22.0.\n", double_value);
+
     IMFAttributes_Release(attributes);
 }
 




More information about the wine-cvs mailing list