Commit 4cd0b036 authored by Laurent Aimar's avatar Laurent Aimar

Removed picture_heap_t::i_aspect/width/height/chroma.

parent 47e1d944
......@@ -43,16 +43,6 @@ struct picture_heap_t
{
int i_pictures; /**< current heap size */
/* \name Picture static properties
* Those properties are fixed at initialization and should NOT be modified
* @{
*/
unsigned int i_width; /**< picture width */
unsigned int i_height; /**< picture height */
vlc_fourcc_t i_chroma; /**< picture chroma */
unsigned int i_aspect; /**< aspect ratio */
/**@}*/
/* Real pictures */
picture_t* pp_picture[VOUT_MAX_PICTURES]; /**< pictures */
int i_last_used_pic; /**< last used pic in heap */
......
......@@ -241,12 +241,6 @@ vout_thread_t *vout_Request( vlc_object_t *p_this, vout_thread_t *p_vout,
p_vout->fmt_render.i_sar_num = i_sar_num;
p_vout->fmt_render.i_sar_den = i_sar_den;
p_vout->render.i_aspect = (int64_t)i_sar_num *
p_vout->fmt_render.i_width *
VOUT_ASPECT_FACTOR /
i_sar_den /
p_vout->fmt_render.i_height;
p_vout->i_changes |= VOUT_ASPECT_CHANGE;
}
vlc_mutex_unlock( &p_vout->change_lock );
......@@ -289,26 +283,19 @@ vout_thread_t * vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
int i_index; /* loop variable */
vlc_value_t text;
unsigned int i_width = p_fmt->i_width;
unsigned int i_height = p_fmt->i_height;
vlc_fourcc_t i_chroma = vlc_fourcc_GetCodec( VIDEO_ES, p_fmt->i_chroma );
config_chain_t *p_cfg;
char *psz_parser;
char *psz_name;
if( i_width <= 0 || i_height <= 0 )
if( p_fmt->i_width <= 0 || p_fmt->i_height <= 0 )
return NULL;
const vlc_fourcc_t i_chroma = vlc_fourcc_GetCodec( VIDEO_ES, p_fmt->i_chroma );
vlc_ureduce( &p_fmt->i_sar_num, &p_fmt->i_sar_den,
p_fmt->i_sar_num, p_fmt->i_sar_den, 50000 );
if( p_fmt->i_sar_num <= 0 || p_fmt->i_sar_den <= 0 )
return NULL;
unsigned int i_aspect = (int64_t)p_fmt->i_sar_num *
i_width *
VOUT_ASPECT_FACTOR /
p_fmt->i_sar_den /
i_height;
/* Allocate descriptor */
static const char typename[] = "video output";
......@@ -340,22 +327,15 @@ vout_thread_t * vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
p_vout->fmt_render = *p_fmt; /* FIXME palette */
p_vout->fmt_in = *p_fmt; /* FIXME palette */
p_vout->fmt_render.i_chroma =
p_vout->fmt_in.i_chroma = i_chroma;
video_format_FixRgb( &p_vout->fmt_render );
video_format_FixRgb( &p_vout->fmt_in );
p_vout->render.i_width = i_width;
p_vout->render.i_height = i_height;
p_vout->render.i_chroma = i_chroma;
p_vout->render.i_aspect = i_aspect;
p_vout->render.i_last_used_pic = -1;
/* Zero the output heap */
I_OUTPUTPICTURES = 0;
p_vout->output.i_width = 0;
p_vout->output.i_height = 0;
p_vout->output.i_chroma = 0;
p_vout->output.i_aspect = 0;
/* Initialize misc stuff */
p_vout->i_changes = 0;
......@@ -778,22 +758,12 @@ static int InitThread( vout_thread_t *p_vout )
msg_Dbg( p_vout, "got %i direct buffer(s)", I_OUTPUTPICTURES );
if( !p_vout->fmt_out.i_width || !p_vout->fmt_out.i_height )
{
p_vout->fmt_out.i_width = p_vout->fmt_out.i_visible_width =
p_vout->output.i_width;
p_vout->fmt_out.i_height = p_vout->fmt_out.i_visible_height =
p_vout->output.i_height;
p_vout->fmt_out.i_x_offset = p_vout->fmt_out.i_y_offset = 0;
p_vout->fmt_out.i_chroma = p_vout->output.i_chroma;
}
assert( p_vout->fmt_out.i_width > 0 && p_vout->fmt_out.i_height > 0 );
if( !p_vout->fmt_out.i_sar_num || !p_vout->fmt_out.i_sar_num )
{
p_vout->fmt_out.i_sar_num = p_vout->output.i_aspect *
p_vout->fmt_out.i_height;
p_vout->fmt_out.i_sar_den = VOUT_ASPECT_FACTOR *
p_vout->fmt_out.i_width;
/* FIXME is it possible to end up here ? */
p_vout->fmt_out.i_sar_num = 1;
p_vout->fmt_out.i_sar_den = 1;
}
vlc_ureduce( &p_vout->fmt_out.i_sar_num, &p_vout->fmt_out.i_sar_den,
......@@ -833,9 +803,9 @@ static int InitThread( vout_thread_t *p_vout )
p_vout->fmt_out.i_sar_num, p_vout->fmt_out.i_sar_den,
p_vout->fmt_out.i_rmask, p_vout->fmt_out.i_gmask, p_vout->fmt_out.i_bmask );
assert( p_vout->output.i_width == p_vout->render.i_width &&
p_vout->output.i_height == p_vout->render.i_height &&
p_vout->output.i_chroma == p_vout->render.i_chroma );
assert( p_vout->fmt_out.i_width == p_vout->fmt_render.i_width &&
p_vout->fmt_out.i_height == p_vout->fmt_render.i_height &&
p_vout->fmt_out.i_chroma == p_vout->fmt_render.i_chroma );
/* Check whether we managed to create direct buffers similar to
* the render buffers, ie same size and chroma */
......
......@@ -46,11 +46,13 @@ void vout_OSDSlider( vlc_object_t *p_caller, int i_channel, int i_position,
if( p_vout && ( var_InheritBool( p_caller, "osd" ) && ( i_position >= 0 ) ) )
{
osd_Slider( p_caller, vout_GetSpu( p_vout ), p_vout->render.i_width,
p_vout->render.i_height, p_vout->fmt_in.i_x_offset,
p_vout->fmt_in.i_height - p_vout->fmt_in.i_visible_height
- p_vout->fmt_in.i_y_offset,
i_channel, i_position, i_type );
osd_Slider( p_caller, vout_GetSpu( p_vout ),
p_vout->fmt_render.i_width,
p_vout->fmt_render.i_height,
p_vout->fmt_in.i_x_offset,
p_vout->fmt_in.i_height - p_vout->fmt_in.i_visible_height
- p_vout->fmt_in.i_y_offset,
i_channel, i_position, i_type );
}
vlc_object_release( p_vout );
}
......@@ -70,8 +72,8 @@ void vout_OSDIcon( vlc_object_t *p_caller, int i_channel, short i_type )
{
osd_Icon( p_caller,
vout_GetSpu( p_vout ),
p_vout->render.i_width,
p_vout->render.i_height,
p_vout->fmt_render.i_width,
p_vout->fmt_render.i_height,
p_vout->fmt_in.i_width - p_vout->fmt_in.i_visible_width
- p_vout->fmt_in.i_x_offset,
p_vout->fmt_in.i_y_offset,
......
......@@ -817,10 +817,6 @@ static int AspectCallback( vlc_object_t *p_this, char const *psz_cmd,
/* Restore defaults */
p_vout->fmt_in.i_sar_num = p_vout->fmt_render.i_sar_num;
p_vout->fmt_in.i_sar_den = p_vout->fmt_render.i_sar_den;
p_vout->render.i_aspect = (int64_t)p_vout->fmt_render.i_sar_num *
p_vout->fmt_render.i_width *
VOUT_ASPECT_FACTOR /
p_vout->fmt_render.i_sar_den / p_vout->fmt_render.i_height;
if( !psz_parser ) goto aspect_end;
......@@ -835,18 +831,12 @@ static int AspectCallback( vlc_object_t *p_this, char const *psz_cmd,
vlc_ureduce( &i_sar_num, &i_sar_den, i_sar_num, i_sar_den, 0 );
p_vout->fmt_in.i_sar_num = i_sar_num;
p_vout->fmt_in.i_sar_den = i_sar_den;
p_vout->render.i_aspect = i_aspect_num * VOUT_ASPECT_FACTOR / i_aspect_den;
aspect_end:
if( p_vout->p->i_par_num && p_vout->p->i_par_den )
{
p_vout->fmt_in.i_sar_num *= p_vout->p->i_par_den;
p_vout->fmt_in.i_sar_den *= p_vout->p->i_par_num;
p_vout->render.i_aspect = (int64_t)p_vout->fmt_in.i_sar_num *
p_vout->fmt_in.i_width *
VOUT_ASPECT_FACTOR /
p_vout->fmt_in.i_sar_den /
p_vout->fmt_in.i_height;
}
p_vout->i_changes |= VOUT_ASPECT_CHANGE;
......
......@@ -167,10 +167,9 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout,
if( p_freepic != NULL )
{
vout_AllocatePicture( VLC_OBJECT(p_vout),
p_freepic, p_vout->render.i_chroma,
p_vout->render.i_width, p_vout->render.i_height,
p_vout->render.i_aspect * p_vout->render.i_height,
VOUT_ASPECT_FACTOR * p_vout->render.i_width);
p_freepic, p_vout->fmt_render.i_chroma,
p_vout->fmt_render.i_width, p_vout->fmt_render.i_height,
p_vout->fmt_in.i_sar_num, p_vout->fmt_in.i_sar_den ); /* The right AR is in fmt_in and not fmt_render */
if( p_freepic->i_planes )
{
......
......@@ -146,19 +146,13 @@ int vout_InitWrapper(vout_thread_t *vout)
/* */
video_format_t source = vd->source;
vout->output.i_chroma = source.i_chroma;
vout->output.i_width = source.i_width;
vout->output.i_height = source.i_height;
vout->output.i_aspect = (int64_t)source.i_sar_num * source.i_width * VOUT_ASPECT_FACTOR / source.i_sar_den / source.i_height;
/* also set fmt_out (completly broken API) */
vout->fmt_out.i_chroma = vout->output.i_chroma;
vout->fmt_out.i_chroma = source.i_chroma;
vout->fmt_out.i_width =
vout->fmt_out.i_visible_width = vout->output.i_width;
vout->fmt_out.i_visible_width = source.i_width;
vout->fmt_out.i_height =
vout->fmt_out.i_visible_height = vout->output.i_height;
vout->fmt_out.i_sar_num = vout->output.i_aspect * vout->output.i_height;
vout->fmt_out.i_sar_den = VOUT_ASPECT_FACTOR * vout->output.i_width;
vout->fmt_out.i_visible_height = source.i_height;
vout->fmt_out.i_sar_num = source.i_sar_num;
vout->fmt_out.i_sar_den = source.i_sar_den;
vout->fmt_out.i_x_offset = 0;
vout->fmt_out.i_y_offset = 0;
vout->fmt_out.i_rmask = source.i_rmask;
......@@ -277,8 +271,6 @@ int vout_ManageWrapper(vout_thread_t *vout)
vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
}
if (vout->i_changes & VOUT_ASPECT_CHANGE) {
vout->output.i_aspect = (int64_t)vout->fmt_in.i_sar_num * vout->fmt_in.i_width * VOUT_ASPECT_FACTOR /
vout->fmt_in.i_sar_den / vout->fmt_in.i_height;
vout->fmt_out.i_sar_num = vout->fmt_in.i_sar_num;
vout->fmt_out.i_sar_den = vout->fmt_in.i_sar_den;
......
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