]> git.sesse.net Git - vlc/blobdiff - modules/gui/fbosd.c
module_need wants pointers and boolean so give NULL and false instead of 0.
[vlc] / modules / gui / fbosd.c
index 710452ce9d1454a96127f173fa3552e63a7336f4..f64b4b1253f334cbecca2545dc4c598d334ff878 100644 (file)
@@ -174,10 +174,10 @@ static const char *const ppsz_color_descriptions[] = {
                N_("Teal"), N_("Lime"), N_("Purple"), N_("Navy"), N_("Blue"),
                N_("Aqua") };
 
-vlc_module_begin();
-    set_shortname( "fbosd" );
-    set_category( CAT_INTERFACE );
-    set_subcategory( SUBCAT_INTERFACE_MAIN );
+vlc_module_begin ()
+    set_shortname( "fbosd" )
+    set_category( CAT_INTERFACE )
+    set_subcategory( SUBCAT_INTERFACE_MAIN )
 
     add_file( "fbosd-dev", "/dev/fb1", NULL, DEVICE_TEXT, DEVICE_LONGTEXT,
               false );
@@ -192,15 +192,15 @@ vlc_module_begin();
     add_integer_with_range( "fbosd-alpha", 255, 0, 255, NULL, ALPHA_TEXT,
                             ALPHA_LONGTEXT, true );
 
-    set_section( N_("Position"), NULL );
+    set_section( N_("Position"), NULL )
     add_integer( "fbosd-x", 0, NULL, POSX_TEXT,
                  POSX_LONGTEXT, false );
     add_integer( "fbosd-y", 0, NULL, POSY_TEXT,
                  POSY_LONGTEXT, false );
-    add_integer( "fbosd-position", 8, NULL, POS_TEXT, POS_LONGTEXT, true );
+    add_integer( "fbosd-position", 8, NULL, POS_TEXT, POS_LONGTEXT, true )
         change_integer_list( pi_pos_values, ppsz_pos_descriptions, NULL );
 
-    set_section( N_("Font"), NULL );
+    set_section( N_("Font"), NULL )
     add_integer_with_range( "fbosd-font-opacity", 255, 0, 255, NULL,
         OPACITY_TEXT, OPACITY_LONGTEXT, false );
     add_integer( "fbosd-font-color", 0x00FFFFFF, NULL, COLOR_TEXT, COLOR_LONGTEXT,
@@ -209,15 +209,15 @@ vlc_module_begin();
     add_integer( "fbosd-font-size", -1, NULL, SIZE_TEXT, SIZE_LONGTEXT,
                  false );
 
-    set_section( N_("Commands"), NULL );
-    add_bool( "fbosd-clear", false, NULL, CLEAR_TEXT, CLEAR_LONGTEXT, true );
-    add_bool( "fbosd-render", false, NULL, RENDER_TEXT, RENDER_LONGTEXT, true );
-    add_bool( "fbosd-display", false, NULL, DISPLAY_TEXT, DISPLAY_LONGTEXT, true );
+    set_section( N_("Commands"), NULL )
+    add_bool( "fbosd-clear", false, NULL, CLEAR_TEXT, CLEAR_LONGTEXT, true )
+    add_bool( "fbosd-render", false, NULL, RENDER_TEXT, RENDER_LONGTEXT, true )
+    add_bool( "fbosd-display", false, NULL, DISPLAY_TEXT, DISPLAY_LONGTEXT, true )
 
-    set_description( N_("GNU/Linux osd/overlay framebuffer interface") );
-    set_capability( "interface", 10 );
-    set_callbacks( Create, Destroy );
-vlc_module_end();
+    set_description( N_("GNU/Linux osd/overlay framebuffer interface") )
+    set_capability( "interface", 10 )
+    set_callbacks( Create, Destroy )
+vlc_module_end ()
 
 /*****************************************************************************
  * fbosd_render_t: render descriptor
@@ -547,7 +547,7 @@ static int OpenBlending( intf_thread_t *p_intf )
                 VLC_FOURCC('Y','U','V','A');
 
     p_intf->p_sys->p_blend->p_module =
-        module_Need( p_intf->p_sys->p_blend, "video blending", 0, 0 );
+        module_need( p_intf->p_sys->p_blend, "video blending", NULL, false );
 
     if( !p_intf->p_sys->p_blend->p_module )
         return VLC_EGENERIC;
@@ -560,7 +560,7 @@ static void CloseBlending( intf_thread_t *p_intf )
     if( p_intf->p_sys->p_blend )
     {
         if( p_intf->p_sys->p_blend->p_module )
-            module_Unneed( p_intf->p_sys->p_blend,
+            module_unneed( p_intf->p_sys->p_blend,
                            p_intf->p_sys->p_blend->p_module );
 
         vlc_object_detach( p_intf->p_sys->p_blend );
@@ -590,13 +590,13 @@ static int OpenTextRenderer( intf_thread_t *p_intf )
     if( psz_modulename && *psz_modulename )
     {
         p_intf->p_sys->p_text->p_module =
-            module_Need( p_intf->p_sys->p_text, "text renderer",
+            module_need( p_intf->p_sys->p_text, "text renderer",
                             psz_modulename, true );
     }
     if( !p_intf->p_sys->p_text->p_module )
     {
         p_intf->p_sys->p_text->p_module =
-            module_Need( p_intf->p_sys->p_text, "text renderer", 0, 0 );
+            module_need( p_intf->p_sys->p_text, "text renderer", NULL, false );
     }
     free( psz_modulename );
 
@@ -611,7 +611,7 @@ static void CloseTextRenderer( intf_thread_t *p_intf )
     if( p_intf->p_sys->p_text )
     {
         if( p_intf->p_sys->p_text->p_module )
-            module_Unneed( p_intf->p_sys->p_text,
+            module_unneed( p_intf->p_sys->p_text,
                            p_intf->p_sys->p_text->p_module );
 
         vlc_object_detach( p_intf->p_sys->p_text );
@@ -846,27 +846,27 @@ static picture_t *RenderText( intf_thread_t *p_intf, const char *psz_string,
 
     if( p_sys->p_text && p_sys->p_text->p_module )
     {
-        p_region = (subpicture_region_t *) malloc( sizeof(subpicture_region_t) );
+        video_format_t fmt;
+
+        memset( &fmt, 0, sizeof(fmt) );
+        fmt.i_chroma = VLC_FOURCC('T','E','X','T');
+        fmt.i_aspect = 0;
+        fmt.i_width  = fmt.i_visible_width = 0;
+        fmt.i_height = fmt.i_visible_height = 0;
+        fmt.i_x_offset = 0;
+        fmt.i_y_offset = 0;
+
+        p_region = subpicture_region_New( &fmt );
         if( !p_region )
             return p_dest;
 
-        memset( p_region, 0, sizeof(subpicture_region_t) );
-
         p_region->psz_text = strdup( psz_string );
         if( !p_region->psz_text )
         {
-            free( p_region );
+            subpicture_region_Delete( p_region );
             return NULL;
         }
         p_region->p_style = p_style;
-
-        p_region->fmt.i_chroma = VLC_FOURCC('T','E','X','T');
-        p_region->fmt.i_aspect = 0;
-        p_region->fmt.i_width = p_region->fmt.i_visible_width = 0;
-        p_region->fmt.i_height = p_region->fmt.i_visible_height = 0;
-        p_region->fmt.i_x_offset = 0;
-        p_region->fmt.i_y_offset = 0;
-
         p_region->i_align = OSD_ALIGN_LEFT | OSD_ALIGN_TOP;
 
         if( p_sys->p_text->pf_render_text )
@@ -887,24 +887,19 @@ static picture_t *RenderText( intf_thread_t *p_intf, const char *psz_string,
             p_dest = AllocatePicture( VLC_OBJECT(p_intf), &fmt_out );
             if( !p_dest )
             {
-                picture_Release( p_region->p_picture );
-                free( p_region->psz_text );
-                free( p_region );
+                subpicture_region_Delete( p_region );
                 return NULL;
             }
-            vout_CopyPicture( VLC_OBJECT(p_intf), p_dest, p_region->p_picture );
+            picture_Copy( p_dest, p_region->p_picture );
 #else
             fmt_out.i_chroma = p_fmt->i_chroma;
             p_dest = ConvertImage( p_intf, &p_region->p_picture,
                                    &p_region->fmt, &fmt_out );
 #endif
-            picture_Release( p_region->p_picture );
-            free( p_region->psz_text );
-            free( p_region );
+            subpicture_region_Delete( p_region );
             return p_dest;
         }
-        free( p_region->psz_text );
-        free( p_region );
+        subpicture_region_Delete( p_region );
     }
     return p_dest;
 }