Commit d466fd41 authored by Laurent Aimar's avatar Laurent Aimar

Removed es_format_t::i_aspect.

It was duplicated with es_format_t::i_sar_num/den.
parent deca66fb
......@@ -105,7 +105,6 @@ struct audio_format_t
struct video_format_t
{
vlc_fourcc_t i_chroma; /**< picture chroma */
unsigned int i_aspect; /**< aspect ratio */
unsigned int i_width; /**< picture width */
unsigned int i_height; /**< picture height */
......
......@@ -647,7 +647,8 @@ static int DemuxOpen( vlc_object_t *p_this )
fmt.video.i_width = p_stream->header.video.bmiHeader.biWidth;
fmt.video.i_height = p_stream->header.video.bmiHeader.biHeight;
fmt.video.i_aspect = 4 * VOUT_ASPECT_FACTOR / 3;
fmt.video.i_sar_num = 4 * fmt.video.i_height;
fmt.video.i_sar_den = 4 * fmt.video.i_width;
if( !p_stream->header.video.bmiHeader.biCompression )
{
......
......@@ -139,8 +139,6 @@ struct demux_sys_t
bool b_spu_change;
/* */
int i_aspect;
int i_title;
input_title_t **title;
......@@ -228,7 +226,6 @@ static int Open( vlc_object_t *p_this )
p_sys->b_reset_pcr = false;
ps_track_init( p_sys->tk );
p_sys->i_aspect = -1;
p_sys->i_mux_rate = 0;
p_sys->i_pgc_length = 0;
p_sys->b_spu_change = false;
......@@ -728,10 +725,6 @@ static int Demux( demux_t *p_demux )
msg_Dbg( p_demux, " - vtsN=%d", event->new_vtsN );
msg_Dbg( p_demux, " - domain=%d", event->new_domain );
/* dvdnav_get_video_aspect / dvdnav_get_video_scale_permission */
/* TODO check if we always have VTS and CELL */
p_sys->i_aspect = dvdnav_get_video_aspect( p_sys->dvdnav );
/* reset PCR */
es_out_Control( p_demux->out, ES_OUT_RESET_PCR );
......@@ -1183,16 +1176,6 @@ static void ESNew( demux_t *p_demux, int i_id )
/* Add a new ES */
if( tk->fmt.i_cat == VIDEO_ES )
{
switch( p_sys->i_aspect )
{
case 1: tk->fmt.video.i_aspect = VOUT_ASPECT_FACTOR; break;
case 2: tk->fmt.video.i_aspect = VOUT_ASPECT_FACTOR * 4 / 3; break;
case 3: tk->fmt.video.i_aspect = VOUT_ASPECT_FACTOR * 16 / 9; break;
case 4: tk->fmt.video.i_aspect = VOUT_ASPECT_FACTOR * 221 / 10; break;
default:
tk->fmt.video.i_aspect = 0;
break;
}
b_select = true;
}
else if( tk->fmt.i_cat == AUDIO_ES )
......
......@@ -172,7 +172,8 @@ struct demux_sys_t
input_title_t **titles;
/* Video */
int i_aspect;
int i_sar_num;
int i_sar_den;
/* SPU */
uint32_t clut[16];
......@@ -266,7 +267,8 @@ static int Open( vlc_object_t *p_this )
DEMUX_INIT_COMMON(); p_sys = p_demux->p_sys;
ps_track_init( p_sys->tk );
p_sys->i_aspect = -1;
p_sys->i_sar_num = 0;
p_sys->i_sar_den = 0;
p_sys->i_title_cur_time = (mtime_t) 0;
p_sys->i_cell_cur_time = (mtime_t) 0;
p_sys->i_cell_duration = (mtime_t) 0;
......@@ -713,16 +715,8 @@ static void ESNew( demux_t *p_demux, int i_id, int i_lang )
/* Add a new ES */
if( tk->fmt.i_cat == VIDEO_ES )
{
switch( p_sys->i_aspect )
{
case 1: tk->fmt.video.i_aspect = VOUT_ASPECT_FACTOR; break;
case 2: tk->fmt.video.i_aspect = VOUT_ASPECT_FACTOR * 4 / 3; break;
case 3: tk->fmt.video.i_aspect = VOUT_ASPECT_FACTOR * 16 / 9; break;
case 4: tk->fmt.video.i_aspect = VOUT_ASPECT_FACTOR * 221 / 10; break;
default:
tk->fmt.video.i_aspect = 0;
break;
}
tk->fmt.video.i_sar_num = p_sys->i_sar_num;
tk->fmt.video.i_sar_den = p_sys->i_sar_den;
}
else if( tk->fmt.i_cat == AUDIO_ES )
{
......@@ -906,7 +900,41 @@ static int DvdReadSetArea( demux_t *p_demux, int i_title, int i_chapter,
ESNew( p_demux, 0xe0, 0 ); /* Video, FIXME ? */
p_sys->i_aspect = p_vts->vtsi_mat->vts_video_attr.display_aspect_ratio;
const video_attr_t *p_attr = &p_vts->vtsi_mat->vts_video_attr;
int i_video_height = p_attr->video_format != 0 ? 576 : 480;
int i_video_width;
switch( p_attr->picture_size )
{
case 0:
i_video_width = 720;
break;
case 1:
i_video_width = 704;
break;
case 2:
i_video_width = 352;
break;
default:
case 3:
i_video_width = 352;
i_video_height /= 2;
break;
}
switch( p_attr->display_aspect_ratio )
{
case 0:
p_sys->i_sar_num = 4 * i_video_height;
p_sys->i_sar_den = 3 * i_video_width;
break;
case 3:
p_sys->i_sar_num = 16 * i_video_height;
p_sys->i_sar_den = 9 * i_video_width;
break;
default:
p_sys->i_sar_num = 0;
p_sys->i_sar_den = 0;
break;
}
#define audio_control \
p_sys->p_vts_file->vts_pgcit->pgci_srp[pgc_id-1].pgc->audio_control[i-1]
......
......@@ -254,7 +254,6 @@ static int Open(vlc_object_t *object)
fmt.video.i_height = var_CreateGetInteger(demux, "imem-height");
unsigned num, den;
if (!var_CreateGetRational(demux, &num, &den, "imem-dar") && num > 0 && den > 0) {
fmt.video.i_aspect = VOUT_ASPECT_FACTOR * num / den;
if (fmt.video.i_width > 0 && fmt.video.i_height > 0) {
fmt.video.i_sar_num = num * fmt.video.i_height;
fmt.video.i_sar_den = den * fmt.video.i_width;
......
......@@ -195,7 +195,6 @@ static int Open( vlc_object_t *p_this )
int i;
int i_width;
int i_height;
int i_aspect;
int result = 0;
/* Only when selected */
......@@ -285,7 +284,8 @@ static int Open( vlc_object_t *p_this )
fmt.video.i_height = p_sys->height = encoded_size.height;
if( par_size.width != encoded_size.width )
{
fmt.video.i_aspect = par_size.width * VOUT_ASPECT_FACTOR / encoded_size.width ;
fmt.video.i_sar_num = (int64_t)encoded_size.height * par_size.width / encoded_size.width;
fmt.video.i_sar_den = encoded_size.width;
}
NSLog( @"encoded_size %d %d", (int)encoded_size.width, (int)encoded_size.height );
......
......@@ -340,8 +340,8 @@ void RenderCursor( demux_t *p_demux, int i_x, int i_y,
p_sys->fmt.video.i_chroma,
p_sys->fmt.video.i_width,
p_sys->fmt.video.i_height,
p_sys->fmt.video.i_aspect * p_sys->fmt.video.i_height,
VOUT_ASPECT_FACTOR * p_sys->fmt.video.i_width );
p_sys->fmt.video.i_sar_num,
p_sys->fmt.video.i_sar_den );
if( !p_sys->p_blend )
{
p_sys->p_blend = vlc_object_create( p_demux, sizeof(filter_t) );
......
......@@ -360,7 +360,8 @@ static int Open( vlc_object_t *p_this )
es_format_Init( &fmt, VIDEO_ES, p_sys->i_fourcc );
fmt.video.i_width = p_sys->i_width;
fmt.video.i_height = p_sys->i_height;
fmt.video.i_aspect = 4 * VOUT_ASPECT_FACTOR / 3;
fmt.video.i_sar_num = 4 * fmt.video.i_height;
fmt.video.i_sar_den = 3 * fmt.video.i_width;
/* Setup rgb mask for RGB formats */
switch( p_sys->i_fourcc )
......
......@@ -2282,7 +2282,8 @@ static int OpenVideoDev( vlc_object_t *p_obj, demux_sys_t *p_sys, bool b_demux )
es_fmt.video.i_height = p_sys->i_height;
/* Get aspect-ratio */
es_fmt.video.i_aspect = p_sys->i_aspect;
es_fmt.video.i_sar_num = p_sys->i_aspect * es_fmt.video.i_height;
es_fmt.video.i_sar_den = VOUT_ASPECT_FACTOR * es_fmt.video.i_width;
demux_t *p_demux = (demux_t *) p_obj;
msg_Dbg( p_demux, "added new video es %4.4s %dx%d",
......
......@@ -386,8 +386,6 @@ int OpenEncoder( vlc_object_t *p_this )
if( p_enc->fmt_in.i_cat == VIDEO_ES )
{
int i_aspect_num, i_aspect_den;
if( !p_enc->fmt_in.video.i_width || !p_enc->fmt_in.video.i_height )
{
msg_Warn( p_enc, "invalid size %ix%i", p_enc->fmt_in.video.i_width,
......@@ -430,13 +428,10 @@ int OpenEncoder( vlc_object_t *p_this )
p_enc->fmt_out.i_codec == VLC_CODEC_MP1V ) )
p_context->flags |= CODEC_FLAG_LOW_DELAY;
av_reduce( &i_aspect_num, &i_aspect_den,
p_enc->fmt_in.video.i_aspect,
VOUT_ASPECT_FACTOR, 1 << 30 /* something big */ );
av_reduce( &p_context->sample_aspect_ratio.num,
&p_context->sample_aspect_ratio.den,
i_aspect_num * (int64_t)p_context->height,
i_aspect_den * (int64_t)p_context->width, 1 << 30 );
p_enc->fmt_in.video.i_sar_num,
p_enc->fmt_in.video.i_sar_den, 1 << 30 );
p_sys->i_buffer_out = p_context->height * p_context->width * 3;
if( p_sys->i_buffer_out < FF_MIN_BUFFER_SIZE )
......
......@@ -189,7 +189,6 @@ static subpicture_region_t *ConvertRegionRGBA(AVSubtitleRect *ffregion)
video_format_t fmt;
memset(&fmt, 0, sizeof(fmt));
fmt.i_chroma = VLC_FOURCC('R','G','B','A');
fmt.i_aspect = 0;
fmt.i_width =
fmt.i_visible_width = ffregion->w;
fmt.i_height =
......
......@@ -150,22 +150,20 @@ static inline picture_t *ffmpeg_NewPictBuf( decoder_t *p_dec,
p_dec->fmt_out.i_codec = p_dec->fmt_out.video.i_chroma;
/* If an aspect-ratio was specified in the input format then force it */
if( p_dec->fmt_in.video.i_aspect )
if( p_dec->fmt_in.video.i_sar_num > 0 && p_dec->fmt_in.video.i_sar_den > 0 )
{
p_dec->fmt_out.video.i_aspect = p_dec->fmt_in.video.i_aspect;
p_dec->fmt_out.video.i_sar_num = p_dec->fmt_in.video.i_sar_num;
p_dec->fmt_out.video.i_sar_den = p_dec->fmt_in.video.i_sar_den;
}
else
{
p_dec->fmt_out.video.i_aspect =
VOUT_ASPECT_FACTOR * ( av_q2d(p_context->sample_aspect_ratio) *
p_context->width / p_context->height );
p_dec->fmt_out.video.i_sar_num = p_context->sample_aspect_ratio.num;
p_dec->fmt_out.video.i_sar_den = p_context->sample_aspect_ratio.den;
if( p_dec->fmt_out.video.i_aspect == 0 )
if( !p_dec->fmt_out.video.i_sar_num || !p_dec->fmt_out.video.i_sar_den )
{
p_dec->fmt_out.video.i_aspect =
VOUT_ASPECT_FACTOR * p_context->width / p_context->height;
p_dec->fmt_out.video.i_sar_num = 1;
p_dec->fmt_out.video.i_sar_den = 1;
}
}
......@@ -644,22 +642,18 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
p_sys->b_has_b_frames = true;
}
if( !p_dec->fmt_in.video.i_aspect )
if( !p_dec->fmt_in.video.i_sar_num || !p_dec->fmt_in.video.i_sar_den )
{
/* Fetch again the aspect ratio in case it changed */
p_dec->fmt_out.video.i_aspect =
VOUT_ASPECT_FACTOR
* ( av_q2d(p_sys->p_context->sample_aspect_ratio)
* p_sys->p_context->width / p_sys->p_context->height );
p_dec->fmt_out.video.i_sar_num
= p_sys->p_context->sample_aspect_ratio.num;
p_dec->fmt_out.video.i_sar_den
= p_sys->p_context->sample_aspect_ratio.den;
if( p_dec->fmt_out.video.i_aspect == 0 )
if( !p_dec->fmt_out.video.i_sar_num || !p_dec->fmt_out.video.i_sar_den )
{
p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR
* p_sys->p_context->width / p_sys->p_context->height;
p_dec->fmt_out.video.i_sar_num = 1;
p_dec->fmt_out.video.i_sar_den = 1;
}
}
......
......@@ -340,7 +340,6 @@ static subpicture_t *Subtitle( decoder_t *p_dec, char *psz_subtitle, char *psz_h
/* Create a new subpicture region */
memset( &fmt, 0, sizeof(video_format_t) );
fmt.i_chroma = VLC_CODEC_TEXT;
fmt.i_aspect = 0;
fmt.i_width = fmt.i_height = 0;
fmt.i_x_offset = fmt.i_y_offset = 0;
p_spu->p_region = subpicture_region_New( &fmt );
......
......@@ -116,8 +116,8 @@ static int Open( vlc_object_t *p_this )
p_dec->fmt_out.i_codec = VLC_CODEC_RGB32;
p_dec->fmt_out.video.i_width = CDG_DISPLAY_WIDTH;
p_dec->fmt_out.video.i_height = CDG_DISPLAY_HEIGHT;
p_dec->fmt_out.video.i_aspect =
VOUT_ASPECT_FACTOR * p_dec->fmt_out.video.i_width / p_dec->fmt_out.video.i_height;
p_dec->fmt_out.video.i_sar_num = 1;
p_dec->fmt_out.video.i_sar_den = 1;
p_dec->fmt_out.video.i_rmask = 0xff << CDG_COLOR_R_SHIFT;
p_dec->fmt_out.video.i_gmask = 0xff << CDG_COLOR_G_SHIFT;
p_dec->fmt_out.video.i_bmask = 0xff << CDG_COLOR_B_SHIFT;
......
......@@ -510,7 +510,8 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data )
/* Create new SPU region */
memset( &fmt, 0, sizeof(video_format_t) );
fmt.i_chroma = VLC_CODEC_YUVP;
fmt.i_aspect = VOUT_ASPECT_FACTOR;
fmt.i_sar_num = 1;
fmt.i_sar_den = 1;
fmt.i_width = fmt.i_visible_width = p_sys->i_width;
fmt.i_height = fmt.i_visible_height = p_sys->i_height;
fmt.i_x_offset = fmt.i_y_offset = 0;
......
......@@ -506,9 +506,8 @@ static int OpenEncoder( vlc_object_t *p_this )
p_sys->ctx.src_params.frame_rate.denominator = p_enc->fmt_in.video.i_frame_rate_base;
unsigned u_asr_num, u_asr_den;
vlc_ureduce( &u_asr_num, &u_asr_den,
p_enc->fmt_in.video.i_height * p_enc->fmt_in.video.i_aspect,
p_enc->fmt_in.video.i_width * VOUT_ASPECT_FACTOR,
0 );
p_enc->fmt_in.video.i_sar_num,
p_enc->fmt_in.video.i_sar_den, 0 );
p_sys->ctx.src_params.pix_asr.numerator = u_asr_num;
p_sys->ctx.src_params.pix_asr.denominator = u_asr_den;
......
......@@ -520,14 +520,16 @@ static int DecOpen( decoder_t *p_dec )
p_dec->fmt_out.video.i_bits_per_pixel = i_bpp;
/* If an aspect-ratio was specified in the input format then force it */
if( p_dec->fmt_in.video.i_aspect )
if( p_dec->fmt_in.video.i_sar_num > 0 &&
p_dec->fmt_in.video.i_sar_den > 0 )
{
p_dec->fmt_out.video.i_aspect = p_dec->fmt_in.video.i_aspect;
p_dec->fmt_out.video.i_sar_num = p_dec->fmt_in.video.i_sar_num;
p_dec->fmt_out.video.i_sar_den = p_dec->fmt_in.video.i_sar_den;
}
else
{
p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR *
p_dec->fmt_out.video.i_width / p_dec->fmt_out.video.i_height;
p_dec->fmt_out.video.i_sar_num = 1;
p_dec->fmt_out.video.i_sar_den = 1;
}
p_bih = &p_vih->bmiHeader;
......
......@@ -1582,7 +1582,8 @@ static subpicture_t *render( decoder_t *p_dec )
/* Create new SPU region */
memset( &fmt, 0, sizeof(video_format_t) );
fmt.i_chroma = VLC_CODEC_YUVP;
fmt.i_aspect = 0; /* 0 means use aspect ratio of background video */
fmt.i_sar_num = 0; /* 0 means use aspect ratio of background video */
fmt.i_sar_den = 1;
fmt.i_width = fmt.i_visible_width = p_region->i_width;
fmt.i_height = fmt.i_visible_height = p_region->i_height;
fmt.i_x_offset = fmt.i_y_offset = 0;
......@@ -1635,7 +1636,8 @@ static subpicture_t *render( decoder_t *p_dec )
/* Create new SPU region */
memset( &fmt, 0, sizeof(video_format_t) );
fmt.i_chroma = VLC_CODEC_TEXT;
fmt.i_aspect = VOUT_ASPECT_FACTOR;
fmt.i_sar_num = 1;
fmt.i_sar_den = 1;
fmt.i_width = fmt.i_visible_width = p_region->i_width;
fmt.i_height = fmt.i_visible_height = p_region->i_height;
fmt.i_x_offset = fmt.i_y_offset = 0;
......
......@@ -269,12 +269,13 @@ static int OpenDecoder( vlc_object_t *p_this )
if ( i_aspect )
{
fmt_out.i_aspect = i_aspect;
fmt_out.i_sar_num = i_aspect * fmt_out.i_height;
fmt_out.i_sar_den = VOUT_ASPECT_FACTOR * fmt_out.i_width;
}
else
{
fmt_out.i_aspect = fmt_out.i_width
* VOUT_ASPECT_FACTOR / fmt_out.i_height;
fmt_out.i_sar_num = 1;
fmt_out.i_sar_den = 1;
}
if( var_CreateGetBool( p_dec, "fake-deinterlace" ) )
......
......@@ -212,7 +212,8 @@ static int OpenDecoder( vlc_object_t *p_this )
p_dec->fmt_out.i_codec = chroma;
p_dec->fmt_out.video.i_width = p_dec->p_sys->i_width;
p_dec->fmt_out.video.i_height = p_dec->p_sys->i_height;
p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR * p_dec->p_sys->i_width / p_dec->p_sys->i_height;
p_dec->fmt_out.video.i_sar_num = 1;
p_dec->fmt_out.video.i_sar_den = 1;
p_dec->fmt_out.i_cat = VIDEO_ES;
p_sys->i_pitch = pitch;
......
......@@ -1332,7 +1332,6 @@ static subpicture_t *SetupSimpleKateSPU( decoder_t *p_dec, subpicture_t *p_spu,
/* create a separate region for the bitmap */
memset( &fmt, 0, sizeof(video_format_t) );
fmt.i_chroma = VLC_CODEC_YUVP;
fmt.i_aspect = 0;
fmt.i_width = fmt.i_visible_width = ev->bitmap->width;
fmt.i_height = fmt.i_visible_height = ev->bitmap->height;
fmt.i_x_offset = fmt.i_y_offset = 0;
......@@ -1355,7 +1354,8 @@ static subpicture_t *SetupSimpleKateSPU( decoder_t *p_dec, subpicture_t *p_spu,
/* text region */
fmt.i_chroma = VLC_CODEC_TEXT;
fmt.i_aspect = 0;
fmt.i_sar_num = 0;
fmt.i_sar_den = 1;
fmt.i_width = fmt.i_height = 0;
fmt.i_x_offset = fmt.i_y_offset = 0;
p_spu->p_region = subpicture_region_New( &fmt );
......
......@@ -83,7 +83,6 @@ struct decoder_sys_t
* Output properties
*/
decoder_synchro_t *p_synchro;
int i_aspect;
int i_sar_num;
int i_sar_den;
mtime_t i_last_frame_pts;
......@@ -173,7 +172,8 @@ static int OpenDecoder( vlc_object_t *p_this )
p_sys->i_previous_pts = 0;
p_sys->i_current_dts = 0;
p_sys->i_previous_dts = 0;
p_sys->i_aspect = 0;
p_sys->i_sar_num = 0;
p_sys->i_sar_den = 0;
p_sys->b_garbage_pic = false;
p_sys->b_slice_i = false;
p_sys->b_second_field = false;
......@@ -281,7 +281,8 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
mpeg2_custom_fbuf( p_sys->p_mpeg2dec, 1 );
/* Set the first 2 reference frames */
p_sys->i_aspect = 0;
p_sys->i_sar_num = 0;
p_sys->i_sar_den = 0;
GetAR( p_dec );
for( int i = 0; i < 2; i++ )
{
......@@ -651,7 +652,6 @@ static picture_t *GetNewPicture( decoder_t *p_dec )
p_dec->fmt_out.video.i_height = p_sys->p_info->sequence->height;
p_dec->fmt_out.video.i_visible_height =
p_sys->p_info->sequence->picture_height;
p_dec->fmt_out.video.i_aspect = p_sys->i_aspect;
p_dec->fmt_out.video.i_sar_num = p_sys->i_sar_num;
p_dec->fmt_out.video.i_sar_den = p_sys->i_sar_den;
......@@ -719,24 +719,21 @@ static block_t *GetCc( decoder_t *p_dec, bool pb_present[4] )
static void GetAR( decoder_t *p_dec )
{
decoder_sys_t *p_sys = p_dec->p_sys;
int i_old_aspect = p_sys->i_aspect;
int i_old_sar_num = p_sys->i_sar_num;
int i_old_sar_den = p_sys->i_sar_den;
/* Check whether the input gave a particular aspect ratio */
if( p_dec->fmt_in.video.i_aspect )
if( p_dec->fmt_in.video.i_sar_num > 0 &&
p_dec->fmt_in.video.i_sar_den > 0 )
{
p_sys->i_aspect = p_dec->fmt_in.video.i_aspect;
p_sys->i_sar_num = p_dec->fmt_in.video.i_sar_num;
p_sys->i_sar_den = p_dec->fmt_in.video.i_sar_den;
}
else
{
/* Use the value provided in the MPEG sequence header */
if( p_sys->p_info->sequence->pixel_height > 0 )
{
p_sys->i_aspect =
((uint64_t)p_sys->p_info->sequence->display_width) *
p_sys->p_info->sequence->pixel_width *
VOUT_ASPECT_FACTOR /
p_sys->p_info->sequence->display_height /
p_sys->p_info->sequence->pixel_height;
p_sys->i_sar_num = p_sys->p_info->sequence->pixel_width;
p_sys->i_sar_den = p_sys->p_info->sequence->pixel_height;
}
......@@ -745,23 +742,23 @@ static void GetAR( decoder_t *p_dec )
/* Invalid aspect, assume 4:3.
* This shouldn't happen and if it does it is a bug
* in libmpeg2 (likely triggered by an invalid stream) */
p_sys->i_aspect = VOUT_ASPECT_FACTOR * 4 / 3;
p_sys->i_sar_num = p_sys->p_info->sequence->picture_height * 4;
p_sys->i_sar_den = p_sys->p_info->sequence->picture_width * 3;
}
}
if( p_sys->i_aspect == i_old_aspect )
if( p_sys->i_sar_num == i_old_sar_num &&
p_sys->i_sar_den == i_old_sar_den )
return;
if( p_sys->p_info->sequence->frame_period > 0 )
msg_Dbg( p_dec,
"%dx%d (display %d,%d), aspect %d, sar %i:%i, %u.%03u fps",
"%dx%d (display %d,%d), sar %i:%i, %u.%03u fps",
p_sys->p_info->sequence->picture_width,
p_sys->p_info->sequence->picture_height,
p_sys->p_info->sequence->display_width,
p_sys->p_info->sequence->display_height,
p_sys->i_aspect, p_sys->i_sar_num, p_sys->i_sar_den,
p_sys->i_sar_num, p_sys->i_sar_den,
(uint32_t)((uint64_t)1001000000 * 27 /
p_sys->p_info->sequence->frame_period / 1001),
(uint32_t)((uint64_t)1001000000 * 27 /
......
......@@ -184,7 +184,8 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_dec->fmt_out.i_codec = VLC_CODEC_RGBA;
p_dec->fmt_out.video.i_width = i_width;
p_dec->fmt_out.video.i_height = i_height;
p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR * i_width / i_height;
p_dec->fmt_out.video.i_sar_num = 1;
p_dec->fmt_out.video.i_sar_den = 1;
p_dec->fmt_out.video.i_rmask = 0x000000ff;
p_dec->fmt_out.video.i_gmask = 0x0000ff00;
p_dec->fmt_out.video.i_bmask = 0x00ff0000;
......
......@@ -844,7 +844,8 @@ static int OpenVideo( decoder_t *p_dec )
es_format_Init( &p_dec->fmt_out, VIDEO_ES, VLC_CODEC_YUYV);
p_dec->fmt_out.video.i_width = p_dec->fmt_in.video.i_width;
p_dec->fmt_out.video.i_height= p_dec->fmt_in.video.i_height;
p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR * p_dec->fmt_in.video.i_width / p_dec->fmt_in.video.i_height;
p_dec->fmt_out.video.i_sar_num = 1;
p_dec->fmt_out.video.i_sar_den = 1;
vlc_mutex_unlock( &qt_mutex );
return VLC_SUCCESS;
......
......@@ -159,15 +159,15 @@ 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_height,
VOUT_ASPECT_FACTOR * p_dec->fmt_in.video.i_width );
p_dec->fmt_in.video.i_sar_num,
p_dec->fmt_in.video.i_sar_den );
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;
if( !p_dec->fmt_in.video.i_aspect )
if( !p_dec->fmt_in.video.i_sar_num || !p_dec->fmt_in.video.i_sar_den )
{
p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR *
p_dec->fmt_out.video.i_width / p_dec->fmt_out.video.i_height;
p_dec->fmt_out.video.i_sar_num = 1;
p_dec->fmt_out.video.i_sar_den = 1;
}
/* Set callbacks */
......
......@@ -355,7 +355,8 @@ static int InitVideo(decoder_t *p_dec)
p_dec->fmt_out.video.i_width = p_dec->fmt_in.video.i_width;
p_dec->fmt_out.video.i_height= p_dec->fmt_in.video.i_height;
p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR * p_dec->fmt_in.video.i_width / p_dec->fmt_in.video.i_height;
p_dec->fmt_out.video.i_sar_num = 1;
p_dec->fmt_out.video.i_sar_den = 1;
p_sys->inited = 0;
vlc_mutex_unlock( &rm_mutex );
......@@ -527,7 +528,8 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
p_dec->fmt_out.video.i_visible_height =
p_dec->fmt_in.video.i_height= transform_out[4];
p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR * p_dec->fmt_in.video.i_width / p_dec->fmt_in.video.i_height;
p_dec->fmt_out.video.i_sar_num = 1;
p_dec->fmt_out.video.i_sar_den = 1;
}
else
{
......
......@@ -130,7 +130,6 @@ static int OpenDecoder( vlc_object_t *p_this )
static void SetVideoFormat( decoder_t *p_dec )
{
decoder_sys_t *p_sys = p_dec->p_sys;
double f_aspect;
p_sys->p_format = schro_decoder_get_video_format(p_sys->p_schro);
if( p_sys->p_format == NULL ) return;
......@@ -158,11 +157,8 @@ static void SetVideoFormat( decoder_t *p_dec )
p_dec->fmt_out.video.i_height = p_sys->p_format->height;
/* aspect_ratio_[numerator|denominator] describes the pixel aspect ratio */
f_aspect = (double)
( p_sys->p_format->aspect_ratio_numerator * p_sys->p_format->width ) /
( p_sys->p_format->aspect_ratio_denominator * p_sys->p_format->height);
p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR * f_aspect;
p_dec->fmt_out.video.i_sar_num = p_sys->p_format->aspect_ratio_numerator;
p_dec->fmt_out.video.i_sar_den = p_sys->p_format->aspect_ratio_denominator;
p_dec->fmt_out.video.i_frame_rate =
p_sys->p_format->frame_rate_numerator;
......
......@@ -173,8 +173,8 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
}
p_dec->fmt_out.video.i_width = p_surface->w;
p_dec->fmt_out.video.i_height = p_surface->h;
p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR * p_surface->w
/ p_surface->h;
p_dec->fmt_out.video.i_sar_num = 1;
p_dec->fmt_out.video.i_sar_den = 1;
/* Get a new picture. */
p_pic = decoder_NewPicture( p_dec );
......
......@@ -688,7 +688,8 @@ static void Render( decoder_t *p_dec, subpicture_t *p_spu,
/* Create a new subpicture region */
memset( &fmt, 0, sizeof(video_format_t) );
fmt.i_chroma = VLC_CODEC_YUVP;
fmt.i_aspect = 0; /* 0 means use aspect ratio of background video */
fmt.i_sar_num = 0; /* 0 means use aspect ratio of background video */
fmt.i_sar_den = 1;
fmt.i_width = fmt.i_visible_width = p_spu_properties->i_width;
fmt.i_height = fmt.i_visible_height = p_spu_properties->i_height -
p_spu_data->i_y_top_offset - p_spu_data->i_y_bottom_offset;
......
......@@ -493,7 +493,6 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
/* Create a new subpicture region */
memset( &fmt, 0, sizeof(video_format_t) );
fmt.i_chroma = VLC_CODEC_TEXT;
fmt.i_aspect = 0;
fmt.i_width = fmt.i_height = 0;
fmt.i_x_offset = fmt.i_y_offset = 0;
p_spu->p_region = subpicture_region_New( &fmt );
......
......@@ -383,7 +383,6 @@ static subpicture_region_t *CreateTextRegion( decoder_t *p_dec,
/* Create a new subpicture region */
memset( &fmt, 0, sizeof(video_format_t) );
fmt.i_chroma = VLC_CODEC_TEXT;
fmt.i_aspect = 0;
fmt.i_width = fmt.i_height = 0;
fmt.i_x_offset = fmt.i_y_offset = 0;
p_text_region = subpicture_region_New( &fmt );
......@@ -1163,7 +1162,6 @@ static subpicture_region_t *LoadEmbeddedImage( decoder_t *p_dec,
memset( &fmt_out, 0, sizeof( video_format_t));
fmt_out.i_chroma = VLC_CODEC_YUVA;
fmt_out.i_aspect = VOUT_ASPECT_FACTOR;
fmt_out.i_sar_num = fmt_out.i_sar_den = 1