[PATCH 08/11] mfplat: Implement IMFattributes::{SetDouble, GetDouble}.
Jactry Zeng
jzeng at codeweavers.com
Fri Dec 28 09:47:07 CST 2018
Signed-off-by: Jactry Zeng <jzeng at codeweavers.com>
---
dlls/mfplat/main.c | 19 +++++++++++++++----
dlls/mfplat/tests/mfplat.c | 10 ++++++++++
2 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
index bc3b385b14..0b86843c2f 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -622,10 +622,17 @@ static HRESULT WINAPI mfattributes_GetUINT64(IMFAttributes *iface, REFGUID key,
static HRESULT WINAPI mfattributes_GetDouble(IMFAttributes *iface, REFGUID key, double *value)
{
mfattributes *This = impl_from_IMFAttributes(iface);
+ PROPVARIANT attrval;
+ HRESULT hres;
- FIXME("%p, %s, %p\n", This, debugstr_guid(key), value);
+ TRACE("(%p, %s, %p)\n", This, debugstr_guid(key), value);
- return E_NOTIMPL;
+ PropVariantInit(&attrval);
+ attrval.vt = MF_ATTRIBUTE_DOUBLE;
+ hres = mfattributes_getitem(This, key, &attrval, TRUE);
+ if(SUCCEEDED(hres))
+ hres = PropVariantToDouble(&attrval, value);
+ return hres;
}
static HRESULT WINAPI mfattributes_GetGUID(IMFAttributes *iface, REFGUID key, GUID *value)
@@ -817,10 +824,14 @@ static HRESULT WINAPI mfattributes_SetUINT64(IMFAttributes *iface, REFGUID key,
static HRESULT WINAPI mfattributes_SetDouble(IMFAttributes *iface, REFGUID key, double value)
{
mfattributes *This = impl_from_IMFAttributes(iface);
+ PROPVARIANT attrval;
- FIXME("%p, %s, %f\n", This, debugstr_guid(key), value);
+ TRACE("(%p, %s, %f)\n", This, debugstr_guid(key), value);
- return E_NOTIMPL;
+ PropVariantInit(&attrval);
+ attrval.vt = MF_ATTRIBUTE_DOUBLE;
+ attrval.dblVal = value;
+ return mfattribute_setitem(This, 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 01cb1a3377..2e463d36ae 100644
--- a/dlls/mfplat/tests/mfplat.c
+++ b/dlls/mfplat/tests/mfplat.c
@@ -424,6 +424,7 @@ static void test_MFCreateAttributes(void)
HRESULT hr;
UINT32 uint32_value;
UINT64 uint64_value;
+ double double_value;
hr = MFCreateAttributes( &attributes, 3 );
ok(hr == S_OK, "got 0x%08x\n", hr);
@@ -456,6 +457,15 @@ static void test_MFCreateAttributes(void)
ok(hr == MF_E_INVALIDTYPE, "IMFAttributes_GetUINT32 should fail: 0x%08x.\n", hr);
ok(uint32_value == 0xdeadbeef, "got wrong value: %d, expected: 0xdeadbeef.\n", uint32_value);
+ hr = IMFAttributes_SetDouble(attributes, &GUID_NULL, 22.0);
+ ok(hr == S_OK, "IMFAttributes_SetDouble failed: 0x%08x.\n", hr);
+ CHECK_COUNT(attributes, 2);
+
+ double_value = 0xdeadbeef;
+ hr = IMFAttributes_GetDouble(attributes, &GUID_NULL, &double_value);
+ ok(hr == S_OK, "IMFAttributes_GetDouble failed: 0x%08x.\n", hr);
+ ok(double_value == 22.0, "got wrong value: %f, expected: 22.0.\n", double_value);
+
IMFAttributes_Release(attributes);
}
--
2.19.2
More information about the wine-devel
mailing list