Commit 9b965746 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

aout_MuteToggle: fix name and remove unused or misused volume parameter

In particular, show OSD mute icon when mute is enabled, rather than
when volume is nul (which is orthogonal).
parent 60e47a90
......@@ -36,8 +36,8 @@ VLC_API int aout_VolumeSet( vlc_object_t *, audio_volume_t );
VLC_API int aout_VolumeUp( vlc_object_t *, int, audio_volume_t * );
#define aout_VolumeUp(a, b, c) aout_VolumeUp(VLC_OBJECT(a), b, c)
#define aout_VolumeDown(a, b, c) aout_VolumeUp(a, -(b), c)
VLC_API int aout_ToggleMute( vlc_object_t *, audio_volume_t * );
#define aout_ToggleMute(a, b) aout_ToggleMute(VLC_OBJECT(a), b)
VLC_API int aout_MuteToggle( vlc_object_t * );
#define aout_MuteToggle(a) aout_MuteToggle(VLC_OBJECT(a))
VLC_API int aout_SetMute( vlc_object_t *, audio_volume_t *, bool );
VLC_API bool aout_IsMuted( vlc_object_t * );
......
......@@ -313,7 +313,7 @@ void libvlc_audio_output_set_device_type( libvlc_media_player_t *mp,
*****************************************************************************/
void libvlc_audio_toggle_mute( libvlc_media_player_t *mp )
{
aout_ToggleMute( mp, NULL );
aout_MuteToggle( mp );
}
int libvlc_audio_get_mute( libvlc_media_player_t *mp )
......
......@@ -274,7 +274,7 @@ static void ProcessGesture( intf_thread_t *p_intf )
case GESTURE(UP,DOWN,NONE,NONE):
case GESTURE(DOWN,UP,NONE,NONE):
msg_Dbg( p_intf, "Mute sound" );
aout_ToggleMute( p_playlist, NULL );
aout_MuteToggle( p_playlist );
break;
case GESTURE(UP,RIGHT,NONE,NONE):
......
......@@ -201,21 +201,20 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
}
case ACTIONID_VOL_MUTE:
if( aout_MuteToggle( p_playlist ) == 0 && p_vout != NULL )
{
audio_volume_t i_newvol = -1;
aout_ToggleMute( p_playlist, &i_newvol );
if( p_vout )
{
if( i_newvol == 0 )
if( aout_IsMuted( VLC_OBJECT(p_playlist) ) )
{
ClearChannels( p_intf, p_vout );
DisplayIcon( p_vout, OSD_MUTE_ICON );
}
else
DisplayVolume( p_intf, p_vout, i_newvol );
{
audio_volume_t i_vol = aout_VolumeGet( p_playlist );
DisplayVolume( p_intf, p_vout, i_vol );
}
break;
}
break;
/* Interface showing */
case ACTIONID_INTF_TOGGLE_FSC:
......
......@@ -1499,7 +1499,7 @@ static int Volume( vlc_object_t *p_this, char const *psz_cmd,
/* Set. */
audio_volume_t i_volume = atoi( newval.psz_string );
if( i_volume == 0 )
aout_ToggleMute( p_playlist, NULL );
aout_MuteToggle( p_playlist );
if( !aout_VolumeSet( p_playlist, i_volume ) )
i_error = VLC_SUCCESS;
osd_Volume( p_this );
......
......@@ -494,7 +494,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
if( !p_intf )
return;
aout_ToggleMute( pl_Get( p_intf ), NULL );
aout_MuteToggle( pl_Get( p_intf ) );
}
- (BOOL)isMuted
......
......@@ -179,7 +179,7 @@ void ActionsManager::frame()
void ActionsManager::toggleMuteAudio()
{
aout_ToggleMute( THEPL, NULL );
aout_MuteToggle( THEPL );
}
void ActionsManager::AudioUp()
......
......@@ -102,7 +102,7 @@ void CmdFaster::execute()
void CmdMute::execute()
{
aout_ToggleMute( getIntf()->p_sys->p_playlist, NULL );
aout_MuteToggle( getIntf()->p_sys->p_playlist );
}
......
......@@ -180,23 +180,18 @@ int aout_VolumeUp (vlc_object_t *obj, int value, audio_volume_t *volp)
return ret;
}
#undef aout_ToggleMute
#undef aout_MuteToggle
/**
* Toggles the mute state.
*/
int aout_ToggleMute (vlc_object_t *obj, audio_volume_t *volp)
int aout_MuteToggle (vlc_object_t *obj)
{
audio_output_t *aout;
int ret;
float vol;
bool mute;
prepareVolume (obj, &aout, &vol, &mute);
mute = !mute;
ret = commitVolume (obj, aout, vol, mute);
if (volp != NULL)
*volp = lroundf (vol * AOUT_VOLUME_DEFAULT);
return ret;
return commitVolume (obj, aout, vol, mute);
}
/**
......
......@@ -17,7 +17,7 @@ aout_MixerRun
aout_VolumeGet
aout_VolumeSet
aout_VolumeUp
aout_ToggleMute
aout_MuteToggle
aout_IsMuted
aout_SetMute
aout_VolumeSoftInit
......
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