Commit 41d4b8bd authored by Laurent Aimar's avatar Laurent Aimar

Fixed and simplify --monitor-par support.

parent b5b258f7
...@@ -118,8 +118,6 @@ static vout_thread_t *VoutCreate(vlc_object_t *object, ...@@ -118,8 +118,6 @@ static vout_thread_t *VoutCreate(vlc_object_t *object,
vout_control_PushVoid(&vout->p->control, VOUT_CONTROL_INIT); vout_control_PushVoid(&vout->p->control, VOUT_CONTROL_INIT);
vout_statistic_Init(&vout->p->statistic); vout_statistic_Init(&vout->p->statistic);
vout->p->i_par_num =
vout->p->i_par_den = 1;
vout_snapshot_Init(&vout->p->snapshot); vout_snapshot_Init(&vout->p->snapshot);
...@@ -526,8 +524,14 @@ static void VoutGetDisplayCfg(vout_thread_t *vout, vout_display_cfg_t *cfg, cons ...@@ -526,8 +524,14 @@ static void VoutGetDisplayCfg(vout_thread_t *vout, vout_display_cfg_t *cfg, cons
cfg->display.width = display_width > 0 ? display_width : 0; cfg->display.width = display_width > 0 ? display_width : 0;
cfg->display.height = display_height > 0 ? display_height : 0; cfg->display.height = display_height > 0 ? display_height : 0;
cfg->is_display_filled = var_CreateGetBool(vout, "autoscale"); cfg->is_display_filled = var_CreateGetBool(vout, "autoscale");
cfg->display.sar.num = 1; /* TODO monitor AR */ unsigned msar_num, msar_den;
cfg->display.sar.den = 1; if (var_InheritURational(vout, &msar_num, &msar_den, "monitor-par") ||
msar_num <= 0 || msar_den <= 0) {
msar_num = 1;
msar_den = 1;
}
cfg->display.sar.num = msar_num;
cfg->display.sar.den = msar_den;
unsigned zoom_den = 1000; unsigned zoom_den = 1000;
unsigned zoom_num = zoom_den * var_CreateGetFloat(vout, "scale"); unsigned zoom_num = zoom_den * var_CreateGetFloat(vout, "scale");
vlc_ureduce(&zoom_num, &zoom_den, zoom_num, zoom_den, 0); vlc_ureduce(&zoom_num, &zoom_den, zoom_num, zoom_den, 0);
......
...@@ -71,10 +71,6 @@ struct vout_thread_sys_t ...@@ -71,10 +71,6 @@ struct vout_thread_sys_t
vlc_mutex_t spu_lock; vlc_mutex_t spu_lock;
spu_t *p_spu; spu_t *p_spu;
/* Monitor Pixel Aspect Ratio */
unsigned int i_par_num;
unsigned int i_par_den;
/* Video output window */ /* Video output window */
struct { struct {
bool is_unused; bool is_unused;
......
...@@ -153,7 +153,6 @@ static void AddCustomRatios( vout_thread_t *p_vout, const char *psz_var, ...@@ -153,7 +153,6 @@ static void AddCustomRatios( vout_thread_t *p_vout, const char *psz_var,
void vout_IntfInit( vout_thread_t *p_vout ) void vout_IntfInit( vout_thread_t *p_vout )
{ {
vlc_value_t val, text, old_val; vlc_value_t val, text, old_val;
bool b_force_par = false;
char *psz_buf; char *psz_buf;
int i; int i;
...@@ -250,35 +249,6 @@ void vout_IntfInit( vout_thread_t *p_vout ) ...@@ -250,35 +249,6 @@ void vout_IntfInit( vout_thread_t *p_vout )
/* Monitor pixel aspect-ratio */ /* Monitor pixel aspect-ratio */
var_Create( p_vout, "monitor-par", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); var_Create( p_vout, "monitor-par", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Get( p_vout, "monitor-par", &val ); var_Get( p_vout, "monitor-par", &val );
if( val.psz_string && *val.psz_string )
{
char *psz_parser = strchr( val.psz_string, ':' );
unsigned int i_aspect_num = 0, i_aspect_den = 0;
float i_aspect = 0;
if( psz_parser )
{
i_aspect_num = strtol( val.psz_string, 0, 10 );
i_aspect_den = strtol( ++psz_parser, 0, 10 );
}
else
{
i_aspect = us_atof( val.psz_string );
vlc_ureduce( &i_aspect_num, &i_aspect_den,
i_aspect *VOUT_ASPECT_FACTOR, VOUT_ASPECT_FACTOR, 0 );
}
if( !i_aspect_num || !i_aspect_den ) i_aspect_num = i_aspect_den = 1;
p_vout->p->i_par_num = i_aspect_num;
p_vout->p->i_par_den = i_aspect_den;
vlc_ureduce( &p_vout->p->i_par_num, &p_vout->p->i_par_den,
p_vout->p->i_par_num, p_vout->p->i_par_den, 0 );
msg_Dbg( p_vout, "overriding monitor pixel aspect-ratio: %i:%i",
p_vout->p->i_par_num, p_vout->p->i_par_den );
b_force_par = true;
}
free( val.psz_string );
/* Aspect-ratio object var */ /* Aspect-ratio object var */
var_Create( p_vout, "aspect-ratio", VLC_VAR_STRING | VLC_VAR_ISCOMMAND | var_Create( p_vout, "aspect-ratio", VLC_VAR_STRING | VLC_VAR_ISCOMMAND |
...@@ -307,7 +277,7 @@ void vout_IntfInit( vout_thread_t *p_vout ) ...@@ -307,7 +277,7 @@ void vout_IntfInit( vout_thread_t *p_vout )
var_AddCallback( p_vout, "aspect-ratio", AspectCallback, NULL ); var_AddCallback( p_vout, "aspect-ratio", AspectCallback, NULL );
var_Get( p_vout, "aspect-ratio", &old_val ); var_Get( p_vout, "aspect-ratio", &old_val );
if( (old_val.psz_string && *old_val.psz_string) || b_force_par ) if( (old_val.psz_string && *old_val.psz_string) )
var_TriggerCallback( p_vout, "aspect-ratio" ); var_TriggerCallback( p_vout, "aspect-ratio" );
free( old_val.psz_string ); free( old_val.psz_string );
......
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