# include "config.h"
#endif
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
#include <errno.h>
#include <stdlib.h> /* free() */
#define DISPLAY_LONGTEXT N_( "All rendered images and text will be " \
"displayed on the overlay framebuffer." )
-static int pi_pos_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };
-static const char *ppsz_pos_descriptions[] =
+static const int pi_pos_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };
+static const char *const ppsz_pos_descriptions[] =
{ N_("Center"), N_("Left"), N_("Right"), N_("Top"), N_("Bottom"),
N_("Top-Left"), N_("Top-Right"), N_("Bottom-Left"), N_("Bottom-Right") };
-static int pi_color_values[] = { 0xf0000000, 0x00000000, 0x00808080, 0x00C0C0C0,
+static const int pi_color_values[] = {
+ 0xf0000000, 0x00000000, 0x00808080, 0x00C0C0C0,
0x00FFFFFF, 0x00800000, 0x00FF0000, 0x00FF00FF, 0x00FFFF00,
0x00808000, 0x00008000, 0x00008080, 0x0000FF00, 0x00800080,
0x00000080, 0x000000FF, 0x0000FFFF};
-static const char *ppsz_color_descriptions[] = { N_("Default"), N_("Black"),
+static const char *const ppsz_color_descriptions[] = {
+ N_("Default"), 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"),
add_string( "fbosd-text", NULL, NULL, FBOSD_TEXT,
FBOSD_LONGTEXT, true );
-#if defined(FBOSD_BLENDING)
add_integer_with_range( "fbosd-alpha", 255, 0, 255, NULL, ALPHA_TEXT,
ALPHA_LONGTEXT, true );
-#endif
-
set_section( N_("Position"), NULL );
add_integer( "fbosd-x", 0, NULL, POSX_TEXT,
POSX_LONGTEXT, false );
add_bool( "fbosd-render", false, NULL, RENDER_TEXT, RENDER_LONGTEXT, true );
add_bool( "fbosd-display", false, NULL, DISPLAY_TEXT, DISPLAY_LONGTEXT, true );
- set_description( _("GNU/Linux osd/overlay framebuffer interface") );
+ set_description( N_("GNU/Linux osd/overlay framebuffer interface") );
set_capability( "interface", 10 );
set_callbacks( Create, Destroy );
vlc_module_end();
char *psz_string;
/* Position */
- bool b_absolute;
+ bool b_absolute;
int i_x;
int i_y;
int i_pos;
/* Allocate instance and initialize some members */
p_intf->p_sys = p_sys = malloc( sizeof( intf_sys_t ) );
if( !p_intf->p_sys )
- {
- msg_Err( p_intf, "out of memory" );
return VLC_ENOMEM;
- };
memset( p_sys, 0, sizeof(intf_sys_t) );
p_sys->p_style = malloc( sizeof( text_style_t ) );
if( !p_sys->p_style )
{
free( p_intf->p_sys );
- msg_Err( p_intf, "out of memory" );
return VLC_ENOMEM;
}
vlc_memcpy( p_sys->p_style, &default_text_style, sizeof( text_style_t ) );
{
free( p_intf->p_sys->p_style );
free( p_intf->p_sys );
- msg_Err( p_intf, "out of memory" );
return VLC_ENOMEM;
}
-#if defined(FBOSD_BLENDING)
p_sys->i_alpha = var_CreateGetIntegerCommand( p_intf, "fbosd-alpha" );
var_AddCallback( p_intf, "fbosd-alpha", OverlayCallback, NULL );
-#else
- p_sys->i_alpha = 255;
-#endif
+
p_sys->i_aspect = -1;
psz_aspect =
var_CreateGetNonEmptyString( p_intf, "fbosd-aspect-ratio" );
p_sys->b_render = false;
p_sys->b_clear = false;
-#if defined(FBOSD_BLENDING)
var_DelCallback( p_intf, "fbosd-alpha", OverlayCallback, NULL );
var_Destroy( p_intf, "fbosd-alpha" );
-#endif
var_DelCallback( p_intf, "fbosd-x", OverlayCallback, NULL );
var_DelCallback( p_intf, "fbosd-y", OverlayCallback, NULL );
{
free( p_pic->p_data_orig );
if( p_pic->pf_release ) p_pic->pf_release( p_pic );
+ else free( p_pic );
}
if( p_fmt )
{
{
msg_Dbg( p_intf, "Make overlay %s",
b_transparent ? "transparent" : "opaque" );
- memset( p_sys->p_overlay->p[0].p_pixels, 0x00, i_page_size );
if( b_transparent )
memset( p_sys->p_overlay->p[0].p_pixels, 0xFF, i_page_size );
+ else
+ memset( p_sys->p_overlay->p[0].p_pixels, 0x00, i_page_size );
}
}
for( ; p_begin < p_end; p_begin += i_skip )
{
- uint8_t i_opacity;
+ uint8_t i_opacity = 0;
- if( i_opacity != 0xFF )
+ if( *p_begin != 0xFF )
i_opacity = 255 - *p_begin;
*p_begin = i_opacity;
}
picture_t *p_src, picture_t *p_dest )
{
int i;
+ VLC_UNUSED( p_intf );
if( !p_dest && !p_src ) return VLC_EGENERIC;
memset( p_region, 0, sizeof(subpicture_region_t) );
p_region->psz_text = strdup( psz_string );
+ if( !p_region->psz_text )
+ {
+ free( p_region );
+ return NULL;
+ }
p_region->p_style = p_style;
p_region->fmt.i_chroma = VLC_FOURCC('T','E','X','T');
if( p_sys->p_overlay )
{
int ret;
- ret = write( p_sys->i_fd, p_sys->p_overlay->p[0].p_pixels, p_sys->i_page_size );
+ ret = write( p_sys->i_fd, p_sys->p_overlay->p[0].p_pixels,
+ p_sys->i_page_size );
if( ret < 0 )
msg_Err( p_intf, "unable to clear overlay" );
}
}
/*****************************************************************************
- * Run: rc thread
+ * Run: thread
*****************************************************************************
* This part of the interface is in a separate thread so that we can call
* exec() from within it without annoying the rest of the program.
{
p_sys->render[i].text_style.i_font_alpha = 255 - newval.i_int;
}
-#if defined(FBOSD_BLENDING)
else if( !strncmp( psz_cmd, "fbosd-alpha", 11 ) )
{
p_sys->render[i].i_alpha = newval.i_int;
}
-#endif
}
return VLC_SUCCESS;
}