winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
March 2019
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
1097 discussions
Start a n
N
ew thread
Francois Gouget : dbghelp: Spelling fixes in a couple of comments.
by Alexandre Julliard
14 Mar '19
14 Mar '19
Module: wine Branch: master Commit: ab71398eb09d24f9f99b6266cb3005faea7a448f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ab71398eb09d24f9f99b6266…
Author: Francois Gouget <fgouget(a)free.fr> Date: Thu Mar 14 02:40:53 2019 +0100 dbghelp: Spelling fixes in a couple of comments. Signed-off-by: Francois Gouget <fgouget(a)free.fr> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dbghelp/symbol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c index 96a1f87..f59e322 100644 --- a/dlls/dbghelp/symbol.c +++ b/dlls/dbghelp/symbol.c @@ -850,7 +850,7 @@ static void symt_get_length(struct module* module, const struct symt* symt, ULON *size = 0x1000; /* arbitrary value */ } -/* neede by symt_find_nearest */ +/* needed by symt_find_nearest */ static int symt_get_best_at(struct module* module, int idx_sorttab) { ULONG64 ref_addr; @@ -870,7 +870,7 @@ static int symt_get_best_at(struct module* module, int idx_sorttab) !cmp_sorttab_addr(module, idx_sorttab + 1, ref_addr)) idx_sorttab++; } - /* if no better symbol fond restore original */ + /* if no better symbol was found restore the original */ if (module->addr_sorttab[idx_sorttab]->symt.tag == SymTagPublicSymbol) idx_sorttab = idx_sorttab_orig; }
1
0
0
0
Jactry Zeng : mfplat: Implement IMFAttributes::DeleteAllItems().
by Alexandre Julliard
14 Mar '19
14 Mar '19
Module: wine Branch: master Commit: 20ab5230f6835a66f9ae004b6f22f368dbb41f4b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=20ab5230f6835a66f9ae004b…
Author: Jactry Zeng <jzeng(a)codeweavers.com> Date: Thu Mar 14 11:03:16 2019 +0300 mfplat: Implement IMFAttributes::DeleteAllItems(). Signed-off-by: Jactry Zeng <jzeng(a)codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfplat/main.c | 18 +++++++++++++++--- dlls/mfplat/tests/mfplat.c | 4 ++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index 31bed33..5a37eba 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -962,11 +962,23 @@ static HRESULT WINAPI mfattributes_DeleteItem(IMFAttributes *iface, REFGUID key) static HRESULT WINAPI mfattributes_DeleteAllItems(IMFAttributes *iface) { - mfattributes *This = impl_from_IMFAttributes(iface); + struct attributes *attributes = impl_from_IMFAttributes(iface); - FIXME("%p\n", This); + TRACE("%p.\n", iface); - return E_NOTIMPL; + EnterCriticalSection(&attributes->cs); + + while (attributes->count) + { + PropVariantClear(&attributes->attributes[--attributes->count].value); + } + heap_free(attributes->attributes); + attributes->attributes = NULL; + attributes->capacity = 0; + + LeaveCriticalSection(&attributes->cs); + + return S_OK; } static HRESULT WINAPI mfattributes_SetUINT32(IMFAttributes *iface, REFGUID key, UINT32 value) diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 5579e02..a999b9b 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -714,6 +714,10 @@ static void test_MFCreateAttributes(void) hr = IMFAttributes_GetUnknown(attributes, &DUMMY_CLSID, &IID_IUnknown, (void **)&unk_value); ok(hr == MF_E_INVALIDTYPE, "Unexpected hr %#x.\n", hr); + hr = IMFAttributes_DeleteAllItems(attributes); + ok(hr == S_OK, "Failed to delete items, hr %#x.\n", hr); + CHECK_ATTR_COUNT(attributes, 0); + IMFAttributes_Release(attributes); }
1
0
0
0
Jactry Zeng : mfplat: Implement IMFAttributes::{SetUnknown, GetUnknown}.
by Alexandre Julliard
14 Mar '19
14 Mar '19
Module: wine Branch: master Commit: 57ac2649f86e25ca7761e235d3719ae5b55708c5 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=57ac2649f86e25ca7761e235…
Author: Jactry Zeng <jzeng(a)codeweavers.com> Date: Thu Mar 14 11:03:15 2019 +0300 mfplat: Implement IMFAttributes::{SetUnknown, GetUnknown}. Signed-off-by: Jactry Zeng <jzeng(a)codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfplat/main.c | 25 ++++++++++++++++++++----- dlls/mfplat/tests/mfplat.c | 25 +++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index d73076b..31bed33 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -671,7 +671,7 @@ static HRESULT attributes_get_item(struct attributes *attributes, const GUID *ke attribute = attributes_find_item(attributes, key, NULL); if (attribute) { - if (attribute->value.vt == value->vt) + if (attribute->value.vt == value->vt && !(value->vt == VT_UNKNOWN && !attribute->value.u.punkVal)) hr = PropVariantCopy(value, &attribute->value); else hr = MF_E_INVALIDTYPE; @@ -866,9 +866,19 @@ static HRESULT WINAPI mfattributes_GetAllocatedBlob(IMFAttributes *iface, REFGUI static HRESULT WINAPI mfattributes_GetUnknown(IMFAttributes *iface, REFGUID key, REFIID riid, void **ppv) { - FIXME("%p, %s, %s, %p.\n", iface, debugstr_attr(key), debugstr_guid(riid), ppv); + struct attributes *attributes = impl_from_IMFAttributes(iface); + PROPVARIANT attrval; + HRESULT hr; - return E_NOTIMPL; + TRACE("%p, %s, %s, %p.\n", iface, debugstr_attr(key), debugstr_guid(riid), ppv); + + PropVariantInit(&attrval); + attrval.vt = VT_UNKNOWN; + hr = attributes_get_item(attributes, key, &attrval); + if (SUCCEEDED(hr)) + hr = IUnknown_QueryInterface(attrval.u.punkVal, riid, ppv); + PropVariantClear(&attrval); + return hr; } static HRESULT attributes_set_item(struct attributes *attributes, REFGUID key, REFPROPVARIANT value) @@ -1023,9 +1033,14 @@ static HRESULT WINAPI mfattributes_SetBlob(IMFAttributes *iface, REFGUID key, co static HRESULT WINAPI mfattributes_SetUnknown(IMFAttributes *iface, REFGUID key, IUnknown *unknown) { - FIXME("%p, %s, %p.\n", iface, debugstr_attr(key), unknown); + struct attributes *attributes = impl_from_IMFAttributes(iface); + PROPVARIANT attrval; - return E_NOTIMPL; + TRACE("%p, %s, %p.\n", iface, debugstr_attr(key), unknown); + + attrval.vt = VT_UNKNOWN; + attrval.u.punkVal = unknown; + return attributes_set_item(attributes, key, &attrval); } static HRESULT WINAPI mfattributes_LockStore(IMFAttributes *iface) diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 3fda11d..5579e02 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -511,6 +511,7 @@ static void test_MFCreateAttributes(void) UINT32 value, string_length; IMFAttributes *attributes; double double_value; + IUnknown *unk_value; WCHAR bufferW[256]; UINT64 value64; WCHAR *string; @@ -689,6 +690,30 @@ static void test_MFCreateAttributes(void) ok(hr == MF_E_INVALIDTYPE, "Unexpected hr %#x.\n", hr); ok(string_length == 0xdeadbeef, "Unexpected length %u.\n", string_length); + /* VT_UNKNOWN */ + hr = IMFAttributes_SetUnknown(attributes, &DUMMY_GUID2, (IUnknown *)attributes); + ok(hr == S_OK, "Failed to set value, hr %#x.\n", hr); + CHECK_ATTR_COUNT(attributes, 4); + + hr = IMFAttributes_GetUnknown(attributes, &DUMMY_GUID2, &IID_IUnknown, (void **)&unk_value); + ok(hr == S_OK, "Failed to get value, hr %#x.\n", hr); + IUnknown_Release(unk_value); + + hr = IMFAttributes_GetUnknown(attributes, &DUMMY_GUID2, &IID_IMFAttributes, (void **)&unk_value); + ok(hr == S_OK, "Failed to get value, hr %#x.\n", hr); + IUnknown_Release(unk_value); + + hr = IMFAttributes_GetUnknown(attributes, &DUMMY_GUID2, &IID_IStream, (void **)&unk_value); + ok(hr == E_NOINTERFACE, "Unexpected hr %#x.\n", hr); + + hr = IMFAttributes_SetUnknown(attributes, &DUMMY_CLSID, NULL); + ok(hr == S_OK, "Failed to set value, hr %#x.\n", hr); + CHECK_ATTR_COUNT(attributes, 5); + + unk_value = NULL; + hr = IMFAttributes_GetUnknown(attributes, &DUMMY_CLSID, &IID_IUnknown, (void **)&unk_value); + ok(hr == MF_E_INVALIDTYPE, "Unexpected hr %#x.\n", hr); + IMFAttributes_Release(attributes); }
1
0
0
0
Jactry Zeng : mfplat: Add support for string attributes.
by Alexandre Julliard
14 Mar '19
14 Mar '19
Module: wine Branch: master Commit: e00bfc4c91b8649c1a11f465c1944d6e489ed3db URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e00bfc4c91b8649c1a11f465…
Author: Jactry Zeng <jzeng(a)codeweavers.com> Date: Thu Mar 14 11:03:14 2019 +0300 mfplat: Add support for string attributes. Signed-off-by: Jactry Zeng <jzeng(a)codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfplat/main.c | 63 ++++++++++++++++++++++++++++++++++------- dlls/mfplat/tests/mfplat.c | 44 ++++++++++++++++++++++++++-- dlls/mfreadwrite/tests/mfplat.c | 2 +- 3 files changed, 95 insertions(+), 14 deletions(-) diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index 6fb917e..d73076b 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -785,25 +785,61 @@ static HRESULT WINAPI mfattributes_GetGUID(IMFAttributes *iface, REFGUID key, GU static HRESULT WINAPI mfattributes_GetStringLength(IMFAttributes *iface, REFGUID key, UINT32 *length) { - FIXME("%p, %s, %p.\n", iface, debugstr_attr(key), length); + struct attributes *attributes = impl_from_IMFAttributes(iface); + PROPVARIANT attrval; + HRESULT hr; - return E_NOTIMPL; + TRACE("%p, %s, %p.\n", iface, debugstr_attr(key), length); + + PropVariantInit(&attrval); + attrval.vt = VT_LPWSTR; + hr = attributes_get_item(attributes, key, &attrval); + if (SUCCEEDED(hr) && length) + *length = lstrlenW(attrval.u.pwszVal); + PropVariantClear(&attrval); + + return hr; } static HRESULT WINAPI mfattributes_GetString(IMFAttributes *iface, REFGUID key, WCHAR *value, - UINT32 size, UINT32 *length) + UINT32 size, UINT32 *length) { - FIXME("%p, %s, %p, %d, %p.\n", iface, debugstr_attr(key), value, size, length); + struct attributes *attributes = impl_from_IMFAttributes(iface); + PROPVARIANT attrval; + HRESULT hr; - return E_NOTIMPL; + TRACE("%p, %s, %p, %d, %p.\n", iface, debugstr_attr(key), value, size, length); + + PropVariantInit(&attrval); + attrval.vt = VT_LPWSTR; + hr = attributes_get_item(attributes, key, &attrval); + if (SUCCEEDED(hr)) + hr = PropVariantToString(&attrval, value, size); + if (SUCCEEDED(hr) && length) + *length = lstrlenW(value); + PropVariantClear(&attrval); + + return hr; } -static HRESULT WINAPI mfattributes_GetAllocatedString(IMFAttributes *iface, REFGUID key, - WCHAR **value, UINT32 *length) +static HRESULT WINAPI mfattributes_GetAllocatedString(IMFAttributes *iface, REFGUID key, WCHAR **value, UINT32 *length) { - FIXME("%p, %s, %p, %p.\n", iface, debugstr_attr(key), value, length); + struct attributes *attributes = impl_from_IMFAttributes(iface); + PROPVARIANT attrval; + HRESULT hr; - return E_NOTIMPL; + TRACE("%p, %s, %p, %p.\n", iface, debugstr_attr(key), value, length); + + PropVariantInit(&attrval); + attrval.vt = VT_LPWSTR; + hr = attributes_get_item(attributes, key, &attrval); + if (SUCCEEDED(hr)) + { + *value = attrval.u.pwszVal; + *length = lstrlenW(*value); + } + + return hr; } static HRESULT WINAPI mfattributes_GetBlobSize(IMFAttributes *iface, REFGUID key, UINT32 *size) @@ -968,9 +1004,14 @@ static HRESULT WINAPI mfattributes_SetGUID(IMFAttributes *iface, REFGUID key, RE static HRESULT WINAPI mfattributes_SetString(IMFAttributes *iface, REFGUID key, const WCHAR *value) { - FIXME("%p, %s, %s.\n", iface, debugstr_attr(key), debugstr_w(value)); + struct attributes *attributes = impl_from_IMFAttributes(iface); + PROPVARIANT attrval; - return E_NOTIMPL; + TRACE("%p, %s, %s.\n", iface, debugstr_attr(key), debugstr_w(value)); + + attrval.vt = VT_LPWSTR; + attrval.u.pwszVal = (WCHAR *)value; + return attributes_set_item(attributes, key, &attrval); } static HRESULT WINAPI mfattributes_SetBlob(IMFAttributes *iface, REFGUID key, const UINT8 *buf, UINT32 size) diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index e6a3f4b..3fda11d 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -44,6 +44,7 @@ DEFINE_GUID(DUMMY_GUID3, 0x12345678,0x1234,0x1234,0x23,0x23,0x23,0x23,0x23,0x23, #include "mferror.h" #include "mfreadwrite.h" #include "propvarutil.h" +#include "strsafe.h" #include "wine/test.h" @@ -285,7 +286,7 @@ static void test_source_resolver(void) (void **)&attributes); ok(hr == S_OK, "got 0x%08x\n", hr); hr = IMFAttributes_SetString(attributes, &MF_BYTESTREAM_CONTENT_TYPE, file_type); - todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); + ok(hr == S_OK, "Failed to set string value, hr %#x.\n", hr); IMFAttributes_Release(attributes); hr = IMFSourceResolver_CreateObjectFromByteStream( @@ -505,11 +506,14 @@ static void check_attr_count(IMFAttributes* obj, UINT32 expected, int line) static void test_MFCreateAttributes(void) { + static const WCHAR stringW[] = {'W','i','n','e',0}; PROPVARIANT propvar, ret_propvar; + UINT32 value, string_length; IMFAttributes *attributes; double double_value; + WCHAR bufferW[256]; UINT64 value64; - UINT32 value; + WCHAR *string; HRESULT hr; GUID key; @@ -649,6 +653,42 @@ static void test_MFCreateAttributes(void) 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); + hr = IMFAttributes_SetString(attributes, &DUMMY_GUID1, stringW); + ok(hr == S_OK, "Failed to set string attribute, hr %#x.\n", hr); + CHECK_ATTR_COUNT(attributes, 3); + + hr = IMFAttributes_GetStringLength(attributes, &DUMMY_GUID1, &string_length); + ok(hr == S_OK, "Failed to get string length, hr %#x.\n", hr); + ok(string_length == lstrlenW(stringW), "Unexpected length %u.\n", string_length); + + string_length = 0xdeadbeef; + hr = IMFAttributes_GetAllocatedString(attributes, &DUMMY_GUID1, &string, &string_length); + ok(hr == S_OK, "Failed to get allocated string, hr %#x.\n", hr); + ok(!lstrcmpW(string, stringW), "Unexpected string %s.\n", wine_dbgstr_w(string)); + ok(string_length == lstrlenW(stringW), "Unexpected length %u.\n", string_length); + CoTaskMemFree(string); + + string_length = 0xdeadbeef; + hr = IMFAttributes_GetString(attributes, &DUMMY_GUID1, bufferW, ARRAY_SIZE(bufferW), &string_length); + ok(hr == S_OK, "Failed to get string value, hr %#x.\n", hr); + ok(!lstrcmpW(bufferW, stringW), "Unexpected string %s.\n", wine_dbgstr_w(bufferW)); + ok(string_length == lstrlenW(stringW), "Unexpected length %u.\n", string_length); + memset(bufferW, 0, sizeof(bufferW)); + + hr = IMFAttributes_GetString(attributes, &DUMMY_GUID1, bufferW, ARRAY_SIZE(bufferW), NULL); + ok(hr == S_OK, "Failed to get string value, hr %#x.\n", hr); + ok(!lstrcmpW(bufferW, stringW), "Unexpected string %s.\n", wine_dbgstr_w(bufferW)); + memset(bufferW, 0, sizeof(bufferW)); + + hr = IMFAttributes_GetString(attributes, &DUMMY_GUID1, bufferW, 1, NULL); + ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "Unexpected hr %#x.\n", hr); + ok(!bufferW[0], "Unexpected string %s.\n", wine_dbgstr_w(bufferW)); + + string_length = 0xdeadbeef; + hr = IMFAttributes_GetStringLength(attributes, &GUID_NULL, &string_length); + ok(hr == MF_E_INVALIDTYPE, "Unexpected hr %#x.\n", hr); + ok(string_length == 0xdeadbeef, "Unexpected length %u.\n", string_length); + IMFAttributes_Release(attributes); } diff --git a/dlls/mfreadwrite/tests/mfplat.c b/dlls/mfreadwrite/tests/mfplat.c index 1767433..609510d 100644 --- a/dlls/mfreadwrite/tests/mfplat.c +++ b/dlls/mfreadwrite/tests/mfplat.c @@ -64,7 +64,7 @@ static void test_MFCreateSourceReaderFromByteStream(void) ok(hr == S_OK, "got 0x%08x\n", hr); hr = IMFAttributes_SetString(attributes, &MF_READWRITE_MMCSS_CLASS_AUDIO, audio); - todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); + ok(hr == S_OK, "Failed to set string value, hr %#x.\n", hr); hr = IMFAttributes_SetUINT32(attributes, &MF_READWRITE_MMCSS_PRIORITY_AUDIO, 0); ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr);
1
0
0
0
Jactry Zeng : mfplat: Implement IMFAttributes::{SetDouble, GetDouble}.
by Alexandre Julliard
14 Mar '19
14 Mar '19
Module: wine Branch: master Commit: 535ec306a4c3d45520108f6e88db13d6dc8a49e8 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=535ec306a4c3d45520108f6e…
Author: Jactry Zeng <jzeng(a)codeweavers.com> Date: Thu Mar 14 11:03:13 2019 +0300 mfplat: Implement IMFAttributes::{SetDouble, GetDouble}. Signed-off-by: Jactry Zeng <jzeng(a)codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)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); }
1
0
0
0
Jactry Zeng : mfplat: Implement IMFAttributes::GetCount().
by Alexandre Julliard
14 Mar '19
14 Mar '19
Module: wine Branch: master Commit: e8a9cd2e06910eee8af494c746dad6ae47e0c0ee URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e8a9cd2e06910eee8af494c7…
Author: Jactry Zeng <jzeng(a)codeweavers.com> Date: Thu Mar 14 11:03:12 2019 +0300 mfplat: Implement IMFAttributes::GetCount(). Signed-off-by: Jactry Zeng <jzeng(a)codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfplat/main.c | 11 ++++++----- dlls/mfplat/tests/mfplat.c | 27 +++++++++++++++++---------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index 4b4f262..7bb09d6 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -993,14 +993,15 @@ static HRESULT WINAPI mfattributes_UnlockStore(IMFAttributes *iface) static HRESULT WINAPI mfattributes_GetCount(IMFAttributes *iface, UINT32 *items) { - mfattributes *This = impl_from_IMFAttributes(iface); + struct attributes *attributes = impl_from_IMFAttributes(iface); - FIXME("%p, %p\n", This, items); + TRACE("%p, %p.\n", iface, items); - if(items) - *items = 0; + EnterCriticalSection(&attributes->cs); + *items = attributes->count; + LeaveCriticalSection(&attributes->cs); - return E_NOTIMPL; + return S_OK; } static HRESULT WINAPI mfattributes_GetItemByIndex(IMFAttributes *iface, UINT32 index, GUID *key, PROPVARIANT *value) diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index b51e5e2..361584f 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -494,29 +494,31 @@ static void test_MFCreateMediaEvent(void) IMFMediaEvent_Release(mediaevent); } +#define CHECK_ATTR_COUNT(obj, expected) check_attr_count(obj, expected, __LINE__) +static void check_attr_count(IMFAttributes* obj, UINT32 expected, int line) +{ + UINT32 count = expected + 1; + HRESULT hr = IMFAttributes_GetCount(obj, &count); + ok_(__FILE__, line)(hr == S_OK, "Failed to get attributes count, hr %#x.\n", hr); + ok_(__FILE__, line)(count == expected, "Unexpected count %u, expected %u.\n", count, expected); +} + static void test_MFCreateAttributes(void) { PROPVARIANT propvar, ret_propvar; IMFAttributes *attributes; - UINT32 count, value; UINT64 value64; + UINT32 value; HRESULT hr; GUID key; hr = MFCreateAttributes( &attributes, 3 ); ok(hr == S_OK, "got 0x%08x\n", hr); - count = 88; - hr = IMFAttributes_GetCount(attributes, &count); - todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); - ok(count == 0, "got %d\n", count); - + CHECK_ATTR_COUNT(attributes, 0); hr = IMFAttributes_SetUINT32(attributes, &MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, 123); ok(hr == S_OK, "Failed to set UINT32 value, hr %#x.\n", hr); - - hr = IMFAttributes_GetCount(attributes, &count); - todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); - todo_wine ok(count == 1, "got %d\n", count); + CHECK_ATTR_COUNT(attributes, 1); value = 0xdeadbeef; hr = IMFAttributes_GetUINT32(attributes, &MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, &value); @@ -530,6 +532,7 @@ static void test_MFCreateAttributes(void) hr = IMFAttributes_SetUINT64(attributes, &MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, 65536); ok(hr == S_OK, "Failed to set UINT64 value, hr %#x.\n", hr); + CHECK_ATTR_COUNT(attributes, 1); hr = IMFAttributes_GetUINT64(attributes, &MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, &value64); ok(hr == S_OK, "Failed to get UINT64 value, hr %#x.\n", hr); @@ -557,6 +560,7 @@ static void test_MFCreateAttributes(void) ok(hr == S_OK, "Failed to get item, hr %#x.\n", hr); ok(!PropVariantCompareEx(&propvar, &ret_propvar, 0, 0), "Unexpected item value.\n"); PropVariantClear(&ret_propvar); + CHECK_ATTR_COUNT(attributes, 1); PropVariantInit(&ret_propvar); ret_propvar.vt = MF_ATTRIBUTE_STRING; @@ -581,6 +585,7 @@ static void test_MFCreateAttributes(void) ok(!PropVariantCompareEx(&propvar, &ret_propvar, 0, 0), "Unexpected item value.\n"); PropVariantClear(&ret_propvar); PropVariantClear(&propvar); + CHECK_ATTR_COUNT(attributes, 1); PropVariantInit(&propvar); propvar.vt = VT_I4; @@ -604,9 +609,11 @@ static void test_MFCreateAttributes(void) hr = IMFAttributes_DeleteItem(attributes, &DUMMY_GUID2); ok(hr == S_OK, "Failed to delete item, hr %#x.\n", hr); + CHECK_ATTR_COUNT(attributes, 2); hr = IMFAttributes_DeleteItem(attributes, &DUMMY_GUID2); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + CHECK_ATTR_COUNT(attributes, 2); hr = IMFAttributes_GetItem(attributes, &DUMMY_GUID3, &ret_propvar); ok(hr == S_OK, "Failed to get item, hr %#x.\n", hr);
1
0
0
0
Jactry Zeng : mfplat: Add support for integer attribute values.
by Alexandre Julliard
14 Mar '19
14 Mar '19
Module: wine Branch: master Commit: c127fab80e2c47d531d29d7e286dd6455450a727 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c127fab80e2c47d531d29d7e…
Author: Jactry Zeng <jzeng(a)codeweavers.com> Date: Thu Mar 14 11:03:11 2019 +0300 mfplat: Add support for integer attribute values. Signed-off-by: Jactry Zeng <jzeng(a)codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfplat/Makefile.in | 2 +- dlls/mfplat/main.c | 71 +++++++++++++++++++++++++++++++++++------ dlls/mfplat/tests/mfplat.c | 35 +++++++++++++++----- dlls/mfreadwrite/tests/mfplat.c | 2 +- 4 files changed, 91 insertions(+), 19 deletions(-) diff --git a/dlls/mfplat/Makefile.in b/dlls/mfplat/Makefile.in index e64e405..eb9b26f 100644 --- a/dlls/mfplat/Makefile.in +++ b/dlls/mfplat/Makefile.in @@ -1,6 +1,6 @@ MODULE = mfplat.dll IMPORTLIB = mfplat -IMPORTS = advapi32 ole32 mfuuid +IMPORTS = advapi32 ole32 mfuuid propsys C_SRCS = \ buffer.c \ diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index c339f23..4b4f262 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -20,6 +20,7 @@ #include <string.h> #define COBJMACROS +#define NONAMELESSUNION #include "windef.h" #include "winbase.h" @@ -35,6 +36,7 @@ #include "mfplat_private.h" #include "mfreadwrite.h" +#include "propvarutil.h" WINE_DEFAULT_DEBUG_CHANNEL(mfplat); @@ -659,6 +661,29 @@ static struct attribute *attributes_find_item(struct attributes *attributes, REF return NULL; } +static HRESULT attributes_get_item(struct attributes *attributes, const GUID *key, PROPVARIANT *value) +{ + struct attribute *attribute; + HRESULT hr; + + EnterCriticalSection(&attributes->cs); + + attribute = attributes_find_item(attributes, key, NULL); + if (attribute) + { + if (attribute->value.vt == value->vt) + hr = PropVariantCopy(value, &attribute->value); + else + hr = MF_E_INVALIDTYPE; + } + else + hr = MF_E_ATTRIBUTENOTFOUND; + + LeaveCriticalSection(&attributes->cs); + + return hr; +} + static HRESULT WINAPI mfattributes_GetItem(IMFAttributes *iface, REFGUID key, PROPVARIANT *value) { struct attributes *attributes = impl_from_IMFAttributes(iface); @@ -705,16 +730,34 @@ static HRESULT WINAPI mfattributes_Compare(IMFAttributes *iface, IMFAttributes * static HRESULT WINAPI mfattributes_GetUINT32(IMFAttributes *iface, REFGUID key, UINT32 *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_UI4; + hr = attributes_get_item(attributes, key, &attrval); + if (SUCCEEDED(hr)) + hr = PropVariantToUInt32(&attrval, value); + return hr; } static HRESULT WINAPI mfattributes_GetUINT64(IMFAttributes *iface, REFGUID key, UINT64 *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_UI8; + hr = attributes_get_item(attributes, key, &attrval); + if (SUCCEEDED(hr)) + hr = PropVariantToUInt64(&attrval, value); + return hr; } static HRESULT WINAPI mfattributes_GetDouble(IMFAttributes *iface, REFGUID key, double *value) @@ -873,16 +916,26 @@ static HRESULT WINAPI mfattributes_DeleteAllItems(IMFAttributes *iface) static HRESULT WINAPI mfattributes_SetUINT32(IMFAttributes *iface, REFGUID key, UINT32 value) { - FIXME("%p, %s, %d.\n", iface, debugstr_attr(key), value); + struct attributes *attributes = impl_from_IMFAttributes(iface); + PROPVARIANT attrval; - return E_NOTIMPL; + TRACE("%p, %s, %d.\n", iface, debugstr_attr(key), value); + + attrval.vt = VT_UI4; + attrval.u.ulVal = value; + return attributes_set_item(attributes, key, &attrval); } static HRESULT WINAPI mfattributes_SetUINT64(IMFAttributes *iface, REFGUID key, UINT64 value) { - FIXME("%p, %s, %s.\n", iface, debugstr_attr(key), wine_dbgstr_longlong(value)); + struct attributes *attributes = impl_from_IMFAttributes(iface); + PROPVARIANT attrval; - return E_NOTIMPL; + TRACE("%p, %s, %s.\n", iface, debugstr_attr(key), wine_dbgstr_longlong(value)); + + attrval.vt = VT_UI8; + attrval.u.uhVal.QuadPart = value; + return attributes_set_item(attributes, key, &attrval); } static HRESULT WINAPI mfattributes_SetDouble(IMFAttributes *iface, REFGUID key, double value) @@ -3481,7 +3534,7 @@ static HRESULT WINAPI eventqueue_QueueEventParamUnk(IMFMediaEventQueue *iface, M TRACE("%p, %d, %s, %#x, %p.\n", iface, event_type, debugstr_guid(extended_type), status, unk); value.vt = VT_UNKNOWN; - value.punkVal = unk; + value.u.punkVal = unk; if (FAILED(hr = MFCreateMediaEvent(event_type, extended_type, status, &value, &event))) return hr; diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 273aa26..b51e5e2 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -359,25 +359,21 @@ todo_wine ok(compressed, "Unexpected value %d.\n", compressed); hr = IMFMediaType_SetUINT32(mediatype, &MF_MT_ALL_SAMPLES_INDEPENDENT, 0); -todo_wine ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr); compressed = FALSE; hr = IMFMediaType_IsCompressedFormat(mediatype, &compressed); -todo_wine ok(hr == S_OK, "Failed to get media type property, hr %#x.\n", hr); ok(compressed, "Unexpected value %d.\n", compressed); hr = IMFMediaType_SetUINT32(mediatype, &MF_MT_ALL_SAMPLES_INDEPENDENT, 1); -todo_wine ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr); compressed = TRUE; hr = IMFMediaType_IsCompressedFormat(mediatype, &compressed); -todo_wine { ok(hr == S_OK, "Failed to get media type property, hr %#x.\n", hr); ok(!compressed, "Unexpected value %d.\n", compressed); -} + hr = IMFMediaType_SetGUID(mediatype, &MF_MT_MAJOR_TYPE, &MFMediaType_Video); todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); @@ -502,7 +498,8 @@ static void test_MFCreateAttributes(void) { PROPVARIANT propvar, ret_propvar; IMFAttributes *attributes; - UINT32 count; + UINT32 count, value; + UINT64 value64; HRESULT hr; GUID key; @@ -514,13 +511,35 @@ static void test_MFCreateAttributes(void) todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); ok(count == 0, "got %d\n", count); - hr = IMFAttributes_SetUINT32(attributes, &MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, 0); - todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); + hr = IMFAttributes_SetUINT32(attributes, &MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, 123); + ok(hr == S_OK, "Failed to set UINT32 value, hr %#x.\n", hr); hr = IMFAttributes_GetCount(attributes, &count); todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); todo_wine ok(count == 1, "got %d\n", count); + value = 0xdeadbeef; + hr = IMFAttributes_GetUINT32(attributes, &MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, &value); + ok(hr == S_OK, "Failed to get UINT32 value, hr %#x.\n", hr); + ok(value == 123, "Unexpected value %u, expected: 123.\n", value); + + value64 = 0xdeadbeef; + hr = IMFAttributes_GetUINT64(attributes, &MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, &value64); + ok(hr == MF_E_INVALIDTYPE, "Unexpected hr %#x.\n", hr); + ok(value64 == 0xdeadbeef, "Unexpected value.\n"); + + hr = IMFAttributes_SetUINT64(attributes, &MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, 65536); + ok(hr == S_OK, "Failed to set UINT64 value, hr %#x.\n", hr); + + hr = IMFAttributes_GetUINT64(attributes, &MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, &value64); + ok(hr == S_OK, "Failed to get UINT64 value, hr %#x.\n", hr); + ok(value64 == 65536, "Unexpected value.\n"); + + value = 0xdeadbeef; + hr = IMFAttributes_GetUINT32(attributes, &MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, &value); + ok(hr == MF_E_INVALIDTYPE, "Unexpected hr %#x.\n", hr); + ok(value == 0xdeadbeef, "Unexpected value.\n"); + IMFAttributes_Release(attributes); hr = MFCreateAttributes(&attributes, 0); diff --git a/dlls/mfreadwrite/tests/mfplat.c b/dlls/mfreadwrite/tests/mfplat.c index 58533cc..1767433 100644 --- a/dlls/mfreadwrite/tests/mfplat.c +++ b/dlls/mfreadwrite/tests/mfplat.c @@ -67,7 +67,7 @@ static void test_MFCreateSourceReaderFromByteStream(void) todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); hr = IMFAttributes_SetUINT32(attributes, &MF_READWRITE_MMCSS_PRIORITY_AUDIO, 0); - todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); + ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr); hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); ok(hr == S_OK, "got 0x%08x\n", hr);
1
0
0
0
Jactry Zeng : mfplat: Implement IMFAttributes::GetItemByIndex().
by Alexandre Julliard
14 Mar '19
14 Mar '19
Module: wine Branch: master Commit: a80b603c03194fa567d29258b1b76db768161027 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a80b603c03194fa567d29258…
Author: Jactry Zeng <jzeng(a)codeweavers.com> Date: Thu Mar 14 11:03:10 2019 +0300 mfplat: Implement IMFAttributes::GetItemByIndex(). Signed-off-by: Jactry Zeng <jzeng(a)codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfplat/main.c | 19 ++++++++++++++++--- dlls/mfplat/tests/mfplat.c | 10 ++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index e12847e..c339f23 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -952,11 +952,24 @@ static HRESULT WINAPI mfattributes_GetCount(IMFAttributes *iface, UINT32 *items) static HRESULT WINAPI mfattributes_GetItemByIndex(IMFAttributes *iface, UINT32 index, GUID *key, PROPVARIANT *value) { - mfattributes *This = impl_from_IMFAttributes(iface); + struct attributes *attributes = impl_from_IMFAttributes(iface); + HRESULT hr = S_OK; - FIXME("%p, %d, %p, %p\n", This, index, key, value); + TRACE("%p, %u, %p, %p.\n", iface, index, key, value); - return E_NOTIMPL; + EnterCriticalSection(&attributes->cs); + + if (index < attributes->count) + { + *key = attributes->attributes[index].key; + PropVariantCopy(value, &attributes->attributes[index].value); + } + else + hr = E_INVALIDARG; + + LeaveCriticalSection(&attributes->cs); + + return hr; } static HRESULT WINAPI mfattributes_CopyAllItems(IMFAttributes *iface, IMFAttributes *dest) diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 3a94d4b..273aa26 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -504,6 +504,7 @@ static void test_MFCreateAttributes(void) IMFAttributes *attributes; UINT32 count; HRESULT hr; + GUID key; hr = MFCreateAttributes( &attributes, 3 ); ok(hr == S_OK, "got 0x%08x\n", hr); @@ -603,6 +604,15 @@ static void test_MFCreateAttributes(void) PropVariantClear(&ret_propvar); PropVariantClear(&propvar); + /* Item ordering is not consistent across Windows version. */ + hr = IMFAttributes_GetItemByIndex(attributes, 0, &key, &ret_propvar); + ok(hr == S_OK, "Failed to get item, hr %#x.\n", hr); + PropVariantClear(&ret_propvar); + + hr = IMFAttributes_GetItemByIndex(attributes, 100, &key, &ret_propvar); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + PropVariantClear(&ret_propvar); + IMFAttributes_Release(attributes); }
1
0
0
0
Jactry Zeng : mfplat: Implement IMFAttributes::DeleteItem().
by Alexandre Julliard
14 Mar '19
14 Mar '19
Module: wine Branch: master Commit: 50a57f8613f170d680191a9ccf4ffe485c56e1e4 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=50a57f8613f170d680191a9c…
Author: Jactry Zeng <jzeng(a)codeweavers.com> Date: Thu Mar 14 11:03:09 2019 +0300 mfplat: Implement IMFAttributes::DeleteItem(). Signed-off-by: Jactry Zeng <jzeng(a)codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfplat/main.c | 24 ++++++++++++++++++++++-- dlls/mfplat/tests/mfplat.c | 5 ++++- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index 8ab7c97..e12847e 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -837,9 +837,29 @@ static HRESULT WINAPI mfattributes_SetItem(IMFAttributes *iface, REFGUID key, RE static HRESULT WINAPI mfattributes_DeleteItem(IMFAttributes *iface, REFGUID key) { - FIXME("%p, %s.\n", iface, debugstr_attr(key)); + struct attributes *attributes = impl_from_IMFAttributes(iface); + struct attribute *attribute; + size_t index = 0; - return E_NOTIMPL; + TRACE("%p, %s.\n", iface, debugstr_attr(key)); + + EnterCriticalSection(&attributes->cs); + + if ((attribute = attributes_find_item(attributes, key, &index))) + { + size_t count; + + PropVariantClear(&attribute->value); + + attributes->count--; + count = attributes->count - index; + if (count) + memmove(&attributes->attributes[index], &attributes->attributes[index + 1], count * sizeof(*attributes->attributes)); + } + + LeaveCriticalSection(&attributes->cs); + + return S_OK; } static HRESULT WINAPI mfattributes_DeleteAllItems(IMFAttributes *iface) diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 8550160..3a94d4b 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -583,7 +583,10 @@ static void test_MFCreateAttributes(void) ok(hr == S_OK, "Failed to set item, hr %#x.\n", hr); hr = IMFAttributes_DeleteItem(attributes, &DUMMY_GUID2); - todo_wine ok(hr == S_OK, "Failed to delete item, hr %#x.\n", hr); + ok(hr == S_OK, "Failed to delete item, hr %#x.\n", hr); + + hr = IMFAttributes_DeleteItem(attributes, &DUMMY_GUID2); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); hr = IMFAttributes_GetItem(attributes, &DUMMY_GUID3, &ret_propvar); ok(hr == S_OK, "Failed to get item, hr %#x.\n", hr);
1
0
0
0
Jactry Zeng : mfplat: Implement IMFAttributes::{SetItem,GetItem}.
by Alexandre Julliard
14 Mar '19
14 Mar '19
Module: wine Branch: master Commit: 7edec69cd7451731402bcd4fe4fb03c6cffd548b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=7edec69cd7451731402bcd4f…
Author: Jactry Zeng <jzeng(a)codeweavers.com> Date: Thu Mar 14 11:03:08 2019 +0300 mfplat: Implement IMFAttributes::{SetItem,GetItem}. Signed-off-by: Jactry Zeng <jzeng(a)codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfplat/main.c | 85 ++++++++++++++++++++++++++++++++++++++++--- dlls/mfplat/tests/Makefile.in | 2 +- dlls/mfplat/tests/mfplat.c | 85 ++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 165 insertions(+), 7 deletions(-) diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index 9d8a3ae..8ab7c97 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -642,11 +642,41 @@ static ULONG WINAPI mfattributes_Release(IMFAttributes *iface) return refcount; } +static struct attribute *attributes_find_item(struct attributes *attributes, REFGUID key, size_t *index) +{ + size_t i; + + for (i = 0; i < attributes->count; ++i) + { + if (IsEqualGUID(key, &attributes->attributes[i].key)) + { + if (index) + *index = i; + return &attributes->attributes[i]; + } + } + + return NULL; +} + static HRESULT WINAPI mfattributes_GetItem(IMFAttributes *iface, REFGUID key, PROPVARIANT *value) { - FIXME("%p, %s, %p.\n", iface, debugstr_attr(key), value); + struct attributes *attributes = impl_from_IMFAttributes(iface); + struct attribute *attribute; + HRESULT hr; - return E_NOTIMPL; + TRACE("%p, %s, %p.\n", iface, debugstr_attr(key), value); + + EnterCriticalSection(&attributes->cs); + + if ((attribute = attributes_find_item(attributes, key, NULL))) + hr = PropVariantCopy(value, &attribute->value); + else + hr = MF_E_ATTRIBUTENOTFOUND; + + LeaveCriticalSection(&attributes->cs); + + return hr; } static HRESULT WINAPI mfattributes_GetItemType(IMFAttributes *iface, REFGUID key, MF_ATTRIBUTE_TYPE *type) @@ -753,11 +783,56 @@ static HRESULT WINAPI mfattributes_GetUnknown(IMFAttributes *iface, REFGUID key, return E_NOTIMPL; } -static HRESULT WINAPI mfattributes_SetItem(IMFAttributes *iface, REFGUID key, REFPROPVARIANT Value) +static HRESULT attributes_set_item(struct attributes *attributes, REFGUID key, REFPROPVARIANT value) { - FIXME("%p, %s, %p.\n", iface, debugstr_attr(key), Value); + struct attribute *attribute; - return E_NOTIMPL; + EnterCriticalSection(&attributes->cs); + + attribute = attributes_find_item(attributes, key, NULL); + if (!attribute) + { + if (!mf_array_reserve((void **)&attributes->attributes, &attributes->capacity, attributes->count + 1, + sizeof(*attributes->attributes))) + { + LeaveCriticalSection(&attributes->cs); + return E_OUTOFMEMORY; + } + attributes->attributes[attributes->count].key = *key; + attribute = &attributes->attributes[attributes->count++]; + } + else + PropVariantClear(&attribute->value); + + PropVariantCopy(&attribute->value, value); + + LeaveCriticalSection(&attributes->cs); + + return S_OK; +} + +static HRESULT WINAPI mfattributes_SetItem(IMFAttributes *iface, REFGUID key, REFPROPVARIANT value) +{ + struct attributes *attributes = impl_from_IMFAttributes(iface); + PROPVARIANT empty; + + TRACE("%p, %s, %p.\n", iface, debugstr_attr(key), value); + + switch (value->vt) + { + case MF_ATTRIBUTE_UINT32: + case MF_ATTRIBUTE_UINT64: + case MF_ATTRIBUTE_DOUBLE: + case MF_ATTRIBUTE_GUID: + case MF_ATTRIBUTE_STRING: + case MF_ATTRIBUTE_BLOB: + case MF_ATTRIBUTE_IUNKNOWN: + return attributes_set_item(attributes, key, value); + default: + PropVariantInit(&empty); + attributes_set_item(attributes, key, &empty); + return MF_E_INVALIDTYPE; + } } static HRESULT WINAPI mfattributes_DeleteItem(IMFAttributes *iface, REFGUID key) diff --git a/dlls/mfplat/tests/Makefile.in b/dlls/mfplat/tests/Makefile.in index 15b8e17..150ca6f 100644 --- a/dlls/mfplat/tests/Makefile.in +++ b/dlls/mfplat/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = mfplat.dll -IMPORTS = ole32 mfplat mfuuid +IMPORTS = ole32 mfplat mfuuid propsys C_SRCS = \ mfplat.c diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index aa8029c..8550160 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -35,6 +35,7 @@ DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); DEFINE_GUID(DUMMY_CLSID, 0x12345678,0x1234,0x1234,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19); DEFINE_GUID(DUMMY_GUID1, 0x12345678,0x1234,0x1234,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21); DEFINE_GUID(DUMMY_GUID2, 0x12345678,0x1234,0x1234,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22); +DEFINE_GUID(DUMMY_GUID3, 0x12345678,0x1234,0x1234,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23); #undef INITGUID #include <guiddef.h> @@ -42,6 +43,7 @@ DEFINE_GUID(DUMMY_GUID2, 0x12345678,0x1234,0x1234,0x22,0x22,0x22,0x22,0x22,0x22, #include "mfidl.h" #include "mferror.h" #include "mfreadwrite.h" +#include "propvarutil.h" #include "wine/test.h" @@ -498,9 +500,10 @@ static void test_MFCreateMediaEvent(void) static void test_MFCreateAttributes(void) { + PROPVARIANT propvar, ret_propvar; IMFAttributes *attributes; - HRESULT hr; UINT32 count; + HRESULT hr; hr = MFCreateAttributes( &attributes, 3 ); ok(hr == S_OK, "got 0x%08x\n", hr); @@ -518,6 +521,86 @@ static void test_MFCreateAttributes(void) todo_wine ok(count == 1, "got %d\n", count); IMFAttributes_Release(attributes); + + hr = MFCreateAttributes(&attributes, 0); + ok(hr == S_OK, "Failed to create attributes object, hr %#x.\n", hr); + + PropVariantInit(&propvar); + propvar.vt = MF_ATTRIBUTE_UINT32; + U(propvar).ulVal = 123; + hr = IMFAttributes_SetItem(attributes, &DUMMY_GUID1, &propvar); + ok(hr == S_OK, "Failed to set item, hr %#x.\n", hr); + PropVariantInit(&ret_propvar); + ret_propvar.vt = MF_ATTRIBUTE_UINT32; + U(ret_propvar).ulVal = 0xdeadbeef; + hr = IMFAttributes_GetItem(attributes, &DUMMY_GUID1, &ret_propvar); + ok(hr == S_OK, "Failed to get item, hr %#x.\n", hr); + ok(!PropVariantCompareEx(&propvar, &ret_propvar, 0, 0), "Unexpected item value.\n"); + PropVariantClear(&ret_propvar); + + PropVariantInit(&ret_propvar); + ret_propvar.vt = MF_ATTRIBUTE_STRING; + U(ret_propvar).pwszVal = NULL; + hr = IMFAttributes_GetItem(attributes, &DUMMY_GUID1, &ret_propvar); + ok(hr == S_OK, "Failed to get item, hr %#x.\n", hr); + ok(!PropVariantCompareEx(&propvar, &ret_propvar, 0, 0), "Unexpected item value.\n"); + PropVariantClear(&ret_propvar); + + PropVariantClear(&propvar); + + PropVariantInit(&propvar); + propvar.vt = MF_ATTRIBUTE_UINT64; + U(propvar).uhVal.QuadPart = 65536; + hr = IMFAttributes_SetItem(attributes, &DUMMY_GUID1, &propvar); + ok(hr == S_OK, "Failed to set item, hr %#x.\n", hr); + PropVariantInit(&ret_propvar); + ret_propvar.vt = MF_ATTRIBUTE_UINT32; + U(ret_propvar).ulVal = 0xdeadbeef; + hr = IMFAttributes_GetItem(attributes, &DUMMY_GUID1, &ret_propvar); + ok(hr == S_OK, "Failed to get item, hr %#x.\n", hr); + ok(!PropVariantCompareEx(&propvar, &ret_propvar, 0, 0), "Unexpected item value.\n"); + PropVariantClear(&ret_propvar); + PropVariantClear(&propvar); + + PropVariantInit(&propvar); + propvar.vt = VT_I4; + U(propvar).lVal = 123; + hr = IMFAttributes_SetItem(attributes, &DUMMY_GUID2, &propvar); + ok(hr == MF_E_INVALIDTYPE, "Failed to set item, hr %#x.\n", hr); + PropVariantInit(&ret_propvar); + ret_propvar.vt = MF_ATTRIBUTE_UINT32; + U(ret_propvar).lVal = 0xdeadbeef; + hr = IMFAttributes_GetItem(attributes, &DUMMY_GUID2, &ret_propvar); + ok(hr == S_OK, "Failed to get item, hr %#x.\n", hr); + PropVariantClear(&propvar); + ok(!PropVariantCompareEx(&propvar, &ret_propvar, 0, 0), "Unexpected item value.\n"); + PropVariantClear(&ret_propvar); + + PropVariantInit(&propvar); + propvar.vt = MF_ATTRIBUTE_UINT32; + U(propvar).ulVal = 123; + hr = IMFAttributes_SetItem(attributes, &DUMMY_GUID3, &propvar); + ok(hr == S_OK, "Failed to set item, hr %#x.\n", hr); + + hr = IMFAttributes_DeleteItem(attributes, &DUMMY_GUID2); + todo_wine ok(hr == S_OK, "Failed to delete item, hr %#x.\n", hr); + + hr = IMFAttributes_GetItem(attributes, &DUMMY_GUID3, &ret_propvar); + ok(hr == S_OK, "Failed to get item, hr %#x.\n", hr); + ok(!PropVariantCompareEx(&propvar, &ret_propvar, 0, 0), "Unexpected item value.\n"); + PropVariantClear(&ret_propvar); + PropVariantClear(&propvar); + + propvar.vt = MF_ATTRIBUTE_UINT64; + U(propvar).uhVal.QuadPart = 65536; + + hr = IMFAttributes_GetItem(attributes, &DUMMY_GUID1, &ret_propvar); + ok(hr == S_OK, "Failed to get item, hr %#x.\n", hr); + ok(!PropVariantCompareEx(&propvar, &ret_propvar, 0, 0), "Unexpected item value.\n"); + PropVariantClear(&ret_propvar); + PropVariantClear(&propvar); + + IMFAttributes_Release(attributes); } static void test_MFCreateMFByteStreamOnStream(void)
1
0
0
0
← Newer
1
...
48
49
50
51
52
53
54
...
110
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
Results per page:
10
25
50
100
200