Commit 57509f75 authored by Vincent Seguin's avatar Vincent Seguin

Toujours du nettoyage.

Une API pour les sous titres.
parent 653053d2
...@@ -120,9 +120,8 @@ ...@@ -120,9 +120,8 @@
#define INTF_IDLE_SLEEP 100000 #define INTF_IDLE_SLEEP 100000
/* Factor for changing gamma, and minimum and maximum values */ /* Factor for changing gamma, and minimum and maximum values */
#define INTF_GAMMA_FACTOR 1.1 #define INTF_GAMMA_FACTOR .1
#define INTF_GAMMA_MIN 0.1 #define INTF_GAMMA_MAX 3
#define INTF_GAMMA_MAX 10
/* /*
* X11 settings * X11 settings
...@@ -247,7 +246,7 @@ ...@@ -247,7 +246,7 @@
#define VOUT_GRAYSCALE_DEFAULT 0 #define VOUT_GRAYSCALE_DEFAULT 0
/* Default gamma */ /* Default gamma */
#define VOUT_GAMMA 1. #define VOUT_GAMMA 0.
/* /*
* Time settings * Time settings
...@@ -338,7 +337,7 @@ ...@@ -338,7 +337,7 @@
/* Define to enable messages queues - disabling messages queue can be usefull /* Define to enable messages queues - disabling messages queue can be usefull
* when debugging, since it allows messages which would not otherwise be printed, * when debugging, since it allows messages which would not otherwise be printed,
* due to a crash, to be printed anyway */ * due to a crash, to be printed anyway */
//#define INTF_MSG_QUEUE #define INTF_MSG_QUEUE
/* Format of the header for debug messages. The arguments following this header /* Format of the header for debug messages. The arguments following this header
* are the file (char *), the function (char *) and the line (int) in which the * are the file (char *), the function (char *) and the line (int) in which the
......
...@@ -24,7 +24,7 @@ typedef u8 yuv_data_t; ...@@ -24,7 +24,7 @@ typedef u8 yuv_data_t;
* Picture type and flags should only be modified by the output thread. Note * Picture type and flags should only be modified by the output thread. Note
* that an empty picture MUST have its flags set to 0. * that an empty picture MUST have its flags set to 0.
*******************************************************************************/ *******************************************************************************/
typedef struct typedef struct picture_s
{ {
/* Type and flags - should NOT be modified except by the vout thread */ /* Type and flags - should NOT be modified except by the vout thread */
int i_type; /* picture type */ int i_type; /* picture type */
...@@ -69,7 +69,6 @@ typedef struct ...@@ -69,7 +69,6 @@ typedef struct
yuv_data_t * p_v; /* pointer to beginning of V image in p_data */ yuv_data_t * p_v; /* pointer to beginning of V image in p_data */
} picture_t; } picture_t;
/* Pictures types */ /* Pictures types */
#define EMPTY_PICTURE 0 /* picture slot is empty and available */ #define EMPTY_PICTURE 0 /* picture slot is empty and available */
#define YUV_420_PICTURE 100 /* 4:2:0 YUV picture */ #define YUV_420_PICTURE 100 /* 4:2:0 YUV picture */
...@@ -88,3 +87,38 @@ typedef struct ...@@ -88,3 +87,38 @@ typedef struct
#define AR_3_4_PICTURE 2 /* 3:4 picture (TV) */ #define AR_3_4_PICTURE 2 /* 3:4 picture (TV) */
#define AR_16_9_PICTURE 3 /* 16:9 picture (wide screen) */ #define AR_16_9_PICTURE 3 /* 16:9 picture (wide screen) */
#define AR_221_1_PICTURE 4 /* 2.21:1 picture (movie) */ #define AR_221_1_PICTURE 4 /* 2.21:1 picture (movie) */
/*******************************************************************************
* subtitle_t: video subtitle
*******************************************************************************
* Any subtitle destined to be displayed by a video output thread should be
* stored in this structure from it's creation to it's effective display.
* Subtitle type and flags should only be modified by the output thread. Note
* that an empty subtitle MUST have its flags set to 0.
*******************************************************************************/
typedef struct subtitle_s
{
/* Type and flags - should NOT be modified except by the vout thread */
int i_type; /* subtitle type */
int i_status; /* subtitle flags */
/* Other properties */
mtime_t begin_date; /* beginning of display date */
mtime_t end_date; /* end of display date */
/* Subtitle data - data can always be freely modified. p_data itself
* (the pointer) should NEVER be modified. */
void * p_data; /* subtitle data */
} subtitle_t;
/* Subtitle types */
#define EMPTY_SUBTITLE 0 /* subtitle slot is empty and available */
#define RLE_SUBTITLE 100 /* RLE encoded subtitle */
/* Subtitle status */
#define FREE_SUBTITLE 0 /* subtitle is free and not allocated */
#define RESERVED_SUBTITLE 1 /* subtitle is allocated and reserved */
#define READY_SUBTITLE 2 /* subtitle is ready for display */
#define DISPLAYED_SUBTITLE 3 /* subtitle has been displayed but is linked */
#define DESTROYED_SUBTITLE 4 /* subtitle is allocated but no more used */
...@@ -84,46 +84,40 @@ typedef struct vout_thread_s ...@@ -84,46 +84,40 @@ typedef struct vout_thread_s
boolean_t b_die; /* `die' flag */ boolean_t b_die; /* `die' flag */
boolean_t b_error; /* `error' flag */ boolean_t b_error; /* `error' flag */
boolean_t b_active; /* `active' flag */ boolean_t b_active; /* `active' flag */
pthread_t thread_id; /* id for pthread functions */ vlc_thread_t thread_id; /* id for pthread functions */
pthread_mutex_t lock; /* thread lock */ vlc_mutex_t picture_lock; /* picture heap lock */
vlc_mutex_t subtitle_lock; /* subtitle heap lock */
int * pi_status; /* temporary status flag */ int * pi_status; /* temporary status flag */
p_vout_sys_t p_sys; /* system output method */ p_vout_sys_t p_sys; /* system output method */
/* Current display properties */ /* Current display properties */
boolean_t b_info; /* print additionnal informations */ boolean_t b_info; /* print additionnal informations */
boolean_t b_grayscale; /* color or grayscale display */ boolean_t b_grayscale; /* color or grayscale display */
int i_width; /* current output method width */ int i_width; /* current output method width */
int i_height; /* current output method height */ int i_height; /* current output method height */
int i_bytes_per_line;/* bytes per line (including virtual) */ int i_bytes_per_line;/* bytes per line (including virtual) */
int i_screen_depth; /* bits per pixel - FIXED */ int i_screen_depth; /* bits per pixel */
int i_bytes_per_pixel; /* real screen depth - FIXED */ int i_bytes_per_pixel; /* real screen depth */
float f_x_ratio; /* horizontal display ratio */ float f_x_ratio; /* horizontal display ratio */
float f_y_ratio; /* vertical display ratio */ float f_y_ratio; /* vertical display ratio */
float f_gamma; /* gamma */ float f_gamma; /* gamma */
/* Changed properties values - some of them are treated directly by the
* thread, the over may be ignored or handled by vout_SysManage */
//?? info, grayscale, width, height, bytes per line, x ratio, y ratio, gamma
boolean_t b_gamma_change; /* gamma change indicator */
int i_new_width; /* new width */
int i_new_height; /* new height */
#ifdef STATS #ifdef STATS
/* Statistics - these numbers are not supposed to be accurate, but are a /* Statistics - these numbers are not supposed to be accurate, but are a
* good indication of the thread status */ * good indication of the thread status */
count_t c_loops; /* number of loops */ mtime_t loop_time; /* last picture loop time */
count_t c_idle_loops; /* number of idle loops */ count_t c_fps_samples; /* picture counts */
count_t c_fps_samples; /* picture counts */
mtime_t fps_sample[ VOUT_FPS_SAMPLES ]; /* FPS samples dates */ mtime_t fps_sample[ VOUT_FPS_SAMPLES ]; /* FPS samples dates */
#endif #endif
#ifdef DEBUG_VIDEO /* Running properties */
/* Additionnal video debugging informations */ u16 i_changes; /* changes made to the thread */
mtime_t picture_render_time; /* last picture rendering time */ mtime_t last_picture_date; /* last picture display date */
#endif mtime_t last_idle_date; /* last idle screen displaydate */
/* Video heap and translation tables */ /* Videos heap and translation tables */
picture_t p_picture[VOUT_MAX_PICTURES]; /* pictures */ picture_t p_picture[VOUT_MAX_PICTURES]; /* pictures */
subtitle_t p_subtitle[VOUT_MAX_PICTURES]; /* subtitles */
vout_tables_t tables; /* translation tables */ vout_tables_t tables; /* translation tables */
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 */
...@@ -131,25 +125,34 @@ typedef struct vout_thread_s ...@@ -131,25 +125,34 @@ typedef struct vout_thread_s
vout_scale_t * p_Scale; /* scaler */ vout_scale_t * p_Scale; /* scaler */
} vout_thread_t; } vout_thread_t;
/* Flags for changes - these flags are set in the i_changes field when another
* thread changed a variable */
#define VOUT_INFO_CHANGE 0x0001 /* b_info changed */
#define VOUT_GRAYSCALE_CHANGE 0x0002 /* b_grayscale changed */
#define VOUT_SIZE_CHANGE 0x0004 /* size changed */
#define VOUT_DEPTH_CHANGE 0x0008 /* depth changed */
#define VOUT_RATIO_CHANGE 0x0010 /* display ratio changed */
#define VOUT_GAMMA_CHANGE 0x0020 /* gamma changed */
/******************************************************************************* /*******************************************************************************
* Prototypes * Prototypes
*******************************************************************************/ *******************************************************************************/
vout_thread_t * vout_CreateThread ( vout_thread_t * vout_CreateThread (
#ifdef VIDEO_X11 #ifdef VIDEO_X11
char *psz_display, Window root_window, char *psz_display, Window root_window,
#endif #endif
int i_width, int i_height, int *pi_status int i_width, int i_height, int *pi_status
); );
void vout_DestroyThread ( vout_thread_t *p_vout, int *pi_status );
void vout_DestroyThread ( vout_thread_t *p_vout, int *pi_status ); picture_t * vout_CreatePicture ( vout_thread_t *p_vout, int i_type,
int i_width, int i_height );
picture_t * vout_CreatePicture ( vout_thread_t *p_vout, int i_type, void vout_DestroyPicture ( vout_thread_t *p_vout, picture_t *p_pic );
int i_width, int i_height ); void vout_DisplayPicture ( vout_thread_t *p_vout, picture_t *p_pic );
void vout_DestroyPicture ( vout_thread_t *p_vout, picture_t *p_pic ); void vout_LinkPicture ( vout_thread_t *p_vout, picture_t *p_pic );
void vout_DisplayPicture ( vout_thread_t *p_vout, picture_t *p_pic ); void vout_UnlinkPicture ( vout_thread_t *p_vout, picture_t *p_pic );
void vout_LinkPicture ( vout_thread_t *p_vout, picture_t *p_pic ); subtitle_t * vout_CreateSubtitle ( vout_thread_t *p_vout, int i_type, int i_size );
void vout_UnlinkPicture ( vout_thread_t *p_vout, picture_t *p_pic ); void vout_DestroySubtitle ( vout_thread_t *p_vout, subtitle_t *p_sub );
void vout_DisplaySubtitle ( vout_thread_t *p_vout, subtitle_t *p_sub );
......
...@@ -33,5 +33,5 @@ void ConvertYUV420RGB16MMX( u8* p_y, u8* p_u, u8 *p_v, ...@@ -33,5 +33,5 @@ void ConvertYUV420RGB16MMX( u8* p_y, u8* p_u, u8 *p_v,
unsigned int i_ypitch, unsigned int i_vpitch, unsigned int i_ypitch, unsigned int i_vpitch,
unsigned int i_aspect, u8 *p_pic, unsigned int i_aspect, u8 *p_pic,
u32 i_dci_offset, u32 i_offset_to_line_0, u32 i_dci_offset, u32 i_offset_to_line_0,
int CCOPitch, int i_colortype ); int i_pitch, int i_colortype );
#endif #endif
...@@ -421,6 +421,17 @@ static void Usage( void ) ...@@ -421,6 +421,17 @@ static void Usage( void )
intf_Msg("VLANs (Virtual Local Aera Networks) parameters:\n" \ intf_Msg("VLANs (Virtual Local Aera Networks) parameters:\n" \
" vlan_server=<host>[:<port>] VLANs server address and port\n" \ " vlan_server=<host>[:<port>] VLANs server address and port\n" \
); );
/* Interfaces keys */
intf_Msg("Interface keys: most interface accept the following commands:\n" \
" [esc], q quit\n" \
" +, - change volume\n" \
" m mute\n" \
" f fullscreen\n" \
" 0 - 9 select channel\n" \
" [space] toggle info printing\n" \
" g, G change gamma\n" \
);
} }
/******************************************************************************* /*******************************************************************************
......
...@@ -122,15 +122,11 @@ void vout_SysDestroy( vout_thread_t *p_vout ) ...@@ -122,15 +122,11 @@ void vout_SysDestroy( vout_thread_t *p_vout )
* vout_SysManage: handle Sys events * vout_SysManage: handle Sys events
******************************************************************************* *******************************************************************************
* This function should be called regularly by video output thread. It returns * This function should be called regularly by video output thread. It returns
* a negative value if something happened which does not allow the thread to * a non null value if an error occured.
* continue, and a positive one if the thread can go on, but the images have
* been modified and therefore it is useless to display them.
*******************************************************************************/ *******************************************************************************/
int vout_SysManage( vout_thread_t *p_vout ) int vout_SysManage( vout_thread_t *p_vout )
{ {
//?? return( 0 );
return( 0 );
} }
/******************************************************************************* /*******************************************************************************
......
This diff is collapsed.
...@@ -206,30 +206,25 @@ void vout_SysDestroy( vout_thread_t *p_vout ) ...@@ -206,30 +206,25 @@ void vout_SysDestroy( vout_thread_t *p_vout )
* vout_SysManage: handle X11 events * vout_SysManage: handle X11 events
******************************************************************************* *******************************************************************************
* This function should be called regularly by video output thread. It manages * This function should be called regularly by video output thread. It manages
* X11 events and allows window resizing. It returns a negative value if * X11 events and allows window resizing. It returns a non null value on
* something happened which does not allow the thread to continue, and a * error.
* positive one if the thread can go on, but the images have been modified and
* therefore it is useless to display them.
*******************************************************************************/ *******************************************************************************/
int vout_SysManage( vout_thread_t *p_vout ) int vout_SysManage( vout_thread_t *p_vout )
{ {
if( (p_vout->i_width != p_vout->i_new_width) || if( p_vout->i_changes & VOUT_SIZE_CHANGE )
(p_vout->i_height != p_vout->i_new_height) ) {
{ p_vout->i_changes &= ~VOUT_SIZE_CHANGE;
intf_DbgMsg("resizing window\n"); intf_DbgMsg("resizing window\n");
/* Resize window */ /* Resize window */
XResizeWindow( p_vout->p_sys->p_display, p_vout->p_sys->window, XResizeWindow( p_vout->p_sys->p_display, p_vout->p_sys->window,
p_vout->i_new_width, p_vout->i_new_height ); p_vout->i_width, p_vout->i_height );
/* Destroy then recreate XImages to change their size */ /* Destroy XImages to change their size */
vout_SysEnd( p_vout ); vout_SysEnd( p_vout );
p_vout->i_width = p_vout->i_new_width;
p_vout->i_height = p_vout->i_new_height;
/* If SysInit failed, the thread can't go on. Otherwise, it won't display /* Recreate XImages. If SysInit failed, the thread can't go on. */
* the rendered image, but can continue */ return( vout_SysInit( p_vout ) );
return( vout_SysInit( p_vout ) ? -1 : 1);
} }
return 0; return 0;
......
...@@ -413,7 +413,7 @@ static void SetTables( vout_thread_t *p_vout ) ...@@ -413,7 +413,7 @@ static void SetTables( vout_thread_t *p_vout )
*/ */
for( i_index = 0; i_index < 256; i_index++ ) for( i_index = 0; i_index < 256; i_index++ )
{ {
i_gamma[i_index] = 255. * pow( (double)i_index / 255., p_vout->f_gamma ); i_gamma[i_index] = 255. * exp( (double)i_index * p_vout->f_gamma / 255. );
} }
/* /*
......
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