[FFmpeg-cvslog] avfilter/af_ladspa: support simpler syntax for controls

Paul B Mahol git at videolan.org
Sun Sep 13 21:07:43 CEST 2015


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat Sep 12 07:31:49 2015 +0000| [a0a2ca024bd0e6e3cd6cfa3fb878871a18a611e6] | committer: Paul B Mahol

avfilter/af_ladspa: support simpler syntax for controls

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

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

 doc/filters.texi        |    3 +++
 libavfilter/af_ladspa.c |    9 ++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 930129c..447caf5 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -1970,6 +1970,9 @@ threshold or gain).
 Controls need to be defined using the following syntax:
 c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
 @var{valuei} is the value set on the @var{i}-th control.
+Alternatively they can be also defined using the following syntax:
+ at var{value0}|@var{value1}|@var{value2}|..., where
+ at var{valuei} is the value set on the @var{i}-th control.
 If @option{controls} is set to @code{help}, all available controls and
 their valid ranges are printed.
 
diff --git a/libavfilter/af_ladspa.c b/libavfilter/af_ladspa.c
index 1efe3f0..655c018 100644
--- a/libavfilter/af_ladspa.c
+++ b/libavfilter/af_ladspa.c
@@ -396,7 +396,7 @@ static av_cold int init(AVFilterContext *ctx)
     AVFilterPad pad = { NULL };
     char *p, *arg, *saveptr = NULL;
     unsigned long nb_ports;
-    int i;
+    int i, j = 0;
 
     if (!s->dl_name) {
         av_log(ctx, AV_LOG_ERROR, "No plugin name provided\n");
@@ -543,8 +543,11 @@ static av_cold int init(AVFilterContext *ctx)
         p = NULL;
 
         if (sscanf(arg, "c%d=%f", &i, &val) != 2) {
-            av_log(ctx, AV_LOG_ERROR, "Invalid syntax.\n");
-            return AVERROR(EINVAL);
+            if (sscanf(arg, "%f", &val) != 1) {
+                av_log(ctx, AV_LOG_ERROR, "Invalid syntax.\n");
+                return AVERROR(EINVAL);
+            }
+            i = j++;
         }
 
         if ((ret = set_control(ctx, i, val)) < 0)



More information about the ffmpeg-cvslog mailing list