[FFmpeg-cvslog] avfilter/af_ladspa: unbreak Mch -> Nch plugins, where M < N

Paul B Mahol git at videolan.org
Tue Dec 15 20:58:31 CET 2015


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Tue Dec 15 20:53:13 2015 +0100| [09d84e00bd88f9ce191e1fe189c0a0ba8d70c826] | committer: Paul B Mahol

avfilter/af_ladspa: unbreak Mch -> Nch plugins, where M < N

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=09d84e00bd88f9ce191e1fe189c0a0ba8d70c826
---

 libavfilter/af_ladspa.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/libavfilter/af_ladspa.c b/libavfilter/af_ladspa.c
index c323d2d..6bc7313 100644
--- a/libavfilter/af_ladspa.c
+++ b/libavfilter/af_ladspa.c
@@ -26,6 +26,7 @@
 
 #include <dlfcn.h>
 #include <ladspa.h>
+#include "libavutil/avassert.h"
 #include "libavutil/avstring.h"
 #include "libavutil/channel_layout.h"
 #include "libavutil/opt.h"
@@ -144,6 +145,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
     AVFrame *out;
     int i, h, p;
 
+    av_assert0(in->channels == s->nb_inputs);
+
     if (!s->nb_outputs ||
         (av_frame_is_writable(in) && s->nb_inputs == s->nb_outputs &&
         !(s->desc->Properties & LADSPA_PROPERTY_INPLACE_BROKEN))) {
@@ -157,6 +160,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
         av_frame_copy_props(out, in);
     }
 
+    av_assert0(!s->nb_outputs || out->channels == s->nb_outputs);
+
     for (h = 0; h < s->nb_handles; h++) {
         for (i = 0; i < s->nb_inputs; i++) {
             p = s->nb_handles > 1 ? h : i;
@@ -298,6 +303,7 @@ static int config_input(AVFilterLink *inlink)
 static int config_output(AVFilterLink *outlink)
 {
     AVFilterContext *ctx = outlink->src;
+    LADSPAContext *s = ctx->priv;
     int ret;
 
     if (ctx->nb_inputs) {
@@ -305,7 +311,7 @@ static int config_output(AVFilterLink *outlink)
 
         outlink->format      = inlink->format;
         outlink->sample_rate = inlink->sample_rate;
-        if (ctx->nb_inputs == ctx->nb_outputs) {
+        if (s->nb_inputs == s->nb_outputs) {
             outlink->channel_layout = inlink->channel_layout;
             outlink->channels = inlink->channels;
         }
@@ -644,7 +650,7 @@ static int query_formats(AVFilterContext *ctx)
 
         if (s->nb_inputs >= 1) {
             AVFilterLink *inlink = ctx->inputs[0];
-            int64_t inlayout = FF_COUNT2LAYOUT(s->nb_inputs);
+            uint64_t inlayout = FF_COUNT2LAYOUT(s->nb_inputs);
 
             layouts = NULL;
             ret = ff_add_channel_layout(&layouts, inlayout);
@@ -662,7 +668,7 @@ static int query_formats(AVFilterContext *ctx)
         }
 
         if (s->nb_outputs >= 1) {
-            int64_t outlayout = FF_COUNT2LAYOUT(s->nb_outputs);
+            uint64_t outlayout = FF_COUNT2LAYOUT(s->nb_outputs);
 
             layouts = NULL;
             ret = ff_add_channel_layout(&layouts, outlayout);



More information about the ffmpeg-cvslog mailing list