Commit 5b22bedf authored by Vincent Seguin's avatar Vincent Seguin

Nouveau moteur de fontes.

parent aab60d48
...@@ -35,7 +35,7 @@ SYS=LINUX ...@@ -35,7 +35,7 @@ SYS=LINUX
#DECODER=old #DECODER=old
DECODER=new DECODER=new
# Debugging mode on or off # Debugging mode on or off (set to 1 to activate)
DEBUG=1 DEBUG=1
#----------------- do not change anything below this line ---------------------- #----------------- do not change anything below this line ----------------------
...@@ -49,7 +49,7 @@ PROGRAM_VERSION = 1.0-dev ...@@ -49,7 +49,7 @@ PROGRAM_VERSION = 1.0-dev
# PROGRAM_OPTIONS is an identification string of the compilation options # PROGRAM_OPTIONS is an identification string of the compilation options
PROGRAM_OPTIONS = $(VIDEO) $(ARCH) $(SYS) PROGRAM_OPTIONS = $(VIDEO) $(ARCH) $(SYS)
ifneq ($(DEBUG),) ifeq ($(DEBUG),1)
PROGRAM_OPTIONS += DEBUG PROGRAM_OPTIONS += DEBUG
endif endif
...@@ -64,7 +64,7 @@ DEFINE += -DSYS_$(SYS) ...@@ -64,7 +64,7 @@ DEFINE += -DSYS_$(SYS)
DEFINE += -DPROGRAM_VERSION="\"$(PROGRAM_VERSION)\"" DEFINE += -DPROGRAM_VERSION="\"$(PROGRAM_VERSION)\""
DEFINE += -DPROGRAM_OPTIONS="\"$(PROGRAM_OPTIONS)\"" DEFINE += -DPROGRAM_OPTIONS="\"$(PROGRAM_OPTIONS)\""
DEFINE += -DPROGRAM_BUILD="\"$(PROGRAM_BUILD)\"" DEFINE += -DPROGRAM_BUILD="\"$(PROGRAM_BUILD)\""
ifneq ($(DEBUG),) ifeq ($(DEBUG),1)
DEFINE += -DDEBUG DEFINE += -DDEBUG
endif endif
...@@ -163,7 +163,7 @@ endif ...@@ -163,7 +163,7 @@ endif
# #
# Debugging support # Debugging support
ifneq ($(DEBUG),) ifeq ($(DEBUG),1)
CFLAGS += -g CFLAGS += -g
#CFLAGS += -pg #CFLAGS += -pg
endif endif
...@@ -198,6 +198,7 @@ audio_output_obj = audio_output/audio_output.o \ ...@@ -198,6 +198,7 @@ audio_output_obj = audio_output/audio_output.o \
video_output_obj = video_output/video_output.o \ video_output_obj = video_output/video_output.o \
video_output/video_$(video).o \ video_output/video_$(video).o \
video_output/video_text.o \
video_output/video_yuv.o video_output/video_yuv.o
ac3_decoder_obj = ac3_decoder/ac3_decoder.o \ ac3_decoder_obj = ac3_decoder/ac3_decoder.o \
......
...@@ -61,12 +61,14 @@ typedef struct aout_thread_s * p_aout_thread_t; ...@@ -61,12 +61,14 @@ typedef struct aout_thread_s * p_aout_thread_t;
/* Video */ /* Video */
struct vout_thread_s; struct vout_thread_s;
struct vout_font_s;
struct vout_sys_s; struct vout_sys_s;
struct vdec_thread_s; struct vdec_thread_s;
struct vpar_thread_s; struct vpar_thread_s;
struct video_parser_s; struct video_parser_s;
typedef struct vout_thread_s * p_vout_thread_t; typedef struct vout_thread_s * p_vout_thread_t;
typedef struct vout_font_s * p_vout_font_t;
typedef struct vout_sys_s * p_vout_sys_t; typedef struct vout_sys_s * p_vout_sys_t;
typedef struct vdec_thread_s * p_vdec_thread_t; typedef struct vdec_thread_s * p_vdec_thread_t;
typedef struct vpar_thread_s * p_vpar_thread_t; typedef struct vpar_thread_s * p_vpar_thread_t;
......
...@@ -239,6 +239,10 @@ ...@@ -239,6 +239,10 @@
/* Default gamma */ /* Default gamma */
#define VOUT_GAMMA 0. #define VOUT_GAMMA 0.
/* Default fonts */
#define VOUT_DEFAULT_FONT "Resources/default8x9.psf"
#define VOUT_LARGE_FONT "Resources/default8x16.psf"
/* /*
* Time settings * Time settings
*/ */
...@@ -270,15 +274,6 @@ ...@@ -270,15 +274,6 @@
#define VOUT_FB_DEV_VAR "vlc_fb_dev" #define VOUT_FB_DEV_VAR "vlc_fb_dev"
#define VOUT_FB_DEV_DEFAULT "/dev/fb0" #define VOUT_FB_DEV_DEFAULT "/dev/fb0"
/*
* X11 settings
*/
/* Font maximum and minimum characters - characters outside this range are not
* printed - maximum range is 1-256 */
#define VOUT_MIN_CHAR 1
#define VOUT_MAX_CHAR 128
/******************************************************************************* /*******************************************************************************
* Video parser configuration * Video parser configuration
*******************************************************************************/ *******************************************************************************/
......
...@@ -101,6 +101,10 @@ typedef struct vout_thread_s ...@@ -101,6 +101,10 @@ typedef struct vout_thread_s
vout_convert_t * p_ConvertYUV420; /* YUV 4:2:0 converter */ vout_convert_t * p_ConvertYUV420; /* YUV 4:2:0 converter */
vout_convert_t * p_ConvertYUV422; /* YUV 4:2:2 converter */ vout_convert_t * p_ConvertYUV422; /* YUV 4:2:2 converter */
vout_convert_t * p_ConvertYUV444; /* YUV 4:4:4 converter */ vout_convert_t * p_ConvertYUV444; /* YUV 4:4:4 converter */
/* Bitmap fonts */
p_vout_font_t p_default_font; /* default font */
p_vout_font_t p_large_font; /* large font */
} vout_thread_t; } vout_thread_t;
/* Flags for changes - these flags are set in the i_changes field when another /* Flags for changes - these flags are set in the i_changes field when another
...@@ -137,10 +141,3 @@ void vout_DisplaySubtitle ( vout_thread_t *p_vout, subtitle_t *p_s ...@@ -137,10 +141,3 @@ void vout_DisplaySubtitle ( vout_thread_t *p_vout, subtitle_t *p_s
...@@ -13,9 +13,6 @@ void vout_SysDestroy ( p_vout_thread_t p_vout ); ...@@ -13,9 +13,6 @@ void vout_SysDestroy ( p_vout_thread_t p_vout );
int vout_SysManage ( p_vout_thread_t p_vout ); int vout_SysManage ( p_vout_thread_t p_vout );
void vout_SysDisplay ( p_vout_thread_t p_vout ); void vout_SysDisplay ( p_vout_thread_t p_vout );
void * vout_SysGetPicture ( p_vout_thread_t p_vout ); void * vout_SysGetPicture ( p_vout_thread_t p_vout );
void vout_SysPrint ( p_vout_thread_t p_vout, int i_x, int i_y,
int i_halign, int i_valign,
unsigned char *psz_text );
/*******************************************************************************
* video_text.h : text manipulation functions
* (c)1999 VideoLAN
*******************************************************************************/
/* Text styles - these are primary text styles, used by the vout_Print function.
* They may be ignored or interpreted by higher level functions */
#define WIDE_TEXT 1 /* interspacing is doubled */
#define ITALIC_TEXT 2 /* italic */
#define TRANSPARENT_TEXT 4 /* transparent text */
#define OUTLINED_TEXT 8 /* border around letters */
#define VOID_TEXT 16 /* no foreground */
/*******************************************************************************
* Prototypes
*******************************************************************************/
p_vout_font_t vout_LoadFont ( char *psz_name );
void vout_UnloadFont ( p_vout_font_t p_font );
void vout_TextSize ( p_vout_font_t p_font, int i_style, char *psz_text,
int *pi_width, int *pi_height );
void vout_Print ( p_vout_font_t p_font, byte_t *p_pic, int i_depth,
int i_bytes_per_pixel, u32 i_char_color,
u32 i_border_color, u32 i_bg_color,
int i_style, char *psz_text );
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "vlc_thread.h" #include "vlc_thread.h"
#include "video.h" #include "video.h"
#include "video_output.h" #include "video_output.h"
#include "video_text.h"
#include "video_sys.h" #include "video_sys.h"
#include "video_yuv.h" #include "video_yuv.h"
#include "intf_msg.h" #include "intf_msg.h"
...@@ -33,6 +34,7 @@ static int InitThread ( vout_thread_t *p_vout ); ...@@ -33,6 +34,7 @@ static int InitThread ( vout_thread_t *p_vout );
static void RunThread ( vout_thread_t *p_vout ); static void RunThread ( vout_thread_t *p_vout );
static void ErrorThread ( vout_thread_t *p_vout ); static void ErrorThread ( vout_thread_t *p_vout );
static void EndThread ( vout_thread_t *p_vout ); static void EndThread ( vout_thread_t *p_vout );
static void Print ( vout_thread_t *p_vout, int i_x, int i_y, int i_halign, int i_valign, unsigned char *psz_text );
static void RenderBlank ( vout_thread_t *p_vout ); static void RenderBlank ( vout_thread_t *p_vout );
static int RenderPicture ( vout_thread_t *p_vout, picture_t *p_pic, boolean_t b_blank ); static int RenderPicture ( vout_thread_t *p_vout, picture_t *p_pic, boolean_t b_blank );
static int RenderPictureInfo ( vout_thread_t *p_vout, picture_t *p_pic, boolean_t b_blank ); static int RenderPictureInfo ( vout_thread_t *p_vout, picture_t *p_pic, boolean_t b_blank );
...@@ -100,6 +102,23 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_ ...@@ -100,6 +102,23 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_
p_vout->i_width, p_vout->i_height, p_vout->i_screen_depth, p_vout->i_width, p_vout->i_height, p_vout->i_screen_depth,
p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line ); p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line );
/* Load fonts */
p_vout->p_default_font = vout_LoadFont( VOUT_DEFAULT_FONT );
if( p_vout->p_default_font == NULL )
{
vout_SysDestroy( p_vout );
free( p_vout );
return( NULL );
}
p_vout->p_large_font = vout_LoadFont( VOUT_LARGE_FONT );
if( p_vout->p_large_font == NULL )
{
vout_UnloadFont( p_vout->p_default_font );
vout_SysDestroy( p_vout );
free( p_vout );
return( NULL );
}
#ifdef STATS #ifdef STATS
/* Initialize statistics fields */ /* Initialize statistics fields */
p_vout->render_time = 0; p_vout->render_time = 0;
...@@ -119,6 +138,8 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_ ...@@ -119,6 +138,8 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_
if( vlc_thread_create( &p_vout->thread_id, "video output", (void *) RunThread, (void *) p_vout) ) if( vlc_thread_create( &p_vout->thread_id, "video output", (void *) RunThread, (void *) p_vout) )
{ {
intf_ErrMsg("error: %s\n", strerror(ENOMEM)); intf_ErrMsg("error: %s\n", strerror(ENOMEM));
vout_UnloadFont( p_vout->p_default_font );
vout_UnloadFont( p_vout->p_large_font );
vout_SysDestroy( p_vout ); vout_SysDestroy( p_vout );
free( p_vout ); free( p_vout );
return( NULL ); return( NULL );
...@@ -600,6 +621,7 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -600,6 +621,7 @@ static void RunThread( vout_thread_t *p_vout)
p_vout->b_error = InitThread( p_vout ); p_vout->b_error = InitThread( p_vout );
if( p_vout->b_error ) if( p_vout->b_error )
{ {
//??
free( p_vout ); /* destroy descriptor */ free( p_vout ); /* destroy descriptor */
return; return;
} }
...@@ -792,8 +814,10 @@ static void EndThread( vout_thread_t *p_vout ) ...@@ -792,8 +814,10 @@ static void EndThread( vout_thread_t *p_vout )
/* Destroy translation tables */ /* Destroy translation tables */
vout_EndTables( p_vout ); vout_EndTables( p_vout );
/* Destroy thread structures allocated by InitThread */ /* Destroy thread structures allocated by Create and InitThread */
vout_SysEnd( p_vout ); vout_SysEnd( p_vout );
vout_UnloadFont( p_vout->p_default_font );
vout_UnloadFont( p_vout->p_large_font );
vout_SysDestroy( p_vout ); vout_SysDestroy( p_vout );
free( p_vout ); free( p_vout );
...@@ -801,6 +825,53 @@ static void EndThread( vout_thread_t *p_vout ) ...@@ -801,6 +825,53 @@ static void EndThread( vout_thread_t *p_vout )
*pi_status = THREAD_OVER; *pi_status = THREAD_OVER;
} }
/*******************************************************************************
* Print: print simple text on a picture
*******************************************************************************
* This function will print a simple text on the picture. It is designed to
* print debugging or general informations.
*******************************************************************************/
void Print( vout_thread_t *p_vout, int i_x, int i_y, int i_halign, int i_valign, unsigned char *psz_text )
{
int i_text_height; /* total text height */
int i_text_width; /* total text width */
/* Update upper left coordinates according to alignment */
vout_TextSize( p_vout->p_default_font, 0, psz_text, &i_text_width, &i_text_height );
switch( i_halign )
{
case 0: /* centered */
i_x -= i_text_width / 2;
break;
case 1: /* right aligned */
i_x -= i_text_width;
break;
}
switch( i_valign )
{
case 0: /* centered */
i_y -= i_text_height / 2;
break;
case 1: /* bottom aligned */
i_y -= i_text_height;
break;
}
/* Check clipping */
if( (i_y < 0) || (i_y + i_text_height > p_vout->i_height) ||
(i_x < 0) || (i_x + i_text_width > p_vout->i_width) )
{
intf_DbgMsg("'%s' would print outside the screen\n", psz_text);
return;
}
/* Print text */
vout_Print( p_vout->p_default_font, vout_SysGetPicture( p_vout ) +
i_y * p_vout->i_bytes_per_line + i_x * p_vout->i_bytes_per_pixel,
p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line,
0xffffffff, 0x00000000, 0x00000000, 0, psz_text );
}
/****************************************************************************** /******************************************************************************
* RenderBlank: render a blank screen * RenderBlank: render a blank screen
****************************************************************************** ******************************************************************************
...@@ -972,7 +1043,7 @@ static int RenderPictureInfo( vout_thread_t *p_vout, picture_t *p_pic, boolean_t ...@@ -972,7 +1043,7 @@ static int RenderPictureInfo( vout_thread_t *p_vout, picture_t *p_pic, boolean_t
sprintf( psz_buffer, "%.2f fps", (double) VOUT_FPS_SAMPLES * 1000000 / sprintf( psz_buffer, "%.2f fps", (double) VOUT_FPS_SAMPLES * 1000000 /
( p_vout->fps_sample[ (p_vout->c_fps_samples - 1) % VOUT_FPS_SAMPLES ] - ( p_vout->fps_sample[ (p_vout->c_fps_samples - 1) % VOUT_FPS_SAMPLES ] -
p_vout->fps_sample[ p_vout->c_fps_samples % VOUT_FPS_SAMPLES ] ) ); p_vout->fps_sample[ p_vout->c_fps_samples % VOUT_FPS_SAMPLES ] ) );
vout_SysPrint( p_vout, p_vout->i_width, 0, 1, -1, psz_buffer ); Print( p_vout, p_vout->i_width, 0, 1, -1, psz_buffer );
} }
/* /*
...@@ -980,7 +1051,7 @@ static int RenderPictureInfo( vout_thread_t *p_vout, picture_t *p_pic, boolean_t ...@@ -980,7 +1051,7 @@ static int RenderPictureInfo( vout_thread_t *p_vout, picture_t *p_pic, boolean_t
*/ */
sprintf( psz_buffer, "%ld frames render time: %lu us", sprintf( psz_buffer, "%ld frames render time: %lu us",
p_vout->c_fps_samples, (long unsigned) p_vout->render_time ); p_vout->c_fps_samples, (long unsigned) p_vout->render_time );
vout_SysPrint( p_vout, 0, 0, -1, -1, psz_buffer ); Print( p_vout, 0, 0, -1, -1, psz_buffer );
#endif #endif
#ifdef DEBUG #ifdef DEBUG
...@@ -998,7 +1069,7 @@ static int RenderPictureInfo( vout_thread_t *p_vout, picture_t *p_pic, boolean_t ...@@ -998,7 +1069,7 @@ static int RenderPictureInfo( vout_thread_t *p_vout, picture_t *p_pic, boolean_t
((p_pic->i_aspect_ratio == AR_3_4_PICTURE) ? "4:3" : ((p_pic->i_aspect_ratio == AR_3_4_PICTURE) ? "4:3" :
((p_pic->i_aspect_ratio == AR_16_9_PICTURE) ? "16:9" : ((p_pic->i_aspect_ratio == AR_16_9_PICTURE) ? "16:9" :
((p_pic->i_aspect_ratio == AR_221_1_PICTURE) ? "2.21:1" : "ukn-ar" )))); ((p_pic->i_aspect_ratio == AR_221_1_PICTURE) ? "2.21:1" : "ukn-ar" ))));
vout_SysPrint( p_vout, p_vout->i_width, p_vout->i_height, 1, 1, psz_buffer ); Print( p_vout, p_vout->i_width, p_vout->i_height, 1, 1, psz_buffer );
#endif #endif
return( 0 ); return( 0 );
...@@ -1018,8 +1089,8 @@ static int RenderIdle( vout_thread_t *p_vout, boolean_t b_blank ) ...@@ -1018,8 +1089,8 @@ static int RenderIdle( vout_thread_t *p_vout, boolean_t b_blank )
{ {
RenderBlank( p_vout ); RenderBlank( p_vout );
p_vout->last_display_date = mdate(); p_vout->last_display_date = mdate();
vout_SysPrint( p_vout, p_vout->i_width / 2, p_vout->i_height / 2, 0, 0, Print( p_vout, p_vout->i_width / 2, p_vout->i_height / 2, 0, 0,
"no stream" ); "no stream" ); //??
return( 1 ); return( 1 );
} }
...@@ -1063,8 +1134,9 @@ static int RenderInfo( vout_thread_t *p_vout, boolean_t b_blank ) ...@@ -1063,8 +1134,9 @@ static int RenderInfo( vout_thread_t *p_vout, boolean_t b_blank )
p_vout->i_width, p_vout->i_height, p_vout->i_screen_depth, p_vout->i_width, p_vout->i_height, p_vout->i_screen_depth,
p_vout->f_gamma, i_reserved_pic, i_ready_pic, p_vout->f_gamma, i_reserved_pic, i_ready_pic,
VOUT_MAX_PICTURES ); VOUT_MAX_PICTURES );
vout_SysPrint( p_vout, 0, p_vout->i_height, -1, 1, psz_buffer ); Print( p_vout, 0, p_vout->i_height, -1, 1, psz_buffer );
#endif #endif
return( 0 ); return( 0 );
} }
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment