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

Signed-off-by: Jactry Zeng <jzeng@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jactry Zeng 2019-03-14 11:03:13 +03:00 committed by Alexandre Julliard
parent e8a9cd2e06
commit 535ec306a4
2 changed files with 28 additions and 4 deletions

View File

@ -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)

View File

@ -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);
}