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

Paul B Mahol git at videolan.org
Thu Nov 19 12:57:00 EET 2020


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Nov 19 11:53:10 2020 +0100| [381ab69042cad9f0a16718f7b6824076492030d9] | committer: Paul B Mahol

avfilter/vf_frei0r: add support for commands

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

 doc/filters.texi        |  4 ++++
 libavfilter/vf_frei0r.c | 17 ++++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index a2d1a3aa9f..092b343c2c 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -11784,6 +11784,10 @@ frei0r=perspective:0.2/0.2|0.8/0.2
 For more information, see
 @url{http://frei0r.dyne.org}
 
+ at subsection Commands
+
+This filter supports the @option{filter_params} option as @ref{commands}.
+
 @section fspp
 
 Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
diff --git a/libavfilter/vf_frei0r.c b/libavfilter/vf_frei0r.c
index dd94452d10..c084d5b13b 100644
--- a/libavfilter/vf_frei0r.c
+++ b/libavfilter/vf_frei0r.c
@@ -371,11 +371,25 @@ 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)
+{
+    Frei0rContext *s = ctx->priv;
+    int ret;
+
+    ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags);
+    if (ret < 0)
+        return ret;
+
+    return set_params(ctx, s->params);
+}
+
 #define OFFSET(x) offsetof(Frei0rContext, x)
 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
+#define TFLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_RUNTIME_PARAM
 static const AVOption frei0r_options[] = {
     { "filter_name",   NULL, OFFSET(dl_name), AV_OPT_TYPE_STRING, .flags = FLAGS },
-    { "filter_params", NULL, OFFSET(params),  AV_OPT_TYPE_STRING, .flags = FLAGS },
+    { "filter_params", NULL, OFFSET(params),  AV_OPT_TYPE_STRING, .flags = TFLAGS },
     { NULL }
 };
 
@@ -409,6 +423,7 @@ AVFilter ff_vf_frei0r = {
     .priv_class    = &frei0r_class,
     .inputs        = avfilter_vf_frei0r_inputs,
     .outputs       = avfilter_vf_frei0r_outputs,
+    .process_command = process_command,
 };
 
 static av_cold int source_init(AVFilterContext *ctx)



More information about the ffmpeg-cvslog mailing list