[vlc-commits] aout: simplify filterign special cases using pointer comparison

Rémi Denis-Courmont git at videolan.org
Tue Nov 6 22:26:37 CET 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Nov  6 23:24:36 2012 +0200| [5864ae43c26812f3c4e2746f5bb41551048bfe38] | committer: Rémi Denis-Courmont

aout: simplify filterign special cases using pointer comparison

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

 src/audio_output/filters.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/audio_output/filters.c b/src/audio_output/filters.c
index cb7e2ae..87317cb 100644
--- a/src/audio_output/filters.c
+++ b/src/audio_output/filters.c
@@ -404,7 +404,8 @@ int aout_FiltersNew (audio_output_t *aout,
     var_AddCallback (aout, "visual", VisualizationCallback, NULL);
     var_AddCallback (aout, "equalizer", EqualizerCallback, NULL);
 
-    bool scaletempo = var_InheritBool (aout, "audio-time-stretch");
+    const char *scaletempo =
+        var_InheritBool (aout, "audio-time-stretch") ? "scaletempo" : NULL;
     char *filters = var_InheritString (aout, "audio-filter");
     char *visual = var_InheritString (aout, "audio-visual");
 
@@ -421,8 +422,8 @@ int aout_FiltersNew (audio_output_t *aout,
     const char *list[AOUT_MAX_FILTERS];
     unsigned n = 0;
 
-    if (scaletempo)
-        list[n++] = "scaletempo";
+    if (scaletempo != NULL)
+        list[n++] = scaletempo;
     if (filters != NULL)
     {
         char *p = filters, *name;
@@ -445,7 +446,7 @@ int aout_FiltersNew (audio_output_t *aout,
 
         filter_t *filter = CreateFilter (VLC_OBJECT(aout), name,
                                          &input_format, &output_format,
-                                         i == (n - (visual != NULL)));
+                                         name == visual);
         if (filter == NULL)
         {
             msg_Err (aout, "cannot add user filter %s (skipped)", name);
@@ -468,7 +469,7 @@ int aout_FiltersNew (audio_output_t *aout,
         owner->filters[owner->nb_filters++] = filter;
         input_format = filter->fmt_out.audio;
 
-        if (i == 0 && scaletempo) /* scaletempo */
+        if (name == scaletempo)
             owner->rate_filter = filter;
     }
     free (visual);



More information about the vlc-commits mailing list