#define VOUT_GRAYSCALE_VAR "vlc_grayscale"
#define VOUT_GRAYSCALE_DEFAULT 0
+/* Environment variable for fullscreen output mode, and default value */
+#define VOUT_FULLSCREEN_VAR "vlc_fullscreen"
+#define VOUT_FULLSCREEN_DEFAULT 0
+
/* Default gamma */
#define VOUT_GAMMA 0.
int i_width, int i_height, int i_eol, int i_pic_eol,
int i_scale, int i_matrix_coefficients );
-/*******************************************************************************
- * vout_scale_t: horizontal scaling function
- *******************************************************************************
- * The convertion function only perform a vertical scaling. Horizontal scaling
- * is done later using this function.
- * Parameters:
- * p_vout video output thread
- * p_src source address (start address in picture)
- * p_dst destination address (start address in picture)
- * i_width source width
- * i_height source height
- * i_line_width source total pixels per line
- * i_dst_line_width destination total pixels per line
- * 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_src, void *p_dst,
- int i_width, int i_height, int i_line_width,
- int i_dst_line_width, int i_scale );
-
/*******************************************************************************
* vout_thread_t: video output thread descriptor
*******************************************************************************
int * pi_status; /* temporary status flag */
p_vout_sys_t p_sys; /* system output method */
- /* Current display properties */
- boolean_t b_info; /* print additionnal informations */
- boolean_t b_grayscale; /* color or grayscale display */
+ /* Current display properties */
+ boolean_t b_grayscale; /* color or grayscale display */
int i_width; /* current output method width */
int i_height; /* current output method height */
int i_bytes_per_line;/* bytes per line (including virtual) */
int i_screen_depth; /* bits per pixel */
int i_bytes_per_pixel; /* real screen depth */
- int i_horizontal_scale; /* horizontal display scale */
- int i_vertical_scale; /* vertical display scale */
float f_gamma; /* gamma */
+ /* Pictures and rendering properties */
+ boolean_t b_info; /* print additionnal informations */
+
#ifdef STATS
/* Statistics - these numbers are not supposed to be accurate, but are a
* good indication of the thread status */
vout_convert_t * p_ConvertYUV420; /* YUV 4:2:0 converter */
vout_convert_t * p_ConvertYUV422; /* YUV 4:2:2 converter */
vout_convert_t * p_ConvertYUV444; /* YUV 4:4:4 converter */
- vout_scale_t * p_Scale; /* scaler */
} 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 */
-#define VOUT_NODISPLAY_CHANGE 0xffdc /* changes which forbiden the display */
+#define VOUT_SIZE_CHANGE 0x0008 /* size changed */
+#define VOUT_DEPTH_CHANGE 0x0010 /* depth changed */
+#define VOUT_GAMMA_CHANGE 0x0080 /* gamma changed */
+#define VOUT_NODISPLAY_CHANGE 0xffff /* changes which forbidden display */
/*******************************************************************************
* Prototypes
vlc_mutex_unlock( &p_intf->p_vout->change_lock );
}
break;
- case 'x': /* horizontal aspect ratio - */
- 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 );
- p_intf->p_vout->i_horizontal_scale--;
- p_intf->p_vout->i_changes |= VOUT_RATIO_CHANGE;
- vlc_mutex_unlock( &p_intf->p_vout->change_lock );
- }
- break;
- case 'X': /* horizontal aspect ratio + */
- 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 );
- p_intf->p_vout->i_horizontal_scale++;
- p_intf->p_vout->i_changes |= VOUT_RATIO_CHANGE;
- vlc_mutex_unlock( &p_intf->p_vout->change_lock );
- }
- break;
- case 'y': /* vertical aspect ratio - */
- 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 );
- p_intf->p_vout->i_vertical_scale--;
- p_intf->p_vout->i_changes |= VOUT_RATIO_CHANGE;
- vlc_mutex_unlock( &p_intf->p_vout->change_lock );
- }
- break;
- case 'Y': /* horizontal aspect ratio + */
- 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 );
- p_intf->p_vout->i_vertical_scale++;
- p_intf->p_vout->i_changes |= VOUT_RATIO_CHANGE;
- vlc_mutex_unlock( &p_intf->p_vout->change_lock );
- }
- break;
- case 'f': /* toggle fullscreen */
- //??
- break;
case ' ': /* toggle info */
if( p_intf->p_vout != NULL )
{
{ "novideo", 0, 0, OPT_NOVIDEO },
{ "grayscale", 0, 0, 'g' },
{ "color", 0, 0, OPT_COLOR },
+ { "fullscreen", 0, 0, 'f' },
/* VLAN management options */
{ "novlans", 0, 0, OPT_NOVLANS },
};
/* Short options */
-static const char *psz_shortopts = "hg";
+static const char *psz_shortopts = "hgf";
/*******************************************************************************
* Global variable program_data - this is the one and only, see main.h
case OPT_COLOR: /* --color */
main_PutIntVariable( VOUT_GRAYSCALE_VAR, 0 );
break;
+ case 'f': /* -f, --fullscreen */
+ main_PutIntVariable( VOUT_FULLSCREEN_VAR, 1 );
+ break;
/* VLAN management options */
case OPT_NOVLANS: /* --novlans */
" [esc], q quit\n" \
" +, -, m change volume, mute\n" \
" g, G, c change gamma, toggle grayscale\n" \
- " x, X, y, Y, f change aspect ratio, toggle fullscreen\n" \
" 0 - 9 select channel\n" \
" [space] toggle info printing\n" \
);
/* Initialize some fields used by the system-dependant method - these fields will
* probably be modified by the method, and are only preferences */
-#ifdef DEBUG
- p_vout->b_info = 1;
-#else
- p_vout->b_info = 0;
-#endif
p_vout->b_grayscale = main_GetIntVariable( VOUT_GRAYSCALE_VAR,
VOUT_GRAYSCALE_DEFAULT );
p_vout->i_width = i_width;
p_vout->i_bytes_per_line = i_width * 2;
p_vout->i_screen_depth = 15;
p_vout->i_bytes_per_pixel = 2;
- p_vout->i_horizontal_scale = 0;
- p_vout->i_vertical_scale = 0;
p_vout->f_gamma = VOUT_GAMMA;
- intf_DbgMsg("wished configuration: %dx%d,%d (%d bytes/pixel, %d bytes/line), scaling %+d:%+d, gray=%d\n",
+#ifdef DEBUG
+ p_vout->b_info = 1;
+#else
+ p_vout->b_info = 0;
+#endif
+ intf_DbgMsg("wished configuration: %dx%d,%d (%d bytes/pixel, %d bytes/line)\n",
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_horizontal_scale, p_vout->i_vertical_scale, p_vout->b_grayscale );
+ p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line );
/* Create and initialize system-dependant method - this function issues its
* own error messages */
free( p_vout );
return( NULL );
}
- intf_DbgMsg("actual configuration: %dx%d,%d (%d bytes/pixel, %d bytes/line), scaling %+d:%+d, gray=%d\n",
+ intf_DbgMsg("actual configuration: %dx%d,%d (%d bytes/pixel, %d bytes/line)\n",
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_horizontal_scale, p_vout->i_vertical_scale, p_vout->b_grayscale );
+ p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line );
#ifdef STATS
/* Initialize statistics fields */
*******************************************************************************/
static int RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, boolean_t b_blank )
{
+ int i_display_height, i_display_width; /* display dimensions */
+ int i_height, i_width; /* source picture dimensions */
+ int i_scaled_height; /* scaled height of the picture */
+ int i_aspect_scale; /* aspect ratio vertical scale */
+ int i_eol; /* end of line offset for source */
+ byte_t * p_convert_dst; /* convertion destination */
+
#ifdef STATS
/* Start recording render time */
p_vout->render_time = mdate();
#endif
/* Mark last picture date */
- p_vout->last_picture_date = p_pic->date;
-
- /* Blank screen if required */
- if( b_blank )
+ p_vout->last_picture_date = p_pic->date;
+ i_width = p_pic->i_width;
+ i_height = p_pic->i_height;
+ i_display_width = p_vout->i_width;
+ i_display_height = p_vout->i_height;
+
+ /* Select scaling depending of aspect ratio */
+ switch( p_pic->i_aspect_ratio )
{
-// ????? RenderBlank( p_vout );
+ case AR_3_4_PICTURE:
+ i_aspect_scale = (4 * i_height - 3 * i_width) ?
+ 1 + 3 * i_width / ( 4 * i_height - 3 * i_width ) : 0;
+ break;
+ case AR_16_9_PICTURE:
+ i_aspect_scale = ( 16 * i_height - 9 * i_width ) ?
+ 1 + 9 * i_width / ( 16 * i_height - 9 * i_width ) : 0;
+ break;
+ case AR_221_1_PICTURE:
+ i_aspect_scale = ( 221 * i_height - 100 * i_width ) ?
+ 1 + 100 * i_width / ( 221 * i_height - 100 * i_width ) : 0;
+ break;
+ case AR_SQUARE_PICTURE:
+ default:
+ i_aspect_scale = 0;
}
-
- /*
- * Prepare scaling
- */
- if( (p_pic->i_width > p_vout->i_width) || (p_pic->i_height > p_vout->i_height) )
+ i_scaled_height = (i_aspect_scale ? i_height * (i_aspect_scale - 1) / i_aspect_scale : i_height);
+
+ /* Crop picture if too large for the screen */
+ if( i_width > i_display_width )
{
-#ifdef VIDEO_X11
- /* X11: window can be resized, so resize it - the picture won't be
- * rendered since any alteration of the window size means recreating the
- * XImages */
-/* p_vout->i_new_width = p_pic->i_width;
- p_vout->i_new_height = p_pic->i_height;*/
-#else
- /* Other drivers: the video output thread can't change its size, so
- * we need to change the aspect ratio */
- //????
-#endif
+ i_eol = i_width - i_display_width / 16 * 16;
+ i_width = i_display_width / 16 * 16;
+ }
+ else
+ {
+ i_eol = 0;
+ }
+ if( i_scaled_height > i_display_height )
+ {
+ i_height = (i_aspect_scale * i_display_height / (i_aspect_scale - 1)) / 2 * 2;
+ i_scaled_height = i_display_height;
}
+ p_convert_dst = vout_SysGetPicture( p_vout ) +
+ ( i_display_width - i_width ) / 2 * p_vout->i_bytes_per_pixel +
+ ( i_display_height - i_scaled_height ) / 2 * p_vout->i_bytes_per_line;
/*
* Choose appropriate rendering function and render picture
switch( p_pic->i_type )
{
case YUV_420_PICTURE:
- p_vout->p_ConvertYUV420( p_vout, vout_SysGetPicture( p_vout ),
+ p_vout->p_ConvertYUV420( p_vout, p_convert_dst,
p_pic->p_y, p_pic->p_u, p_pic->p_v,
- p_pic->i_width, p_pic->i_height, 0, 0,
- 4, p_pic->i_matrix_coefficients );
+ i_width, i_height, i_eol,
+ p_vout->i_bytes_per_line / p_vout->i_bytes_per_pixel - i_width,
+ i_aspect_scale, p_pic->i_matrix_coefficients );
break;
case YUV_422_PICTURE:
- /* ??? p_vout->p_convert_yuv_420( p_vout,
- p_pic->p_y, p_pic->p_u, p_pic->p_v,
- i_chroma_width, i_chroma_height,
- p_vout->i_width / 2, p_vout->i_height,
- p_vout->i_bytes_per_line,
- 0, 0, 0 );
- */ break;
+ p_vout->p_ConvertYUV422( p_vout, p_convert_dst,
+ p_pic->p_y, p_pic->p_u, p_pic->p_v,
+ i_width, i_height, i_eol,
+ p_vout->i_bytes_per_line / p_vout->i_bytes_per_pixel - i_width,
+ i_aspect_scale, p_pic->i_matrix_coefficients );
+ break;
case YUV_444_PICTURE:
-/* ??? p_vout->p_convert_yuv_420( p_vout,
- p_pic->p_y, p_pic->p_u, p_pic->p_v,
- i_chroma_width, i_chroma_height,
- p_vout->i_width, p_vout->i_height,
- p_vout->i_bytes_per_line,
- 0, 0, 0 );
- */ break;
+ p_vout->p_ConvertYUV444( p_vout, p_convert_dst,
+ p_pic->p_y, p_pic->p_u, p_pic->p_v,
+ i_width, i_height, i_eol,
+ p_vout->i_bytes_per_line / p_vout->i_bytes_per_pixel - i_width,
+ i_aspect_scale, p_pic->i_matrix_coefficients );
+ break;
#ifdef DEBUG
default:
intf_DbgMsg("error: unknown picture type %d\n", p_pic->i_type );
#endif
}
- /*
- * Terminate scaling
- */
- //??
-
#ifdef STATS
/* End recording render time */
p_vout->render_time = mdate() - p_vout->render_time;
break;
}
}
- sprintf( psz_buffer, "%s %dx%d:%d scaling %+d:%+d g%+.2f pic: %d/%d/%d",
- p_vout->b_grayscale ? "gray" : "rgb",
+ sprintf( psz_buffer, "%dx%d:%d g%+.2f pic: %d/%d/%d",
p_vout->i_width, p_vout->i_height, p_vout->i_screen_depth,
- p_vout->i_horizontal_scale, p_vout->i_vertical_scale,
p_vout->f_gamma, i_reserved_pic, i_ready_pic,
VOUT_MAX_PICTURES );
vout_SysPrint( p_vout, 0, p_vout->i_height, -1, 1, psz_buffer );
}
/* Clear changes flags which does not need management or have been handled */
- p_vout->i_changes &= ~(VOUT_INFO_CHANGE | VOUT_GAMMA_CHANGE | VOUT_GRAYSCALE_CHANGE);
+ p_vout->i_changes &= ~(VOUT_GAMMA_CHANGE | VOUT_GRAYSCALE_CHANGE |
+ VOUT_INFO_CHANGE );
/* Detect unauthorized changes */
if( p_vout->i_changes )
if( p_vout->i_changes & VOUT_SIZE_CHANGE )
{
intf_DbgMsg("resizing window\n");
- p_vout->i_changes &= ~VOUT_SIZE_CHANGE;
+ p_vout->i_changes &= ~VOUT_SIZE_CHANGE;
/* Resize window */
XResizeWindow( p_vout->p_sys->p_display, p_vout->p_sys->window,
int i_width, int i_height, int i_eol, int i_pic_eol, int i_scale, int i_matrix_coefficients );
static void ConvertYUV444RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data_t *p_y, yuv_data_t *p_u, yuv_data_t *p_v,
int i_width, int i_height, int i_eol, int i_pic_eol, int i_scale, int i_matrix_coefficients );
-static void Scale16 ( p_vout_thread_t p_vout, void *p_pic, void *p_buffer,
- int i_width, int i_height, int i_eol, int i_pic_eol, float f_alpha, float f_beta );
-static void Scale24 ( p_vout_thread_t p_vout, void *p_pic, void *p_buffer,
- int i_width, int i_height, int i_eol, int i_pic_eol, float f_alpha, float f_beta );
-static void Scale32 ( p_vout_thread_t p_vout, void *p_pic, void *p_buffer,
- int i_width, int i_height, int i_eol, int i_pic_eol, float f_alpha, float f_beta );
/*******************************************************************************
* CLIP_BYTE macro: boundary detection
p_vout->p_ConvertYUV420 = (vout_convert_t *) ConvertY4Gray16;
p_vout->p_ConvertYUV420 = (vout_convert_t *) ConvertY4Gray16;
p_vout->p_ConvertYUV420 = (vout_convert_t *) ConvertY4Gray16;
- p_vout->p_Scale = (vout_scale_t *) Scale16;
break;
case 24:
p_vout->p_ConvertYUV420 = (vout_convert_t *) ConvertY4Gray24;
p_vout->p_ConvertYUV420 = (vout_convert_t *) ConvertY4Gray24;
p_vout->p_ConvertYUV420 = (vout_convert_t *) ConvertY4Gray24;
- p_vout->p_Scale = (vout_scale_t *) Scale24;
break;
case 32:
p_vout->p_ConvertYUV420 = (vout_convert_t *) ConvertY4Gray32;
p_vout->p_ConvertYUV420 = (vout_convert_t *) ConvertY4Gray32;
p_vout->p_ConvertYUV420 = (vout_convert_t *) ConvertY4Gray32;
- p_vout->p_Scale = (vout_scale_t *) Scale32;
break;
}
}
p_vout->p_ConvertYUV420 = (vout_convert_t *) ConvertYUV420RGB16;
p_vout->p_ConvertYUV422 = (vout_convert_t *) ConvertYUV422RGB16;
p_vout->p_ConvertYUV444 = (vout_convert_t *) ConvertYUV444RGB16;
- p_vout->p_Scale = (vout_scale_t *) Scale16;
break;
case 24:
p_vout->p_ConvertYUV420 = (vout_convert_t *) ConvertYUV420RGB24;
p_vout->p_ConvertYUV422 = (vout_convert_t *) ConvertYUV422RGB24;
p_vout->p_ConvertYUV444 = (vout_convert_t *) ConvertYUV444RGB24;
- p_vout->p_Scale = (vout_scale_t *) Scale24;
break;
case 32:
p_vout->p_ConvertYUV420 = (vout_convert_t *) ConvertYUV420RGB32;
p_vout->p_ConvertYUV422 = (vout_convert_t *) ConvertYUV422RGB32;
p_vout->p_ConvertYUV444 = (vout_convert_t *) ConvertYUV444RGB32;
- p_vout->p_Scale = (vout_scale_t *) Scale32;
break;
}
}
CONVERT_YUV_RGB( 444 )
}
-/*******************************************************************************
- * Scale16: 15 or 16 bpp picture scaling
- *******************************************************************************/
-static void Scale16( p_vout_thread_t p_vout, void *p_pic, void *p_buffer,
- int i_width, int i_height, int i_eol, int i_pic_eol, float f_alpha, float f_beta )
-{
- //???
-}
-
-/*******************************************************************************
- * Scale24: 24 bpp picture scaling
- *******************************************************************************/
-static void Scale24( p_vout_thread_t p_vout, void *p_pic, void *p_buffer,
- int i_width, int i_height, int i_eol, int i_pic_eol, float f_alpha, float f_beta )
-{
- //???
-}
-
-/*******************************************************************************
- * Scale32: 32 bpp picture scaling
- *******************************************************************************/
-static void Scale32( p_vout_thread_t p_vout, void *p_pic, void *p_buffer,
- int i_width, int i_height, int i_eol, int i_pic_eol, float f_alpha, float f_beta )
-{
- //???
-}
-
//-------------------- walken code follow --------------------------------
/*