[vlc-commits] aout: delete input callbacks when input is deleted

Rémi Denis-Courmont git at videolan.org
Tue Aug 9 18:02:35 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Aug  9 18:52:49 2011 +0300| [8bffb8943ecf9f51c89ba0e802c46673ea362185] | committer: Rémi Denis-Courmont

aout: delete input callbacks when input is deleted

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8bffb8943ecf9f51c89ba0e802c46673ea362185
---

 src/audio_output/input.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/audio_output/input.c b/src/audio_output/input.c
index 918ca97..fc3bf80 100644
--- a/src/audio_output/input.c
+++ b/src/audio_output/input.c
@@ -137,19 +137,19 @@ int aout_InputNew( audio_output_t * p_aout,
             var_SetString( p_aout, "visual", val.psz_string );
             free( val.psz_string );
         }
-        var_AddCallback( p_aout, "visual", VisualizationCallback, p_input );
     }
+    var_AddCallback( p_aout, "visual", VisualizationCallback, p_input );
 
     if( var_Type( p_aout, "equalizer" ) == 0 )
     {
         module_config_t *p_config;
         int i;
 
+        var_Create( p_aout, "equalizer",
+                    VLC_VAR_STRING | VLC_VAR_HASCHOICE );
         p_config = config_FindConfig( VLC_OBJECT(p_aout), "equalizer-preset" );
         if( p_config && p_config->i_list )
         {
-               var_Create( p_aout, "equalizer",
-                           VLC_VAR_STRING | VLC_VAR_HASCHOICE );
             text.psz_string = _("Equalizer");
             var_Change( p_aout, "equalizer", VLC_VAR_SETTEXT, &text, NULL );
 
@@ -164,9 +164,9 @@ int aout_InputNew( audio_output_t * p_aout,
                             &val, &text );
             }
 
-            var_AddCallback( p_aout, "equalizer", EqualizerCallback, p_input );
         }
     }
+    var_AddCallback( p_aout, "equalizer", EqualizerCallback, p_input );
 
     if( var_Type( p_aout, "audio-filter" ) == 0 )
     {
@@ -438,6 +438,11 @@ int aout_InputDelete( audio_output_t * p_aout, aout_input_t * p_input )
     if ( p_input->b_error )
         return 0;
 
+    var_DelCallback (p_aout, "audio-replay-gain-mode", ReplayGainCallback,
+                     p_input);
+    var_DelCallback (p_aout, "equalizer", EqualizerCallback, p_input);
+    var_DelCallback (p_aout, "visual", VisualizationCallback, p_input);
+
     /* XXX We need to update b_recycle_vout before calling aout_FiltersDestroyPipeline.
      * FIXME They can be a race condition if audio-visual is updated between
      * aout_InputDelete and aout_InputNew.



More information about the vlc-commits mailing list