]> git.sesse.net Git - vlc/commitdiff
aout_MuteToggle: fix name and remove unused or misused volume parameter
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 1 Jul 2012 17:38:20 +0000 (20:38 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Tue, 3 Jul 2012 15:04:07 +0000 (18:04 +0300)
In particular, show OSD mute icon when mute is enabled, rather than
when volume is nul (which is orthogonal).

include/vlc_aout_intf.h
lib/audio.c
modules/control/gestures.c
modules/control/hotkeys.c
modules/control/rc.c
modules/gui/macosx/CoreInteraction.m
modules/gui/qt4/actions_manager.cpp
modules/gui/skins2/commands/cmd_input.cpp
src/audio_output/intf.c
src/libvlccore.sym

index e81f747b22183b7dcf9c990fe6331c7e8af9249c..b31d9803de21065f6d83c33cfce23b02ddf99b71 100644 (file)
@@ -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 * );
 
index c0c8cf79c67ab8925277ea1069850dcb9b0907fe..7a5a288ed2d9f9e31d8ce5508c0a712330ddf9b8 100644 (file)
@@ -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 )
index 05ecb25891174cfb9365390cd869d624058f5808..486f1f69de67f753d4a4cfe5aadfdac483621305 100644 (file)
@@ -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):
index 74e74f0f8ca1fe26a8ac0b40c0c45af1b51756c3..d7e1eee6b4152256c3ec5cbc68f6559e0f9d9433 100644 (file)
@@ -201,21 +201,20 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
         }
 
         case ACTIONID_VOL_MUTE:
-        {
-            audio_volume_t i_newvol = -1;
-            aout_ToggleMute( p_playlist, &i_newvol );
-            if( p_vout )
+            if( aout_MuteToggle( p_playlist ) == 0 && p_vout != NULL )
             {
-                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;
-        }
 
         /* Interface showing */
         case ACTIONID_INTF_TOGGLE_FSC:
index 655a127e8a12784a3b4f68881a247300b0033f9e..360ece2609184919f5da912428305b2be2f76193 100644 (file)
@@ -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 );
index ca5b23f123be9fc579c9480b2e601a10eedc92d8..0602a6f3eed17ab11ac5880726818947ec732e75 100644 (file)
@@ -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
index 93a346c230f4f35240011b9d02ad8af020db8f50..00c8dfea885212e3cb401c5fbf3523daae373196 100644 (file)
@@ -179,7 +179,7 @@ void ActionsManager::frame()
 
 void ActionsManager::toggleMuteAudio()
 {
-     aout_ToggleMute( THEPL, NULL );
+     aout_MuteToggle( THEPL );
 }
 
 void ActionsManager::AudioUp()
index 63f4f470feeef9c50a0c756bb0239b635f451587..e83ba029ee60b0a14e91608781e5cb199be397a6 100644 (file)
@@ -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 );
 }
 
 
index 0ae35f77d49117e4b07526e4f5eee0381bf310e7..7f61e7bcbe18f84d275fceabede6ee0ccdefc7a7 100644 (file)
@@ -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);
 }
 
 /**
index 931d9238f0d3611ee98c064a9b578f3bd3045ea8..6e8c49e6deb553aba392daac5f62e6815bdbe292 100644 (file)
@@ -17,7 +17,7 @@ aout_MixerRun
 aout_VolumeGet
 aout_VolumeSet
 aout_VolumeUp
-aout_ToggleMute
+aout_MuteToggle
 aout_IsMuted
 aout_SetMute
 aout_VolumeSoftInit