Commit 535ec306 authored by Jactry Zeng's avatar Jactry Zeng Committed by Alexandre Julliard

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

parent e8a9cd2e
......@@ -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)
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment