* 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
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;
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;
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,
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;
}
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 )
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 ) )
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;
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 ) )
/* */
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;
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 =
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 )
{
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;
/* 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) );
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 );
}