Commit bb545321 authored by Vincent Seguin's avatar Vincent Seguin

API vout_DateImage (mais �a ne marche pas)

Suite nettoyage
parent 3c6ac119
...@@ -121,12 +121,10 @@ ...@@ -121,12 +121,10 @@
/* Step for changing gamma, and minimum and maximum values */ /* Step for changing gamma, and minimum and maximum values */
#define INTF_GAMMA_STEP .1 #define INTF_GAMMA_STEP .1
#define INTF_GAMMA_MAX 3 #define INTF_GAMMA_LIMIT 3
/* Factor for changing aspect ratio, and minimum and maximum values */ /* Scaling modifier limits */
#define INTF_RATIO_FACTOR 1.1 #define INTF_SCALE_LIMIT 10
#define INTF_RATIO_MIN .1
#define INTF_RATIO_MAX 10
/* /*
* X11 settings * X11 settings
......
...@@ -31,6 +31,11 @@ typedef struct picture_s ...@@ -31,6 +31,11 @@ typedef struct picture_s
int i_status; /* picture flags */ int i_status; /* picture flags */
int i_matrix_coefficients; /* in YUV type, encoding type */ int i_matrix_coefficients; /* in YUV type, encoding type */
/* Picture management properties - these properties can be modified using
* the video output thread API, but should ne be written directly */
int i_refcount; /* link reference counter */
mtime_t date; /* display date */
/* Picture static properties - those properties are fixed at initialization /* Picture static properties - those properties are fixed at initialization
* and should NOT be modified */ * and should NOT be modified */
int i_width; /* picture width */ int i_width; /* picture width */
...@@ -45,20 +50,11 @@ typedef struct picture_s ...@@ -45,20 +50,11 @@ typedef struct picture_s
int i_display_height; /* useful picture height */ int i_display_height; /* useful picture height */
int i_aspect_ratio; /* aspect ratio */ int i_aspect_ratio; /* aspect ratio */
/* Link reference counter - it can be modified using vout_Link and
* vout_Unlink functions, or directly if the picture is independant */
int i_refcount; /* link reference counter */
/* Macroblock counter - the decoder use it to verify if it has /* Macroblock counter - the decoder use it to verify if it has
* decoded all the macroblocks of the picture */ * decoded all the macroblocks of the picture */
int i_deccount; int i_deccount;
vlc_mutex_t lock_deccount; vlc_mutex_t lock_deccount;
/* Video properties - those properties should not be modified once
* the picture is in a heap, but can be freely modified if it is
* independant */
mtime_t date; /* display date */
/* Picture data - data can always be freely modified. p_data itself /* Picture data - data can always be freely modified. p_data itself
* (the pointer) should NEVER be modified. In YUV format, the p_y, p_u and * (the pointer) should NEVER be modified. In YUV format, the p_y, p_u and
* p_v data pointers refers to different areas of p_data, and should not * p_v data pointers refers to different areas of p_data, and should not
......
...@@ -50,26 +50,26 @@ typedef void (vout_convert_t)( p_vout_thread_t p_vout, void *p_pic, ...@@ -50,26 +50,26 @@ typedef void (vout_convert_t)( p_vout_thread_t p_vout, void *p_pic,
int i_scale, int i_matrix_coefficients ); int i_scale, int i_matrix_coefficients );
/******************************************************************************* /*******************************************************************************
* vout_scale_t: scaling function * vout_scale_t: horizontal scaling function
******************************************************************************* *******************************************************************************
* When a picture can't be scaled unsing the fast i_y_scale parameter of a * The convertion function only perform a vertical scaling. Horizontal scaling
* transformation, it is rendered in a temporary buffer then scaled using a * is done later using this function.
* totally accurate (but also very slow) method.
* This is the prototype common to all scaling functions. The types of p_buffer
* and p_pic will change depending of the screen depth treated.
* Parameters: * Parameters:
* p_vout video output thread * p_vout video output thread
* p_pic picture address (start address in picture) * p_src source address (start address in picture)
* p_buffer source picture * p_dst destination address (start address in picture)
* i_width buffer width * i_width source width
* i_height buffer height * i_height source height
* i_eol number of pixels to reach next buffer line * i_line_width source total pixels per line
* i_pic_eol number of pixels to reach next picture line * i_dst_line_width destination total pixels per line
* f_alpha, f_beta horizontal and vertical scaling factors * i_scale if non 0, horizontal scaling is 1 - 1/i_scale
* Conditions:
* i_height % 16
* i_scale < 0 if p_src == p_dst
*******************************************************************************/ *******************************************************************************/
typedef void (vout_scale_t)( p_vout_thread_t p_vout, void *p_pic, void *p_buffer, typedef void (vout_scale_t)( p_vout_thread_t p_vout, void *p_src, void *p_dst,
int i_width, int i_height, int i_eol, int i_pic_eol, int i_width, int i_height, int i_line_width,
float f_alpha, float f_beta ); int i_dst_line_width, int i_scale );
/******************************************************************************* /*******************************************************************************
* vout_thread_t: video output thread descriptor * vout_thread_t: video output thread descriptor
...@@ -99,8 +99,8 @@ typedef struct vout_thread_s ...@@ -99,8 +99,8 @@ typedef struct vout_thread_s
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 */ int i_screen_depth; /* bits per pixel */
int i_bytes_per_pixel; /* real screen depth */ int i_bytes_per_pixel; /* real screen depth */
float f_x_ratio; /* horizontal display ratio */ int i_horizontal_scale; /* horizontal display scale */
float f_y_ratio; /* vertical display ratio */ int i_vertical_scale; /* vertical display scale */
float f_gamma; /* gamma */ float f_gamma; /* gamma */
#ifdef STATS #ifdef STATS
...@@ -146,6 +146,7 @@ picture_t * vout_CreatePicture ( vout_thread_t *p_vout, int i_type, ...@@ -146,6 +146,7 @@ picture_t * vout_CreatePicture ( vout_thread_t *p_vout, int i_type,
int i_width, int i_height ); int i_width, int i_height );
void vout_DestroyPicture ( vout_thread_t *p_vout, picture_t *p_pic ); void vout_DestroyPicture ( vout_thread_t *p_vout, picture_t *p_pic );
void vout_DisplayPicture ( vout_thread_t *p_vout, picture_t *p_pic ); void vout_DisplayPicture ( vout_thread_t *p_vout, picture_t *p_pic );
void vout_DatePicture ( vout_thread_t *p_vout, picture_t *p_pic, mtime_t date );
void vout_LinkPicture ( vout_thread_t *p_vout, picture_t *p_pic ); void vout_LinkPicture ( vout_thread_t *p_vout, picture_t *p_pic );
void vout_UnlinkPicture ( vout_thread_t *p_vout, picture_t *p_pic ); void vout_UnlinkPicture ( vout_thread_t *p_vout, picture_t *p_pic );
subtitle_t * vout_CreateSubtitle ( vout_thread_t *p_vout, int i_type, int i_size ); subtitle_t * vout_CreateSubtitle ( vout_thread_t *p_vout, int i_type, int i_size );
......
...@@ -196,7 +196,7 @@ int intf_ProcessKey( intf_thread_t *p_intf, int i_key ) ...@@ -196,7 +196,7 @@ int intf_ProcessKey( intf_thread_t *p_intf, int i_key )
// ?? // ??
break; break;
case 'g': /* gamma - */ case 'g': /* gamma - */
if( (p_intf->p_vout != NULL) && (p_intf->p_vout->f_gamma > -INTF_GAMMA_MAX) ) if( (p_intf->p_vout != NULL) && (p_intf->p_vout->f_gamma > -INTF_GAMMA_LIMIT) )
{ {
vlc_mutex_lock( &p_intf->p_vout->change_lock ); vlc_mutex_lock( &p_intf->p_vout->change_lock );
p_intf->p_vout->f_gamma -= INTF_GAMMA_STEP; p_intf->p_vout->f_gamma -= INTF_GAMMA_STEP;
...@@ -205,7 +205,7 @@ int intf_ProcessKey( intf_thread_t *p_intf, int i_key ) ...@@ -205,7 +205,7 @@ int intf_ProcessKey( intf_thread_t *p_intf, int i_key )
} }
break; break;
case 'G': /* gamma + */ case 'G': /* gamma + */
if( (p_intf->p_vout != NULL) && (p_intf->p_vout->f_gamma < INTF_GAMMA_MAX) ) if( (p_intf->p_vout != NULL) && (p_intf->p_vout->f_gamma < INTF_GAMMA_LIMIT) )
{ {
vlc_mutex_lock( &p_intf->p_vout->change_lock ); vlc_mutex_lock( &p_intf->p_vout->change_lock );
p_intf->p_vout->f_gamma += INTF_GAMMA_STEP; p_intf->p_vout->f_gamma += INTF_GAMMA_STEP;
...@@ -223,37 +223,37 @@ int intf_ProcessKey( intf_thread_t *p_intf, int i_key ) ...@@ -223,37 +223,37 @@ int intf_ProcessKey( intf_thread_t *p_intf, int i_key )
} }
break; break;
case 'x': /* horizontal aspect ratio - */ case 'x': /* horizontal aspect ratio - */
if( (p_intf->p_vout != NULL) && (p_intf->p_vout->f_x_ratio > INTF_RATIO_MIN) ) if( (p_intf->p_vout != NULL) && (p_intf->p_vout->i_horizontal_scale > -INTF_SCALE_LIMIT) )
{ {
vlc_mutex_lock( &p_intf->p_vout->change_lock ); vlc_mutex_lock( &p_intf->p_vout->change_lock );
p_intf->p_vout->f_x_ratio /= INTF_RATIO_FACTOR; p_intf->p_vout->i_horizontal_scale--;
p_intf->p_vout->i_changes |= VOUT_RATIO_CHANGE; p_intf->p_vout->i_changes |= VOUT_RATIO_CHANGE;
vlc_mutex_unlock( &p_intf->p_vout->change_lock ); vlc_mutex_unlock( &p_intf->p_vout->change_lock );
} }
break; break;
case 'X': /* horizontal aspect ratio + */ case 'X': /* horizontal aspect ratio + */
if( (p_intf->p_vout != NULL) && (p_intf->p_vout->f_x_ratio < INTF_RATIO_MAX) ) if( (p_intf->p_vout != NULL) && (p_intf->p_vout->i_horizontal_scale < INTF_SCALE_LIMIT) )
{ {
vlc_mutex_lock( &p_intf->p_vout->change_lock ); vlc_mutex_lock( &p_intf->p_vout->change_lock );
p_intf->p_vout->f_x_ratio *= INTF_RATIO_FACTOR; p_intf->p_vout->i_horizontal_scale++;
p_intf->p_vout->i_changes |= VOUT_RATIO_CHANGE; p_intf->p_vout->i_changes |= VOUT_RATIO_CHANGE;
vlc_mutex_unlock( &p_intf->p_vout->change_lock ); vlc_mutex_unlock( &p_intf->p_vout->change_lock );
} }
break; break;
case 'y': /* vertical aspect ratio - */ case 'y': /* vertical aspect ratio - */
if( (p_intf->p_vout != NULL) && (p_intf->p_vout->f_y_ratio > INTF_RATIO_MIN) ) if( (p_intf->p_vout != NULL) && (p_intf->p_vout->i_vertical_scale > -INTF_SCALE_LIMIT) )
{ {
vlc_mutex_lock( &p_intf->p_vout->change_lock ); vlc_mutex_lock( &p_intf->p_vout->change_lock );
p_intf->p_vout->f_y_ratio /= INTF_RATIO_FACTOR; p_intf->p_vout->i_vertical_scale--;
p_intf->p_vout->i_changes |= VOUT_RATIO_CHANGE; p_intf->p_vout->i_changes |= VOUT_RATIO_CHANGE;
vlc_mutex_unlock( &p_intf->p_vout->change_lock ); vlc_mutex_unlock( &p_intf->p_vout->change_lock );
} }
break; break;
case 'Y': /* horizontal aspect ratio + */ case 'Y': /* horizontal aspect ratio + */
if( (p_intf->p_vout != NULL) && (p_intf->p_vout->f_y_ratio < INTF_RATIO_MAX) ) if( (p_intf->p_vout != NULL) && (p_intf->p_vout->i_vertical_scale < INTF_SCALE_LIMIT) )
{ {
vlc_mutex_lock( &p_intf->p_vout->change_lock ); vlc_mutex_lock( &p_intf->p_vout->change_lock );
p_intf->p_vout->f_y_ratio *= INTF_RATIO_FACTOR; p_intf->p_vout->i_vertical_scale++;
p_intf->p_vout->i_changes |= VOUT_RATIO_CHANGE; p_intf->p_vout->i_changes |= VOUT_RATIO_CHANGE;
vlc_mutex_unlock( &p_intf->p_vout->change_lock ); vlc_mutex_unlock( &p_intf->p_vout->change_lock );
} }
......
...@@ -83,13 +83,13 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_ ...@@ -83,13 +83,13 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_
p_vout->i_bytes_per_line = i_width * 2; p_vout->i_bytes_per_line = i_width * 2;
p_vout->i_screen_depth = 15; p_vout->i_screen_depth = 15;
p_vout->i_bytes_per_pixel = 2; p_vout->i_bytes_per_pixel = 2;
p_vout->f_x_ratio = 1; p_vout->i_horizontal_scale = 0;
p_vout->f_y_ratio = 1; p_vout->i_vertical_scale = 0;
p_vout->f_gamma = VOUT_GAMMA; p_vout->f_gamma = VOUT_GAMMA;
intf_DbgMsg("wished configuration: %dx%d,%d (%d bytes/pixel, %d bytes/line), ratio %.2f:%.2f, gray=%d\n", intf_DbgMsg("wished configuration: %dx%d,%d (%d bytes/pixel, %d bytes/line), scaling %+d:%+d, gray=%d\n",
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,
p_vout->f_x_ratio, p_vout->f_y_ratio, p_vout->b_grayscale ); p_vout->i_horizontal_scale, p_vout->i_vertical_scale, p_vout->b_grayscale );
/* Create and initialize system-dependant method - this function issues its /* Create and initialize system-dependant method - this function issues its
* own error messages */ * own error messages */
...@@ -98,10 +98,10 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_ ...@@ -98,10 +98,10 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_
free( p_vout ); free( p_vout );
return( NULL ); return( NULL );
} }
intf_DbgMsg("actual configuration: %dx%d,%d (%d bytes/pixel, %d bytes/line), ratio %.2f:%.2f, gray=%d\n", intf_DbgMsg("actual configuration: %dx%d,%d (%d bytes/pixel, %d bytes/line), scaling %+d:%+d, gray=%d\n",
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,
p_vout->f_x_ratio, p_vout->f_y_ratio, p_vout->b_grayscale ); p_vout->i_horizontal_scale, p_vout->i_vertical_scale, p_vout->b_grayscale );
#ifdef STATS #ifdef STATS
/* Initialize statistics fields */ /* Initialize statistics fields */
...@@ -253,7 +253,8 @@ void vout_DestroySubtitle( vout_thread_t *p_vout, subtitle_t *p_sub ) ...@@ -253,7 +253,8 @@ void vout_DestroySubtitle( vout_thread_t *p_vout, subtitle_t *p_sub )
******************************************************************************* *******************************************************************************
* Remove the reservation flag of a picture, which will cause it to be ready for * Remove the reservation flag of a picture, which will cause it to be ready for
* display. The picture does not need to be locked, since it is ignored by * display. The picture does not need to be locked, since it is ignored by
* the output thread if is reserved. * the output thread if is reserved. The picture won't be displayed until
* vout_DatePicture has been called.
*******************************************************************************/ *******************************************************************************/
void vout_DisplayPicture( vout_thread_t *p_vout, picture_t *p_pic ) void vout_DisplayPicture( vout_thread_t *p_vout, picture_t *p_pic )
{ {
...@@ -279,6 +280,19 @@ void vout_DisplayPicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -279,6 +280,19 @@ void vout_DisplayPicture( vout_thread_t *p_vout, picture_t *p_pic )
#endif #endif
} }
/*******************************************************************************
* vout_DatePicture: date a picture
*******************************************************************************
* Remove the reservation flag of a picture, which will cause it to be ready for
* display. The picture does not need to be locked, since it is ignored by
* the output thread if is reserved. The picture won't be displayed until
* vout_DisplayPicture has been called.
*******************************************************************************/
void vout_DatePicture( vout_thread_t *p_vout, picture_t *p_pic, mtime_t date )
{
//??
}
/******************************************************************************* /*******************************************************************************
* vout_CreatePicture: allocate a picture in the video output heap. * vout_CreatePicture: allocate a picture in the video output heap.
******************************************************************************* *******************************************************************************
...@@ -996,11 +1010,11 @@ static int RenderInfo( vout_thread_t *p_vout, boolean_t b_blank ) ...@@ -996,11 +1010,11 @@ static int RenderInfo( vout_thread_t *p_vout, boolean_t b_blank )
break; break;
} }
} }
sprintf( psz_buffer, "%s %dx%d:%d %.2f:%.2f g%+.2f pic: %d/%d/%d", sprintf( psz_buffer, "%s %dx%d:%d scaling %+d:%+d g%+.2f pic: %d/%d/%d",
p_vout->b_grayscale ? "gray" : "rgb", p_vout->b_grayscale ? "gray" : "rgb",
p_vout->i_width, p_vout->i_height, p_vout->i_width, p_vout->i_height, p_vout->i_screen_depth,
p_vout->i_screen_depth, p_vout->f_x_ratio, p_vout->f_y_ratio, p_vout->f_gamma, p_vout->i_horizontal_scale, p_vout->i_vertical_scale,
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 ); vout_SysPrint( p_vout, 0, p_vout->i_height, -1, 1, psz_buffer );
#endif #endif
......
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