[vlc-commits] aout: move input restart on filter change from playlist code

Rémi Denis-Courmont git at videolan.org
Sat May 24 07:04:10 CEST 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat May 24 13:01:44 2014 +0800| [ccdb1377fe701c6614df32a2373dbfb8ef41e23d] | committer: Rémi Denis-Courmont

aout: move input restart on filter change from playlist code

So that it works for LibVLC too.

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

 src/audio_output/output.c |   10 ++++++++++
 src/playlist/aout.c       |    8 ++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/audio_output/output.c b/src/audio_output/output.c
index bfaad8e..04d84f4 100644
--- a/src/audio_output/output.c
+++ b/src/audio_output/output.c
@@ -153,6 +153,14 @@ static int aout_GainNotify (audio_output_t *aout, float gain)
     return 0;
 }
 
+static int FilterCallback (vlc_object_t *obj, const char *var,
+                           vlc_value_t prev, vlc_value_t cur, void *data)
+{
+    aout_InputRequestRestart ((audio_output_t *)obj);
+    (void) var; (void) prev; (void) cur; (void) data;
+    return VLC_SUCCESS;
+}
+
 #undef aout_New
 /**
  * Creates an audio output object and initializes an output module.
@@ -267,6 +275,7 @@ audio_output_t *aout_New (vlc_object_t *parent)
     }
 
     var_Create (aout, "audio-filter", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
+    var_AddCallback (aout, "audio-filter", FilterCallback, NULL);
     text.psz_string = _("Audio filters");
     var_Change (aout, "audio-filter", VLC_VAR_SETTEXT, &text, NULL);
 
@@ -313,6 +322,7 @@ void aout_Destroy (audio_output_t *aout)
     aout->device_select = NULL;
     aout_OutputUnlock (aout);
 
+    var_DelCallback (aout, "audio-filter", FilterCallback, NULL);
     var_DelCallback (aout, "mute", var_Copy, aout->p_parent);
     var_SetFloat (aout, "volume", -1.f);
     var_DelCallback (aout, "volume", var_Copy, aout->p_parent);
diff --git a/src/playlist/aout.c b/src/playlist/aout.c
index f00eaa2..f55c345 100644
--- a/src/playlist/aout.c
+++ b/src/playlist/aout.c
@@ -133,12 +133,8 @@ void playlist_EnableAudioFilter (playlist_t *pl, const char *name, bool add)
 {
     audio_output_t *aout = playlist_GetAout (pl);
 
-    if (aout_ChangeFilterString (VLC_OBJECT(pl), VLC_OBJECT(aout),
-                                 "audio-filter", name, add))
-    {
-        if (aout != NULL)
-            aout_InputRequestRestart (aout);
-    }
+    aout_ChangeFilterString (VLC_OBJECT(pl), VLC_OBJECT(aout),
+                             "audio-filter", name, add);
     if (aout != NULL)
         vlc_object_release (aout);
 }



More information about the vlc-commits mailing list