[FFmpeg-cvslog] avfilter/vf_lumakey: add support for commands

Paul B Mahol git at videolan.org
Thu Nov 21 18:01:56 EET 2019


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Nov 21 16:59:39 2019 +0100| [ae6c4168e67cae029eaab227621535b32392937d] | committer: Paul B Mahol

avfilter/vf_lumakey: add support for commands

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

 doc/filters.texi         |  9 ++++++++-
 libavfilter/vf_lumakey.c | 15 ++++++++++++++-
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index cc192d634f..73f1b03128 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -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
 
+ at 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
diff --git a/libavfilter/vf_lumakey.c b/libavfilter/vf_lumakey.c
index 2e07898f4e..c182e9045b 100644
--- a/libavfilter/vf_lumakey.c
+++ b/libavfilter/vf_lumakey.c
@@ -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,
 };



More information about the ffmpeg-cvslog mailing list