Commit 178600d9 authored by Rémi Denis-Courmont's avatar 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).
parent 9ea08de4
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#define AOUT_VOLUME_DEFAULT 256 #define AOUT_VOLUME_DEFAULT 256
#define AOUT_VOLUME_STEP 32 #define AOUT_VOLUME_STEP 32
#define AOUT_VOLUME_MAX 1024 #define AOUT_VOLUME_MAX 1024
#define AOUT_VOLUME_MIN 0
VLC_API audio_volume_t aout_VolumeGet( vlc_object_t * ); VLC_API audio_volume_t aout_VolumeGet( vlc_object_t * );
#define aout_VolumeGet(a) aout_VolumeGet(VLC_OBJECT(a)) #define aout_VolumeGet(a) aout_VolumeGet(VLC_OBJECT(a))
......
...@@ -1498,13 +1498,12 @@ static int Volume( vlc_object_t *p_this, char const *psz_cmd, ...@@ -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 ); audio_volume_t i_volume = atoi( newval.psz_string );
if ( (i_volume > (audio_volume_t)AOUT_VOLUME_MAX) ) if ( (i_volume > (audio_volume_t)AOUT_VOLUME_MAX) )
{ {
msg_rc( "Volume must be in the range %d-%d.", AOUT_VOLUME_MIN, msg_rc( "Volume must be in the range 0-%d.", AOUT_VOLUME_MAX );
AOUT_VOLUME_MAX );
i_error = VLC_EBADVAR; i_error = VLC_EBADVAR;
} }
else else
{ {
if( i_volume == AOUT_VOLUME_MIN ) if( i_volume == 0 )
aout_ToggleMute( p_playlist, NULL ); aout_ToggleMute( p_playlist, NULL );
if( !aout_VolumeSet( p_playlist, i_volume ) ) if( !aout_VolumeSet( p_playlist, i_volume ) )
i_error = VLC_SUCCESS; i_error = VLC_SUCCESS;
......
...@@ -52,8 +52,7 @@ ...@@ -52,8 +52,7 @@
static int vlclua_volume_set( lua_State *L ) static int vlclua_volume_set( lua_State *L )
{ {
playlist_t *p_this = vlclua_get_playlist_internal( L ); playlist_t *p_this = vlclua_get_playlist_internal( L );
int i_volume = __MAX(__MIN(luaL_checkint( L, 1 ), AOUT_VOLUME_MAX), int i_volume = __MAX(__MIN(luaL_checkint( L, 1 ), AOUT_VOLUME_MAX), 0);
AOUT_VOLUME_MIN);
int i_ret = aout_VolumeSet( p_this, i_volume ); int i_ret = aout_VolumeSet( p_this, i_volume );
return vlclua_push_ret( L, i_ret ); return vlclua_push_ret( L, i_ret );
} }
......
...@@ -164,8 +164,8 @@ int aout_VolumeUp (vlc_object_t *obj, int value, audio_volume_t *volp) ...@@ -164,8 +164,8 @@ int aout_VolumeUp (vlc_object_t *obj, int value, audio_volume_t *volp)
prepareVolume (obj, &aout, &volume, &mute); prepareVolume (obj, &aout, &volume, &mute);
value += volume; value += volume;
if (value < AOUT_VOLUME_MIN) if (value < 0)
volume = AOUT_VOLUME_MIN; volume = 0;
else else
if (value > AOUT_VOLUME_MAX) if (value > AOUT_VOLUME_MAX)
volume = AOUT_VOLUME_MAX; volume = AOUT_VOLUME_MAX;
...@@ -201,7 +201,7 @@ int aout_ToggleMute (vlc_object_t *obj, audio_volume_t *volp) ...@@ -201,7 +201,7 @@ int aout_ToggleMute (vlc_object_t *obj, audio_volume_t *volp)
mute = !mute; mute = !mute;
ret = commitVolume (obj, aout, volume, mute); ret = commitVolume (obj, aout, volume, mute);
if (volp != NULL) if (volp != NULL)
*volp = mute ? AOUT_VOLUME_MIN : volume; *volp = mute ? 0 : volume;
return ret; return ret;
} }
...@@ -234,7 +234,7 @@ int aout_SetMute (vlc_object_t *obj, audio_volume_t *volp, bool mute) ...@@ -234,7 +234,7 @@ int aout_SetMute (vlc_object_t *obj, audio_volume_t *volp, bool mute)
prepareVolume (obj, &aout, &volume, NULL); prepareVolume (obj, &aout, &volume, NULL);
ret = commitVolume (obj, aout, volume, mute); ret = commitVolume (obj, aout, volume, mute);
if (volp != NULL) if (volp != NULL)
*volp = mute ? AOUT_VOLUME_MIN : volume; *volp = mute ? 0 : volume;
return ret; return ret;
} }
......
...@@ -1591,10 +1591,10 @@ vlc_module_begin () ...@@ -1591,10 +1591,10 @@ vlc_module_begin ()
add_bool( "audio", 1, AUDIO_TEXT, AUDIO_LONGTEXT, false ) add_bool( "audio", 1, AUDIO_TEXT, AUDIO_LONGTEXT, false )
change_safe () 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, AOUT_VOLUME_MAX, VOLUME_TEXT,
VOLUME_LONGTEXT, false ) 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, AOUT_VOLUME_MAX, VOLUME_STEP_TEXT,
VOLUME_STEP_LONGTEXT, true ) VOLUME_STEP_LONGTEXT, true )
add_integer( "aout-rate", 0, AOUT_RATE_TEXT, add_integer( "aout-rate", 0, AOUT_RATE_TEXT,
......
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