]> git.sesse.net Git - vlc/blobdiff - modules/misc/quartztext.c
vod: don't handle pause state toggling in the RTSP stack
[vlc] / modules / misc / quartztext.c
index b1dd12ade814bb05b53cab008f14a5dd917ee8c0..5a7228945ae511a78b1ee076b9f0999e6b60868b 100644 (file)
 #include <vlc_xml.h>
 #include <vlc_input.h>
 
+#include <TargetConditionals.h>
+
+#ifdef TARGET_OS_IPHONE
+#include <CoreText/CoreText.h>
+#include <CoreGraphics/CoreGraphics.h>
+
+#else
 // Fix ourselves ColorSync headers that gets included in ApplicationServices.
 #define DisposeCMProfileIterateUPP(a) DisposeCMProfileIterateUPP(CMProfileIterateUPP userUPP __attribute__((unused)))
 #define DisposeCMMIterateUPP(a) DisposeCMMIterateUPP(CMProfileIterateUPP userUPP __attribute__((unused)))
 #define __MACHINEEXCEPTIONS__
 #include <ApplicationServices/ApplicationServices.h>
+#endif
 
 #define DEFAULT_FONT           "Arial Black"
 #define DEFAULT_FONT_COLOR     0xffffff
@@ -109,14 +117,14 @@ vlc_module_begin ()
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_SUBPIC )
 
-    add_string( "quartztext-font", DEFAULT_FONT, NULL, FONT_TEXT, FONT_LONGTEXT,
+    add_string( "quartztext-font", DEFAULT_FONT, FONT_TEXT, FONT_LONGTEXT,
               false )
-    add_integer( "quartztext-rel-fontsize", DEFAULT_REL_FONT_SIZE, NULL, FONTSIZER_TEXT,
+    add_integer( "quartztext-rel-fontsize", DEFAULT_REL_FONT_SIZE, FONTSIZER_TEXT,
                  FONTSIZER_LONGTEXT, false )
-        change_integer_list( pi_sizes, ppsz_sizes_text, NULL );
-    add_integer( "quartztext-color", 0x00FFFFFF, NULL, COLOR_TEXT,
+        change_integer_list( pi_sizes, ppsz_sizes_text )
+    add_integer( "quartztext-color", 0x00FFFFFF, COLOR_TEXT,
                  COLOR_LONGTEXT, false )
-        change_integer_list( pi_color_values, ppsz_color_descriptions, NULL );
+        change_integer_list( pi_color_values, ppsz_color_descriptions )
     set_capability( "text renderer", 150 )
     add_shortcut( "text" )
     set_callbacks( Create, Destroy )
@@ -165,8 +173,10 @@ struct filter_sys_t
     int            i_font_color;
     int            i_font_size;
 
+#ifndef TARGET_OS_IPHONE
     ATSFontContainerRef    *p_fonts;
     int                     i_fonts;
+#endif
 };
 
 //////////////////////////////////////////////////////////////////////////////
@@ -191,8 +201,10 @@ static int Create( vlc_object_t *p_this )
     p_filter->pf_render_text = RenderText;
     p_filter->pf_render_html = RenderHtml;
 
+#ifndef TARGET_OS_IPHONE
     p_sys->p_fonts = NULL;
     p_sys->i_fonts = 0;
+#endif
 
     LoadFontsFromAttachments( p_filter );
 
@@ -208,7 +220,7 @@ 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;
-
+#ifndef TARGET_OS_IPHONE
     if( p_sys->p_fonts )
     {
         int   k;
@@ -220,7 +232,7 @@ static void Destroy( vlc_object_t *p_this )
 
         free( p_sys->p_fonts );
     }
-
+#endif
     free( p_sys->psz_font_name );
     free( p_sys );
 }
@@ -231,6 +243,10 @@ static void Destroy( vlc_object_t *p_this )
 //////////////////////////////////////////////////////////////////////////////
 static int LoadFontsFromAttachments( filter_t *p_filter )
 {
+#ifdef TARGET_OS_IPHONE
+    VLC_UNUSED(p_filter);
+    return VLC_SUCCESS;
+#else
     filter_sys_t         *p_sys = p_filter->p_sys;
     input_attachment_t  **pp_attachments;
     int                   i_attachments_cnt;
@@ -267,8 +283,8 @@ static int LoadFontsFromAttachments( filter_t *p_filter )
         vlc_input_attachment_Delete( p_attach );
     }
     free( pp_attachments );
-
     return VLC_SUCCESS;
+#endif
 }
 
 static char *EliminateCRLF( char *psz_string )
@@ -366,8 +382,8 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out,
                                              CFRangeMake( 0, len ), p_attrString);
 
         RenderYUVA( p_filter, p_region_out, p_attrString );
+        CFRelease( p_attrString );
     }
-    CFRelease(p_attrString);
 
     return VLC_SUCCESS;
 }
@@ -541,7 +557,7 @@ static void setFontAttibutes( char *psz_fontname, int i_font_size, uint32_t i_fo
 {
     CFStringRef p_cfString;
     CTFontRef   p_font;
-    
+
     // Handle font name and size
     p_cfString = CFStringCreateWithCString( NULL,
                                             psz_fontname,
@@ -881,7 +897,7 @@ static CGContextRef CreateOffScreenContext( int i_width, int i_height,
 
         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 )
         {