]> git.sesse.net Git - vlc/commitdiff
skins2: use the "mute" variable
authorErwan Tulou <erwan10@videolan.org>
Tue, 19 Mar 2013 22:23:27 +0000 (23:23 +0100)
committerErwan Tulou <erwan10@videolan.org>
Wed, 20 Mar 2013 00:34:56 +0000 (01:34 +0100)
modules/gui/skins2/src/vlcproc.cpp
modules/gui/skins2/src/vlcproc.hpp

index 6531248f97112eedb17f6e05bffa9d93a76dfc12..d5d17f5e90f1653da503170da86e7066fdd5081b 100644 (file)
@@ -155,6 +155,7 @@ VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf ),
     var_AddCallback( p_object, var, onGenericCallback, this );
 
     ADD_CALLBACK( pIntf->p_sys->p_playlist, "volume" )
+    ADD_CALLBACK( pIntf->p_sys->p_playlist, "mute" )
     ADD_CALLBACK( pIntf->p_libvlc, "intf-toggle-fscontrol" )
 
     ADD_CALLBACK( pIntf->p_sys->p_playlist, "random" )
@@ -201,6 +202,8 @@ VlcProc::~VlcProc()
 
     var_DelCallback( getIntf()->p_sys->p_playlist, "volume",
                      onGenericCallback, this );
+    var_DelCallback( getIntf()->p_sys->p_playlist, "mute",
+                     onGenericCallback, this );
     var_DelCallback( getIntf()->p_libvlc, "intf-toggle-fscontrol",
                      onGenericCallback, this );
 
@@ -365,6 +368,7 @@ int VlcProc::onGenericCallback( vlc_object_t *pObj, const char *pVariable,
     }
 
     ADD_CALLBACK_ENTRY( "volume", on_volume_changed, true )
+    ADD_CALLBACK_ENTRY( "mute", on_mute_changed, true )
 
     ADD_CALLBACK_ENTRY( "bit-rate", on_bit_rate_changed, false )
     ADD_CALLBACK_ENTRY( "sample-rate", on_sample_rate_changed, false )
@@ -669,8 +673,12 @@ void VlcProc::on_volume_changed( vlc_object_t* p_obj, vlc_value_t newVal )
     playlist_t* pPlaylist = getIntf()->p_sys->p_playlist;
 
     SET_VOLUME( m_cVarVolume, var_GetFloat( pPlaylist, "volume" ), false );
-    bool b_is_muted = playlist_MuteGet( pPlaylist ) > 0;
-    SET_BOOL( m_cVarMute, b_is_muted );
+}
+
+void VlcProc::on_mute_changed( vlc_object_t* p_obj, vlc_value_t newVal )
+{
+    (void)p_obj;
+    SET_BOOL( m_cVarMute, newVal.b_bool );
 }
 
 void VlcProc::on_audio_filter_changed( vlc_object_t* p_obj, vlc_value_t newVal )
@@ -773,8 +781,7 @@ void VlcProc::init_variables()
     SET_BOOL( m_cVarRepeat, var_GetBool( pPlaylist, "repeat" ) );
 
     SET_VOLUME( m_cVarVolume, var_GetFloat( pPlaylist, "volume" ), false );
-    bool b_is_muted = playlist_MuteGet( pPlaylist ) > 0;
-    SET_BOOL( m_cVarMute, b_is_muted );
+    SET_BOOL( m_cVarMute, var_GetBool( pPlaylist, "mute" ) );
 
     update_equalizer();
 }
index 63731026a4da0504f2afe151efaece122aa15d5c..8c18aee0352bc516d418656d055ef0afa193702d 100644 (file)
@@ -111,6 +111,7 @@ public:
     void on_repeat_changed( vlc_object_t* p_obj, vlc_value_t newVal );
 
     void on_volume_changed( vlc_object_t* p_obj, vlc_value_t newVal );
+    void on_mute_changed( vlc_object_t* p_obj, vlc_value_t newVal );
     void on_audio_filter_changed( vlc_object_t* p_obj, vlc_value_t newVal );
 
     void on_intf_show_changed( vlc_object_t* p_obj, vlc_value_t newVal );