Commit 3f6b4c87 authored by Felix Paul Kühne's avatar Felix Paul Kühne

MVK: Rebase patches

parent a8620677
From b28820e43852b38f86637e4ca95c378b9d3d0a73 Mon Sep 17 00:00:00 2001
From 150fe8d8cd5262be1f4b8cb23c666fea8966e5eb Mon Sep 17 00:00:00 2001
From: David Geldreich <david.geldreich@free.fr>
Date: Fri, 20 Apr 2012 16:41:19 +0200
Subject: [PATCH 01/14] arm_neon: added function macro to handle the underscore
Subject: [PATCH 01/19] arm_neon: added function macro to handle the underscore
prefix for the iOS ARM ABI
---
......@@ -65,5 +65,5 @@ index 0000000..d853255
+.endm
+
--
2.6.3
2.6.0
From 9ffdd233d5ef6b0d36277be04fe90a24a9cf53e1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
Date: Tue, 17 Apr 2012 16:41:19 +0200
Subject: [PATCH 02/19] progress dialog: add missing sanity check
---
src/interface/dialog.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/interface/dialog.c b/src/interface/dialog.c
index f90e7c8..dcfb5dd 100644
--- a/src/interface/dialog.c
+++ b/src/interface/dialog.c
@@ -251,7 +251,11 @@ void dialog_ProgressDestroy (dialog_progress_bar_t *dialog)
{
assert (dialog);
- dialog->pf_destroy (dialog->p_sys);
+ if (dialog->pf_destroy != NULL)
+ {
+ dialog->pf_destroy (dialog->p_sys);
+ }
+
free (dialog);
}
--
2.6.0
From 70d24369721162c77464ee158d82b11164ecb59e Mon Sep 17 00:00:00 2001
From f168be843a12ec88568178ba5b68459be764f605 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
Date: Fri, 10 Aug 2012 16:02:07 +0200
Subject: [PATCH 02/14] deinterlace/merge: use a macro to fix compilation for
Subject: [PATCH 03/19] deinterlace/merge: use a macro to fix compilation for
iOS
---
......@@ -82,5 +82,5 @@ index dd77902..03e5042 100644
b 1b
+endfunc
--
2.6.3
2.6.0
From d24cb3abb7ca04201fc120665695109e86d2662d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
Date: Wed, 29 May 2013 13:25:54 +0200
Subject: [PATCH 03/14] libass: fix text rendering on iOS by providing a font
lookup mechanism for the font shipped with Aspen
---
modules/codec/libass.c | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/modules/codec/libass.c b/modules/codec/libass.c
index 3d08717..7d90c1c 100644
--- a/modules/codec/libass.c
+++ b/modules/codec/libass.c
@@ -29,6 +29,13 @@
# include "config.h"
#endif
+#if defined (__APPLE__)
+#include <TargetConditionals.h>
+#if TARGET_OS_IPHONE
+#include <CoreFoundation/CoreFoundation.h>
+#endif
+#endif
+
#include <string.h>
#include <limits.h>
#include <assert.h>
@@ -213,6 +220,37 @@ static int Create( vlc_object_t *p_this )
#if defined( __ANDROID__ )
const char *psz_font = "/system/fonts/DroidSans-Bold.ttf";
const char *psz_family = "Droid Sans Bold";
+#elif defined (__APPLE__)
+#if !TARGET_OS_IPHONE
+ const char *psz_font = NULL; /* We don't ship a default font with VLC */
+ const char *psz_family = "Arial"; /* Use Arial if we can't find anything more suitable */
+#else
+ CFURLRef fileURL;
+ fileURL = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("OpenSans-Regular.ttf"),
+ NULL,
+ NULL);
+ if (!fileURL)
+ return VLC_EGENERIC;
+
+ CFStringRef urlString = CFURLCopyFileSystemPath(fileURL, kCFURLPOSIXPathStyle);
+ CFRelease(fileURL);
+
+ if (!urlString)
+ return VLC_EGENERIC;
+
+ CFIndex length = CFStringGetLength(urlString);
+ if (!length)
+ return VLC_EGENERIC;
+ length++;
+
+ char *psz_path = (char *)malloc(length);
+ CFStringGetCString(urlString, psz_path, length, kCFStringEncodingUTF8);
+ CFRelease(urlString);
+
+ const char *psz_font = (const char *)strdup(psz_path);
+ free(psz_path);
+ const char *psz_family = "Open Sans";
+#endif
#else
const char *psz_font = NULL; /* We don't ship a default font with VLC */
const char *psz_family = "Arial"; /* Use Arial if we can't find anything more suitable */
--
2.6.3
From d8b0f4ab969d4b1bf088d0bd7ea8eb3d9d63c77b Mon Sep 17 00:00:00 2001
From 5ca13f0ca73e302a91248bb61f555a18bb67b838 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
Date: Tue, 9 Dec 2014 22:14:55 +0100
Subject: [PATCH 04/14] lib/media player: inherit deinterlace variable to
Subject: [PATCH 04/19] lib/media player: inherit deinterlace variable to
achieve correct value on first use
---
......@@ -9,10 +9,10 @@ Subject: [PATCH 04/14] lib/media player: inherit deinterlace variable to
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/media_player.c b/lib/media_player.c
index d862926..eabbbf6 100644
index 2dee2d7..3ff4b8a 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -598,7 +598,7 @@ libvlc_media_player_new( libvlc_instance_t *instance )
@@ -610,7 +610,7 @@ libvlc_media_player_new( libvlc_instance_t *instance )
var_Create (mp, "zoom", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT);
var_Create (mp, "aspect-ratio", VLC_VAR_STRING);
var_Create (mp, "crop", VLC_VAR_STRING);
......@@ -22,5 +22,5 @@ index d862926..eabbbf6 100644
var_Create (mp, "vbi-page", VLC_VAR_INTEGER);
--
2.6.3
2.6.0
From 6dfc214871dc386bb1f446db547c096822976f1e Mon Sep 17 00:00:00 2001
From 27d09b9a6654d7acecc52294e387a4f5a6192c7c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
Date: Thu, 18 Dec 2014 22:14:55 +0100
Subject: [PATCH 05/14] arm_neon: work-around libtool issue
Subject: [PATCH 05/19] arm_neon: work-around libtool issue
---
modules/arm_neon/Makefile.am | 2 ++
......@@ -18,5 +18,5 @@ index db81ec0..e67e07e 100644
libchroma_yuv_neon_plugin_la_SOURCES = \
--
2.6.3
2.6.0
From 3f00e66bc25da5ae6683b4f9f126184aa4f74741 Mon Sep 17 00:00:00 2001
From 7728ca5c568be20e5b2f5f097ad51f891215eaac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
Date: Fri, 19 Dec 2014 22:14:55 +0100
Subject: [PATCH 06/14] libvlc/media: re-parse if flags changed
Subject: [PATCH 06/19] libvlc/media: re-parse if flags changed
---
lib/media.c | 6 ++++++
......@@ -38,5 +38,5 @@ index 35f06a4..d28297e 100644
/* Media Descriptor */
--
2.6.3
2.6.0
From 6cf891d0167c926e6e5e9c05ad4fca999f089732 Mon Sep 17 00:00:00 2001
From 48f2bcf02f918c7f9d3282d6f426d3dbe73a38f7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
Date: Wed, 10 Dec 2014 22:14:55 +0100
Subject: [PATCH 07/14] arm_neon: fix iOS linking
Subject: [PATCH 07/19] arm_neon: fix iOS linking
---
modules/arm_neon/amplify.S | 7 ++---
......@@ -194,5 +194,5 @@ index a94ae85..54b43a7 100644
pop {r4,pc}
+endfunc
--
2.6.3
2.6.0
From 71ee7b4868554bd8c0be6f05e020f501c4c32df5 Mon Sep 17 00:00:00 2001
From 3686622b1911f6e31c9a82ab3312ce3dd1d97bf6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
Date: Wed, 10 Dec 2014 22:14:55 +0100
Subject: [PATCH 08/14] disable neon volume plugin
Subject: [PATCH 08/19] disable neon volume plugin
---
modules/arm_neon/Makefile.am | 1 -
......@@ -19,5 +19,5 @@ index e67e07e..6909752 100644
libyuv_rgb_neon_plugin.la
endif
--
2.6.3
2.6.0
From 8cce15f28fe6015fe58fdab4ae0892dbc733499f Mon Sep 17 00:00:00 2001
From 247206a891554f30673870c3ddb76797762b858d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
Date: Sun, 7 Dec 2014 20:02:18 +0100
Subject: [PATCH 09/14] contrib/gcrypt: work-around a libtool limitation
Subject: [PATCH 09/19] contrib/gcrypt: work-around a libtool limitation
---
contrib/src/gcrypt/rules.mak | 1 +
......@@ -10,7 +10,7 @@ Subject: [PATCH 09/14] contrib/gcrypt: work-around a libtool limitation
create mode 100644 contrib/src/gcrypt/work-around-libtool-limitation.patch
diff --git a/contrib/src/gcrypt/rules.mak b/contrib/src/gcrypt/rules.mak
index d817a13..5000488 100644
index 2fed2cd..0471522 100644
--- a/contrib/src/gcrypt/rules.mak
+++ b/contrib/src/gcrypt/rules.mak
@@ -15,6 +15,7 @@ libgcrypt: libgcrypt-$(GCRYPT_VERSION).tar.bz2 .sum-gcrypt
......@@ -53,5 +53,5 @@ index 0000000..df97ffb
+ AM_CFLAGS = $(GPG_ERROR_CFLAGS)
+
--
2.6.3
2.6.0
From a678f7e4917e77f02b98a36e632819e4e924c968 Mon Sep 17 00:00:00 2001
From af2d272b6b2c40b55bc30518f8aea8569ffcd280 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
Date: Thu, 10 Sep 2015 19:58:40 +0200
Subject: [PATCH 10/14] src/misc: fix compilation for OS without fork()
Subject: [PATCH 10/19] src/misc: fix compilation for OS without fork()
---
src/misc/cpu.c | 2 +-
......@@ -21,5 +21,5 @@ index 4a5f2a0..79b28e4 100644
{
pid_t pid = fork();
--
2.6.3
2.6.0
From 43aeabb51a837afca42c027a84550f067fe83df1 Mon Sep 17 00:00:00 2001
From 8a77ad7233ce8b5d4493ae7997f26df665c38e2a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
Date: Fri, 11 Sep 2015 18:34:26 +0200
Subject: [PATCH 11/14] libvlc: hack to disable daemon mode
Subject: [PATCH 11/19] libvlc: hack to disable daemon mode
---
src/libvlc.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/libvlc.c b/src/libvlc.c
index 34824da..6bad336 100644
index a7d9a69..c8b5c7a 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -199,6 +199,10 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
......@@ -23,5 +23,5 @@ index 34824da..6bad336 100644
/* Check for daemon mode */
if( var_InheritBool( p_libvlc, "daemon" ) )
--
2.6.3
2.6.0
From 9fa7a01fee244979f3c12494dd95ff813b1acf46 Mon Sep 17 00:00:00 2001
From 99727e9053a815919704699e4756dbad9b2e9bf2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
Date: Sat, 3 Oct 2015 22:45:14 +0200
Subject: [PATCH 12/14] contrib/gcrypt: fix tvOS compilation
Subject: [PATCH 12/19] contrib/gcrypt: fix tvOS compilation
---
contrib/src/gcrypt/fix-sha1-ssse3-for-clang.patch | 16 ++++++++++++++++
......@@ -32,7 +32,7 @@ index 0000000..f1d3ccc
+ * %rdi: ctx, CTX
+ * %rsi: data (64 bytes)
diff --git a/contrib/src/gcrypt/rules.mak b/contrib/src/gcrypt/rules.mak
index 5000488..6de232b 100644
index 0471522..ac20d02 100644
--- a/contrib/src/gcrypt/rules.mak
+++ b/contrib/src/gcrypt/rules.mak
@@ -16,6 +16,7 @@ libgcrypt: libgcrypt-$(GCRYPT_VERSION).tar.bz2 .sum-gcrypt
......@@ -56,5 +56,5 @@ index 5000488..6de232b 100644
GCRYPT_CONF += --disable-aesni-support
else
--
2.6.3
2.6.0
From 38353d401e8f434e24bcbad232e4d38672feabea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
Date: Wed, 22 Jan 2014 13:55:16 +0100
Subject: [PATCH 13/14] freetype: added a fake font lookup mechanism for iOS to
use the packaged demo fonts
---
modules/text_renderer/fonts/darwin.c | 40 ++++++++++++++++++++++++++++++++++
modules/text_renderer/freetype.c | 2 ++
modules/text_renderer/platform_fonts.h | 3 +++
3 files changed, 45 insertions(+)
diff --git a/modules/text_renderer/fonts/darwin.c b/modules/text_renderer/fonts/darwin.c
index 26fb339..71061c6 100644
--- a/modules/text_renderer/fonts/darwin.c
+++ b/modules/text_renderer/fonts/darwin.c
@@ -40,6 +40,9 @@
#include <TargetConditionals.h>
#if !TARGET_OS_IPHONE
# include <Carbon/Carbon.h>
+#else
+#include <CoreFoundation/CoreFoundation.h>
+#include <vlc_url.h>
#endif
#include <sys/param.h> /* for MAXPATHLEN */
@@ -125,4 +128,41 @@ char* MacLegacy_Select( filter_t *p_filter, const char* psz_fontname,
return psz_path;
}
+#else
+char *iOSFake_Select( filter_t *p_filter, const char* psz_fontname,
+ bool b_bold, bool b_italic, int i_size, int *i_idx )
+{
+ VLC_UNUSED(p_filter);
+ VLC_UNUSED(psz_fontname);
+ VLC_UNUSED(b_bold);
+ VLC_UNUSED(b_italic);
+ VLC_UNUSED(i_size);
+ VLC_UNUSED(i_idx);
+
+ CFURLRef fileURL;
+ fileURL = CFBundleCopyResourceURL(CFBundleGetMainBundle(),
+ CFSTR("OpenSans-Regular.ttf"),
+ NULL,
+ NULL);
+ if (!fileURL)
+ return NULL;
+ CFStringRef urlString = CFURLCopyFileSystemPath(fileURL, kCFURLPOSIXPathStyle);
+ CFRelease(fileURL);
+
+ if (!urlString)
+ return NULL;
+
+ CFIndex length = CFStringGetLength(urlString);
+ if (!length)
+ return NULL;
+ length++;
+
+ char *psz_path = (char *)malloc(length);
+ CFStringGetCString(urlString, psz_path, length, kCFStringEncodingUTF8);
+ CFRelease(urlString);
+
+ psz_path = strdup(psz_path);
+
+ return psz_path;
+}
#endif
diff --git a/modules/text_renderer/freetype.c b/modules/text_renderer/freetype.c
index 057447d..ff87929 100644
--- a/modules/text_renderer/freetype.c
+++ b/modules/text_renderer/freetype.c
@@ -1265,6 +1265,8 @@ static int Create( vlc_object_t *p_this )
#elif defined( __APPLE__ )
#if !TARGET_OS_IPHONE
p_sys->pf_select = MacLegacy_Select;
+#else
+ p_sys->pf_select = iOSFake_Select;
#endif
#elif defined( _WIN32 ) && defined( HAVE_GET_FONT_BY_FAMILY_NAME )
const char *const ppsz_win32_default[] =
diff --git a/modules/text_renderer/platform_fonts.h b/modules/text_renderer/platform_fonts.h
index abf76c7..67902bf 100644
--- a/modules/text_renderer/platform_fonts.h
+++ b/modules/text_renderer/platform_fonts.h
@@ -155,6 +155,9 @@ const vlc_family_t *Win32_GetFamily( filter_t *p_filter, const char *psz_family
char* MacLegacy_Select( filter_t *p_filter, const char* psz_fontname,
bool b_bold, bool b_italic,
int *i_idx, uni_char_t codepoint );
+#else
+char *iOSFake_Select( filter_t *p_filter, const char* psz_fontname,
+ bool b_bold, bool b_italic, int i_size, int *i_idx );
#endif
#endif /* __APPLE__ */
--
2.6.3
From 94f07cc008ae3e8c110153bacae03a38253bb1da Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
Date: Mon, 31 Mar 2014 17:54:01 +0200
Subject: [PATCH 14/14] libvlc: add preliminary code path to modify quartztext
variables on-the-fly
---
include/vlc/libvlc_media_player.h | 21 ++++++++++++++
lib/libvlc.sym | 4 +++
lib/media_player.c | 6 ++++
lib/video.c | 47 ++++++++++++++++++++++++++++++++
modules/text_renderer/quartztext.c | 56 ++++++++++++++++++++++++++++++++++----
5 files changed, 128 insertions(+), 6 deletions(-)
diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 6614340..9c17963 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -1515,6 +1515,27 @@ LIBVLC_API float libvlc_video_get_adjust_float( libvlc_media_player_t *p_mi,
LIBVLC_API void libvlc_video_set_adjust_float( libvlc_media_player_t *p_mi,
unsigned option, float value );
+/** option values for libvlc_video_{get,set}_adjust_{int,float,bool} */
+enum libvlc_video_textrenderer_option_t {
+ libvlc_textrender_font = 0,
+ libvlc_textrender_fontsize,
+ libvlc_textrender_fontcolor,
+};
+
+LIBVLC_API int libvlc_video_get_textrenderer_int( libvlc_media_player_t *p_mi,
+ unsigned option );
+
+LIBVLC_API void libvlc_video_set_textrenderer_int( libvlc_media_player_t *p_mi,
+ unsigned option, int value );
+
+LIBVLC_API char *libvlc_video_get_textrenderer_string( libvlc_media_player_t *p_mi,
+ unsigned option );
+
+LIBVLC_API void libvlc_video_set_textrenderer_string( libvlc_media_player_t *p_mi,
+ unsigned option,
+ const char *psz_text );
+
+
/** @} video */
/** \defgroup libvlc_audio LibVLC audio controls
diff --git a/lib/libvlc.sym b/lib/libvlc.sym
index 49207db..9ef430e 100644
--- a/lib/libvlc.sym
+++ b/lib/libvlc.sym
@@ -229,6 +229,8 @@ libvlc_video_get_spu_count
libvlc_video_get_spu_delay
libvlc_video_get_spu_description
libvlc_video_get_teletext
+libvlc_video_get_text_renderer_int
+libvlc_video_get_text_renderer_string
libvlc_video_get_title_description
libvlc_video_get_track
libvlc_video_get_track_count
@@ -253,6 +255,8 @@ libvlc_video_set_spu
libvlc_video_set_spu_delay
libvlc_video_set_subtitle_file
libvlc_video_set_teletext
+libvlc_video_set_text_renderer_int
+libvlc_video_set_text_renderer_string
libvlc_video_set_track
libvlc_video_take_snapshot
libvlc_vlm_add_broadcast
diff --git a/lib/media_player.c b/lib/media_player.c
index eabbbf6..880bbe0 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -628,6 +628,12 @@ libvlc_media_player_new( libvlc_instance_t *instance )
var_Create (mp, "saturation", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT);
var_Create (mp, "gamma", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT);
+#ifdef __APPLE__
+ var_Create (mp, "quartztext-font", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
+ var_Create (mp, "quartztext-fontsize", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
+ var_Create (mp, "quartztext-color", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
+#endif
+
/* Audio */
var_Create (mp, "aout", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
var_Create (mp, "audio-device", VLC_VAR_STRING);
diff --git a/lib/video.c b/lib/video.c
index b2c9b34..588aa1d 100644
--- a/lib/video.c
+++ b/lib/video.c
@@ -910,3 +910,50 @@ float libvlc_video_get_adjust_float( libvlc_media_player_t *p_mi,
{
return get_float( p_mi, "adjust", adjust_option_bynumber(option) );
}
+
+
+static const opt_t *
+textrenderer_option_bynumber( unsigned option )
+{
+ static const opt_t optlist[] =
+ {
+ { "quartztext-font", VLC_VAR_STRING },
+ { "quartztext-fontsize", VLC_VAR_INTEGER },
+ { "quartztext-color", VLC_VAR_INTEGER },
+ };
+ enum { num_opts = sizeof(optlist) / sizeof(*optlist) };
+
+ const opt_t *r = option < num_opts ? optlist+option : NULL;
+ if( !r )
+ libvlc_printerr( "Unknown quartztext option" );
+ return r;
+}
+
+/* basic text renderer support */
+
+void libvlc_video_set_textrenderer_int( libvlc_media_player_t *p_mi,
+ unsigned option, int value )
+{
+ set_int( p_mi, "quartztext", textrenderer_option_bynumber(option), value );
+}
+
+
+int libvlc_video_get_textrenderer_int( libvlc_media_player_t *p_mi,
+ unsigned option )
+{
+ return get_int( p_mi, "quartztext", textrenderer_option_bynumber(option) );
+}
+
+
+void libvlc_video_set_textrenderer_string( libvlc_media_player_t *p_mi,
+ unsigned option, const char *psz_value )
+{
+ set_string( p_mi, "quartztext", textrenderer_option_bynumber(option), psz_value );
+}
+
+
+char * libvlc_video_get_textrenderer_string( libvlc_media_player_t *p_mi,
+ unsigned option )
+{
+ return get_string( p_mi, "quartztext", textrenderer_option_bynumber(option) );
+}
diff --git a/modules/text_renderer/quartztext.c b/modules/text_renderer/quartztext.c
index 5e2cefe..ac0894e 100644
--- a/modules/text_renderer/quartztext.c
+++ b/modules/text_renderer/quartztext.c
@@ -67,6 +67,10 @@
static int Create (vlc_object_t *);
static void Destroy(vlc_object_t *);
+static int QuartztextCallback( vlc_object_t *p_this, char const *psz_var,
+ vlc_value_t oldval, vlc_value_t newval,
+ void *p_data );
+
static int LoadFontsFromAttachments(filter_t *p_filter);
static int RenderText(filter_t *, subpicture_region_t *,
@@ -128,16 +132,20 @@ vlc_module_begin ()
false)
add_string("quartztext-monofont", DEFAULT_MONOFONT, MONOSPACE_FONT_TEXT, FONT_LONGTEXT,
false)
- add_integer("quartztext-rel-fontsize", DEFAULT_REL_FONT_SIZE, FONTSIZER_TEXT,
+ change_safe()
+ add_integer("quartztext-fontsize", DEFAULT_REL_FONT_SIZE, FONTSIZER_TEXT,
FONTSIZER_LONGTEXT, false)
+ change_safe()
change_integer_list(pi_sizes, ppsz_sizes_text)
add_integer("quartztext-color", 0x00FFFFFF, COLOR_TEXT,
COLOR_LONGTEXT, false)
+ change_safe()
change_integer_list(pi_color_values, ppsz_color_descriptions)
add_bool("quartztext-outline", false, OUTLINE_TEXT, NULL, false)
add_bool("quartztext-shadow", true, SHADOW_TEXT, NULL, false)
set_capability("text renderer", 50)
add_shortcut("text")
+ add_shortcut("quartztext")
set_callbacks(Create, Destroy)
vlc_module_end ()
@@ -179,6 +187,7 @@ struct offscreen_bitmap_t
*****************************************************************************/
struct filter_sys_t
{
+ vlc_mutex_t lock;
text_style_t *p_default_style;
#ifndef TARGET_OS_IPHONE
@@ -208,11 +217,11 @@ static int Create(vlc_object_t *p_this)
free(p_sys);
return VLC_ENOMEM;
}
- p_sys->p_default_style->psz_fontname = var_CreateGetString(p_this, "quartztext-font");;
+ p_sys->p_default_style->psz_fontname = var_CreateGetStringCommand(p_this, "quartztext-font");;
p_sys->p_default_style->psz_monofontname = var_CreateGetString(p_this, "quartztext-monofont");
p_sys->p_default_style->i_font_size = GetFontSize(p_filter);
- p_sys->p_default_style->i_font_color = VLC_CLIP(var_CreateGetInteger(p_this, "quartztext-color") , 0, 0xFFFFFF);
+ p_sys->p_default_style->i_font_color = VLC_CLIP(var_CreateGetIntegerCommand(p_this, "quartztext-color") , 0, 0xFFFFFF);
p_sys->p_default_style->i_features |= STYLE_HAS_FONT_COLOR;
if( var_InheritBool(p_this, "quartztext-outline") )
@@ -244,6 +253,11 @@ static int Create(vlc_object_t *p_this)
p_sys->i_fonts = 0;
#endif
+ vlc_mutex_init( &p_sys->lock );
+ var_AddCallback( p_filter, "quartztext-font", QuartztextCallback, p_sys );
+ var_AddCallback( p_filter, "quartztext-fontsize", QuartztextCallback, p_sys );
+ var_AddCallback( p_filter, "quartztext-color", QuartztextCallback, p_sys );
+
LoadFontsFromAttachments(p_filter);
return VLC_SUCCESS;
@@ -258,6 +272,16 @@ static void Destroy(vlc_object_t *p_this)
{
filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys = p_filter->p_sys;
+
+ var_DelCallback( p_filter, "quartztext-font", QuartztextCallback, p_sys );
+ var_DelCallback( p_filter, "quartztext-fontsize", QuartztextCallback, p_sys );
+ var_DelCallback( p_filter, "quartztext-color", QuartztextCallback, p_sys );
+ vlc_mutex_destroy( &p_sys->lock );
+
+ var_Destroy( p_filter, "quartztext-font" ) ;
+ var_Destroy( p_filter, "quartztext-fontsize" );
+ var_Destroy( p_filter, "quartztext-color" );
+
#ifndef TARGET_OS_IPHONE
if (p_sys->p_fonts) {
for (int k = 0; k < p_sys->i_fonts; k++)
@@ -635,12 +659,12 @@ static int GetFontSize(filter_t *p_filter)
{
int i_size = 0;
- int i_ratio = var_CreateGetInteger( p_filter, "quartztext-rel-fontsize" );
+ int i_ratio = var_CreateGetIntegerCommand( p_filter, "quartztext-fontsize" );
+
if( i_ratio > 0 )
i_size = (int)p_filter->fmt_out.video.i_height / i_ratio;
- if( i_size <= 0 )
- {
+ if( i_size <= 0 ) {
msg_Warn( p_filter, "invalid fontsize, using 12" );
i_size = 12;
}
@@ -726,3 +750,23 @@ static int RenderYUVA(filter_t *p_filter, subpicture_region_t *p_region,
return VLC_SUCCESS;
}
+
+static int QuartztextCallback( vlc_object_t *p_this, char const *psz_var,
+ vlc_value_t oldval, vlc_value_t newval,
+ void *p_data )
+{
+ VLC_UNUSED(oldval);
+ filter_t *p_filter = (filter_t *)p_this;
+ filter_sys_t *p_sys = (filter_sys_t *)p_data;
+
+ vlc_mutex_lock( &p_sys->lock );
+ if( !strcmp( psz_var, "quartztext-font" ) )
+ p_sys->p_default_style->psz_fontname = newval.psz_string;
+ else if( !strcmp( psz_var, "quartztext-fontsize" ) )
+ p_sys->p_default_style->i_font_size = (int)p_filter->fmt_out.video.i_height / newval.i_int;
+ else if( !strcmp( psz_var, "quartztext-color" ) )
+ p_sys->p_default_style->i_font_color = VLC_CLIP(newval.i_int, 0, 0xFFFFFF);
+ vlc_mutex_unlock( &p_sys->lock );
+
+ return VLC_SUCCESS;
+}
--
2.6.3
From 4782cb6028f64999615ec26a5a4a194b9de7bb5b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
Date: Mon, 23 Nov 2015 16:09:24 +0100
Subject: [PATCH 15/19] libvlc: expose a base set of freetype options to
overwrite the default font
---
include/vlc/libvlc_media_player.h | 26 ++++++++++++
lib/libvlc.sym | 6 +++
lib/media_player.c | 6 +++
lib/video.c | 67 ++++++++++++++++++++++++++++++-
modules/text_renderer/freetype/freetype.c | 58 ++++++++++++++++++++++++--
modules/text_renderer/freetype/freetype.h | 2 +
6 files changed, 161 insertions(+), 4 deletions(-)
diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 6614340..ef5c54c 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h