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
May 2020
----- 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
1 participants
743 discussions
Start a n
N
ew thread
Nikolay Sivov : mfmediaengine: Keep auto-play flag.
by Alexandre Julliard
28 May '20
28 May '20
Module: wine Branch: master Commit: e5b25e874e0c572ed78f4ce423bd6d4d59f51a6e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e5b25e874e0c572ed78f4ce4…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Thu May 28 18:54:20 2020 +0300 mfmediaengine: Keep auto-play flag. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfmediaengine/main.c | 28 +++++++++++++++++++++++++--- dlls/mfmediaengine/tests/mfmediaengine.c | 1 - 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/dlls/mfmediaengine/main.c b/dlls/mfmediaengine/main.c index 0c082a87f5..7053a3afea 100644 --- a/dlls/mfmediaengine/main.c +++ b/dlls/mfmediaengine/main.c @@ -59,6 +59,7 @@ enum media_engine_flags { /* MF_MEDIA_ENGINE_CREATEFLAGS_MASK is 0x1f. */ FLAGS_ENGINE_SHUT_DOWN = 0x20, + FLAGS_ENGINE_AUTO_PLAY = 0x40, }; struct media_engine @@ -74,6 +75,14 @@ struct media_engine CRITICAL_SECTION cs; }; +static void media_engine_set_flag(struct media_engine *engine, unsigned int mask, BOOL value) +{ + if (value) + engine->flags |= mask; + else + engine->flags &= ~mask; +} + static inline struct media_engine *impl_from_IMFMediaEngine(IMFMediaEngine *iface) { return CONTAINING_RECORD(iface, struct media_engine, IMFMediaEngine_iface); @@ -306,16 +315,29 @@ static BOOL WINAPI media_engine_IsEnded(IMFMediaEngine *iface) static BOOL WINAPI media_engine_GetAutoPlay(IMFMediaEngine *iface) { - FIXME("(%p): stub.\n", iface); + struct media_engine *engine = impl_from_IMFMediaEngine(iface); + BOOL value; - return FALSE; + TRACE("%p.\n", iface); + + EnterCriticalSection(&engine->cs); + value = !!(engine->flags & FLAGS_ENGINE_AUTO_PLAY); + LeaveCriticalSection(&engine->cs); + + return value; } static HRESULT WINAPI media_engine_SetAutoPlay(IMFMediaEngine *iface, BOOL autoplay) { + struct media_engine *engine = impl_from_IMFMediaEngine(iface); + FIXME("(%p, %d): stub.\n", iface, autoplay); - return E_NOTIMPL; + EnterCriticalSection(&engine->cs); + media_engine_set_flag(engine, FLAGS_ENGINE_AUTO_PLAY, autoplay); + LeaveCriticalSection(&engine->cs); + + return S_OK; } static BOOL WINAPI media_engine_GetLoop(IMFMediaEngine *iface) diff --git a/dlls/mfmediaengine/tests/mfmediaengine.c b/dlls/mfmediaengine/tests/mfmediaengine.c index d3c15566a4..8f6c4ca75b 100644 --- a/dlls/mfmediaengine/tests/mfmediaengine.c +++ b/dlls/mfmediaengine/tests/mfmediaengine.c @@ -338,7 +338,6 @@ todo_wine ok(!state, "Unexpected state.\n"); hr = IMFMediaEngine_SetAutoPlay(media_engine, TRUE); -todo_wine ok(hr == S_OK, "Unexpected hr %#x.\n", hr); state = IMFMediaEngine_GetAutoPlay(media_engine);
1
0
0
0
Nikolay Sivov : mfmediaengine: Add shut down state.
by Alexandre Julliard
28 May '20
28 May '20
Module: wine Branch: master Commit: 5007c2bd365a62db4d804738b214bffbd84fd5cc URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5007c2bd365a62db4d804738…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Thu May 28 18:54:19 2020 +0300 mfmediaengine: Add shut down state. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfmediaengine/main.c | 38 ++++++++++++++++++++++++-------- dlls/mfmediaengine/tests/mfmediaengine.c | 2 -- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/dlls/mfmediaengine/main.c b/dlls/mfmediaengine/main.c index 050743e7e3..0c082a87f5 100644 --- a/dlls/mfmediaengine/main.c +++ b/dlls/mfmediaengine/main.c @@ -54,16 +54,24 @@ enum media_engine_mode MEDIA_ENGINE_FRAME_SERVER_MODE, }; +/* Used with create flags. */ +enum media_engine_flags +{ + /* MF_MEDIA_ENGINE_CREATEFLAGS_MASK is 0x1f. */ + FLAGS_ENGINE_SHUT_DOWN = 0x20, +}; + struct media_engine { IMFMediaEngine IMFMediaEngine_iface; LONG refcount; - DWORD flags; IMFMediaEngineNotify *callback; UINT64 playback_hwnd; DXGI_FORMAT output_format; IMFDXGIDeviceManager *dxgi_manager; enum media_engine_mode mode; + unsigned int flags; + CRITICAL_SECTION cs; }; static inline struct media_engine *impl_from_IMFMediaEngine(IMFMediaEngine *iface) @@ -104,6 +112,7 @@ static void free_media_engine(struct media_engine *engine) IMFMediaEngineNotify_Release(engine->callback); if (engine->dxgi_manager) IMFDXGIDeviceManager_Release(engine->dxgi_manager); + DeleteCriticalSection(&engine->cs); heap_free(engine); } @@ -395,9 +404,19 @@ static HRESULT WINAPI media_engine_GetVideoAspectRatio(IMFMediaEngine *iface, DW static HRESULT WINAPI media_engine_Shutdown(IMFMediaEngine *iface) { + struct media_engine *engine = impl_from_IMFMediaEngine(iface); + HRESULT hr = S_OK; + FIXME("(%p): stub.\n", iface); - return E_NOTIMPL; + EnterCriticalSection(&engine->cs); + if (engine->flags & FLAGS_ENGINE_SHUT_DOWN) + hr = MF_E_SHUTDOWN; + else + engine->flags |= FLAGS_ENGINE_SHUT_DOWN; + LeaveCriticalSection(&engine->cs); + + return hr; } static HRESULT WINAPI media_engine_TransferVideoFrame(IMFMediaEngine *iface, IUnknown *surface, @@ -490,10 +509,15 @@ static ULONG WINAPI media_engine_factory_Release(IMFMediaEngineClassFactory *ifa return 1; } -static HRESULT init_media_engine(IMFAttributes *attributes, struct media_engine *engine) +static HRESULT init_media_engine(DWORD flags, IMFAttributes *attributes, struct media_engine *engine) { HRESULT hr; + engine->IMFMediaEngine_iface.lpVtbl = &media_engine_vtbl; + engine->refcount = 1; + engine->flags = flags & MF_MEDIA_ENGINE_CREATEFLAGS_MASK; + InitializeCriticalSection(&engine->cs); + hr = IMFAttributes_GetUnknown(attributes, &MF_MEDIA_ENGINE_CALLBACK, &IID_IMFMediaEngineNotify, (void **)&engine->callback); if (FAILED(hr)) @@ -522,7 +546,7 @@ static HRESULT WINAPI media_engine_factory_CreateInstance(IMFMediaEngineClassFac struct media_engine *object; HRESULT hr; - TRACE("(%p, %#x, %p, %p).\n", iface, flags, attributes, engine); + TRACE("%p, %#x, %p, %p.\n", iface, flags, attributes, engine); if (!attributes || !engine) return E_POINTER; @@ -531,17 +555,13 @@ static HRESULT WINAPI media_engine_factory_CreateInstance(IMFMediaEngineClassFac if (!object) return E_OUTOFMEMORY; - hr = init_media_engine(attributes, object); + hr = init_media_engine(flags, attributes, object); if (FAILED(hr)) { free_media_engine(object); return hr; } - object->IMFMediaEngine_iface.lpVtbl = &media_engine_vtbl; - object->refcount = 1; - object->flags = flags; - *engine = &object->IMFMediaEngine_iface; return S_OK; diff --git a/dlls/mfmediaengine/tests/mfmediaengine.c b/dlls/mfmediaengine/tests/mfmediaengine.c index 07bd8c81e6..d3c15566a4 100644 --- a/dlls/mfmediaengine/tests/mfmediaengine.c +++ b/dlls/mfmediaengine/tests/mfmediaengine.c @@ -247,11 +247,9 @@ static void test_Shutdown(void) media_engine = create_media_engine(callback); hr = IMFMediaEngine_Shutdown(media_engine); -todo_wine ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr); hr = IMFMediaEngine_Shutdown(media_engine); -todo_wine ok(hr == MF_E_SHUTDOWN || broken(hr == S_OK) /* before win10 */, "Unexpected hr %#x.\n", hr); hr = IMFMediaEngine_SetSource(media_engine, NULL);
1
0
0
0
Nikolay Sivov : mfmediaengine/tests: Add some tests for shutdown state.
by Alexandre Julliard
28 May '20
28 May '20
Module: wine Branch: master Commit: a8ee0575fdb38c8f5724a4a3448d331c61514acf URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a8ee0575fdb38c8f5724a4a3…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Thu May 28 18:54:18 2020 +0300 mfmediaengine/tests: Add some tests for shutdown state. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfmediaengine/tests/Makefile.in | 2 +- dlls/mfmediaengine/tests/mfmediaengine.c | 196 +++++++++++++++++++++++++++++++ 2 files changed, 197 insertions(+), 1 deletion(-) diff --git a/dlls/mfmediaengine/tests/Makefile.in b/dlls/mfmediaengine/tests/Makefile.in index d508db9f6f..88758f7a61 100644 --- a/dlls/mfmediaengine/tests/Makefile.in +++ b/dlls/mfmediaengine/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = mfmediaengine.dll -IMPORTS = ole32 mfplat mfmediaengine mfuuid uuid +IMPORTS = ole32 mfplat mfmediaengine oleaut32 mfuuid uuid C_SRCS = \ mfmediaengine.c diff --git a/dlls/mfmediaengine/tests/mfmediaengine.c b/dlls/mfmediaengine/tests/mfmediaengine.c index 14d9eed453..07bd8c81e6 100644 --- a/dlls/mfmediaengine/tests/mfmediaengine.c +++ b/dlls/mfmediaengine/tests/mfmediaengine.c @@ -105,6 +105,34 @@ static IMFMediaEngineNotifyVtbl media_engine_notify_vtbl = media_engine_notify_EventNotify, }; +static IMFMediaEngine *create_media_engine(IMFMediaEngineNotify *callback) +{ + IMFDXGIDeviceManager *manager; + IMFMediaEngine *media_engine; + IMFAttributes *attributes; + UINT token; + HRESULT hr; + + hr = pMFCreateDXGIDeviceManager(&token, &manager); + ok(hr == S_OK, "Failed to create dxgi device manager, hr %#x.\n", hr); + + hr = MFCreateAttributes(&attributes, 3); + ok(hr == S_OK, "Failed to create attributes, hr %#x.\n", hr); + + hr = IMFAttributes_SetUnknown(attributes, &MF_MEDIA_ENGINE_CALLBACK, (IUnknown *)callback); + ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr); + hr = IMFAttributes_SetUINT32(attributes, &MF_MEDIA_ENGINE_VIDEO_OUTPUT_FORMAT, DXGI_FORMAT_UNKNOWN); + ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr); + + hr = IMFMediaEngineClassFactory_CreateInstance(factory, 0, attributes, &media_engine); + ok(hr == S_OK, "Failed to create media engine, hr %#x.\n", hr); + + IMFAttributes_Release(attributes); + IMFDXGIDeviceManager_Release(manager); + + return media_engine; +} + static void test_factory(void) { struct media_engine_notify notify_impl = {{&media_engine_notify_vtbl}, 1}; @@ -204,6 +232,173 @@ static void test_CreateInstance(void) IMFDXGIDeviceManager_Release(manager); } +static void test_Shutdown(void) +{ + struct media_engine_notify notify_impl = {{&media_engine_notify_vtbl}, 1}; + IMFMediaEngineNotify *callback = ¬ify_impl.IMFMediaEngineNotify_iface; + IMFMediaTimeRange *time_range; + IMFMediaEngine *media_engine; + unsigned int state; + DWORD cx, cy; + double val; + HRESULT hr; + BSTR str; + + media_engine = create_media_engine(callback); + + hr = IMFMediaEngine_Shutdown(media_engine); +todo_wine + ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr); + + hr = IMFMediaEngine_Shutdown(media_engine); +todo_wine + ok(hr == MF_E_SHUTDOWN || broken(hr == S_OK) /* before win10 */, "Unexpected hr %#x.\n", hr); + + hr = IMFMediaEngine_SetSource(media_engine, NULL); +todo_wine + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + hr = IMFMediaEngine_GetCurrentSource(media_engine, &str); +todo_wine + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + state = IMFMediaEngine_GetNetworkState(media_engine); + ok(!state, "Unexpected state %d.\n", state); + + /* Preload mode is still accessible. */ + state = IMFMediaEngine_GetPreload(media_engine); +todo_wine + ok(!state, "Unexpected state %d.\n", state); + + hr = IMFMediaEngine_SetPreload(media_engine, MF_MEDIA_ENGINE_PRELOAD_AUTOMATIC); +todo_wine + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + state = IMFMediaEngine_GetPreload(media_engine); +todo_wine + ok(state == MF_MEDIA_ENGINE_PRELOAD_AUTOMATIC, "Unexpected state %d.\n", state); + + hr = IMFMediaEngine_GetBuffered(media_engine, &time_range); +todo_wine + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + hr = IMFMediaEngine_Load(media_engine); +todo_wine + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + str = SysAllocString(L"video/mp4"); + hr = IMFMediaEngine_CanPlayType(media_engine, str, &state); +todo_wine + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + SysFreeString(str); + + state = IMFMediaEngine_GetReadyState(media_engine); + ok(!state, "Unexpected state %d.\n", state); + + state = IMFMediaEngine_IsSeeking(media_engine); + ok(!state, "Unexpected state %d.\n", state); + + val = IMFMediaEngine_GetCurrentTime(media_engine); + ok(val == 0.0, "Unexpected time %f.\n", val); + + hr = IMFMediaEngine_SetCurrentTime(media_engine, 1.0); +todo_wine + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + val = IMFMediaEngine_GetStartTime(media_engine); + ok(val == 0.0, "Unexpected time %f.\n", val); + + state = IMFMediaEngine_IsPaused(media_engine); +todo_wine + ok(!!state, "Unexpected state %d.\n", state); + + val = IMFMediaEngine_GetDefaultPlaybackRate(media_engine); +todo_wine + ok(val == 1.0, "Unexpected rate %f.\n", val); + + hr = IMFMediaEngine_SetDefaultPlaybackRate(media_engine, 2.0); +todo_wine + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + val = IMFMediaEngine_GetPlaybackRate(media_engine); +todo_wine + ok(val == 1.0, "Unexpected rate %f.\n", val); + + hr = IMFMediaEngine_GetPlayed(media_engine, &time_range); +todo_wine + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + hr = IMFMediaEngine_GetSeekable(media_engine, &time_range); +todo_wine + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + state = IMFMediaEngine_IsEnded(media_engine); + ok(!state, "Unexpected state %d.\n", state); + + /* Autoplay mode is still accessible. */ + state = IMFMediaEngine_GetAutoPlay(media_engine); + ok(!state, "Unexpected state.\n"); + + hr = IMFMediaEngine_SetAutoPlay(media_engine, TRUE); +todo_wine + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + state = IMFMediaEngine_GetAutoPlay(media_engine); +todo_wine + ok(!!state, "Unexpected state.\n"); + + /* Loop mode is still accessible. */ + state = IMFMediaEngine_GetLoop(media_engine); + ok(!state, "Unexpected state.\n"); + + hr = IMFMediaEngine_SetLoop(media_engine, TRUE); +todo_wine + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + state = IMFMediaEngine_GetLoop(media_engine); +todo_wine + ok(!!state, "Unexpected state.\n"); + + hr = IMFMediaEngine_Play(media_engine); +todo_wine + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + hr = IMFMediaEngine_Pause(media_engine); +todo_wine + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + state = IMFMediaEngine_GetMuted(media_engine); + ok(!state, "Unexpected state.\n"); + + hr = IMFMediaEngine_SetMuted(media_engine, TRUE); +todo_wine + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + val = IMFMediaEngine_GetVolume(media_engine); +todo_wine + ok(val == 1.0, "Unexpected value %f.\n", val); + + val = IMFMediaEngine_SetVolume(media_engine, 2.0); +todo_wine + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + state = IMFMediaEngine_HasVideo(media_engine); + ok(!state, "Unexpected state.\n"); + + state = IMFMediaEngine_HasAudio(media_engine); + ok(!state, "Unexpected state.\n"); + + hr = IMFMediaEngine_GetNativeVideoSize(media_engine, &cx, &cy); +todo_wine + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + hr = IMFMediaEngine_GetVideoAspectRatio(media_engine, &cx, &cy); +todo_wine + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + IMFMediaEngine_Release(media_engine); +} + START_TEST(mfmediaengine) { HRESULT hr; @@ -226,6 +421,7 @@ START_TEST(mfmediaengine) test_factory(); test_CreateInstance(); + test_Shutdown(); IMFMediaEngineClassFactory_Release(factory);
1
0
0
0
Nikolay Sivov : mfmediaengine/tests: Use global factory instance.
by Alexandre Julliard
28 May '20
28 May '20
Module: wine Branch: master Commit: 9de7895e4e4707b2c8fb164887a40bfe915ed580 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9de7895e4e4707b2c8fb1648…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Thu May 28 18:54:17 2020 +0300 mfmediaengine/tests: Use global factory instance. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfmediaengine/tests/mfmediaengine.c | 85 ++++++++++++++++++++++++++------ 1 file changed, 69 insertions(+), 16 deletions(-) diff --git a/dlls/mfmediaengine/tests/mfmediaengine.c b/dlls/mfmediaengine/tests/mfmediaengine.c index 2bbc79fb6c..14d9eed453 100644 --- a/dlls/mfmediaengine/tests/mfmediaengine.c +++ b/dlls/mfmediaengine/tests/mfmediaengine.c @@ -35,6 +35,8 @@ static HRESULT (WINAPI *pMFCreateDXGIDeviceManager)(UINT *token, IMFDXGIDeviceManager **manager); +static IMFMediaEngineClassFactory *factory; + #define EXPECT_REF(obj,ref) _expect_ref((IUnknown*)obj, ref, __LINE__) static void _expect_ref(IUnknown *obj, ULONG ref, int line) { @@ -114,25 +116,20 @@ static void test_factory(void) UINT token; HRESULT hr; - CoInitialize(NULL); - - hr = CoCreateInstance(&CLSID_MFMediaEngineClassFactory, NULL, CLSCTX_INPROC_SERVER, - &IID_IMFMediaEngineClassFactory, (void **)&factory); - ok(hr == S_OK || broken(hr == REGDB_E_CLASSNOTREG) /* pre-win8 */, - "Failed to create class factory, hr %#x.\n", hr); - - hr = CoCreateInstance(&CLSID_MFMediaEngineClassFactory, (IUnknown *)factory, CLSCTX_INPROC_SERVER, - &IID_IMFMediaEngineClassFactory, (void **)&factory2); - ok(hr == CLASS_E_NOAGGREGATION || broken(hr == REGDB_E_CLASSNOTREG) /* pre-win8 */, - "Unexpected hr %#x.\n", hr); - - if (!factory) + hr = CoCreateInstance(&CLSID_MFMediaEngineClassFactory, NULL, CLSCTX_INPROC_SERVER, &IID_IMFMediaEngineClassFactory, + (void **)&factory); + ok(hr == S_OK || broken(hr == REGDB_E_CLASSNOTREG) /* pre-win8 */, "Failed to create class factory, hr %#x.\n", hr); + if (FAILED(hr)) { - win_skip("Not IMFMediaEngineClassFactory support.\n"); - CoUninitialize(); + win_skip("Media Engine is not supported.\n"); return; } + /* Aggregation is not supported. */ + hr = CoCreateInstance(&CLSID_MFMediaEngineClassFactory, (IUnknown *)factory, CLSCTX_INPROC_SERVER, + &IID_IMFMediaEngineClassFactory, (void **)&factory2); + ok(hr == CLASS_E_NOAGGREGATION, "Unexpected hr %#x.\n", hr); + hr = pMFCreateDXGIDeviceManager(&token, &manager); ok(hr == S_OK, "MFCreateDXGIDeviceManager failed: %#x.\n", hr); hr = MFCreateAttributes(&attributes, 3); @@ -163,20 +160,76 @@ static void test_factory(void) IMFAttributes_Release(attributes); IMFDXGIDeviceManager_Release(manager); IMFMediaEngineClassFactory_Release(factory); +} - CoUninitialize(); +static void test_CreateInstance(void) +{ + struct media_engine_notify notify_impl = {{&media_engine_notify_vtbl}, 1}; + IMFMediaEngineNotify *notify = ¬ify_impl.IMFMediaEngineNotify_iface; + IMFDXGIDeviceManager *manager; + IMFMediaEngine *media_engine; + IMFAttributes *attributes; + UINT token; + HRESULT hr; + + hr = pMFCreateDXGIDeviceManager(&token, &manager); + ok(hr == S_OK, "Failed to create dxgi device manager, hr %#x.\n", hr); + + hr = MFCreateAttributes(&attributes, 3); + ok(hr == S_OK, "Failed to create attributes, hr %#x.\n", hr); + + hr = IMFMediaEngineClassFactory_CreateInstance(factory, MF_MEDIA_ENGINE_WAITFORSTABLE_STATE, + attributes, &media_engine); + ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#x.\n", hr); + + hr = IMFAttributes_SetUnknown(attributes, &MF_MEDIA_ENGINE_OPM_HWND, NULL); + ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr); + + hr = IMFMediaEngineClassFactory_CreateInstance(factory, MF_MEDIA_ENGINE_WAITFORSTABLE_STATE, + attributes, &media_engine); + ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#x.\n", hr); + + IMFAttributes_DeleteAllItems(attributes); + + hr = IMFAttributes_SetUnknown(attributes, &MF_MEDIA_ENGINE_CALLBACK, (IUnknown *)notify); + ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr); + hr = IMFAttributes_SetUINT32(attributes, &MF_MEDIA_ENGINE_VIDEO_OUTPUT_FORMAT, DXGI_FORMAT_UNKNOWN); + ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr); + + hr = IMFMediaEngineClassFactory_CreateInstance(factory, MF_MEDIA_ENGINE_WAITFORSTABLE_STATE, attributes, &media_engine); + ok(hr == S_OK, "Failed to create media engine, hr %#x.\n", hr); + + IMFMediaEngine_Release(media_engine); + IMFAttributes_Release(attributes); + IMFDXGIDeviceManager_Release(manager); } START_TEST(mfmediaengine) { HRESULT hr; + CoInitialize(NULL); + + hr = CoCreateInstance(&CLSID_MFMediaEngineClassFactory, NULL, CLSCTX_INPROC_SERVER, &IID_IMFMediaEngineClassFactory, + (void **)&factory); + if (FAILED(hr)) + { + win_skip("Media Engine is not supported.\n"); + CoUninitialize(); + return; + } + init_functions(); hr = MFStartup(MF_VERSION, MFSTARTUP_FULL); ok(hr == S_OK, "MFStartup failed: %#x.\n", hr); test_factory(); + test_CreateInstance(); + + IMFMediaEngineClassFactory_Release(factory); + + CoUninitialize(); MFShutdown(); }
1
0
0
0
Nikolay Sivov : include: Add Media Engine events constants.
by Alexandre Julliard
28 May '20
28 May '20
Module: wine Branch: master Commit: e2c681a8976bb31378fd946497da485e5ef73fad URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e2c681a8976bb31378fd9464…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Thu May 28 18:54:16 2020 +0300 include: Add Media Engine events constants. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/mfmediaengine.idl | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/include/mfmediaengine.idl b/include/mfmediaengine.idl index e5d91a5732..4ea3d834cf 100644 --- a/include/mfmediaengine.idl +++ b/include/mfmediaengine.idl @@ -94,6 +94,49 @@ typedef enum MF_MEDIA_ENGINE_CREATEFLAGS MF_MEDIA_ENGINE_CREATEFLAGS_MASK = 0x1f } MF_MEDIA_ENGINE_CREATEFLAGS; +typedef enum MF_MEDIA_ENGINE_EVENT +{ + MF_MEDIA_ENGINE_EVENT_LOADSTART = 1, + MF_MEDIA_ENGINE_EVENT_PROGRESS = 2, + MF_MEDIA_ENGINE_EVENT_SUSPEND = 3, + MF_MEDIA_ENGINE_EVENT_ABORT = 4, + MF_MEDIA_ENGINE_EVENT_ERROR = 5, + MF_MEDIA_ENGINE_EVENT_EMPTIED = 6, + MF_MEDIA_ENGINE_EVENT_STALLED = 7, + MF_MEDIA_ENGINE_EVENT_PLAY = 8, + MF_MEDIA_ENGINE_EVENT_PAUSE = 9, + MF_MEDIA_ENGINE_EVENT_LOADEDMETADATA = 10, + MF_MEDIA_ENGINE_EVENT_LOADEDDATA = 11, + MF_MEDIA_ENGINE_EVENT_WAITING = 12, + MF_MEDIA_ENGINE_EVENT_PLAYING = 13, + MF_MEDIA_ENGINE_EVENT_CANPLAY = 14, + MF_MEDIA_ENGINE_EVENT_CANPLAYTHROUGH = 15, + MF_MEDIA_ENGINE_EVENT_SEEKING = 16, + MF_MEDIA_ENGINE_EVENT_SEEKED = 17, + MF_MEDIA_ENGINE_EVENT_TIMEUPDATE = 18, + MF_MEDIA_ENGINE_EVENT_ENDED = 19, + MF_MEDIA_ENGINE_EVENT_RATECHANGE = 20, + MF_MEDIA_ENGINE_EVENT_DURATIONCHANGE = 21, + MF_MEDIA_ENGINE_EVENT_VOLUMECHANGE = 22, + MF_MEDIA_ENGINE_EVENT_FORMATCHANGE = 1000, + MF_MEDIA_ENGINE_EVENT_PURGEQUEUEDEVENTS = 1001, + MF_MEDIA_ENGINE_EVENT_TIMELINE_MARKER = 1002, + MF_MEDIA_ENGINE_EVENT_BALANCECHANGE = 1003, + MF_MEDIA_ENGINE_EVENT_DOWNLOADCOMPLETE = 1004, + MF_MEDIA_ENGINE_EVENT_BUFFERINGSTARTED = 1005, + MF_MEDIA_ENGINE_EVENT_BUFFERINGENDED = 1006, + MF_MEDIA_ENGINE_EVENT_FRAMESTEPCOMPLETED = 1007, + MF_MEDIA_ENGINE_EVENT_NOTIFYSTABLESTATE = 1008, + MF_MEDIA_ENGINE_EVENT_FIRSTFRAMEREADY = 1009, + MF_MEDIA_ENGINE_EVENT_TRACKSCHANGE = 1010, + MF_MEDIA_ENGINE_EVENT_OPMINFO = 1011, + MF_MEDIA_ENGINE_EVENT_RESOURCELOST = 1012, + MF_MEDIA_ENGINE_EVENT_DELAYLOADEVENT_CHANGED = 1013, + MF_MEDIA_ENGINE_EVENT_STREAMRENDERINGERROR = 1014, + MF_MEDIA_ENGINE_EVENT_SUPPORTEDRATES_CHANGED = 1015, + MF_MEDIA_ENGINE_EVENT_AUDIOENDPOINTCHANGE = 1016, +} MF_MEDIA_ENGINE_EVENT; + [ object, uuid(fc0e10d2-ab2a-4501-a951-06bb1075184c),
1
0
0
0
Nikolay Sivov : dwrite: Add stub handler for ligature substitution.
by Alexandre Julliard
28 May '20
28 May '20
Module: wine Branch: master Commit: 9479f87b8a646b4c3324070c5a56b11bdf5a7bd0 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9479f87b8a646b4c3324070c…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Thu May 28 14:54:29 2020 +0300 dwrite: Add stub handler for ligature substitution. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dwrite/opentype.c | 154 ++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 126 insertions(+), 28 deletions(-) diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c index 92061cbf5c..c6cfdb6133 100644 --- a/dlls/dwrite/opentype.c +++ b/dlls/dwrite/opentype.c @@ -585,6 +585,27 @@ struct ot_gsub_altsubst_format1 UINT16 sets[1]; }; +struct ot_gsub_ligsubst_format1 +{ + UINT16 format; + UINT16 coverage; + UINT16 lig_set_count; + UINT16 lig_sets[1]; +}; + +struct ot_gsub_ligset +{ + UINT16 count; + UINT16 offsets[1]; +}; + +struct ot_gsub_lig +{ + UINT16 lig_glyph; + UINT16 comp_count; + UINT16 components[1]; +}; + struct ot_gsub_chaincontext_subst_format1 { UINT16 format; @@ -4464,13 +4485,23 @@ void opentype_layout_apply_gpos_features(struct scriptshaping_context *context, heap_free(lookups.lookups); } +static void opentype_layout_replace_glyph(struct scriptshaping_context *context, UINT16 glyph) +{ + UINT16 orig_glyph = context->u.subst.glyphs[context->cur]; + if (glyph != orig_glyph) + { + context->u.subst.glyphs[context->cur] = glyph; + opentype_set_subst_glyph_props(context, context->cur, glyph); + } + context->cur++; +} + static BOOL opentype_layout_apply_gsub_single_substitution(struct scriptshaping_context *context, const struct lookup *lookup, unsigned int subtable_offset) { const struct dwrite_fonttable *gsub = &context->table->table; UINT16 format, coverage, orig_glyph, glyph; unsigned int idx, coverage_index; - BOOL ret; idx = context->cur; orig_glyph = glyph = context->u.subst.glyphs[idx]; @@ -4502,16 +4533,14 @@ static BOOL opentype_layout_apply_gsub_single_substitution(struct scriptshaping_ glyph = GET_BE_WORD(format2->substitutes[coverage_index]); } else - WARN("Unknown single substitution format %u.\n", format); - - if ((ret = (glyph != orig_glyph))) { - context->u.subst.glyphs[idx] = glyph; - opentype_set_subst_glyph_props(context, idx, glyph); - context->cur++; + WARN("Unknown single substitution format %u.\n", format); + return FALSE; } - return ret; + opentype_layout_replace_glyph(context, glyph); + + return TRUE; } static BOOL opentype_layout_gsub_ensure_buffer(struct scriptshaping_context *context, unsigned int count) @@ -4568,13 +4597,13 @@ static BOOL opentype_layout_apply_gsub_mult_substitution(struct scriptshaping_co unsigned int subtable_offset) { const struct dwrite_fonttable *gsub = &context->table->table; - UINT16 format, coverage, orig_glyph, glyph, seq_count, glyph_count; + UINT16 format, coverage, glyph, seq_count, glyph_count; const struct ot_gsub_multsubst_format1 *format1; unsigned int i, idx, coverage_index; const UINT16 *glyphs; idx = context->cur; - orig_glyph = glyph = context->u.subst.glyphs[idx]; + glyph = context->u.subst.glyphs[idx]; format = table_read_be_word(gsub, subtable_offset); @@ -4603,15 +4632,7 @@ static BOOL opentype_layout_apply_gsub_mult_substitution(struct scriptshaping_co if (glyph_count == 1) { /* Equivalent of single substitution. */ - glyph = GET_BE_WORD(glyphs[0]); - - if (glyph != orig_glyph) - { - context->u.subst.glyphs[idx] = glyph; - opentype_set_subst_glyph_props(context, idx, glyph); - } - - context->cur++; + opentype_layout_replace_glyph(context, GET_BE_WORD(glyphs[0])); } else if (glyph_count == 0) { @@ -4682,12 +4703,11 @@ static BOOL opentype_layout_apply_gsub_alt_substitution(struct scriptshaping_con unsigned int subtable_offset) { const struct dwrite_fonttable *gsub = &context->table->table; - UINT16 format, coverage, orig_glyph, glyph; unsigned int idx, coverage_index, offset; - BOOL ret; + UINT16 format, coverage, glyph; idx = context->cur; - orig_glyph = glyph = context->u.subst.glyphs[idx]; + glyph = context->u.subst.glyphs[idx]; format = table_read_be_word(gsub, subtable_offset); @@ -4721,16 +4741,92 @@ static BOOL opentype_layout_apply_gsub_alt_substitution(struct scriptshaping_con glyph = table_read_be_word(gsub, subtable_offset + offset + sizeof(count) + (alt_index - 1) * sizeof(glyph)); } else + { WARN("Unexpected alternate substitution format %d.\n", format); + return FALSE; + } + + opentype_layout_replace_glyph(context, glyph); + + return TRUE; +} + +static BOOL opentype_layout_apply_ligature(struct scriptshaping_context *context, unsigned int offset) +{ + const struct dwrite_fonttable *gsub = &context->table->table; + const struct ot_gsub_lig *lig; + unsigned int comp_count; + + comp_count = table_read_be_word(gsub, offset + FIELD_OFFSET(struct ot_gsub_lig, comp_count)); + + if (!comp_count) + return FALSE; + + lig = table_read_ensure(gsub, offset, FIELD_OFFSET(struct ot_gsub_lig, components[comp_count-1])); + if (!lig) + return FALSE; - if ((ret = (glyph != orig_glyph))) + if (comp_count == 1) { - context->u.subst.glyphs[idx] = glyph; - opentype_set_subst_glyph_props(context, idx, glyph); - context->cur++; + opentype_layout_replace_glyph(context, GET_BE_WORD(lig->lig_glyph)); + return TRUE; } - return ret; + /* TODO: actually apply ligature */ + + return FALSE; +} + +static BOOL opentype_layout_apply_gsub_lig_substitution(struct scriptshaping_context *context, const struct lookup *lookup, + unsigned int subtable_offset) +{ + const struct dwrite_fonttable *gsub = &context->table->table; + unsigned int coverage_index, offset, lig_set_offset, lig_set_count; + UINT16 format, coverage, glyph; + + glyph = context->u.subst.glyphs[context->cur]; + + format = table_read_be_word(gsub, subtable_offset); + + if (format == 1) + { + const struct ot_gsub_ligsubst_format1 *format1 = table_read_ensure(gsub, subtable_offset, sizeof(*format1)); + const struct ot_gsub_ligset *lig_set; + unsigned int i, lig_count; + + coverage = table_read_be_word(gsub, subtable_offset + FIELD_OFFSET(struct ot_gsub_ligsubst_format1, coverage)); + + coverage_index = opentype_layout_is_glyph_covered(context, subtable_offset + coverage, glyph); + if (coverage_index == GLYPH_NOT_COVERED) + return FALSE; + + lig_set_count = table_read_be_word(gsub, subtable_offset + FIELD_OFFSET(struct ot_gsub_ligsubst_format1, lig_set_count)); + if (coverage_index >= lig_set_count || !table_read_ensure(gsub, subtable_offset, + FIELD_OFFSET(struct ot_gsub_ligsubst_format1, lig_sets[lig_set_count]))) + { + return FALSE; + } + + lig_set_offset = table_read_be_word(gsub, subtable_offset + + FIELD_OFFSET(struct ot_gsub_ligsubst_format1, lig_sets[coverage_index])); + offset = subtable_offset + lig_set_offset; + + lig_count = table_read_be_word(gsub, offset); + lig_set = table_read_ensure(gsub, offset, FIELD_OFFSET(struct ot_gsub_ligset, offsets[lig_count])); + if (!lig_count || !lig_set) + return FALSE; + + /* First applicable ligature is used. */ + for (i = 0; i < lig_count; ++i) + { + if (opentype_layout_apply_ligature(context, offset + GET_BE_WORD(lig_set->offsets[i]))) + return TRUE; + } + } + else + WARN("Unexpected ligature substitution format %d.\n", format); + + return FALSE; } #define CHAIN_CONTEXT_MAX_LENGTH 64 @@ -5000,10 +5096,12 @@ static BOOL opentype_layout_apply_gsub_lookup(struct scriptshaping_context *cont case GSUB_LOOKUP_ALTERNATE_SUBST: ret = opentype_layout_apply_gsub_alt_substitution(context, lookup, subtable_offset); break; + case GSUB_LOOKUP_LIGATURE_SUBST: + ret = opentype_layout_apply_gsub_lig_substitution(context, lookup, subtable_offset); + break; case GSUB_LOOKUP_CHAINING_CONTEXTUAL_SUBST: ret = opentype_layout_apply_gsub_chain_context_substitution(context, lookup, subtable_offset); break; - case GSUB_LOOKUP_LIGATURE_SUBST: case GSUB_LOOKUP_CONTEXTUAL_SUBST: case GSUB_LOOKUP_REVERSE_CHAINING_CONTEXTUAL_SUBST: WARN("Unimplemented lookup %d.\n", lookup->type);
1
0
0
0
Nikolay Sivov : dwrite: Update glyph component count on multiple substitution.
by Alexandre Julliard
28 May '20
28 May '20
Module: wine Branch: master Commit: 2e4d71c7218d139476c5ef84129a54c9209cea8b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=2e4d71c7218d139476c5ef84…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Thu May 28 14:54:28 2020 +0300 dwrite: Update glyph component count on multiple substitution. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dwrite/dwrite_private.h | 13 ++++++++++++- dlls/dwrite/opentype.c | 10 +++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h index 2ed53658cd..94705b0d63 100644 --- a/dlls/dwrite/dwrite_private.h +++ b/dlls/dwrite/dwrite_private.h @@ -468,6 +468,17 @@ struct shaping_glyph_info unsigned int props; }; +struct shaping_glyph_properties +{ + UINT16 justification : 4; + UINT16 isClusterStart : 1; + UINT16 isDiacritic : 1; + UINT16 isZeroWidthSpace : 1; + UINT16 reserved : 1; + UINT16 components : 4; + UINT16 reserved2 : 4; +}; + struct scriptshaping_context { struct scriptshaping_cache *cache; @@ -498,7 +509,7 @@ struct scriptshaping_context struct { UINT16 *glyphs; - DWRITE_SHAPING_GLYPH_PROPERTIES *glyph_props; + struct shaping_glyph_properties *glyph_props; UINT16 *clustermap; } buffer; } u; diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c index e31057710b..92061cbf5c 100644 --- a/dlls/dwrite/opentype.c +++ b/dlls/dwrite/opentype.c @@ -4648,7 +4648,10 @@ static BOOL opentype_layout_apply_gsub_mult_substitution(struct scriptshaping_co glyph = GET_BE_WORD(glyphs[i]); context->u.subst.glyphs[idx + i] = glyph; if (i) + { context->u.subst.glyph_props[idx + i].isClusterStart = 0; + context->u.buffer.glyph_props[idx + i].components = 0; + } opentype_set_subst_glyph_props(context, idx + i, glyph); /* Inherit feature mask from original matched glyph. */ context->glyph_infos[idx + i].mask = mask; @@ -5081,11 +5084,12 @@ static void opentype_get_nominal_glyphs(struct scriptshaping_context *context, c codepoint = context->u.subst.digits[codepoint - '0']; context->u.subst.glyphs[g] = font->get_glyph(context->cache->context, codepoint); - context->u.subst.glyph_props[g].justification = SCRIPT_JUSTIFY_CHARACTER; - context->u.subst.glyph_props[g].isClusterStart = 1; + context->u.buffer.glyph_props[g].justification = SCRIPT_JUSTIFY_CHARACTER; + context->u.buffer.glyph_props[g].isClusterStart = 1; opentype_set_subst_glyph_props(context, g, context->u.subst.glyphs[g]); if (opentype_is_default_ignorable(codepoint)) - context->u.subst.glyph_props[g].isZeroWidthSpace = 1; + context->u.buffer.glyph_props[g].isZeroWidthSpace = 1; + context->u.buffer.glyph_props[g].components = 1; context->glyph_count++; clustermap[i] = i;
1
0
0
0
Nikolay Sivov : dwrite: Implement multiple substitution (GSUB lookup 2).
by Alexandre Julliard
28 May '20
28 May '20
Module: wine Branch: master Commit: 9f31bf0e1c444a3b96dfa478a3cfcf1bd45f470d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9f31bf0e1c444a3b96dfa478…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Thu May 28 14:54:27 2020 +0300 dwrite: Implement multiple substitution (GSUB lookup 2). Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dwrite/opentype.c | 173 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 172 insertions(+), 1 deletion(-) diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c index 8886186303..e31057710b 100644 --- a/dlls/dwrite/opentype.c +++ b/dlls/dwrite/opentype.c @@ -569,6 +569,14 @@ struct ot_gsub_singlesubst_format2 UINT16 substitutes[1]; }; +struct ot_gsub_multsubst_format1 +{ + UINT16 format; + UINT16 coverage; + UINT16 seq_count; + UINT16 seq[1]; +}; + struct ot_gsub_altsubst_format1 { UINT16 format; @@ -4506,6 +4514,167 @@ static BOOL opentype_layout_apply_gsub_single_substitution(struct scriptshaping_ return ret; } +static BOOL opentype_layout_gsub_ensure_buffer(struct scriptshaping_context *context, unsigned int count) +{ + DWRITE_SHAPING_GLYPH_PROPERTIES *glyph_props; + struct shaping_glyph_info *glyph_infos; + unsigned int new_capacity; + UINT16 *glyphs; + BOOL ret; + + if (context->u.subst.capacity >= count) + return TRUE; + + new_capacity = context->u.subst.capacity * 2; + + if ((glyphs = heap_realloc(context->u.subst.glyphs, new_capacity * sizeof(*glyphs)))) + context->u.subst.glyphs = glyphs; + if ((glyph_props = heap_realloc(context->u.subst.glyph_props, new_capacity * sizeof(*glyph_props)))) + context->u.subst.glyph_props = glyph_props; + if ((glyph_infos = heap_realloc(context->glyph_infos, new_capacity * sizeof(*glyph_infos)))) + context->glyph_infos = glyph_infos; + + if ((ret = (glyphs && glyph_props && glyph_infos))) + context->u.subst.capacity = new_capacity; + + return ret; +} + +static unsigned int opentype_layout_get_next_char_index(const struct scriptshaping_context *context, unsigned int idx) +{ + unsigned int start = 0, end = context->length - 1, mid, ret = ~0u; + + for (;;) + { + mid = (start + end) / 2; + + if (context->u.buffer.clustermap[mid] <= idx) + { + if (mid == end) break; + start = mid + 1; + } + else + { + ret = mid; + if (mid == start) break; + end = mid - 1; + } + } + + return ret; +} + +static BOOL opentype_layout_apply_gsub_mult_substitution(struct scriptshaping_context *context, const struct lookup *lookup, + unsigned int subtable_offset) +{ + const struct dwrite_fonttable *gsub = &context->table->table; + UINT16 format, coverage, orig_glyph, glyph, seq_count, glyph_count; + const struct ot_gsub_multsubst_format1 *format1; + unsigned int i, idx, coverage_index; + const UINT16 *glyphs; + + idx = context->cur; + orig_glyph = glyph = context->u.subst.glyphs[idx]; + + format = table_read_be_word(gsub, subtable_offset); + + coverage = table_read_be_word(gsub, subtable_offset + FIELD_OFFSET(struct ot_gsub_multsubst_format1, coverage)); + + if (format == 1) + { + coverage_index = opentype_layout_is_glyph_covered(context, subtable_offset + coverage, glyph); + if (coverage_index == GLYPH_NOT_COVERED) + return FALSE; + + seq_count = table_read_be_word(gsub, subtable_offset + FIELD_OFFSET(struct ot_gsub_multsubst_format1, seq_count)); + + format1 = table_read_ensure(gsub, subtable_offset, FIELD_OFFSET(struct ot_gsub_multsubst_format1, seq[seq_count])); + + if (!seq_count || seq_count <= coverage_index || !format1) + return FALSE; + + glyph_count = table_read_be_word(gsub, subtable_offset + GET_BE_WORD(format1->seq[coverage_index])); + + glyphs = table_read_ensure(gsub, subtable_offset + GET_BE_WORD(format1->seq[coverage_index]) + 2, + glyph_count * sizeof(*glyphs)); + if (!glyphs) + return FALSE; + + if (glyph_count == 1) + { + /* Equivalent of single substitution. */ + glyph = GET_BE_WORD(glyphs[0]); + + if (glyph != orig_glyph) + { + context->u.subst.glyphs[idx] = glyph; + opentype_set_subst_glyph_props(context, idx, glyph); + } + + context->cur++; + } + else if (glyph_count == 0) + { + context->cur++; + } + else + { + unsigned int shift_len, src_idx, dest_idx, mask; + + /* Current glyph is also replaced. */ + glyph_count--; + + if (!(opentype_layout_gsub_ensure_buffer(context, context->glyph_count + glyph_count))) + return FALSE; + + shift_len = context->cur + 1 < context->glyph_count ? context->glyph_count - context->cur - 1 : 0; + + if (shift_len) + { + src_idx = context->cur + 1; + dest_idx = src_idx + glyph_count; + + memmove(&context->u.subst.glyphs[dest_idx], &context->u.subst.glyphs[src_idx], + shift_len * sizeof(*context->u.subst.glyphs)); + memmove(&context->u.subst.glyph_props[dest_idx], &context->u.subst.glyph_props[src_idx], + shift_len * sizeof(*context->u.subst.glyph_props)); + memmove(&context->glyph_infos[dest_idx], &context->glyph_infos[src_idx], + shift_len * sizeof(*context->glyph_infos)); + } + + mask = context->glyph_infos[context->cur].mask; + for (i = 0, idx = context->cur; i <= glyph_count; ++i) + { + glyph = GET_BE_WORD(glyphs[i]); + context->u.subst.glyphs[idx + i] = glyph; + if (i) + context->u.subst.glyph_props[idx + i].isClusterStart = 0; + opentype_set_subst_glyph_props(context, idx + i, glyph); + /* Inherit feature mask from original matched glyph. */ + context->glyph_infos[idx + i].mask = mask; + } + + /* Update following clusters. */ + idx = opentype_layout_get_next_char_index(context, context->cur); + if (idx != ~0u) + { + for (i = idx; i < context->length; ++i) + context->u.subst.clustermap[i] += glyph_count; + } + + context->cur += glyph_count + 1; + context->glyph_count += glyph_count; + } + } + else + { + WARN("Unknown multiple substitution format %u.\n", format); + return FALSE; + } + + return TRUE; +} + static BOOL opentype_layout_apply_gsub_alt_substitution(struct scriptshaping_context *context, const struct lookup *lookup, unsigned int subtable_offset) { @@ -4822,13 +4991,15 @@ static BOOL opentype_layout_apply_gsub_lookup(struct scriptshaping_context *cont case GSUB_LOOKUP_SINGLE_SUBST: ret = opentype_layout_apply_gsub_single_substitution(context, lookup, subtable_offset); break; + case GSUB_LOOKUP_MULTIPLE_SUBST: + ret = opentype_layout_apply_gsub_mult_substitution(context, lookup, subtable_offset); + break; case GSUB_LOOKUP_ALTERNATE_SUBST: ret = opentype_layout_apply_gsub_alt_substitution(context, lookup, subtable_offset); break; case GSUB_LOOKUP_CHAINING_CONTEXTUAL_SUBST: ret = opentype_layout_apply_gsub_chain_context_substitution(context, lookup, subtable_offset); break; - case GSUB_LOOKUP_MULTIPLE_SUBST: case GSUB_LOOKUP_LIGATURE_SUBST: case GSUB_LOOKUP_CONTEXTUAL_SUBST: case GSUB_LOOKUP_REVERSE_CHAINING_CONTEXTUAL_SUBST:
1
0
0
0
Nikolay Sivov : dwrite: Use GPOS handlers for subtables, not whole lookups.
by Alexandre Julliard
28 May '20
28 May '20
Module: wine Branch: master Commit: 684dd31cc218d77e38289c87d7df15e065ff379c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=684dd31cc218d77e38289c87…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Thu May 28 14:54:26 2020 +0300 dwrite: Use GPOS handlers for subtables, not whole lookups. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dwrite/opentype.c | 885 +++++++++++++++++++++++-------------------------- 1 file changed, 410 insertions(+), 475 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=684dd31cc218d77e3828…
1
0
0
0
Nikolay Sivov : dwrite: Keep text properties zero initialized.
by Alexandre Julliard
28 May '20
28 May '20
Module: wine Branch: master Commit: a66668c129aa44c7fc734ef585168326819f4836 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a66668c129aa44c7fc734ef5…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Thu May 28 14:54:25 2020 +0300 dwrite: Keep text properties zero initialized. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dwrite/analyzer.c | 6 +-- dlls/dwrite/dwrite_private.h | 10 ----- dlls/dwrite/shape.c | 99 -------------------------------------------- 3 files changed, 2 insertions(+), 113 deletions(-) diff --git a/dlls/dwrite/analyzer.c b/dlls/dwrite/analyzer.c index 556191a13d..56950a5baa 100644 --- a/dlls/dwrite/analyzer.c +++ b/dlls/dwrite/analyzer.c @@ -34,11 +34,11 @@ extern const unsigned short wine_scripts_table[] DECLSPEC_HIDDEN; /* Number of characters needed for LOCALE_SNATIVEDIGITS */ #define NATIVE_DIGITS_LEN 11 -struct dwritescript_properties { +struct dwritescript_properties +{ DWRITE_SCRIPT_PROPERTIES props; UINT32 scripttags[3]; /* Maximum 2 script tags, 0-terminated. */ BOOL is_complex; - const struct scriptshaping_ops *ops; }; #define _OT(a,b,c,d) DWRITE_MAKE_OPENTYPE_TAG(a,b,c,d) @@ -1194,8 +1194,6 @@ static HRESULT WINAPI dwritetextanalyzer_GetGlyphs(IDWriteTextAnalyzer2 *iface, *actual_glyph_count = context.glyph_count; memcpy(glyphs, context.u.subst.glyphs, context.glyph_count * sizeof(*glyphs)); memcpy(glyph_props, context.u.subst.glyph_props, context.glyph_count * sizeof(*glyph_props)); - hr = default_shaping_ops.set_text_glyphs_props(&context, clustermap, glyphs, *actual_glyph_count, - text_props, glyph_props); } heap_free(context.u.subst.glyph_props); diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h index cf3e0f7c12..2ed53658cd 100644 --- a/dlls/dwrite/dwrite_private.h +++ b/dlls/dwrite/dwrite_private.h @@ -571,15 +571,5 @@ extern void opentype_layout_apply_gsub_features(struct scriptshaping_context *co extern void opentype_layout_apply_gpos_features(struct scriptshaping_context *context, unsigned int script_index, unsigned int language_index, const struct shaping_features *features) DECLSPEC_HIDDEN; -struct scriptshaping_ops -{ - HRESULT (*contextual_shaping)(struct scriptshaping_context *context, UINT16 *clustermap, UINT16 *glyph_indices, UINT32* actual_glyph_count); - HRESULT (*set_text_glyphs_props)(struct scriptshaping_context *context, UINT16 *clustermap, UINT16 *glyph_indices, - UINT32 glyphcount, DWRITE_SHAPING_TEXT_PROPERTIES *text_props, DWRITE_SHAPING_GLYPH_PROPERTIES *glyph_props); - const struct shaping_features *gpos_features; -}; - -extern const struct scriptshaping_ops default_shaping_ops DECLSPEC_HIDDEN; - extern HRESULT shape_get_glyphs(struct scriptshaping_context *context, const unsigned int *scripts) DECLSPEC_HIDDEN; extern HRESULT shape_get_positions(struct scriptshaping_context *context, const unsigned int *scripts) DECLSPEC_HIDDEN; diff --git a/dlls/dwrite/shape.c b/dlls/dwrite/shape.c index b7b40d1211..32aabac5f6 100644 --- a/dlls/dwrite/shape.c +++ b/dlls/dwrite/shape.c @@ -55,105 +55,6 @@ void release_scriptshaping_cache(struct scriptshaping_cache *cache) heap_free(cache); } -static void shape_update_clusters_from_glyphprop(UINT32 glyphcount, UINT32 text_len, UINT16 *clustermap, DWRITE_SHAPING_GLYPH_PROPERTIES *glyph_props) -{ - UINT32 i; - - for (i = 0; i < glyphcount; i++) { - if (!glyph_props[i].isClusterStart) { - UINT32 j; - - for (j = 0; j < text_len; j++) { - if (clustermap[j] == i) { - int k = j; - while (k >= 0 && k < text_len && !glyph_props[clustermap[k]].isClusterStart) - k--; - - if (k >= 0 && k < text_len && glyph_props[clustermap[k]].isClusterStart) - clustermap[j] = clustermap[k]; - } - } - } - } -} - -static int compare_clustersearch(const void *a, const void* b) -{ - UINT16 target = *(UINT16*)a; - UINT16 index = *(UINT16*)b; - int ret = 0; - - if (target > index) - ret = 1; - else if (target < index) - ret = -1; - - return ret; -} - -/* Maps given glyph position in glyph indices array to text index this glyph represents. - Lowest possible index is returned. - - clustermap [I] Text index to index in glyph indices array map - len [I] Clustermap size - target [I] Index in glyph indices array to map - */ -static INT32 map_glyph_to_text_pos(const UINT16 *clustermap, UINT32 len, UINT16 target) -{ - UINT16 *ptr; - INT32 k; - - ptr = bsearch(&target, clustermap, len, sizeof(UINT16), compare_clustersearch); - if (!ptr) - return -1; - - /* get to the beginning */ - for (k = (ptr - clustermap) - 1; k >= 0 && clustermap[k] == target; k--) - ; - k++; - - return k; -} - -static HRESULT default_set_text_glyphs_props(struct scriptshaping_context *context, UINT16 *clustermap, UINT16 *glyph_indices, - UINT32 glyphcount, DWRITE_SHAPING_TEXT_PROPERTIES *text_props, DWRITE_SHAPING_GLYPH_PROPERTIES *glyph_props) -{ - UINT32 i; - - for (i = 0; i < glyphcount; i++) { - UINT32 char_index[20]; - UINT32 char_count = 0; - INT32 k; - - k = map_glyph_to_text_pos(clustermap, context->length, i); - if (k >= 0) { - for (; k < context->length && clustermap[k] == i; k++) - char_index[char_count++] = k; - } - - if (char_count == 0) - continue; - - if (char_count == 1 && isspaceW(context->text[char_index[0]])) { - glyph_props[i].justification = SCRIPT_JUSTIFY_BLANK; - text_props[char_index[0]].isShapedAlone = context->text[char_index[0]] == ' '; - } - else - glyph_props[i].justification = SCRIPT_JUSTIFY_CHARACTER; - } - - /* FIXME: update properties using GDEF table */ - shape_update_clusters_from_glyphprop(glyphcount, context->length, clustermap, glyph_props); - - return S_OK; -} - -const struct scriptshaping_ops default_shaping_ops = -{ - NULL, - default_set_text_glyphs_props -}; - static unsigned int shape_select_script(const struct scriptshaping_cache *cache, DWORD kind, const DWORD *scripts, unsigned int *script_index) {
1
0
0
0
← Newer
1
...
5
6
7
8
9
10
11
...
75
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
Results per page:
10
25
50
100
200