]> git.sesse.net Git - vlc/commitdiff
Added dynamic variable volume-change to notify upon a volume change. The rc-interface...
authorJean-Paul Saman <jpsaman@videolan.org>
Thu, 3 Nov 2005 20:39:41 +0000 (20:39 +0000)
committerJean-Paul Saman <jpsaman@videolan.org>
Thu, 3 Nov 2005 20:39:41 +0000 (20:39 +0000)
modules/control/rc.c
src/audio_output/intf.c
src/libvlc.c

index 281ce5d8c989371c8eefe33561846925b6129ea2..2907ad22b1f11558b588ce76d6bcb6ab7dc753ac 100644 (file)
@@ -135,7 +135,7 @@ void __msg_rc( intf_thread_t *p_intf, const char *psz_fmt, ... )
     if( p_intf->p_sys->i_socket == -1 )
     {
         vprintf( psz_fmt, args );
-        printf( "\n" );
+        printf( "\r\n" );
     }
     else
     {
@@ -531,7 +531,7 @@ static void Run( intf_thread_t *p_intf )
 
     /* status callbacks */
     /* Listen to audio volume updates */
-    var_AddCallback( p_intf->p_vlc, "volume", VolumeChanged, p_intf );
+    var_AddCallback( p_intf->p_vlc, "volume-change", VolumeChanged, p_intf );
 
 #ifdef WIN32
     /* Get the file descriptor of the console input */
@@ -865,7 +865,7 @@ static void Run( intf_thread_t *p_intf )
         p_playlist = NULL;
     }
 
-    var_DelCallback( p_intf->p_vlc, "volume", VolumeChanged, p_intf );
+    var_DelCallback( p_intf->p_vlc, "volume-change", VolumeChanged, p_intf );
 }
 
 static void Help( intf_thread_t *p_intf, vlc_bool_t b_longhelp)
@@ -979,7 +979,7 @@ static int VolumeChanged( vlc_object_t *p_this, char const *psz_cmd,
     intf_thread_t *p_intf = (intf_thread_t*)p_data;
 
     vlc_mutex_lock( &p_intf->p_sys->status_lock );
-    msg_rc( STATUS_CHANGE "( audio volume: %d )", newval.i_int );
+    msg_rc( STATUS_CHANGE "( audio volume: %d )", config_GetInt( p_this, "volume") );
     vlc_mutex_unlock( &p_intf->p_sys->status_lock );
     return VLC_SUCCESS;
 }
@@ -1699,7 +1699,7 @@ static int Volume( vlc_object_t *p_this, char const *psz_cmd,
 {
     intf_thread_t *p_intf = (intf_thread_t*)p_this;
     input_thread_t *p_input = NULL;
-    int i_error;
+    int i_error = VLC_EGENERIC;
 
     p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_ANYWHERE );
     if( !p_input )
index 507cdd93aab866fb76fb1ae901b57aef4f73d618..4d5a15f8bdb11a1573b5e903544b22891de4062b 100644 (file)
@@ -87,8 +87,7 @@ int __aout_VolumeGet( vlc_object_t * p_object, audio_volume_t * pi_volume )
 int __aout_VolumeSet( vlc_object_t * p_object, audio_volume_t i_volume )
 {
     vlc_value_t val;
-    aout_instance_t * p_aout = vlc_object_find( p_object, VLC_OBJECT_AOUT,
-                                                FIND_ANYWHERE );
+    aout_instance_t *p_aout = vlc_object_find( p_object, VLC_OBJECT_AOUT, FIND_ANYWHERE );
     int i_result = 0;
 
     config_PutInt( p_object, "volume", i_volume );
@@ -104,6 +103,7 @@ int __aout_VolumeSet( vlc_object_t * p_object, audio_volume_t i_volume )
 
     val.b_bool = VLC_TRUE;
     var_Set( p_aout, "intf-change", val );
+    var_Set( p_aout->p_vlc, "volume-change", val );
     vlc_object_release( p_aout );
     return i_result;
 }
index 2462e084fe0f5dac685a37baa88cbaa761eb2b69..69fecc75b6cc157148799a8be0a195b4e2617c35 100644 (file)
@@ -779,6 +779,9 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
     var_Create( p_vlc, "drawableportx", VLC_VAR_INTEGER );
     var_Create( p_vlc, "drawableporty", VLC_VAR_INTEGER );
 
+    /* Create volume callback system. */
+    var_Create( p_vlc, "volume-change", VLC_VAR_BOOL );
+
     /*
      * Get input filenames given as commandline arguments
      */