[vlc-commits] DBus: fix scale on setting volume

Rémi Denis-Courmont git at videolan.org
Tue Jul 26 17:41:54 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Jul 26 18:35:08 2011 +0300| [2ac4e79ae64f16c9bb6a05335894169d7620a44a] | committer: Rémi Denis-Courmont

DBus: fix scale on setting volume

1.0 is nominal, not maximum. This is consistent with both VLC and the
MPRIS 2.1 specification. Also, the setter ought to have the same scale
as the getter!

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2ac4e79ae64f16c9bb6a05335894169d7620a44a
---

 modules/control/dbus/dbus_player.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/modules/control/dbus/dbus_player.c b/modules/control/dbus/dbus_player.c
index 362fd49..36571f5 100644
--- a/modules/control/dbus/dbus_player.c
+++ b/modules/control/dbus/dbus_player.c
@@ -201,14 +201,12 @@ DBUS_METHOD( VolumeSet )
     if( VLC_SUCCESS != DemarshalSetPropertyValue( p_from, &d_dbus_vol ) )
         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 
-    if( d_dbus_vol > 1. )
-        d_dbus_vol = 1.;
-    else if( d_dbus_vol < 0. )
+    d_dbus_vol *= AOUT_VOLUME_DEFAULT;
+    if( d_dbus_vol < 0. )
         d_dbus_vol = 0.;
-
-    double d_vol = d_dbus_vol * AOUT_VOLUME_MAX;
-    audio_volume_t i_vol = round( d_vol );
-    aout_VolumeSet( PL, i_vol );
+    if( d_dbus_vol > AOUT_VOLUME_MAX )
+        d_dbus_vol = AOUT_VOLUME_MAX;
+    aout_VolumeSet( PL, lround(d_dbus_vol) );
 
     REPLY_SEND;
 }



More information about the vlc-commits mailing list