]> git.sesse.net Git - ffmpeg/commitdiff
avfilter/vf_gblur: add support for commands
authorPaul B Mahol <onemda@gmail.com>
Sun, 6 Oct 2019 13:23:55 +0000 (15:23 +0200)
committerPaul B Mahol <onemda@gmail.com>
Sun, 6 Oct 2019 13:34:28 +0000 (15:34 +0200)
doc/filters.texi
libavfilter/vf_gblur.c

index 468227ce5093e8374b675fdbe283e238a16998fe..59bac5816621a7400661872ecfd8ef8ddd800f54 100644 (file)
@@ -10873,6 +10873,13 @@ Set vertical sigma, if negative it will be same as @code{sigma}.
 Default is @code{-1}.
 @end table
 
+@subsection Commands
+This filter supports same commands as options.
+The command accepts the same syntax of the corresponding option.
+
+If the specified expression is not valid, it is kept at its current
+value.
+
 @section geq
 
 Apply generic equation to each pixel.
index e71b33da800930434a3a6a9d34a41089f5c9414e..6ef261478fae455cfaec5fcc3bfd566dc3ba6ceb 100644 (file)
@@ -344,6 +344,22 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
     return ff_filter_frame(outlink, out);
 }
 
+static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
+                           char *res, int res_len, int flags)
+{
+    GBlurContext *s = ctx->priv;
+    int ret = 0;
+
+    if (   !strcmp(cmd, "sigma") || !strcmp(cmd, "sigmaV")
+        || !strcmp(cmd, "steps") || !strcmp(cmd, "planes")) {
+        av_opt_set(s, cmd, args, 0);
+    } else {
+        ret = AVERROR(ENOSYS);
+    }
+
+    return ret;
+}
+
 static av_cold void uninit(AVFilterContext *ctx)
 {
     GBlurContext *s = ctx->priv;
@@ -379,4 +395,5 @@ AVFilter ff_vf_gblur = {
     .inputs        = gblur_inputs,
     .outputs       = gblur_outputs,
     .flags         = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS,
+    .process_command = process_command,
 };