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

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


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

aout: delete input callbacks when input is deleted

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

 src/audio_output/input.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/audio_output/input.c b/src/audio_output/input.c
index 918ca97..992a926 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 )
     {
@@ -204,10 +204,9 @@ int aout_InputNew( audio_output_t * p_aout,
                 var_Change( p_aout, "audio-replay-gain-mode", VLC_VAR_ADDCHOICE,
                             &val, &text );
             }
-
-            var_AddCallback( p_aout, "audio-replay-gain-mode", ReplayGainCallback, p_input );
         }
     }
+    var_AddCallback( p_aout, "audio-replay-gain-mode", ReplayGainCallback, p_input );
 
     char *gain = var_InheritString (p_aout, "audio-replay-gain-mode");
     vlc_atomic_setf (&p_input->multiplier,
@@ -438,6 +437,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