]> git.sesse.net Git - ffmpeg/commitdiff
avfilter/vf_lumakey: add support for commands
authorPaul B Mahol <onemda@gmail.com>
Thu, 21 Nov 2019 15:59:39 +0000 (16:59 +0100)
committerPaul B Mahol <onemda@gmail.com>
Thu, 21 Nov 2019 15:59:39 +0000 (16:59 +0100)
doc/filters.texi
libavfilter/vf_lumakey.c

index cc192d634fbda1b54098a29a4ccd574ed50891c3..73f1b03128ecb884a250daf36327b2e2a12fd655 100644 (file)
@@ -12609,13 +12609,20 @@ Default value is @code{0}.
 
 @item tolerance
 Set the range of luma values to be keyed out.
-Default value is @code{0}.
+Default value is @code{0.01}.
 
 @item softness
 Set the range of softness. Default value is @code{0}.
 Use this to control gradual transition from zero to full transparency.
 @end table
 
+@subsection Commands
+This filter supports same @ref{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 lut, lutrgb, lutyuv
 
 Compute a look-up table for binding each pixel component input value
index 2e07898f4e3c6f5d09a7e0bb502ca126a1ee098b..c182e9045bd9afa9e4ec925fe7a7333fd884eee9 100644 (file)
@@ -163,6 +163,18 @@ static av_cold int query_formats(AVFilterContext *ctx)
     return ff_set_common_formats(ctx, formats);
 }
 
+static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
+                           char *res, int res_len, int flags)
+{
+    int ret;
+
+    ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags);
+    if (ret < 0)
+        return ret;
+
+    return config_input(ctx->inputs[0]);
+}
+
 static const AVFilterPad lumakey_inputs[] = {
     {
         .name         = "default",
@@ -182,7 +194,7 @@ static const AVFilterPad lumakey_outputs[] = {
 };
 
 #define OFFSET(x) offsetof(LumakeyContext, x)
-#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
+#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
 
 static const AVOption lumakey_options[] = {
     { "threshold", "set the threshold value", OFFSET(threshold), AV_OPT_TYPE_DOUBLE, {.dbl=0},    0, 1, FLAGS },
@@ -202,4 +214,5 @@ AVFilter ff_vf_lumakey = {
     .inputs        = lumakey_inputs,
     .outputs       = lumakey_outputs,
     .flags         = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS,
+    .process_command = process_command,
 };