set_category( CAT_INTERFACE )
set_subcategory( SUBCAT_INTERFACE_MAIN )
- add_file( "fbosd-dev", "/dev/fb1", NULL, DEVICE_TEXT, DEVICE_LONGTEXT,
+ add_file( "fbosd-dev", "/dev/fb0", NULL, DEVICE_TEXT, DEVICE_LONGTEXT,
false )
add_string( "fbosd-aspect-ratio", "", NULL, ASPECT_RATIO_TEXT,
ASPECT_RATIO_LONGTEXT, true )
int i_state;
/* Font style */
- text_style_t text_style; /* font control */
+ text_style_t* p_text_style; /* font control */
char *psz_string;
/* Position */
int i;
/* Allocate instance and initialize some members */
- p_intf->p_sys = p_sys = malloc( sizeof( intf_sys_t ) );
+ p_intf->p_sys = p_sys = calloc( 1, sizeof( intf_sys_t ) );
if( !p_intf->p_sys )
return VLC_ENOMEM;
- memset( p_sys, 0, sizeof(intf_sys_t) );
- p_sys->p_style = malloc( sizeof( text_style_t ) );
+ p_sys->p_style = text_style_New();
if( !p_sys->p_style )
{
free( p_intf->p_sys );
return VLC_ENOMEM;
}
- vlc_memcpy( p_sys->p_style, &default_text_style, sizeof( text_style_t ) );
p_intf->pf_run = Run;
p_sys->p_image = image_HandlerCreate( p_this );
if( !p_sys->p_image )
{
- free( p_intf->p_sys->p_style );
- free( p_intf->p_sys );
+ text_style_Delete( p_sys->p_style );
+ free( p_sys );
return VLC_ENOMEM;
}
atoi( psz_aspect ), atoi( psz_parser ) );
free( psz_aspect );
- psz_aspect = NULL;
}
/* Use PAL by default */
var_AddCallback( p_intf, "fbosd-font-opacity", OverlayCallback, NULL );
for( i = 0; i < FBOSD_RENDER_MAX; i++ )
- {
- vlc_memcpy( &p_sys->render[i].text_style, &default_text_style,
- sizeof( text_style_t ) );
- }
+ p_sys->render[i].p_text_style = text_style_New();
p_sys->b_clear = var_CreateGetBoolCommand( p_intf, "fbosd-clear" );
p_sys->b_render = var_CreateGetBoolCommand( p_intf, "fbosd-render" );
static void Destroy( vlc_object_t *p_this )
{
intf_thread_t *p_intf = (intf_thread_t *)p_this;
- intf_sys_t *p_sys = (intf_sys_t *) p_intf->p_sys;
+ intf_sys_t *p_sys = p_intf->p_sys;
int i;
+
p_sys->b_need_update = false;
p_sys->b_render = false;
p_sys->b_clear = false;
{
free( p_sys->render[i].psz_string );
p_sys->render[i].i_state = FBOSD_STATE_FREE;
+ text_style_Delete( p_sys->render[i].p_text_style );
}
#if defined(FBOSD_BLENDING)
if( p_sys->p_overlay )
picture_Release( p_sys->p_overlay );
- free( p_sys->p_style );
+ text_style_Delete( p_sys->p_style );
free( p_sys );
}
p_intf->p_sys->fmt_out.i_chroma;
if( config_GetInt( p_intf, "freetype-yuvp" ) )
p_intf->p_sys->p_blend->fmt_in.video.i_chroma =
- VLC_FOURCC('Y','U','V','P');
+ VLC_CODEC_YUVP;
else
p_intf->p_sys->p_blend->fmt_in.video.i_chroma =
- VLC_FOURCC('Y','U','V','A');
+ VLC_CODEC_YUVA;
p_intf->p_sys->p_blend->p_module =
module_need( p_intf->p_sys->p_blend, "video blending", NULL, false );
return NULL;
if( !p_fmt->p_palette &&
- ( p_fmt->i_chroma == VLC_FOURCC('Y','U','V','P') ) )
+ ( p_fmt->i_chroma == VLC_CODEC_YUVP ) )
{
p_fmt->p_palette = malloc( sizeof(video_palette_t) );
if( !p_fmt->p_palette )
static void SetOverlayTransparency( intf_thread_t *p_intf,
bool b_transparent )
{
- intf_sys_t *p_sys = (intf_sys_t *) p_intf->p_sys;
+ intf_sys_t *p_sys = p_intf->p_sys;
size_t i_size = p_sys->fmt_out.i_width * p_sys->fmt_out.i_height
* p_sys->i_bytes_per_pixel;
size_t i_page_size = (p_sys->i_page_size > i_size) ?
video_format_t *p_fmt_dst, picture_t *p_pic_src,
picture_t *p_pic_dst )
{
- intf_sys_t *p_sys = (intf_sys_t *) p_intf->p_sys;
+ intf_sys_t *p_sys = p_intf->p_sys;
if( p_sys->p_blend && p_sys->p_blend->p_module )
{
int i_x_offset = p_sys->i_x;
switch( fmt.i_chroma )
{
- case VLC_FOURCC('R','V','2','4'):
+ case VLC_CODEC_RGB24:
p_begin = (uint8_t *)(*p_pic)->p[Y_PLANE].p_pixels;
p_end = (uint8_t *)(*p_pic)->p[Y_PLANE].p_pixels +
( fmt.i_height * (*p_pic)->p[Y_PLANE].i_pitch );
i_skip = 3;
break;
- case VLC_FOURCC('R','V','3','2'):
+ case VLC_CODEC_RGB32:
p_begin = (uint8_t *)(*p_pic)->p[Y_PLANE].p_pixels;
p_end = (uint8_t *)(*p_pic)->p[Y_PLANE].p_pixels +
( fmt.i_height * (*p_pic)->p[Y_PLANE].i_pitch );
static picture_t *RenderText( intf_thread_t *p_intf, const char *psz_string,
text_style_t *p_style, video_format_t *p_fmt )
{
- intf_sys_t *p_sys = (intf_sys_t *) p_intf->p_sys;
+ intf_sys_t *p_sys = p_intf->p_sys;
subpicture_region_t *p_region;
picture_t *p_dest = NULL;
video_format_t fmt;
memset( &fmt, 0, sizeof(fmt) );
- fmt.i_chroma = VLC_FOURCC('T','E','X','T');
+ fmt.i_chroma = VLC_CODEC_TEXT;
fmt.i_aspect = 0;
fmt.i_width = fmt.i_visible_width = 0;
fmt.i_height = fmt.i_visible_height = 0;
subpicture_region_Delete( p_region );
return NULL;
}
- p_region->p_style = p_style;
+ p_region->p_style = text_style_Duplicate( p_style );
p_region->i_align = OSD_ALIGN_LEFT | OSD_ALIGN_TOP;
if( p_sys->p_text->pf_render_text )
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_dest = ConvertImage( p_intf, p_region->p_picture,
&p_region->fmt, &fmt_out );
#endif
subpicture_region_Delete( p_region );
static picture_t *ConvertImage( intf_thread_t *p_intf, picture_t *p_pic,
video_format_t *p_fmt_in, video_format_t *p_fmt_out )
{
- intf_sys_t *p_sys = (intf_sys_t *) p_intf->p_sys;
+ intf_sys_t *p_sys = p_intf->p_sys;
picture_t *p_old = NULL;
if( p_sys->p_image )
*****************************************************************************/
static int Init( intf_thread_t *p_intf )
{
- intf_sys_t *p_sys = (intf_sys_t *) p_intf->p_sys;
+ intf_sys_t *p_sys = p_intf->p_sys;
/* Initialize the output structure: RGB with square pixels, whatever
* the input format is, since it's the only format we know */
switch( p_sys->var_info.bits_per_pixel )
{
case 8: /* FIXME: set the palette */
- p_sys->fmt_out.i_chroma = VLC_FOURCC('R','G','B','2'); break;
+ p_sys->fmt_out.i_chroma = VLC_CODEC_RGB8; break;
case 15:
- p_sys->fmt_out.i_chroma = VLC_FOURCC('R','V','1','5'); break;
+ p_sys->fmt_out.i_chroma = VLC_CODEC_RGB15; break;
case 16:
- p_sys->fmt_out.i_chroma = VLC_FOURCC('R','V','1','6'); break;
+ p_sys->fmt_out.i_chroma = VLC_CODEC_RGB16; break;
case 24:
- p_sys->fmt_out.i_chroma = VLC_FOURCC('R','V','2','4'); break;
+ p_sys->fmt_out.i_chroma = VLC_CODEC_RGB24; break;
case 32:
- p_sys->fmt_out.i_chroma = VLC_FOURCC('R','V','3','2'); break;
+ p_sys->fmt_out.i_chroma = VLC_CODEC_RGB32; break;
default:
msg_Err( p_intf, "unknown screen depth %i",
p_sys->var_info.bits_per_pixel );
*****************************************************************************/
static void End( intf_thread_t *p_intf )
{
- intf_sys_t *p_sys = (intf_sys_t *) p_intf->p_sys;
+ intf_sys_t *p_sys = p_intf->p_sys;
/* CleanUp */
SetOverlayTransparency( p_intf, false );
*****************************************************************************/
static int OpenDisplay( intf_thread_t *p_intf )
{
- intf_sys_t *p_sys = (intf_sys_t *) p_intf->p_sys;
+ intf_sys_t *p_sys = p_intf->p_sys;
char *psz_device; /* framebuffer device path */
struct fb_fix_screeninfo fix_info; /* framebuffer fix information */
*****************************************************************************/
static void CloseDisplay( intf_thread_t *p_intf )
{
- intf_sys_t *p_sys = (intf_sys_t *) p_intf;
+ intf_sys_t *p_sys = p_intf->p_sys;
/* Restore palette */
if( p_sys->var_info.bits_per_pixel == 8 )
static void Render( intf_thread_t *p_intf, struct fbosd_render_t *render )
{
- intf_sys_t *p_sys = (intf_sys_t*) p_intf->p_sys;
+ intf_sys_t *p_sys = p_intf->p_sys;
if( render->i_state != FBOSD_STATE_RENDER ) return;
if( !render->psz_string ) return;
#if defined(FBOSD_BLENDING)
video_format_t fmt_in;
memset( &fmt_in, 0, sizeof(video_format_t) );
- p_text = RenderText( p_intf, render->psz_string, &render->text_style,
+ p_text = RenderText( p_intf, render->psz_string, render->p_text_style,
&fmt_in );
if( p_text )
{
DeAllocatePicture( p_text, &fmt_in );
}
#else
- p_text = RenderText( p_intf, render->psz_string, &render->text_style,
+ p_text = RenderText( p_intf, render->psz_string, render->p_text_style,
&p_sys->fmt_out );
if( p_text )
{
static void RenderClear( intf_thread_t *p_intf, struct fbosd_render_t *render )
{
- intf_sys_t *p_sys = (intf_sys_t*) p_intf->p_sys;
+ intf_sys_t *p_sys = p_intf->p_sys;
- vlc_memcpy( &render->text_style, &default_text_style,
- sizeof( text_style_t ) );
+ text_style_Delete( render->p_text_style );
+ render->p_text_style = text_style_New();
free( render->psz_string );
render->psz_string = NULL;
static bool isRendererReady( intf_thread_t *p_intf )
{
- intf_sys_t *p_sys = (intf_sys_t*) p_intf->p_sys;
+ intf_sys_t *p_sys = p_intf->p_sys;
int i;
/* Check if there are more items to render */
*****************************************************************************/
static void Run( intf_thread_t *p_intf )
{
- intf_sys_t *p_sys = (intf_sys_t*) p_intf->p_sys;
+ intf_sys_t *p_sys = p_intf->p_sys;
int canc = vlc_savecancel();
while( vlc_object_alive( p_intf ) )
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
intf_thread_t *p_intf = (intf_thread_t *) p_this;
- intf_sys_t *p_sys = (intf_sys_t*) p_intf->p_sys;
+ intf_sys_t *p_sys = p_intf->p_sys;
VLC_UNUSED(oldval); VLC_UNUSED(p_data);
if( !strncmp( psz_cmd, "fbosd-display", 13 ) )
}
else if( !strncmp( psz_cmd, "fbosd-font-size", 15 ) )
{
- p_sys->render[i].text_style.i_font_size = newval.i_int;
+ p_sys->render[i].p_text_style->i_font_size = newval.i_int;
}
else if( !strncmp( psz_cmd, "fbosd-font-color", 16 ) )
{
- p_sys->render[i].text_style.i_font_color = newval.i_int;
+ p_sys->render[i].p_text_style->i_font_color = newval.i_int;
}
else if( !strncmp( psz_cmd, "fbosd-font-opacity", 18 ) )
{
- p_sys->render[i].text_style.i_font_alpha = 255 - newval.i_int;
+ p_sys->render[i].p_text_style->i_font_alpha = 255 - newval.i_int;
}
else if( !strncmp( psz_cmd, "fbosd-alpha", 11 ) )
{