Commit 63b7c098 authored by Laurent Aimar's avatar Laurent Aimar

Used a sar for video_format_Setup.

parent 24c96490
......@@ -175,7 +175,7 @@ static inline void video_format_Clean( video_format_t *p_src )
* It will fill up a video_format_tvideo_format_t using the given arguments.
* Becarefull that the video_format_t must already be initialized.
*/
VLC_EXPORT( void, video_format_Setup, ( video_format_t *, vlc_fourcc_t i_chroma, int i_width, int i_height, int i_aspect ) );
VLC_EXPORT( void, video_format_Setup, ( video_format_t *, vlc_fourcc_t i_chroma, int i_width, int i_height, int i_sar_num, int i_sar_den ) );
/**
* This function will check if the first video format is similar
......
......@@ -192,7 +192,7 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
i_height);
video_format_Setup( &p_dec->fmt_out.video, VLC_CODEC_I420,
i_width, i_height,
VOUT_ASPECT_FACTOR * i_width / i_height );
1, 1 );
p_sys->b_inited = true;
}
p_pic = NULL;
......
......@@ -159,7 +159,8 @@ static int OpenDecoder( vlc_object_t *p_this )
video_format_Setup( &p_dec->fmt_out.video, p_dec->fmt_in.i_codec,
p_dec->fmt_in.video.i_width,
p_dec->fmt_in.video.i_height,
p_dec->fmt_in.video.i_aspect );
p_dec->fmt_in.video.i_aspect * p_dec->fmt_in.video.i_height,
VOUT_ASPECT_FACTOR * p_dec->fmt_in.video.i_width );
p_sys->i_raw_size = p_dec->fmt_out.video.i_bits_per_pixel *
p_dec->fmt_out.video.i_width * p_dec->fmt_out.video.i_height / 8;
......
......@@ -357,7 +357,8 @@ static int Open( vlc_object_t * p_this )
es_format_Init( &p_sys->fmt_video, VIDEO_ES, i_chroma );
video_format_Setup( &p_sys->fmt_video.video,
i_chroma, i_width, i_height, i_aspect );
i_chroma, i_width, i_height,
i_aspect * i_height, VOUT_ASPECT_FACTOR * i_width );
vlc_ureduce( &p_sys->fmt_video.video.i_frame_rate,
&p_sys->fmt_video.video.i_frame_rate_base,
......
......@@ -56,7 +56,7 @@ overlay_t *OverlayCreate( void )
p_ovl->i_alpha = 0xFF;
p_ovl->b_active = false;
video_format_Setup( &p_ovl->format, VLC_FOURCC( '\0','\0','\0','\0') , 0, 0,
VOUT_ASPECT_FACTOR );
1, 1 );
p_ovl->p_fontstyle = text_style_New();
p_ovl->data.p_text = NULL;
......@@ -464,7 +464,7 @@ static int exec_DataSharedMem( filter_t *p_filter,
}
video_format_Setup( &p_ovl->format, VLC_CODEC_TEXT,
0, 0, 0 );
0, 0, 0, 1 );
p_data = shmat( p_params->i_shmid, NULL, SHM_RDONLY );
if( p_data == NULL )
......@@ -489,7 +489,7 @@ static int exec_DataSharedMem( filter_t *p_filter,
video_format_Setup( &p_ovl->format, p_params->fourcc,
p_params->i_width, p_params->i_height,
VOUT_ASPECT_FACTOR );
1, 1 );
if( vout_AllocatePicture( p_filter, p_ovl->data.p_pic,
p_ovl->format.i_chroma, p_params->i_width,
p_params->i_height, p_ovl->format.i_aspect ) )
......
......@@ -145,7 +145,8 @@ static int Open( vlc_object_t *p_this, const char *psz_name, bool b_filter )
es_format_Init( &fmt, VIDEO_ES, p_vout->render.i_chroma );
video_format_Setup( &fmt.video, p_vout->render.i_chroma,
p_vout->render.i_width, p_vout->render.i_height,
p_vout->render.i_aspect );
p_vout->render.i_aspect * p_vout->render.i_height,
VOUT_ASPECT_FACTOR * p_vout->render.i_width );
if( fmt.video.i_sar_num <= 0 || fmt.video.i_sar_den <= 0 )
{
fmt.video.i_sar_num = fmt.video.i_aspect * fmt.video.i_visible_height;
......
......@@ -215,7 +215,8 @@ static int Init( vout_thread_t *p_vout )
p_vout->render.i_chroma,
p_vout->render.i_width,
p_vout->render.i_height,
p_vout->render.i_aspect );
p_vout->render.i_aspect * p_vout->render.i_height,
VOUT_ASPECT_FACTOR * p_vout->render.i_width );
if( vout_display_opengl_Init( &p_sys->vgl, &fmt, &p_sys->gl ) )
......
......@@ -272,7 +272,7 @@ static void *Thread( void *p_data )
/* */
video_format_Init( &fmt, 0 );
video_format_Setup( &fmt, VLC_CODEC_RGB32,
p_sys->i_width, p_sys->i_height, 0 );
p_sys->i_width, p_sys->i_height, 0, 1 );
fmt.i_sar_num = 1;
fmt.i_sar_den = 1;
......
......@@ -129,7 +129,9 @@ void video_format_FixRgb( video_format_t *p_fmt )
p_fmt->i_bmask );
}
void video_format_Setup( video_format_t *p_fmt, vlc_fourcc_t i_chroma, int i_width, int i_height, int i_aspect )
void video_format_Setup( video_format_t *p_fmt, vlc_fourcc_t i_chroma,
int i_width, int i_height,
int i_sar_num, int i_sar_den )
{
p_fmt->i_chroma = vlc_fourcc_GetCodec( VIDEO_ES, i_chroma );
p_fmt->i_width =
......@@ -138,7 +140,13 @@ void video_format_Setup( video_format_t *p_fmt, vlc_fourcc_t i_chroma, int i_wid
p_fmt->i_visible_height = i_height;
p_fmt->i_x_offset =
p_fmt->i_y_offset = 0;
p_fmt->i_aspect = i_aspect;
vlc_ureduce( &p_fmt->i_sar_num, &p_fmt->i_sar_den,
i_sar_num, i_sar_den, 0 );
if( p_fmt->i_sar_den > 0 && i_height > 0 )
p_fmt->i_aspect = (int64_t)p_fmt->i_sar_num * i_width * VOUT_ASPECT_FACTOR /
p_fmt->i_sar_den / i_height;
else
p_fmt->i_aspect = 0;
switch( p_fmt->i_chroma )
{
......
......@@ -714,7 +714,8 @@ int picture_Setup( picture_t *p_picture, vlc_fourcc_t i_chroma, int i_width, int
p_picture->i_qstride = 0;
p_picture->p_q = NULL;
video_format_Setup( &p_picture->format, i_chroma, i_width, i_height, i_aspect );
video_format_Setup( &p_picture->format, i_chroma, i_width, i_height,
i_aspect * i_height, VOUT_ASPECT_FACTOR * i_width );
/* Make sure the real dimensions are a multiple of 16 */
i_width_aligned = (i_width + 15) >> 4 << 4;
......@@ -947,7 +948,9 @@ picture_t *picture_NewFromResource( const video_format_t *p_fmt, const picture_r
/* It is needed to be sure all informations are filled */
video_format_Setup( &fmt, p_fmt->i_chroma,
p_fmt->i_width, p_fmt->i_height, p_fmt->i_aspect );
p_fmt->i_width, p_fmt->i_height,
p_fmt->i_aspect * p_fmt->i_height,
VOUT_ASPECT_FACTOR * p_fmt->i_width );
/* */
picture_t *p_picture = calloc( 1, sizeof(*p_picture) );
......@@ -996,7 +999,8 @@ picture_t *picture_New( vlc_fourcc_t i_chroma, int i_width, int i_height, int i_
video_format_t fmt;
memset( &fmt, 0, sizeof(fmt) );
video_format_Setup( &fmt, i_chroma, i_width, i_height, i_aspect );
video_format_Setup( &fmt, i_chroma, i_width, i_height,
i_aspect * i_height, VOUT_ASPECT_FACTOR * i_width );
return picture_NewFromFormat( &fmt );
}
......
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