]> git.sesse.net Git - vlc/blobdiff - modules/misc/win32text.c
macosx: Fix addNode:.
[vlc] / modules / misc / win32text.c
index 52882d9cdf884c89ed66fa6044861998a5dc1467..6318570ffd0a541290394aebdfc0b457119a63d5 100644 (file)
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <stdlib.h>                                      /* malloc(), free() */
-#include <string.h>
 
-#include <vlc/vlc.h>
-#include <vlc/vout.h>
-#include "vlc_osd.h"
-#include "vlc_block.h"
-#include "vlc_filter.h"
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#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 <math.h>
 
@@ -57,52 +60,54 @@ static int SetFont( filter_t *, int );
 #define FONTSIZE_LONGTEXT N_("This is the default size of the fonts " \
      "that will be rendered on the video. " \
      "If set to something different than 0 this option will override the " \
-     "relative font size. " )
+     "relative font size." )
 #define OPACITY_TEXT N_("Opacity")
 #define OPACITY_LONGTEXT N_("The opacity (inverse of transparency) of the " \
      "text that will be rendered on the video. 0 = transparent, " \
      "255 = totally opaque. " )
 #define COLOR_TEXT N_("Text default color")
 #define COLOR_LONGTEXT N_("The color of the text that will be rendered on "\
-  "the video. This must be an hexadecimal (like HTML colors). The first two "\    "chars are for red, then green, then blue. #000000 = black, #FF0000 = red,"\    " #00FF00 = green, #FFFF00 = yellow (red + green), #FFFFFF = white" )
+  "the video. This must be an hexadecimal (like HTML colors). The first two "\
+  "chars are for red, then green, then blue. #000000 = black, #FF0000 = red,"\
+  " #00FF00 = green, #FFFF00 = yellow (red + green), #FFFFFF = white" )
 #define FONTSIZER_TEXT N_("Relative font size")
 #define FONTSIZER_LONGTEXT N_("This is the relative default size of the " \
   "fonts that will be rendered on the video. If absolute font size is set, "\
    "relative size will be overriden." )
 
-static int   pi_sizes[] = { 20, 18, 16, 12, 6 };
-static char *ppsz_sizes_text[] = { N_("Smaller"), N_("Small"), N_("Normal"),
-                                   N_("Large"), N_("Larger") };
-static int pi_color_values[] = {
+static int const pi_sizes[] = { 20, 18, 16, 12, 6 };
+static char *const ppsz_sizes_text[] = {
+    N_("Smaller"), N_("Small"), N_("Normal"), N_("Large"), N_("Larger") };
+static const int pi_color_values[] = {
   0x00000000, 0x00808080, 0x00C0C0C0, 0x00FFFFFF, 0x00800000,
   0x00FF0000, 0x00FF00FF, 0x00FFFF00, 0x00808000, 0x00008000, 0x00008080,
   0x0000FF00, 0x00800080, 0x00000080, 0x000000FF, 0x0000FFFF };
 
-static char *ppsz_color_descriptions[] = {
+static const char *const ppsz_color_descriptions[] = {
   N_("Black"), N_("Gray"), N_("Silver"), N_("White"), N_("Maroon"),
   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( _("Text renderer"));
-    set_description( _("Win32 font renderer") );
+    set_shortname( N_("Text renderer"));
+    set_description( N_("Win32 font renderer") );
     set_category( CAT_VIDEO );
     set_subcategory( SUBCAT_VIDEO_SUBPIC );
 
     add_integer( "win32text-fontsize", 0, NULL, FONTSIZE_TEXT,
-                 FONTSIZE_LONGTEXT, VLC_TRUE );
+                 FONTSIZE_LONGTEXT, true );
 
     /* opacity valid on 0..255, with default 255 = fully opaque */
     add_integer_with_range( "win32-opacity", 255, 0, 255, NULL,
-        OPACITY_TEXT, OPACITY_LONGTEXT, VLC_FALSE );
+        OPACITY_TEXT, OPACITY_LONGTEXT, false );
 
     /* hook to the color values list, with default 0x00ffffff = white */
     add_integer( "win32text-color", 0x00FFFFFF, NULL, COLOR_TEXT,
-                 COLOR_LONGTEXT, VLC_TRUE );
+                 COLOR_LONGTEXT, true );
         change_integer_list( pi_color_values, ppsz_color_descriptions, 0 );
 
     add_integer( "win32text-rel-fontsize", 16, NULL, FONTSIZER_TEXT,
-                 FONTSIZER_LONGTEXT, VLC_FALSE );
+                 FONTSIZER_LONGTEXT, false );
         change_integer_list( pi_sizes, ppsz_sizes_text, 0 );
 
     set_capability( "text renderer", 50 );
@@ -146,10 +151,7 @@ static int Create( vlc_object_t *p_this )
     /* Allocate structure */
     p_filter->p_sys = p_sys = malloc( sizeof( filter_sys_t ) );
     if( !p_sys )
-    {
-        msg_Err( p_filter, "out of memory" );
         return VLC_ENOMEM;
-    }
     p_sys->i_font_size = 0;
     p_sys->i_display_height = 0;
 
@@ -179,12 +181,13 @@ static int Create( vlc_object_t *p_this )
     p_sys->i_default_font_size = val.i_int;
     if( SetFont( p_filter, 0 ) != VLC_SUCCESS ) goto error;
 
-    if( psz_fontfile ) free( psz_fontfile );
+    free( psz_fontfile );
     p_filter->pf_render_text = RenderText;
+    p_filter->pf_render_html = NULL;
     return VLC_SUCCESS;
 
  error:
-    if( psz_fontfile ) free( psz_fontfile );
+    free( psz_fontfile );
     free( p_sys );
     return VLC_EGENERIC;
 }
@@ -215,7 +218,7 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region,
     video_format_t fmt;
     int i, i_pitch;
     subpicture_region_t *p_region_tmp;
-    vlc_bool_t b_outline = VLC_TRUE;
+    bool b_outline = true;
 
     /* Create a new subpicture region */
     memset( &fmt, 0, sizeof(video_format_t) );
@@ -410,11 +413,11 @@ static int SetFont( filter_t *p_filter, int i_size )
         }
         if( i_size <= 0 )
         {
-            msg_Warn( p_filter, "Invalid fontsize, using 12" );
+            msg_Warn( p_filter, "invalid fontsize, using 12" );
             i_size = 12;
         }
 
-        msg_Dbg( p_filter, "Using fontsize: %i", i_size );
+        msg_Dbg( p_filter, "using fontsize: %i", i_size );
     }
 
     p_sys->i_font_size = i_size;