avfilter/af_ladspa: process all channels for nb_handles > 1
authorPaul B Mahol <onemda@gmail.com>
Wed, 16 Sep 2015 09:27:30 +0000 (09:27 +0000)
committerPaul B Mahol <onemda@gmail.com>
Wed, 16 Sep 2015 12:50:13 +0000 (12:50 +0000)
Signed-off-by: Paul B Mahol <onemda@gmail.com>
(cherry picked from commit dc1050a3e8557fc423023036f698cc476fb675b4)

libavfilter/af_ladspa.c

index 2057e6d..f89e2bc 100644 (file)
@@ -142,7 +142,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
     AVFilterContext *ctx = inlink->dst;
     LADSPAContext *s = ctx->priv;
     AVFrame *out;
-    int i, h;
+    int i, h, p;
 
     if (!s->nb_outputs ||
         (av_frame_is_writable(in) && s->nb_inputs == s->nb_outputs &&
@@ -159,13 +159,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 
     for (h = 0; h < s->nb_handles; h++) {
         for (i = 0; i < s->nb_inputs; i++) {
+            p = s->nb_handles > 1 ? h : i;
             s->desc->connect_port(s->handles[h], s->ipmap[i],
-                                  (LADSPA_Data*)in->extended_data[i]);
+                                  (LADSPA_Data*)in->extended_data[p]);
         }
 
         for (i = 0; i < s->nb_outputs; i++) {
+            p = s->nb_handles > 1 ? h : i;
             s->desc->connect_port(s->handles[h], s->opmap[i],
-                                  (LADSPA_Data*)out->extended_data[i]);
+                                  (LADSPA_Data*)out->extended_data[p]);
         }
 
         s->desc->run(s->handles[h], in->nb_samples);