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

Paul B Mahol git at videolan.org
Tue Dec 15 21:36:08 EET 2020


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Tue Dec 15 20:31:25 2020 +0100| [32586a42da8c9dedd30c6e4c0417c9da91c1f283] | committer: Paul B Mahol

avfilter/vf_limiter: add support for commands

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

 doc/filters.texi         |  4 ++++
 libavfilter/vf_limiter.c | 19 ++++++++++++++++---
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 89244dc543..62e34b99ee 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -13551,6 +13551,10 @@ Upper bound. Defaults to the highest allowed value for the input.
 Specify which planes will be processed. Defaults to all available.
 @end table
 
+ at subsection Commands
+
+This filter supports the all above options as @ref{commands}.
+
 @section loop
 
 Loop video frames.
diff --git a/libavfilter/vf_limiter.c b/libavfilter/vf_limiter.c
index 8db28fee64..1779c63944 100644
--- a/libavfilter/vf_limiter.c
+++ b/libavfilter/vf_limiter.c
@@ -46,7 +46,7 @@ typedef struct LimiterContext {
 } LimiterContext;
 
 #define OFFSET(x) offsetof(LimiterContext, 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 limiter_options[] = {
     { "min",    "set min value", OFFSET(min),    AV_OPT_TYPE_INT, {.i64=0},     0, 65535, .flags = FLAGS },
@@ -133,7 +133,7 @@ static void limiter16(const uint8_t *ssrc, uint8_t *ddst,
     }
 }
 
-static int config_props(AVFilterLink *inlink)
+static int config_input(AVFilterLink *inlink)
 {
     AVFilterContext *ctx = inlink->dst;
     LimiterContext *s = ctx->priv;
@@ -230,12 +230,24 @@ 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)
+{
+    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 inputs[] = {
     {
         .name         = "default",
         .type         = AVMEDIA_TYPE_VIDEO,
         .filter_frame = filter_frame,
-        .config_props = config_props,
+        .config_props = config_input,
     },
     { NULL }
 };
@@ -258,4 +270,5 @@ AVFilter ff_vf_limiter = {
     .inputs        = inputs,
     .outputs       = outputs,
     .flags         = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS,
+    .process_command = process_command,
 };



More information about the ffmpeg-cvslog mailing list