[vlc-commits] commit: Fixed and simplify --monitor-par support. (Laurent Aimar )
git at videolan.org
git at videolan.org
Mon Oct 25 20:41:53 CEST 2010
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Fri Oct 22 20:39:03 2010 +0200| [41d4b8bd7df6a2a2814e29e84efb10bebda6faf2] | committer: Laurent Aimar
Fixed and simplify --monitor-par support.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=41d4b8bd7df6a2a2814e29e84efb10bebda6faf2
---
src/video_output/video_output.c | 12 ++++++++----
src/video_output/vout_internal.h | 4 ----
src/video_output/vout_intf.c | 32 +-------------------------------
3 files changed, 9 insertions(+), 39 deletions(-)
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 0215883..31bd7cb 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -118,8 +118,6 @@ static vout_thread_t *VoutCreate(vlc_object_t *object,
vout_control_PushVoid(&vout->p->control, VOUT_CONTROL_INIT);
vout_statistic_Init(&vout->p->statistic);
- vout->p->i_par_num =
- vout->p->i_par_den = 1;
vout_snapshot_Init(&vout->p->snapshot);
@@ -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.height = display_height > 0 ? display_height : 0;
cfg->is_display_filled = var_CreateGetBool(vout, "autoscale");
- cfg->display.sar.num = 1; /* TODO monitor AR */
- cfg->display.sar.den = 1;
+ unsigned msar_num, msar_den;
+ 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_num = zoom_den * var_CreateGetFloat(vout, "scale");
vlc_ureduce(&zoom_num, &zoom_den, zoom_num, zoom_den, 0);
diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h
index c5d9903..0e287df 100644
--- a/src/video_output/vout_internal.h
+++ b/src/video_output/vout_internal.h
@@ -71,10 +71,6 @@ struct vout_thread_sys_t
vlc_mutex_t spu_lock;
spu_t *p_spu;
- /* Monitor Pixel Aspect Ratio */
- unsigned int i_par_num;
- unsigned int i_par_den;
-
/* Video output window */
struct {
bool is_unused;
diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index f3c78c2..bdcdd92 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -153,7 +153,6 @@ static void AddCustomRatios( vout_thread_t *p_vout, const char *psz_var,
void vout_IntfInit( vout_thread_t *p_vout )
{
vlc_value_t val, text, old_val;
- bool b_force_par = false;
char *psz_buf;
int i;
@@ -250,35 +249,6 @@ void vout_IntfInit( vout_thread_t *p_vout )
/* Monitor pixel aspect-ratio */
var_Create( p_vout, "monitor-par", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
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 */
var_Create( p_vout, "aspect-ratio", VLC_VAR_STRING | VLC_VAR_ISCOMMAND |
@@ -307,7 +277,7 @@ void vout_IntfInit( vout_thread_t *p_vout )
var_AddCallback( p_vout, "aspect-ratio", AspectCallback, NULL );
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" );
free( old_val.psz_string );
More information about the vlc-commits
mailing list