[vlc-commits] Replace AOUT_VOLUME_MIN with 0

Rémi Denis-Courmont git at videolan.org
Mon Jul 25 20:17:22 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Jul 25 21:11:49 2011 +0300| [178600d9c057cf15a1982f65daa9c91fb9f0763d] | committer: Rémi Denis-Courmont

Replace AOUT_VOLUME_MIN with 0

This assumption is correct and already present in plenty of code paths
(e.g. when converting to/from float).

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

 include/vlc_aout_intf.h   |    1 -
 modules/control/rc.c      |    5 ++---
 modules/lua/libs/volume.c |    3 +--
 src/audio_output/intf.c   |    8 ++++----
 src/libvlc-module.c       |    4 ++--
 5 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/include/vlc_aout_intf.h b/include/vlc_aout_intf.h
index 2e61293..7043ce5 100644
--- a/include/vlc_aout_intf.h
+++ b/include/vlc_aout_intf.h
@@ -29,7 +29,6 @@
 #define AOUT_VOLUME_DEFAULT             256
 #define AOUT_VOLUME_STEP                32
 #define AOUT_VOLUME_MAX                 1024
-#define AOUT_VOLUME_MIN                 0
 
 VLC_API audio_volume_t aout_VolumeGet( vlc_object_t * );
 #define aout_VolumeGet(a) aout_VolumeGet(VLC_OBJECT(a))
diff --git a/modules/control/rc.c b/modules/control/rc.c
index a2a44d8..3a61cbe 100644
--- a/modules/control/rc.c
+++ b/modules/control/rc.c
@@ -1498,13 +1498,12 @@ static int Volume( vlc_object_t *p_this, char const *psz_cmd,
         audio_volume_t i_volume = atoi( newval.psz_string );
         if ( (i_volume > (audio_volume_t)AOUT_VOLUME_MAX) )
         {
-            msg_rc( "Volume must be in the range %d-%d.", AOUT_VOLUME_MIN,
-                    AOUT_VOLUME_MAX );
+            msg_rc( "Volume must be in the range 0-%d.", AOUT_VOLUME_MAX );
             i_error = VLC_EBADVAR;
         }
         else
         {
-            if( i_volume == AOUT_VOLUME_MIN )
+            if( i_volume == 0 )
                 aout_ToggleMute( p_playlist, NULL );
             if( !aout_VolumeSet( p_playlist, i_volume ) )
                 i_error = VLC_SUCCESS;
diff --git a/modules/lua/libs/volume.c b/modules/lua/libs/volume.c
index ee40919..1f21ed0 100644
--- a/modules/lua/libs/volume.c
+++ b/modules/lua/libs/volume.c
@@ -52,8 +52,7 @@
 static int vlclua_volume_set( lua_State *L )
 {
     playlist_t *p_this = vlclua_get_playlist_internal( L );
-    int i_volume = __MAX(__MIN(luaL_checkint( L, 1 ), AOUT_VOLUME_MAX),
-                         AOUT_VOLUME_MIN);
+    int i_volume = __MAX(__MIN(luaL_checkint( L, 1 ), AOUT_VOLUME_MAX), 0);
     int i_ret = aout_VolumeSet( p_this, i_volume );
     return vlclua_push_ret( L, i_ret );
 }
diff --git a/src/audio_output/intf.c b/src/audio_output/intf.c
index 73cf2f2..56a5e5f 100644
--- a/src/audio_output/intf.c
+++ b/src/audio_output/intf.c
@@ -164,8 +164,8 @@ int aout_VolumeUp (vlc_object_t *obj, int value, audio_volume_t *volp)
 
     prepareVolume (obj, &aout, &volume, &mute);
     value += volume;
-    if (value < AOUT_VOLUME_MIN)
-        volume = AOUT_VOLUME_MIN;
+    if (value < 0)
+        volume = 0;
     else
     if (value > AOUT_VOLUME_MAX)
         volume = AOUT_VOLUME_MAX;
@@ -201,7 +201,7 @@ int aout_ToggleMute (vlc_object_t *obj, audio_volume_t *volp)
     mute = !mute;
     ret = commitVolume (obj, aout, volume, mute);
     if (volp != NULL)
-        *volp = mute ? AOUT_VOLUME_MIN : volume;
+        *volp = mute ? 0 : volume;
     return ret;
 }
 
@@ -234,7 +234,7 @@ int aout_SetMute (vlc_object_t *obj, audio_volume_t *volp, bool mute)
     prepareVolume (obj, &aout, &volume, NULL);
     ret = commitVolume (obj, aout, volume, mute);
     if (volp != NULL)
-        *volp = mute ? AOUT_VOLUME_MIN : volume;
+        *volp = mute ? 0 : volume;
     return ret;
 }
 
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index 8c84ec0..2069b11 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -1591,10 +1591,10 @@ vlc_module_begin ()
 
     add_bool( "audio", 1, AUDIO_TEXT, AUDIO_LONGTEXT, false )
         change_safe ()
-    add_integer_with_range( "volume", AOUT_VOLUME_DEFAULT, AOUT_VOLUME_MIN,
+    add_integer_with_range( "volume", AOUT_VOLUME_DEFAULT, 0,
                             AOUT_VOLUME_MAX, VOLUME_TEXT,
                             VOLUME_LONGTEXT, false )
-    add_integer_with_range( "volume-step", AOUT_VOLUME_STEP, AOUT_VOLUME_MIN,
+    add_integer_with_range( "volume-step", AOUT_VOLUME_STEP, 0,
                             AOUT_VOLUME_MAX, VOLUME_STEP_TEXT,
                             VOLUME_STEP_LONGTEXT, true )
     add_integer( "aout-rate", 0, AOUT_RATE_TEXT,



More information about the vlc-commits mailing list