]> git.sesse.net Git - vlc/blobdiff - modules/misc/freetype.c
fix typo
[vlc] / modules / misc / freetype.c
index e65baeffac1f7956ae423b73813f98b6af3fe1a8..19b96ab71737519376f052cdf8a4b35d960d9fc2 100644 (file)
@@ -33,9 +33,7 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 #include <vlc_osd.h>
-#include <vlc_block.h>
 #include <vlc_filter.h>
 #include <vlc_stream.h>
 #include <vlc_xml.h>
@@ -130,40 +128,40 @@ static const char *const ppsz_color_descriptions[] = {
   N_("Red"), N_("Fuchsia"), N_("Yellow"), N_("Olive"), N_("Green"), N_("Teal"),
   N_("Lime"), N_("Purple"), N_("Navy"), N_("Blue"), N_("Aqua") };
 
-vlc_module_begin();
-    set_shortname( N_("Text renderer"));
-    set_description( N_("Freetype2 font renderer") );
-    set_category( CAT_VIDEO );
-    set_subcategory( SUBCAT_VIDEO_SUBPIC );
+vlc_module_begin ()
+    set_shortname( N_("Text renderer"))
+    set_description( N_("Freetype2 font renderer") )
+    set_category( CAT_VIDEO )
+    set_subcategory( SUBCAT_VIDEO_SUBPIC )
 
     add_file( "freetype-font", DEFAULT_FONT, NULL, FONT_TEXT, FONT_LONGTEXT,
-              false );
+              false )
 
     add_integer( "freetype-fontsize", 0, NULL, FONTSIZE_TEXT,
-                 FONTSIZE_LONGTEXT, true );
+                 FONTSIZE_LONGTEXT, true )
 
     /* opacity valid on 0..255, with default 255 = fully opaque */
     add_integer_with_range( "freetype-opacity", 255, 0, 255, NULL,
-        OPACITY_TEXT, OPACITY_LONGTEXT, true );
+        OPACITY_TEXT, OPACITY_LONGTEXT, true )
 
     /* hook to the color values list, with default 0x00ffffff = white */
     add_integer( "freetype-color", 0x00FFFFFF, NULL, COLOR_TEXT,
-                 COLOR_LONGTEXT, false );
-        change_integer_list( pi_color_values, ppsz_color_descriptions, NULL );
+                 COLOR_LONGTEXT, false )
+        change_integer_list( pi_color_values, ppsz_color_descriptions, NULL )
 
     add_integer( "freetype-rel-fontsize", 16, NULL, FONTSIZER_TEXT,
-                 FONTSIZER_LONGTEXT, false );
-        change_integer_list( pi_sizes, ppsz_sizes_text, NULL );
+                 FONTSIZER_LONGTEXT, false )
+        change_integer_list( pi_sizes, ppsz_sizes_text, NULL )
     add_integer( "freetype-effect", 2, NULL, EFFECT_TEXT,
-                 EFFECT_LONGTEXT, false );
-        change_integer_list( pi_effects, ppsz_effects_text, NULL );
+                 EFFECT_LONGTEXT, false )
+        change_integer_list( pi_effects, ppsz_effects_text, NULL )
 
     add_bool( "freetype-yuvp", 0, NULL, YUVP_TEXT,
-              YUVP_LONGTEXT, true );
-    set_capability( "text renderer", 100 );
-    add_shortcut( "text" );
-    set_callbacks( Create, Destroy );
-vlc_module_end();
+              YUVP_LONGTEXT, true )
+    set_capability( "text renderer", 100 )
+    add_shortcut( "text" )
+    set_callbacks( Create, Destroy )
+vlc_module_end ()
 
 
 
@@ -466,18 +464,21 @@ static vlc_object_t *FontBuilderAttach( filter_t *p_filter )
 
             var_Create( p_fontbuilder, "build-done", VLC_VAR_BOOL );
             var_SetBool( p_fontbuilder, "build-done", false );
+            var_Create( p_fontbuilder, "build-joined", VLC_VAR_BOOL );
+            var_SetBool( p_fontbuilder, "build-joined", false );
 
             if( vlc_thread_create( p_fontbuilder,
                                    "fontlist builder",
                                    FontBuilderThread,
-                                   VLC_THREAD_PRIORITY_LOW,
-                                   false ) )
+                                   VLC_THREAD_PRIORITY_LOW ) )
             {
                 msg_Warn( p_filter, "fontconfig database builder thread can't "
                         "be launched. Font styling support will be limited." );
             }
         }
     }
+    else
+        vlc_object_hold( p_fontbuilder );
     if( p_fontbuilder )
     {
         var_AddCallback( p_fontbuilder, "build-done", FontBuilderDone, p_filter );
@@ -491,21 +492,17 @@ static void FontBuilderDetach( filter_t *p_filter, vlc_object_t *p_fontbuilder )
     vlc_mutex_lock( &fb_lock );
     if( p_fontbuilder )
     {
-        const bool b_alive = vlc_object_alive( p_fontbuilder );
-
         var_DelCallback( p_fontbuilder, "build-done", FontBuilderDone, p_filter );
 
         /* We wait for the thread on the first FontBuilderDetach */
-        if( b_alive )
+        if( !var_GetBool( p_fontbuilder, "build-joined" ) )
         {
-            vlc_object_kill( p_fontbuilder );
+            var_SetBool( p_fontbuilder, "build-joined", true );
             vlc_mutex_unlock( &fb_lock );
-
             /* We need to unlock otherwise we may not join (the thread waiting
              * for the lock). It is safe to unlock as no one else will try a
              * join and we have a reference on the object) */
             vlc_thread_join( p_fontbuilder );
-
             vlc_mutex_lock( &fb_lock );
         }
         vlc_object_release( p_fontbuilder );
@@ -516,8 +513,6 @@ static void* FontBuilderThread( vlc_object_t *p_this )
 {
     FcConfig      *p_fontconfig = FcInitLoadConfig();
 
-    vlc_thread_ready( p_this );
-
     if( p_fontconfig )
     {
         mtime_t    t1, t2;