From: Jactry Zeng jzeng@codeweavers.com
Signed-off-by: Jactry Zeng jzeng@codeweavers.com Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- 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 7bb09d6528..6fb917e219 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 361584ff7b..e6a3f4b9d5 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); }