]> git.sesse.net Git - vlc/blobdiff - src/audio_output/intf.c
doVolumeChanges: always return the value
[vlc] / src / audio_output / intf.c
index 44cc169e21f3aca8fb06c037d9815075bf37e855..3fadb4fbc319a891ed5e5ba031d376a34f4b75da 100644 (file)
 
 static aout_instance_t *findAout (vlc_object_t *obj)
 {
-    input_thread_t *p_input = playlist_CurrentInput (pl_Get (obj));
+    input_thread_t *(*pf_find_input) (vlc_object_t *);
+
+    pf_find_input = var_GetAddress (obj, "find-input-callback");
+    if (unlikely(pf_find_input == NULL))
+        return NULL;
+
+    input_thread_t *p_input = pf_find_input (obj);
     if (p_input == NULL)
        return NULL;
 
@@ -50,6 +56,7 @@ static aout_instance_t *findAout (vlc_object_t *obj)
     vlc_object_release (p_input);
     return p_aout;
 }
+#define findAout(o) findAout(VLC_OBJECT(o))
 
 /*
  * Volume management
@@ -80,10 +87,12 @@ enum {
     INCREMENT_VOLUME=4,
     TOGGLE_MUTE=8
 };
+
 /*****************************************************************************
  * doVolumeChanges : handle all volume changes. Internal use only to ease
  *                   variables locking.
  *****************************************************************************/
+static
 int doVolumeChanges( unsigned action, vlc_object_t * p_object, int i_nb_steps,
                 audio_volume_t i_volume, audio_volume_t * i_return_volume,
                 bool b_mute )
@@ -141,9 +150,6 @@ int doVolumeChanges( unsigned action, vlc_object_t * p_object, int i_nb_steps,
             i_volume = AOUT_VOLUME_MIN;
         else
             i_volume = i_new_volume;
-
-        if ( i_return_volume != NULL )
-            *i_return_volume = i_volume;
     }
 
     var_Create( p_object->p_libvlc, "saved-volume", VLC_VAR_INTEGER );
@@ -178,6 +184,8 @@ int doVolumeChanges( unsigned action, vlc_object_t * p_object, int i_nb_steps,
         vlc_object_release( p_aout );
     }
 
+    if ( i_return_volume != NULL )
+         *i_return_volume = i_volume;
     return i_result;
 }
 
@@ -449,7 +457,7 @@ static int aout_Restart( aout_instance_t * p_aout )
 int aout_FindAndRestart( vlc_object_t * p_this, const char *psz_name,
                          vlc_value_t oldval, vlc_value_t newval, void *p_data )
 {
-    aout_instance_t * p_aout = findAout( p_this );
+    aout_instance_t * p_aout = findAout( pl_Get(p_this) );
 
     (void)psz_name; (void)oldval; (void)newval; (void)p_data;
     if ( p_aout == NULL ) return VLC_SUCCESS;