#include <vlc_common.h>
#include <vlc_plugin.h>
+#include <vlc_fs.h>
+#include <vlc_modules.h>
-#include <errno.h>
#include <stdlib.h> /* free() */
#include <string.h> /* strerror() */
#include <fcntl.h> /* open() */
p_sys->i_alpha = var_CreateGetIntegerCommand( p_intf, "fbosd-alpha" );
var_AddCallback( p_intf, "fbosd-alpha", OverlayCallback, NULL );
+ /* Use PAL by default */
+ p_sys->i_width = p_sys->fmt_out.i_width = 704;
+ p_sys->i_height = p_sys->fmt_out.i_height = 576;
+
p_sys->i_aspect = -1;
psz_aspect =
var_CreateGetNonEmptyString( p_intf, "fbosd-aspect-ratio" );
*psz_parser++ = '\0';
p_sys->i_aspect = ( atoi( psz_aspect )
* VOUT_ASPECT_FACTOR ) / atoi( psz_parser );
- p_sys->fmt_out.i_aspect = p_sys->i_aspect;
+ p_sys->fmt_out.i_sar_num = p_sys->i_aspect * p_sys->i_height;
+ p_sys->fmt_out.i_sar_den = VOUT_ASPECT_FACTOR * p_sys->i_width;
}
msg_Dbg( p_intf, "using aspect ratio %d:%d",
atoi( psz_aspect ), atoi( psz_parser ) );
free( psz_aspect );
}
- /* Use PAL by default */
- p_sys->i_width = p_sys->fmt_out.i_width = 704;
- p_sys->i_height = p_sys->fmt_out.i_height = 576;
-
psz_tmp = var_CreateGetNonEmptyStringCommand( p_intf, "fbosd-image" );
var_AddCallback( p_intf, "fbosd-image", OverlayCallback, NULL );
if( psz_tmp && *psz_tmp )
vlc_object_attach( p_intf->p_sys->p_blend, p_intf );
p_intf->p_sys->p_blend->fmt_out.video.i_x_offset =
p_intf->p_sys->p_blend->fmt_out.video.i_y_offset = 0;
- p_intf->p_sys->p_blend->fmt_out.video.i_aspect =
- p_intf->p_sys->fmt_out.i_aspect;
+ p_intf->p_sys->p_blend->fmt_out.video.i_sar_num =
+ p_intf->p_sys->fmt_out.i_sar_num;
+ p_intf->p_sys->p_blend->fmt_out.video.i_sar_den =
+ p_intf->p_sys->fmt_out.i_sar_den;
p_intf->p_sys->p_blend->fmt_out.video.i_chroma =
p_intf->p_sys->fmt_out.i_chroma;
- if( config_GetInt( p_intf, "freetype-yuvp" ) )
+ if( var_InheritBool( p_intf, "freetype-yuvp" ) )
p_intf->p_sys->p_blend->fmt_in.video.i_chroma =
VLC_CODEC_YUVP;
else
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 );
vlc_object_release( p_intf->p_sys->p_blend );
}
}
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 );
vlc_object_release( p_intf->p_sys->p_text );
}
}
*****************************************************************************/
static picture_t *AllocatePicture( video_format_t *p_fmt )
{
- picture_t *p_picture = picture_New( p_fmt->i_chroma,
- p_fmt->i_width, p_fmt->i_height,
- p_fmt->i_aspect );
+ picture_t *p_picture = picture_NewFromFormat( p_fmt );
if( !p_picture )
return NULL;
memset( &fmt, 0, sizeof(fmt) );
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;
fmt.i_x_offset = 0;
return NULL;
}
p_region->p_style = text_style_Duplicate( p_style );
- p_region->i_align = OSD_ALIGN_LEFT | OSD_ALIGN_TOP;
+ p_region->i_align = SUBPICTURE_ALIGN_LEFT | SUBPICTURE_ALIGN_TOP;
if( p_sys->p_text->pf_render_text )
{
/* Assume we have square pixels */
if( p_sys->i_aspect < 0 )
{
- p_sys->fmt_out.i_aspect = ( p_sys->i_width
- * VOUT_ASPECT_FACTOR ) / p_sys->i_height;
+ p_sys->fmt_out.i_sar_num = 1;
+ p_sys->fmt_out.i_sar_den = 1;
+ }
+ else
+ {
+ p_sys->fmt_out.i_sar_num = p_sys->i_aspect * p_sys->i_height;
+ p_sys->fmt_out.i_sar_den = VOUT_ASPECT_FACTOR * p_sys->i_width;
}
- else p_sys->fmt_out.i_aspect = p_sys->i_aspect;
-
- p_sys->fmt_out.i_sar_num = p_sys->fmt_out.i_sar_den = 1;
/* Allocate overlay buffer */
p_sys->p_overlay = AllocatePicture( &p_sys->fmt_out );
struct fb_fix_screeninfo fix_info; /* framebuffer fix information */
/* Open framebuffer device */
- if( !(psz_device = config_GetPsz( p_intf, "fbosd-dev" )) )
+ if( !(psz_device = var_InheritString( p_intf, "fbosd-dev" )) )
{
msg_Err( p_intf, "don't know which fb osd/overlay device to open" );
return VLC_EGENERIC;
}
- p_sys->i_fd = open( psz_device, O_RDWR );
+ p_sys->i_fd = vlc_open( psz_device, O_RDWR );
if( p_sys->i_fd == -1 )
{
msg_Err( p_intf, "cannot open %s (%m)", psz_device );