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 ...@@ -105,7 +105,6 @@ struct audio_format_t
struct video_format_t struct video_format_t
{ {
vlc_fourcc_t i_chroma; /**< picture chroma */ vlc_fourcc_t i_chroma; /**< picture chroma */
unsigned int i_aspect; /**< aspect ratio */
unsigned int i_width; /**< picture width */ unsigned int i_width; /**< picture width */
unsigned int i_height; /**< picture height */ unsigned int i_height; /**< picture height */
......
...@@ -647,7 +647,8 @@ static int DemuxOpen( vlc_object_t *p_this ) ...@@ -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_width = p_stream->header.video.bmiHeader.biWidth;
fmt.video.i_height = p_stream->header.video.bmiHeader.biHeight; 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 ) if( !p_stream->header.video.bmiHeader.biCompression )
{ {
......
...@@ -139,8 +139,6 @@ struct demux_sys_t ...@@ -139,8 +139,6 @@ struct demux_sys_t
bool b_spu_change; bool b_spu_change;
/* */ /* */
int i_aspect;
int i_title; int i_title;
input_title_t **title; input_title_t **title;
...@@ -228,7 +226,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -228,7 +226,6 @@ static int Open( vlc_object_t *p_this )
p_sys->b_reset_pcr = false; p_sys->b_reset_pcr = false;
ps_track_init( p_sys->tk ); ps_track_init( p_sys->tk );
p_sys->i_aspect = -1;
p_sys->i_mux_rate = 0; p_sys->i_mux_rate = 0;
p_sys->i_pgc_length = 0; p_sys->i_pgc_length = 0;
p_sys->b_spu_change = false; p_sys->b_spu_change = false;
...@@ -728,10 +725,6 @@ static int Demux( demux_t *p_demux ) ...@@ -728,10 +725,6 @@ static int Demux( demux_t *p_demux )
msg_Dbg( p_demux, " - vtsN=%d", event->new_vtsN ); msg_Dbg( p_demux, " - vtsN=%d", event->new_vtsN );
msg_Dbg( p_demux, " - domain=%d", event->new_domain ); 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 */ /* reset PCR */
es_out_Control( p_demux->out, ES_OUT_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 ) ...@@ -1183,16 +1176,6 @@ static void ESNew( demux_t *p_demux, int i_id )
/* Add a new ES */ /* Add a new ES */
if( tk->fmt.i_cat == VIDEO_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; b_select = true;
} }
else if( tk->fmt.i_cat == AUDIO_ES ) else if( tk->fmt.i_cat == AUDIO_ES )
......
...@@ -172,7 +172,8 @@ struct demux_sys_t ...@@ -172,7 +172,8 @@ struct demux_sys_t
input_title_t **titles; input_title_t **titles;
/* Video */ /* Video */
int i_aspect; int i_sar_num;
int i_sar_den;
/* SPU */ /* SPU */
uint32_t clut[16]; uint32_t clut[16];
...@@ -266,7 +267,8 @@ static int Open( vlc_object_t *p_this ) ...@@ -266,7 +267,8 @@ static int Open( vlc_object_t *p_this )
DEMUX_INIT_COMMON(); p_sys = p_demux->p_sys; DEMUX_INIT_COMMON(); p_sys = p_demux->p_sys;
ps_track_init( p_sys->tk ); 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_title_cur_time = (mtime_t) 0;
p_sys->i_cell_cur_time = (mtime_t) 0; p_sys->i_cell_cur_time = (mtime_t) 0;
p_sys->i_cell_duration = (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 ) ...@@ -713,16 +715,8 @@ static void ESNew( demux_t *p_demux, int i_id, int i_lang )
/* Add a new ES */ /* Add a new ES */
if( tk->fmt.i_cat == VIDEO_ES ) if( tk->fmt.i_cat == VIDEO_ES )
{ {
switch( p_sys->i_aspect ) tk->fmt.video.i_sar_num = p_sys->i_sar_num;
{ tk->fmt.video.i_sar_den = p_sys->i_sar_den;
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;
}
} }
else if( tk->fmt.i_cat == AUDIO_ES ) 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, ...@@ -906,7 +900,41 @@ static int DvdReadSetArea( demux_t *p_demux, int i_title, int i_chapter,
ESNew( p_demux, 0xe0, 0 ); /* Video, FIXME ? */ 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 \ #define audio_control \
p_sys->p_vts_file->vts_pgcit->pgci_srp[pgc_id-1].pgc->audio_control[i-1] 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) ...@@ -254,7 +254,6 @@ static int Open(vlc_object_t *object)
fmt.video.i_height = var_CreateGetInteger(demux, "imem-height"); fmt.video.i_height = var_CreateGetInteger(demux, "imem-height");
unsigned num, den; unsigned num, den;
if (!var_CreateGetRational(demux, &num, &den, "imem-dar") && num > 0 && den > 0) { 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) { 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_num = num * fmt.video.i_height;
fmt.video.i_sar_den = den * fmt.video.i_width; fmt.video.i_sar_den = den * fmt.video.i_width;
......
...@@ -195,7 +195,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -195,7 +195,6 @@ static int Open( vlc_object_t *p_this )
int i; int i;
int i_width; int i_width;
int i_height; int i_height;
int i_aspect;
int result = 0; int result = 0;
/* Only when selected */ /* Only when selected */
...@@ -285,7 +284,8 @@ static int Open( vlc_object_t *p_this ) ...@@ -285,7 +284,8 @@ static int Open( vlc_object_t *p_this )
fmt.video.i_height = p_sys->height = encoded_size.height; fmt.video.i_height = p_sys->height = encoded_size.height;
if( par_size.width != encoded_size.width ) 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 ); 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, ...@@ -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_chroma,
p_sys->fmt.video.i_width, p_sys->fmt.video.i_width,
p_sys->fmt.video.i_height, p_sys->fmt.video.i_height,
p_sys->fmt.video.i_aspect * p_sys->fmt.video.i_height, p_sys->fmt.video.i_sar_num,
VOUT_ASPECT_FACTOR * p_sys->fmt.video.i_width ); p_sys->fmt.video.i_sar_den );
if( !p_sys->p_blend ) if( !p_sys->p_blend )
{ {
p_sys->p_blend = vlc_object_create( p_demux, sizeof(filter_t) ); p_sys->p_blend = vlc_object_create( p_demux, sizeof(filter_t) );
......
...@@ -360,7 +360,8 @@ static int Open( vlc_object_t *p_this ) ...@@ -360,7 +360,8 @@ static int Open( vlc_object_t *p_this )
es_format_Init( &fmt, VIDEO_ES, p_sys->i_fourcc ); es_format_Init( &fmt, VIDEO_ES, p_sys->i_fourcc );
fmt.video.i_width = p_sys->i_width; fmt.video.i_width = p_sys->i_width;
fmt.video.i_height = p_sys->i_height; 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 */ /* Setup rgb mask for RGB formats */
switch( p_sys->i_fourcc ) 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 ) ...@@ -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; es_fmt.video.i_height = p_sys->i_height;
/* Get aspect-ratio */ /* 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; demux_t *p_demux = (demux_t *) p_obj;
msg_Dbg( p_demux, "added new video es %4.4s %dx%d", msg_Dbg( p_demux, "added new video es %4.4s %dx%d",
......
...@@ -386,8 +386,6 @@ int OpenEncoder( vlc_object_t *p_this ) ...@@ -386,8 +386,6 @@ int OpenEncoder( vlc_object_t *p_this )
if( p_enc->fmt_in.i_cat == VIDEO_ES ) 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 ) 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, 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 ) ...@@ -430,13 +428,10 @@ int OpenEncoder( vlc_object_t *p_this )
p_enc->fmt_out.i_codec == VLC_CODEC_MP1V ) ) p_enc->fmt_out.i_codec == VLC_CODEC_MP1V ) )
p_context->flags |= CODEC_FLAG_LOW_DELAY; 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, av_reduce( &p_context->sample_aspect_ratio.num,
&p_context->sample_aspect_ratio.den, &p_context->sample_aspect_ratio.den,
i_aspect_num * (int64_t)p_context->height, p_enc->fmt_in.video.i_sar_num,
i_aspect_den * (int64_t)p_context->width, 1 << 30 ); p_enc->fmt_in.video.i_sar_den, 1 << 30 );
p_sys->i_buffer_out = p_context->height * p_context->width * 3; p_sys->i_buffer_out = p_context->height * p_context->width * 3;
if( p_sys->i_buffer_out < FF_MIN_BUFFER_SIZE ) if( p_sys->i_buffer_out < FF_MIN_BUFFER_SIZE )
......
...@@ -189,7 +189,6 @@ static subpicture_region_t *ConvertRegionRGBA(AVSubtitleRect *ffregion) ...@@ -189,7 +189,6 @@ static subpicture_region_t *ConvertRegionRGBA(AVSubtitleRect *ffregion)
video_format_t fmt; video_format_t fmt;
memset(&fmt, 0, sizeof(fmt)); memset(&fmt, 0, sizeof(fmt));
fmt.i_chroma = VLC_FOURCC('R','G','B','A'); fmt.i_chroma = VLC_FOURCC('R','G','B','A');
fmt.i_aspect = 0;
fmt.i_width = fmt.i_width =
fmt.i_visible_width = ffregion->w; fmt.i_visible_width = ffregion->w;
fmt.i_height = fmt.i_height =
......
...@@ -150,22 +150,20 @@ static inline picture_t *ffmpeg_NewPictBuf( decoder_t *p_dec, ...@@ -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; 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 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 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_num = p_context->sample_aspect_ratio.num;
p_dec->fmt_out.video.i_sar_den = p_context->sample_aspect_ratio.den; 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 = p_dec->fmt_out.video.i_sar_num = 1;
VOUT_ASPECT_FACTOR * p_context->width / p_context->height; p_dec->fmt_out.video.i_sar_den = 1;
} }
} }
...@@ -644,22 +642,18 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block ) ...@@ -644,22 +642,18 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
p_sys->b_has_b_frames = true; 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 */ /* 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_dec->fmt_out.video.i_sar_num
= p_sys->p_context->sample_aspect_ratio.num; = p_sys->p_context->sample_aspect_ratio.num;
p_dec->fmt_out.video.i_sar_den p_dec->fmt_out.video.i_sar_den
= p_sys->p_context->sample_aspect_ratio.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_dec->fmt_out.video.i_sar_num = 1;
* p_sys->p_context->width / p_sys->p_context->height; 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 ...@@ -340,7 +340,6 @@ static subpicture_t *Subtitle( decoder_t *p_dec, char *psz_subtitle, char *psz_h
/* Create a new subpicture region */ /* Create a new subpicture region */
memset( &fmt, 0, sizeof(video_format_t) ); memset( &fmt, 0, sizeof(video_format_t) );
fmt.i_chroma = VLC_CODEC_TEXT; fmt.i_chroma = VLC_CODEC_TEXT;
fmt.i_aspect = 0;
fmt.i_width = fmt.i_height = 0; fmt.i_width = fmt.i_height = 0;
fmt.i_x_offset = fmt.i_y_offset = 0; fmt.i_x_offset = fmt.i_y_offset = 0;
p_spu->p_region = subpicture_region_New( &fmt ); p_spu->p_region = subpicture_region_New( &fmt );
......
...@@ -116,8 +116,8 @@ static int Open( vlc_object_t *p_this ) ...@@ -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.i_codec = VLC_CODEC_RGB32;
p_dec->fmt_out.video.i_width = CDG_DISPLAY_WIDTH; 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_height = CDG_DISPLAY_HEIGHT;
p_dec->fmt_out.video.i_aspect = p_dec->fmt_out.video.i_sar_num = 1;
VOUT_ASPECT_FACTOR * p_dec->fmt_out.video.i_width / p_dec->fmt_out.video.i_height; 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_rmask = 0xff << CDG_COLOR_R_SHIFT;
p_dec->fmt_out.video.i_gmask = 0xff << CDG_COLOR_G_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; 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 ) ...@@ -510,7 +510,8 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data )
/* Create new SPU region */ /* Create new SPU region */
memset( &fmt, 0, sizeof(video_format_t) ); memset( &fmt, 0, sizeof(video_format_t) );
fmt.i_chroma = VLC_CODEC_YUVP; 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_width = fmt.i_visible_width = p_sys->i_width;
fmt.i_height = fmt.i_visible_height = p_sys->i_height; fmt.i_height = fmt.i_visible_height = p_sys->i_height;
fmt.i_x_offset = fmt.i_y_offset = 0; fmt.i_x_offset = fmt.i_y_offset = 0;
......
...@@ -506,9 +506,8 @@ static int OpenEncoder( vlc_object_t *p_this ) ...@@ -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; p_sys->ctx.src_params.frame_rate.denominator = p_enc->fmt_in.video.i_frame_rate_base;
unsigned u_asr_num, u_asr_den; unsigned u_asr_num, u_asr_den;
vlc_ureduce( &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_sar_num,
p_enc->fmt_in.video.i_width * VOUT_ASPECT_FACTOR, p_enc->fmt_in.video.i_sar_den, 0 );
0 );
p_sys->ctx.src_params.pix_asr.numerator = u_asr_num; p_sys->ctx.src_params.pix_asr.numerator = u_asr_num;
p_sys->ctx.src_params.pix_asr.denominator = u_asr_den; p_sys->ctx.src_params.pix_asr.denominator = u_asr_den;
......
...@@ -520,14 +520,16 @@ static int DecOpen( decoder_t *p_dec ) ...@@ -520,14 +520,16 @@ static int DecOpen( decoder_t *p_dec )
p_dec->fmt_out.video.i_bits_per_pixel = i_bpp; 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 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 else
{ {
p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR * p_dec->fmt_out.video.i_sar_num = 1;
p_dec->fmt_out.video.i_width / p_dec->fmt_out.video.i_height; p_dec->fmt_out.video.i_sar_den = 1;
} }
p_bih = &p_vih->bmiHeader; p_bih = &p_vih->bmiHeader;
......
...@@ -1582,7 +1582,8 @@ static subpicture_t *render( decoder_t *p_dec ) ...@@ -1582,7 +1582,8 @@ static subpicture_t *render( decoder_t *p_dec )
/* Create new SPU region */ /* Create new SPU region */
memset( &fmt, 0, sizeof(video_format_t) ); memset( &fmt, 0, sizeof(video_format_t) );
fmt.i_chroma = VLC_CODEC_YUVP; 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_width = fmt.i_visible_width = p_region->i_width;
fmt.i_height = fmt.i_visible_height = p_region->i_height; fmt.i_height = fmt.i_visible_height = p_region->i_height;
fmt.i_x_offset = fmt.i_y_offset = 0; fmt.i_x_offset = fmt.i_y_offset = 0;
...@@ -1635,7 +1636,8 @@ static subpicture_t *render( decoder_t *p_dec ) ...@@ -1635,7 +1636,8 @@ static subpicture_t *render( decoder_t *p_dec )
/* Create new SPU region */ /* Create new SPU region */
memset( &fmt, 0, sizeof(video_format_t) ); memset( &fmt, 0, sizeof(video_format_t) );
fmt.i_chroma = VLC_CODEC_TEXT; 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_width = fmt.i_visible_width = p_region->i_width;
fmt.i_height = fmt.i_visible_height = p_region->i_height; fmt.i_height = fmt.i_visible_height = p_region->i_height;
fmt.i_x_offset = fmt.i_y_offset = 0; fmt.i_x_offset = fmt.i_y_offset = 0;
......
...@@ -269,12 +269,13 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -269,12 +269,13 @@ static int OpenDecoder( vlc_object_t *p_this )
if ( i_aspect ) 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 else
{ {
fmt_out.i_aspect = fmt_out.i_width fmt_out.i_sar_num = 1;
* VOUT_ASPECT_FACTOR / fmt_out.i_height; fmt_out.i_sar_den = 1;
} }
if( var_CreateGetBool( p_dec, "fake-deinterlace" ) ) if( var_CreateGetBool( p_dec, "fake-deinterlace" ) )
......