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

index 59bac5816621a7400661872ecfd8ef8ddd800f54..777dc3014c2713dc38a4bbb8ae778b6db289d95d 100644 (file)
@@ -6211,6 +6211,13 @@ Set vertical radius size, if zero it will be same as @code{sizeX}.
 Default is @code{0}.
 @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 bbox
 
 Compute the bounding box for the non-black pixels in the input frame
index fdc9d39ce188980926990c8157cecd14b64259b7..a1f6c9b80eebd8d52a9ecf84eac9c69c8f97b8c6 100644 (file)
@@ -287,6 +287,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)
+{
+    AverageBlurContext *s = ctx->priv;
+    int ret = 0;
+
+    if (   !strcmp(cmd, "sizeX") || !strcmp(cmd, "sizeY")
+        || !strcmp(cmd, "planes")) {
+        av_opt_set(s, cmd, args, 0);
+    } else {
+        ret = AVERROR(ENOSYS);
+    }
+
+    return ret;
+}
+
 static av_cold void uninit(AVFilterContext *ctx)
 {
     AverageBlurContext *s = ctx->priv;
@@ -322,4 +338,5 @@ AVFilter ff_vf_avgblur = {
     .inputs        = avgblur_inputs,
     .outputs       = avgblur_outputs,
     .flags         = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS,
+    .process_command = process_command,
 };