[vlc-commits] contrib: ass: Fix Dwrite usage on WinRT/UWP
Hugo Beauzée-Luyssen
git at videolan.org
Wed Dec 14 12:48:30 CET 2016
vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Wed Dec 14 12:45:43 2016 +0100| [eedb57aa96d2bc0046a6da2e081c75ae9edf8fd5] | committer: Hugo Beauzée-Luyssen
contrib: ass: Fix Dwrite usage on WinRT/UWP
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=eedb57aa96d2bc0046a6da2e081c75ae9edf8fd5
---
contrib/src/ass/dwrite.patch | 48 ++++++++++++++++++++++++++++++++++++++++++++
contrib/src/ass/rules.mak | 10 +++++++--
modules/codec/Makefile.am | 3 +++
3 files changed, 59 insertions(+), 2 deletions(-)
diff --git a/contrib/src/ass/dwrite.patch b/contrib/src/ass/dwrite.patch
new file mode 100644
index 0000000..a08a1f1
--- /dev/null
+++ b/contrib/src/ass/dwrite.patch
@@ -0,0 +1,48 @@
+--- libass/libass/ass_directwrite.c.orig 2016-12-14 12:09:24.569899227 +0100
++++ libass/libass/ass_directwrite.c 2016-12-14 12:21:28.429203219 +0100
+@@ -23,6 +23,7 @@
+ #include <initguid.h>
+ #include <ole2.h>
+ #include <shobjidl.h>
++#include <winapifamily.h>
+
+ #include "dwrite_c.h"
+
+@@ -742,8 +743,9 @@
+ ASS_FontProvider *provider = NULL;
+ DWriteCreateFactoryFn DWriteCreateFactoryPtr = NULL;
+ ProviderPrivate *priv = NULL;
+-
+- HMODULE directwrite_lib = LoadLibraryW(L"Dwrite.dll");
++ HMODULE directwrite_lib = NULL;
++#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
++ directwrite_lib = LoadLibraryW(L"Dwrite.dll");
+ if (!directwrite_lib)
+ goto cleanup;
+
+@@ -751,6 +753,9 @@
+ "DWriteCreateFactory");
+ if (!DWriteCreateFactoryPtr)
+ goto cleanup;
++#else
++ DWriteCreateFactoryPtr = DWriteCreateFactory;
++#endif
+
+ hr = DWriteCreateFactoryPtr(DWRITE_FACTORY_TYPE_SHARED,
+ &IID_IDWriteFactory,
+--- libass/libass/dwrite_c.h.orig 2016-12-14 12:36:59.215968100 +0100
++++ libass/libass/dwrite_c.h 2016-12-14 12:38:42.359500667 +0100
+@@ -142,6 +142,13 @@
+ typedef struct DWRITE_TRIMMING DWRITE_TRIMMING;
+ typedef struct DWRITE_UNDERLINE DWRITE_UNDERLINE;
+
++DWRITEAPI HRESULT WINAPI DWriteCreateFactory(
++ DWRITE_FACTORY_TYPE factoryType,
++ REFIID iid,
++ IUnknown **factory
++);
++
++
+ #ifndef __MINGW_DEF_ARG_VAL
+ #ifdef __cplusplus
+ #define __MINGW_DEF_ARG_VAL(x) = x
diff --git a/contrib/src/ass/rules.mak b/contrib/src/ass/rules.mak
index 5195ae9..3151e90 100644
--- a/contrib/src/ass/rules.mak
+++ b/contrib/src/ass/rules.mak
@@ -25,6 +25,7 @@ else
ifdef HAVE_WINSTORE
WITH_FONTCONFIG = 0
WITH_HARFBUZZ = 1
+WITH_DWRITE = 1
else
WITH_FONTCONFIG = 1
WITH_HARFBUZZ = 1
@@ -43,20 +44,25 @@ libass: libass-$(ASS_VERSION).tar.gz .sum-ass
$(APPLY) $(SRC)/ass/ass-macosx.patch
ifdef HAVE_WIN32
$(APPLY) $(SRC)/ass/use-topendir.patch
+ifdef HAVE_WINSTORE
+ $(APPLY) $(SRC)/ass/dwrite.patch
+endif
endif
$(UPDATE_AUTOCONFIG)
$(MOVE)
DEPS_ass = freetype2 $(DEPS_freetype2) fribidi
-ASS_CONF=--disable-enca
-
ifneq ($(WITH_FONTCONFIG), 0)
DEPS_ass += fontconfig $(DEPS_fontconfig)
else
ASS_CONF += --disable-fontconfig --disable-require-system-font-provider
endif
+ifneq ($(WITH_DWRITE), 0)
+ASS_CONF += --enable-directwrite
+endif
+
ifneq ($(WITH_HARFBUZZ), 0)
DEPS_ass += harfbuzz $(DEPS_harfbuzz)
else
diff --git a/modules/codec/Makefile.am b/modules/codec/Makefile.am
index e43ba76..ae2f912 100644
--- a/modules/codec/Makefile.am
+++ b/modules/codec/Makefile.am
@@ -173,6 +173,9 @@ liblibass_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS_libass)
liblibass_plugin_la_CFLAGS = $(AM_CFLAGS) $(LIBASS_CFLAGS)
liblibass_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(codecdir)'
liblibass_plugin_la_LIBADD = $(LIBASS_LIBS) $(LIBS_libass) $(LIBS_freetype) $(FREETYPE_LIBS)
+if HAVE_WINSTORE
+liblibass_plugin_la_LIBADD += -ldwrite
+endif
EXTRA_LTLIBRARIES += liblibass_plugin.la
codec_LTLIBRARIES += $(LTLIBlibass)
More information about the vlc-commits
mailing list