unsigned u_fps_num=0, u_fps_den=1;
char *psz_ext;
vlc_fourcc_t i_chroma;
- unsigned int i_aspect = 0;
+ unsigned int i_sar_num = 0;
+ unsigned int i_sar_den = 0;
const struct preset_t *p_preset = NULL;
const uint8_t *p_peek;
bool b_valid = false;
i_height = p_preset->i_height;
u_fps_num = p_preset->u_fps_num;
u_fps_den = p_preset->u_fps_den;
- i_aspect = VOUT_ASPECT_FACTOR * p_preset->u_ar_num / p_preset->u_ar_den;
+ i_sar_num = p_preset->u_ar_num * p_preset->i_height;
+ i_sar_den = p_preset->u_ar_den * p_preset->i_width;
i_chroma = p_preset->i_chroma;
}
READ_FRAC( " F", u_fps_num, u_fps_den );
READ_FRAC( " A", a, b );
#undef READ_FRAC
- /* Try to calculate aspect ratio here, rather than store ratio
- * in u_ar_{num,den}, since width may be overridden by then.
- * Plus, a:b is sar. */
if( b != 0 )
- i_aspect = VOUT_ASPECT_FACTOR * a * i_width / (b * i_height);
+ {
+ i_sar_num = a;
+ i_sar_den = b;
+ }
psz_buf = strstr( psz+9, " C" );
if( psz_buf )
if( psz_denominator )
{
*psz_denominator++ = '\0';
- i_aspect = atoi( psz_tmp ) * VOUT_ASPECT_FACTOR
- / atoi( psz_denominator );
+ i_sar_num = atoi( psz_tmp ) * i_height;
+ i_sar_den = atoi( psz_denominator ) * i_width;
}
free( psz_tmp );
}
}
/* fixup anything missing with sensible assumptions */
- if( !i_aspect )
+ if( i_sar_num <= 0 || i_sar_den <= 0 )
{
/* assume 1:1 sar */
- i_aspect = i_width * VOUT_ASPECT_FACTOR / i_height;
+ i_sar_num = 1;
+ i_sar_den = 1;
}
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_height, VOUT_ASPECT_FACTOR * i_width );
+ i_sar_num, i_sar_den );
vlc_ureduce( &p_sys->fmt_video.video.i_frame_rate,
&p_sys->fmt_video.video.i_frame_rate_base,
u_fps_num, u_fps_den, 0);
date_Init( &p_sys->pcr, p_sys->fmt_video.video.i_frame_rate,
p_sys->fmt_video.video.i_frame_rate_base );
- date_Set( &p_sys->pcr, 1 );
+ date_Set( &p_sys->pcr, 0 );
if( !p_sys->fmt_video.video.i_bits_per_pixel )
{
mtime_t i_pcr = date_Get( &p_sys->pcr );
/* Call the pace control */
- es_out_Control( p_demux->out, ES_OUT_SET_PCR, i_pcr );
+ es_out_Control( p_demux->out, ES_OUT_SET_PCR, VLC_TS_0 + i_pcr );
if( p_sys->b_y4m )
{
return 0;
}
- p_block->i_dts = p_block->i_pts = i_pcr;
+ p_block->i_dts = p_block->i_pts = VLC_TS_0 + i_pcr;
es_out_Send( p_demux->out, p_sys->p_es_video, p_block );
date_Increment( &p_sys->pcr, 1 );