Commit 4197f75c authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

quartztext: Basic support for iOS.

parent 0c8b345c
...@@ -36,11 +36,17 @@ ...@@ -36,11 +36,17 @@
#include <vlc_xml.h> #include <vlc_xml.h>
#include <vlc_input.h> #include <vlc_input.h>
#include <Availability.h>
#include <CoreText/CoreText.h>
#include <CoreGraphics/CoreGraphics.h>
#if !TARGET_OS_IPHONE
// Fix ourselves ColorSync headers that gets included in ApplicationServices. // Fix ourselves ColorSync headers that gets included in ApplicationServices.
#define DisposeCMProfileIterateUPP(a) DisposeCMProfileIterateUPP(CMProfileIterateUPP userUPP __attribute__((unused))) #define DisposeCMProfileIterateUPP(a) DisposeCMProfileIterateUPP(CMProfileIterateUPP userUPP __attribute__((unused)))
#define DisposeCMMIterateUPP(a) DisposeCMMIterateUPP(CMProfileIterateUPP userUPP __attribute__((unused))) #define DisposeCMMIterateUPP(a) DisposeCMMIterateUPP(CMProfileIterateUPP userUPP __attribute__((unused)))
#define __MACHINEEXCEPTIONS__ #define __MACHINEEXCEPTIONS__
#include <ApplicationServices/ApplicationServices.h> #include <ApplicationServices/ApplicationServices.h>
#endif
#define DEFAULT_FONT "Arial Black" #define DEFAULT_FONT "Arial Black"
#define DEFAULT_FONT_COLOR 0xffffff #define DEFAULT_FONT_COLOR 0xffffff
...@@ -165,8 +171,10 @@ struct filter_sys_t ...@@ -165,8 +171,10 @@ struct filter_sys_t
int i_font_color; int i_font_color;
int i_font_size; int i_font_size;
#if !TARGET_OS_IPHONE
ATSFontContainerRef *p_fonts; ATSFontContainerRef *p_fonts;
int i_fonts; int i_fonts;
#endif
}; };
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
...@@ -191,8 +199,10 @@ static int Create( vlc_object_t *p_this ) ...@@ -191,8 +199,10 @@ static int Create( vlc_object_t *p_this )
p_filter->pf_render_text = RenderText; p_filter->pf_render_text = RenderText;
p_filter->pf_render_html = RenderHtml; p_filter->pf_render_html = RenderHtml;
#if !TARGET_OS_IPHONE
p_sys->p_fonts = NULL; p_sys->p_fonts = NULL;
p_sys->i_fonts = 0; p_sys->i_fonts = 0;
#endif
LoadFontsFromAttachments( p_filter ); LoadFontsFromAttachments( p_filter );
...@@ -208,7 +218,7 @@ static void Destroy( vlc_object_t *p_this ) ...@@ -208,7 +218,7 @@ static void Destroy( vlc_object_t *p_this )
{ {
filter_t *p_filter = (filter_t *)p_this; filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys = p_filter->p_sys; filter_sys_t *p_sys = p_filter->p_sys;
#if !TARGET_OS_IPHONE
if( p_sys->p_fonts ) if( p_sys->p_fonts )
{ {
int k; int k;
...@@ -220,7 +230,7 @@ static void Destroy( vlc_object_t *p_this ) ...@@ -220,7 +230,7 @@ static void Destroy( vlc_object_t *p_this )
free( p_sys->p_fonts ); free( p_sys->p_fonts );
} }
#endif
free( p_sys->psz_font_name ); free( p_sys->psz_font_name );
free( p_sys ); free( p_sys );
} }
...@@ -231,6 +241,10 @@ static void Destroy( vlc_object_t *p_this ) ...@@ -231,6 +241,10 @@ static void Destroy( vlc_object_t *p_this )
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
static int LoadFontsFromAttachments( filter_t *p_filter ) static int LoadFontsFromAttachments( filter_t *p_filter )
{ {
#if TARGET_OS_IPHONE
VLC_UNUSED(p_filter);
return VLC_SUCCESS;
#else
filter_sys_t *p_sys = p_filter->p_sys; filter_sys_t *p_sys = p_filter->p_sys;
input_attachment_t **pp_attachments; input_attachment_t **pp_attachments;
int i_attachments_cnt; int i_attachments_cnt;
...@@ -267,8 +281,8 @@ static int LoadFontsFromAttachments( filter_t *p_filter ) ...@@ -267,8 +281,8 @@ static int LoadFontsFromAttachments( filter_t *p_filter )
vlc_input_attachment_Delete( p_attach ); vlc_input_attachment_Delete( p_attach );
} }
free( pp_attachments ); free( pp_attachments );
return VLC_SUCCESS; return VLC_SUCCESS;
#endif
} }
static char *EliminateCRLF( char *psz_string ) static char *EliminateCRLF( char *psz_string )
...@@ -881,7 +895,7 @@ static CGContextRef CreateOffScreenContext( int i_width, int i_height, ...@@ -881,7 +895,7 @@ static CGContextRef CreateOffScreenContext( int i_width, int i_height,
p_bitmap->p_data = calloc( i_height, p_bitmap->i_bytesPerRow ); p_bitmap->p_data = calloc( i_height, p_bitmap->i_bytesPerRow );
*pp_colorSpace = CGColorSpaceCreateWithName( kCGColorSpaceGenericRGB ); *pp_colorSpace = CGColorSpaceCreateDeviceRGB();
if( p_bitmap->p_data && *pp_colorSpace ) if( p_bitmap->p_data && *pp_colorSpace )
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment