Commit 34b0c609 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

fbosd: remove plugin

This plugin is unmaintained, unused and quite buggy.
parent 5adefde4
......@@ -36,6 +36,7 @@ Mac OS X Interface:
Removed modules:
* portaudio audio output
* X11 On Screen Display notifications (xosd)
* Linux Framebuffer On Screen Display interface (fbosd)
Changes between 2.0.0 and 2.0.1:
......
......@@ -3804,18 +3804,6 @@ if test "${enable_ncurses}" != "no"; then
VLC_RESTORE_FLAGS
fi
dnl
dnl Framebuffer (overlay) plugin
dnl
AC_ARG_ENABLE(fbosd,
[ --enable-fbosd fbosd interface support (default disabled)])
if test "${enable_fbosd}" = "yes"
then
AC_CHECK_HEADERS(linux/fb.h, [
VLC_ADD_PLUGIN([fbosd])
])
fi
dnl
dnl Lirc plugin
dnl
......
......@@ -121,7 +121,6 @@ $Id$
* extract: Extract RGB components video filter
* faad: AAC decoder using libfaad2
* fb: video output module for the Linux framebuffer
* fbosd: framebuffer osd plugin
* filesystem: Filesystem access module
* fixed32_mixer: Fixed-point audio mixer
* flac: Flac decoder using libflac
......
......@@ -15,5 +15,4 @@ SUBDIRS += skins2
endif
SOURCES_ncurses = ncurses.c
SOURCES_fbosd = fbosd.c
EXTRA_DIST += eject.c
/*****************************************************************************
* fbosd.c : framebuffer osd plugin for vlc
*****************************************************************************
* Copyright (C) 2007-2008, the VideoLAN team
* $Id$
*
* Authors: Jean-Paul Saman
* Copied from modules/video_output/fb.c by Samuel Hocevar <sam@zoy.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_fs.h>
#include <vlc_modules.h>
#include <stdlib.h> /* free() */
#include <string.h> /* strerror() */
#include <fcntl.h> /* open() */
#include <unistd.h> /* close() */
#include <sys/ioctl.h>
#include <sys/mman.h> /* mmap() */
#include <linux/fb.h>
#include <vlc_image.h>
#include <vlc_interface.h>
#include <vlc_input.h>
#include <vlc_vout.h>
#include <vlc_filter.h>
#include <vlc_osd.h>
#include <vlc_strings.h>
#undef FBOSD_BLENDING
#undef FBOSD_DEBUG
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int Create ( vlc_object_t * );
static void Destroy ( vlc_object_t * );
static void Run ( intf_thread_t * );
static int Init ( intf_thread_t * );
static void End ( intf_thread_t * );
static int OpenDisplay ( intf_thread_t * );
static void CloseDisplay ( intf_thread_t * );
/* Load modules needed for rendering and blending */
#if defined(FBOSD_BLENDING)
static int OpenBlending ( intf_thread_t * );
static void CloseBlending ( intf_thread_t * );
#endif
static int OpenTextRenderer ( intf_thread_t * );
static void CloseTextRenderer( intf_thread_t * );
/* Manipulate the overlay buffer */
static int OverlayCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
static picture_t *AllocatePicture( video_format_t * );
static void DeAllocatePicture( picture_t *, video_format_t * );
static void SetOverlayTransparency( intf_thread_t *,
bool );
static picture_t *LoadImage( intf_thread_t *, video_format_t *,
char * );
#if defined(FBOSD_BLENDING)
static int BlendPicture( intf_thread_t *, video_format_t *,
video_format_t *, picture_t *, picture_t * );
#else
static picture_t *ConvertImage( intf_thread_t *, picture_t *,
video_format_t *, video_format_t * );
#endif
static int RenderPicture( intf_thread_t *, int, int,
picture_t *, picture_t * );
static picture_t *RenderText( intf_thread_t *, const char *,
text_style_t *, video_format_t * );
#define DEVICE_TEXT N_("Framebuffer device")
#define DEVICE_LONGTEXT N_( \
"Framebuffer device to use for rendering (usually /dev/fb0).")
#define ASPECT_RATIO_TEXT N_("Video aspect ratio")
#define ASPECT_RATIO_LONGTEXT N_( \
"Aspect ratio of the video image (4:3, 16:9). Default is square pixels." )
#define FBOSD_IMAGE_TEXT N_("Image file")
#define FBOSD_IMAGE_LONGTEXT N_( \
"Filename of image file to use on the overlay framebuffer." )
#define ALPHA_TEXT N_("Transparency of the image")
#define ALPHA_LONGTEXT N_( "Transparency value of the new image " \
"used in blending. By default it set to fully opaque (255). " \
"(from 0 for full transparency to 255 for full opacity)" )
#define FBOSD_TEXT N_("Text")
#define FBOSD_LONGTEXT N_( "Text to display on the overlay framebuffer." )
#define POSX_TEXT N_("X coordinate")
#define POSX_LONGTEXT N_("X coordinate of the rendered image")
#define POSY_TEXT N_("Y coordinate")
#define POSY_LONGTEXT N_("Y coordinate of the rendered image")
#define POS_TEXT N_("Position")
#define POS_LONGTEXT N_( \
"You can enforce the picture position on the overlay " \
"(0=center, 1=left, 2=right, 4=top, 8=bottom, you can " \
"also use combinations of these values, e.g. 6=top-right).")
#define OPACITY_TEXT N_("Opacity")
#define OPACITY_LONGTEXT N_("Opacity (inverse of transparency) of " \
"overlayed text. 0 = transparent, 255 = totally opaque. " )
#define SIZE_TEXT N_("Font size, pixels")
#define SIZE_LONGTEXT N_("Font size, in pixels. Default is -1 (use default " \
"font size)." )
#define COLOR_TEXT N_("Color")
#define COLOR_LONGTEXT N_("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" )
#define CLEAR_TEXT N_( "Clear overlay framebuffer" )
#define CLEAR_LONGTEXT N_( "The displayed overlay images is cleared by " \
"making the overlay completely transparent. All previously rendered " \
"images and text will be cleared from the cache." )
#define RENDER_TEXT N_( "Render text or image" )
#define RENDER_LONGTEXT N_( "Render the image or text in current overlay " \
"buffer." )
#define DISPLAY_TEXT N_( "Display on overlay framebuffer" )
#define DISPLAY_LONGTEXT N_( "All rendered images and text will be " \
"displayed on the overlay framebuffer." )
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 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 *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"),
N_("Aqua") };
vlc_module_begin ()
set_shortname( "fbosd" )
set_category( CAT_INTERFACE )
set_subcategory( SUBCAT_INTERFACE_MAIN )
add_loadfile( "fbosd-dev", "/dev/fb0", DEVICE_TEXT, DEVICE_LONGTEXT,
false )
add_string( "fbosd-aspect-ratio", "", ASPECT_RATIO_TEXT,
ASPECT_RATIO_LONGTEXT, true )
add_string( "fbosd-image", NULL, FBOSD_IMAGE_TEXT,
FBOSD_IMAGE_LONGTEXT, true )
add_string( "fbosd-text", NULL, FBOSD_TEXT,
FBOSD_LONGTEXT, true )
add_integer_with_range( "fbosd-alpha", 255, 0, 255, ALPHA_TEXT,
ALPHA_LONGTEXT, true )
set_section( N_("Position"), NULL )
add_integer( "fbosd-x", 0, POSX_TEXT,
POSX_LONGTEXT, false )
add_integer( "fbosd-y", 0, POSY_TEXT,
POSY_LONGTEXT, false )
add_integer( "fbosd-position", 8, POS_TEXT, POS_LONGTEXT, true )
change_integer_list( pi_pos_values, ppsz_pos_descriptions );
set_section( N_("Font"), NULL )
add_integer_with_range( "fbosd-font-opacity", 255, 0, 255,
OPACITY_TEXT, OPACITY_LONGTEXT, false )
add_integer( "fbosd-font-color", 0x00FFFFFF, COLOR_TEXT, COLOR_LONGTEXT,
false )
change_integer_list( pi_color_values, ppsz_color_descriptions );
add_integer( "fbosd-font-size", -1, SIZE_TEXT, SIZE_LONGTEXT,
false )
set_section( N_("Commands"), NULL )
add_bool( "fbosd-clear", false, CLEAR_TEXT, CLEAR_LONGTEXT, true )
add_bool( "fbosd-render", false, RENDER_TEXT, RENDER_LONGTEXT, true )
add_bool( "fbosd-display", false, DISPLAY_TEXT, DISPLAY_LONGTEXT, true )
set_description( N_("GNU/Linux osd/overlay framebuffer interface") )
set_capability( "interface", 10 )
set_callbacks( Create, Destroy )
vlc_module_end ()
/*****************************************************************************
* fbosd_render_t: render descriptor
*****************************************************************************/
struct fbosd_render_t
{
#define FBOSD_RENDER_IMAGE 0
#define FBOSD_RENDER_TEXT 1
int i_type;
#define FBOSD_STATE_FREE 0
#define FBOSD_STATE_RESERVED 1
#define FBOSD_STATE_RENDER 2
int i_state;
/* Font style */
text_style_t* p_text_style; /* font control */
char *psz_string;
/* Position */
bool b_absolute;
int i_x;
int i_y;
int i_pos;
int i_alpha; /* transparency for images */
};
#define FBOSD_RENDER_MAX 10
/*****************************************************************************
* intf_sys_t: interface framebuffer method descriptor
*****************************************************************************/
struct intf_sys_t
{
/* Framebuffer information */
int i_fd; /* device handle */
struct fb_var_screeninfo var_info; /* current mode information */
bool b_pan; /* does device supports panning ? */
struct fb_cmap fb_cmap; /* original colormap */
uint16_t *p_palette; /* original palette */
/* Overlay framebuffer format */
video_format_t fmt_out;
picture_t *p_overlay;
size_t i_page_size; /* page size */
int i_width;
int i_height;
int i_aspect;
int i_bytes_per_pixel;
/* Image and Picture rendering */
image_handler_t *p_image;
#if defined(FBOSD_BLENDING)
filter_t *p_blend; /* alpha blending module */
#endif
filter_t *p_text; /* text renderer module */
/* Render */
struct fbosd_render_t render[FBOSD_RENDER_MAX];
/* Font style */
text_style_t *p_style; /* font control */
/* Position */
bool b_absolute;
int i_x;
int i_y;
int i_pos;
int i_alpha; /* transparency for images */
/* commands control */
bool b_need_update; /* update display with \overlay buffer */
bool b_clear; /* clear overlay buffer make it tranparent */
bool b_render; /* render an image or text in overlay buffer */
};
/*****************************************************************************
* Create: allocates FB interface thread output method
*****************************************************************************/
static int Create( vlc_object_t *p_this )
{
intf_thread_t *p_intf = (intf_thread_t *)p_this;
intf_sys_t *p_sys;
char *psz_aspect;
char *psz_tmp;
int i;
/* Allocate instance and initialize some members */
p_intf->p_sys = p_sys = calloc( 1, sizeof( intf_sys_t ) );
if( !p_intf->p_sys )
return VLC_ENOMEM;
p_sys->p_style = text_style_New();
if( !p_sys->p_style )
{
free( p_intf->p_sys );
return VLC_ENOMEM;
}
p_intf->pf_run = Run;
p_sys->p_image = image_HandlerCreate( p_this );
if( !p_sys->p_image )
{
text_style_Delete( p_sys->p_style );
free( p_sys );
return VLC_ENOMEM;
}
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" );
if( psz_aspect )
{
char *psz_parser = strchr( psz_aspect, ':' );
if( psz_parser )
{
*psz_parser++ = '\0';
p_sys->i_aspect = ( atoi( psz_aspect )
* VOUT_ASPECT_FACTOR ) / atoi( psz_parser );
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 );
}
psz_tmp = var_CreateGetNonEmptyStringCommand( p_intf, "fbosd-image" );
var_AddCallback( p_intf, "fbosd-image", OverlayCallback, NULL );
if( psz_tmp && *psz_tmp )
{
p_sys->render[0].i_type = FBOSD_RENDER_IMAGE;
p_sys->render[0].i_state = FBOSD_STATE_RENDER;
p_sys->render[0].psz_string = strdup( psz_tmp );
}
free( psz_tmp );
psz_tmp = var_CreateGetNonEmptyStringCommand( p_intf, "fbosd-text" );
var_AddCallback( p_intf, "fbosd-text", OverlayCallback, NULL );
if( psz_tmp && *psz_tmp )
{
p_sys->render[1].i_type = FBOSD_RENDER_TEXT;
p_sys->render[1].i_state = FBOSD_STATE_RENDER;
p_sys->render[1].psz_string = strdup( psz_tmp );
}
free( psz_tmp );
p_sys->i_pos = var_CreateGetIntegerCommand( p_intf, "fbosd-position" );
p_sys->i_x = var_CreateGetIntegerCommand( p_intf, "fbosd-x" );
p_sys->i_y = var_CreateGetIntegerCommand( p_intf, "fbosd-y" );
var_AddCallback( p_intf, "fbosd-position", OverlayCallback, NULL );
var_AddCallback( p_intf, "fbosd-x", OverlayCallback, NULL );
var_AddCallback( p_intf, "fbosd-y", OverlayCallback, NULL );
p_sys->p_style->i_font_size =
var_CreateGetIntegerCommand( p_intf, "fbosd-font-size" );
p_sys->p_style->i_font_color =
var_CreateGetIntegerCommand( p_intf, "fbosd-font-color" );
p_sys->p_style->i_font_alpha = 255 -
var_CreateGetIntegerCommand( p_intf, "fbosd-font-opacity" );
var_AddCallback( p_intf, "fbosd-font-color", OverlayCallback, NULL );
var_AddCallback( p_intf, "fbosd-font-size", OverlayCallback, NULL );
var_AddCallback( p_intf, "fbosd-font-opacity", OverlayCallback, NULL );
for( i = 0; i < FBOSD_RENDER_MAX; i++ )
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" );
p_sys->b_need_update = var_CreateGetBoolCommand( p_intf, "fbosd-display" );
var_AddCallback( p_intf, "fbosd-clear", OverlayCallback, NULL );
var_AddCallback( p_intf, "fbosd-render", OverlayCallback, NULL );
var_AddCallback( p_intf, "fbosd-display", OverlayCallback, NULL );
/* Check if picture position was overridden */
p_sys->b_absolute = true;
if( ( p_sys->i_x >= 0 ) && ( p_sys->i_y >= 0 ) )
{
p_sys->b_absolute = false;
p_sys->i_y = (p_sys->i_y < p_sys->i_height) ?
p_sys->i_y : p_sys->i_height;
p_sys->i_x = (p_sys->i_x < p_sys->i_width) ?
p_sys->i_x : p_sys->i_width;
}
p_sys->render[0].i_x = p_sys->render[1].i_x = p_sys->i_x;
p_sys->render[0].i_y = p_sys->render[1].i_y = p_sys->i_y;
p_sys->render[0].i_pos = p_sys->render[1].i_pos = p_sys->i_pos;
p_sys->render[0].i_alpha = p_sys->render[1].i_alpha = p_sys->i_alpha;
/* Initialize framebuffer */
if( OpenDisplay( p_intf ) )
{
Destroy( VLC_OBJECT(p_intf) );
return VLC_EGENERIC;
}
Init( p_intf );
#if defined(FBOSD_BLENDING)
/* Load the blending module */
if( OpenBlending( p_intf ) )
{
msg_Err( p_intf, "Unable to load image blending module" );
Destroy( VLC_OBJECT(p_intf) );
return VLC_EGENERIC;
}
#endif
/* Load text renderer module */
if( OpenTextRenderer( p_intf ) )
{
msg_Err( p_intf, "Unable to load text rendering module" );
Destroy( VLC_OBJECT(p_intf) );
return VLC_EGENERIC;
}
p_sys->b_render = true;
p_sys->b_need_update = true;
return VLC_SUCCESS;
}
/*****************************************************************************
* Destroy: destroy FB interface thread output method
*****************************************************************************
* Terminate an output method created by Create
*****************************************************************************/
static void Destroy( vlc_object_t *p_this )
{
intf_thread_t *p_intf = (intf_thread_t *)p_this;
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;
var_DelCallback( p_intf, "fbosd-alpha", OverlayCallback, NULL );
var_Destroy( p_intf, "fbosd-alpha" );
var_DelCallback( p_intf, "fbosd-x", OverlayCallback, NULL );
var_DelCallback( p_intf, "fbosd-y", OverlayCallback, NULL );
var_DelCallback( p_intf, "fbosd-position", OverlayCallback, NULL );
var_DelCallback( p_intf, "fbosd-image", OverlayCallback, NULL );
var_DelCallback( p_intf, "fbosd-text", OverlayCallback, NULL );
var_DelCallback( p_intf, "fbosd-font-size", OverlayCallback, NULL );
var_DelCallback( p_intf, "fbosd-font-color", OverlayCallback, NULL );
var_DelCallback( p_intf, "fbosd-font-opacity", OverlayCallback, NULL );
var_DelCallback( p_intf, "fbosd-clear", OverlayCallback, NULL );
var_DelCallback( p_intf, "fbosd-render", OverlayCallback, NULL );
var_DelCallback( p_intf, "fbosd-display", OverlayCallback, NULL );
var_Destroy( p_intf, "fbosd-x" );
var_Destroy( p_intf, "fbosd-y" );
var_Destroy( p_intf, "fbosd-position" );
var_Destroy( p_intf, "fbosd-image" );
var_Destroy( p_intf, "fbosd-text" );
var_Destroy( p_intf, "fbosd-font-size" );
var_Destroy( p_intf, "fbosd-font-color" );
var_Destroy( p_intf, "fbosd-font-opacity" );
var_Destroy( p_intf, "fbosd-clear" );
var_Destroy( p_intf, "fbosd-render" );
var_Destroy( p_intf, "fbosd-display" );
var_Destroy( p_intf, "fbosd-aspect-ratio" );
CloseDisplay( p_intf );
for( i = 0; i < FBOSD_RENDER_MAX; i++ )
{
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_blend ) CloseBlending( p_intf );
#endif
if( p_sys->p_text ) CloseTextRenderer( p_intf );
if( p_sys->p_image )
image_HandlerDelete( p_sys->p_image );
if( p_sys->p_overlay )
picture_Release( p_sys->p_overlay );
text_style_Delete( p_sys->p_style );
free( p_sys );
}
#if defined(FBOSD_BLENDING)
static int OpenBlending( intf_thread_t *p_intf )
{
if( p_intf->p_sys->p_blend ) return VLC_EGENERIC;
p_intf->p_sys->p_blend =
vlc_object_create( p_intf, sizeof(filter_t) );
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_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( var_InheritBool( p_intf, "freetype-yuvp" ) )
p_intf->p_sys->p_blend->fmt_in.video.i_chroma =
VLC_CODEC_YUVP;
else
p_intf->p_sys->p_blend->fmt_in.video.i_chroma =
VLC_CODEC_YUVA;
p_intf->p_sys->p_blend->p_module =
module_need( p_intf->p_sys->p_blend, "video blending", NULL, false );
if( !p_intf->p_sys->p_blend->p_module )
return VLC_EGENERIC;
return VLC_SUCCESS;
}
static void CloseBlending( intf_thread_t *p_intf )
{
if( p_intf->p_sys->p_blend )
{
if( p_intf->p_sys->p_blend->p_module )
module_unneed( p_intf->p_sys->p_blend,
p_intf->p_sys->p_blend->p_module );
vlc_object_release( p_intf->p_sys->p_blend );
}
}
#endif
static int OpenTextRenderer( intf_thread_t *p_intf )
{
char *psz_modulename = NULL;
if( p_intf->p_sys->p_text ) return VLC_EGENERIC;
p_intf->p_sys->p_text =
vlc_object_create( p_intf, sizeof(filter_t) );
p_intf->p_sys->p_text->fmt_out.video.i_width =
p_intf->p_sys->p_text->fmt_out.video.i_visible_width =
p_intf->p_sys->i_width;
p_intf->p_sys->p_text->fmt_out.video.i_height =
p_intf->p_sys->p_text->fmt_out.video.i_visible_height =
p_intf->p_sys->i_height;
psz_modulename = var_CreateGetString( p_intf, "text-renderer" );
if( psz_modulename && *psz_modulename )
{
p_intf->p_sys->p_text->p_module =
module_need( p_intf->p_sys->p_text, "text renderer",
psz_modulename, true );
}
if( !p_intf->p_sys->p_text->p_module )
{
p_intf->p_sys->p_text->p_module =
module_need( p_intf->p_sys->p_text, "text renderer", NULL, false );
}
free( psz_modulename );
if( !p_intf->p_sys->p_text->p_module )
return VLC_EGENERIC;
return VLC_SUCCESS;
}
static void CloseTextRenderer( intf_thread_t *p_intf )
{
if( p_intf->p_sys->p_text )
{
if( p_intf->p_sys->p_text->p_module )
module_unneed( p_intf->p_sys->p_text,
p_intf->p_sys->p_text->p_module );
vlc_object_release( p_intf->p_sys->p_text );
}
}
/*****************************************************************************
* AllocatePicture:
* allocate a picture buffer for use with the overlay fb.
*****************************************************************************/
static picture_t *AllocatePicture( video_format_t *p_fmt )
{
picture_t *p_picture = picture_NewFromFormat( p_fmt );
if( !p_picture )
return NULL;
if( !p_fmt->p_palette &&
( p_fmt->i_chroma == VLC_CODEC_YUVP ) )
{
p_fmt->p_palette = malloc( sizeof(video_palette_t) );
if( !p_fmt->p_palette )
{
picture_Release( p_picture );
return NULL;
}
}
else
{
p_fmt->p_palette = NULL;
}
return p_picture;
}
/*****************************************************************************
* DeAllocatePicture:
* Deallocate a picture buffer and free all associated memory.
*****************************************************************************/
static void DeAllocatePicture( picture_t *p_pic, video_format_t *p_fmt )
{
if( p_fmt )
{
free( p_fmt->p_palette );
p_fmt->p_palette = NULL;
}
if( p_pic )
picture_Release( p_pic );
}
/*****************************************************************************
* SetOverlayTransparency: Set the transparency for this overlay fb,
* - true is make transparent
* - false is make non tranparent
*****************************************************************************/
static void SetOverlayTransparency( intf_thread_t *p_intf,
bool b_transparent )
{
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) ?
i_size : p_sys->i_page_size;
if( p_sys->p_overlay )
{
msg_Dbg( p_intf, "Make overlay %s",
b_transparent ? "transparent" : "opaque" );
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 );
}
}
#if defined(FBOSD_BLENDING)
/*****************************************************************************
* BlendPicture: Blend two pictures together..
*****************************************************************************/
static int BlendPicture( intf_thread_t *p_intf, video_format_t *p_fmt_src,
video_format_t *p_fmt_dst, picture_t *p_pic_src,
picture_t *p_pic_dst )
{
intf_sys_t *p_sys = p_intf->p_sys;
if( p_sys->p_blend && p_sys->p_blend->p_module )
{
int i_x_offset =