# include "config.h"
#endif
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
#include <vlc_vout.h>
#include <vlc_osd.h>
#include <vlc_block.h>
#include <fontconfig/fontconfig.h>
#endif
+#include <assert.h>
+
typedef struct line_desc_t line_desc_t;
/*****************************************************************************
"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 const char *ppsz_sizes_text[] = { N_("Smaller"), N_("Small"), N_("Normal"),
- N_("Large"), N_("Larger") };
+static const int pi_sizes[] = { 20, 18, 16, 12, 6 };
+static const char *const ppsz_sizes_text[] = {
+ N_("Smaller"), N_("Small"), N_("Normal"), N_("Large"), N_("Larger") };
#define YUVP_TEXT N_("Use YUVP renderer")
#define YUVP_LONGTEXT N_("This renders the font using \"paletized YUV\". " \
"This option is only needed if you want to encode into DVB subtitles" )
#define EFFECT_OUTLINE 2
#define EFFECT_OUTLINE_FAT 3
-static int pi_effects[] = { 1, 2, 3 };
-static const char *ppsz_effects_text[] = { N_("Background"),N_("Outline"),
- N_("Fat Outline") };
-static int pi_color_values[] = {
+static int const pi_effects[] = { 1, 2, 3 };
+static const char *const ppsz_effects_text[] = {
+ N_("Background"),N_("Outline"), N_("Fat Outline") };
+static const int pi_color_values[] = {
0x00000000, 0x00808080, 0x00C0C0C0, 0x00FFFFFF, 0x00800000,
0x00FF0000, 0x00FF00FF, 0x00FFFF00, 0x00808000, 0x00008000, 0x00008080,
0x0000FF00, 0x00800080, 0x00000080, 0x000000FF, 0x0000FFFF };
-static const 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( _("Freetype2 font renderer") );
+ set_shortname( N_("Text renderer"));
+ set_description( N_("Freetype2 font renderer") );
set_category( CAT_VIDEO );
set_subcategory( SUBCAT_VIDEO_SUBPIC );
/* 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->p_face = 0;
p_sys->p_library = 0;
p_sys->i_font_size = 0;
free( psz_fontfile );
psz_fontfile = (char *)malloc( PATH_MAX + 1 );
if( !psz_fontfile )
- {
- msg_Err( p_filter, "out of memory" );
goto error;
- }
#ifdef WIN32
GetWindowsDirectory( psz_fontfile, PATH_MAX + 1 );
strcat( psz_fontfile, "\\fonts\\arial.ttf" );
*/
p_fontbuilder = vlc_object_create( p_filter->p_libvlc,
- VLC_OBJECT_GENERIC );
+ sizeof(vlc_object_t) );
if( p_fontbuilder )
{
p_fontbuilder->psz_object_name = strdup( "fontlist builder" );
psz_unicode = psz_unicode_orig =
malloc( ( strlen(psz_string) + 1 ) * sizeof(uint32_t) );
if( psz_unicode == NULL )
- {
- msg_Err( p_filter, "out of memory" );
goto error;
- }
#if defined(WORDS_BIGENDIAN)
iconv_handle = vlc_iconv_open( "UCS-4BE", "UTF-8" );
#else
p_fribidi_string = malloc( (i_string_length + 1) * sizeof(uint32_t) );
if( !p_fribidi_string )
- {
- msg_Err( p_filter, "out of memory" );
goto error;
- }
/* Do bidi conversion line-by-line */
while( pos < i_string_length )
/* Calculate relative glyph positions and a bounding box for the
* entire string */
if( !(p_line = NewLine( strlen( psz_string ))) )
- {
- msg_Err( p_filter, "out of memory" );
goto error;
- }
p_lines = p_line;
i_pen_x = i_pen_y = 0;
i_previous = i = 0;
{
psz_line_start = psz_unicode;
if( !(p_next = NewLine( strlen( psz_string ))) )
- {
- msg_Err( p_filter, "out of memory" );
goto error;
- }
p_line->p_next = p_next;
p_line->i_width = line.xMax;
p_line->i_height = face->size->metrics.height >> 6;
! p_new_positions ||
! p_levels )
{
- msg_Err( p_filter, "out of memory" );
free( p_levels );
free( p_old_positions );
free( p_new_positions );
malloc( (k - i_prev + 1) * sizeof( uint32_t ));
if( !psz_unicode )
{
- msg_Err( p_filter, "out of memory" );
if( p_face ) FT_Done_Face( p_face );
free( pp_char_styles );
free( psz_unicode );
{
if( !(p_line = NewLine( i_len - i_prev)) )
{
- msg_Err( p_filter, "out of memory" );
if( p_face ) FT_Done_Face( p_face );
free( pp_char_styles );
free( psz_unicode );