[FFmpeg-cvslog] avfilter/vf_datascope: pixscope: add commands support

Paul B Mahol git at videolan.org
Sat Feb 13 13:39:35 EET 2021


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat Feb 13 12:32:59 2021 +0100| [bbf6183e11e1d4514d87edc61d5c3f1e2951ffa2] | committer: Paul B Mahol

avfilter/vf_datascope: pixscope: add commands support

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

 doc/filters.texi           |  4 ++++
 libavfilter/vf_datascope.c | 27 ++++++++++++++++++++-------
 2 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 282109e808..9dfc0ec67f 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -16218,6 +16218,10 @@ Set window X position, relative offset on X axis.
 Set window Y position, relative offset on Y axis.
 @end table
 
+ at subsection Commands
+
+This filter supports same @ref{commands} as options.
+
 @section pp
 
 Enable the specified chain of postprocessing subfilters using libpostproc. This
diff --git a/libavfilter/vf_datascope.c b/libavfilter/vf_datascope.c
index 440cf57d64..88007c9265 100644
--- a/libavfilter/vf_datascope.c
+++ b/libavfilter/vf_datascope.c
@@ -494,13 +494,13 @@ typedef struct PixscopeContext {
 #define POFFSET(x) offsetof(PixscopeContext, x)
 
 static const AVOption pixscope_options[] = {
-    { "x",  "set scope x offset",  POFFSET(xpos), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0,  1, FLAGS },
-    { "y",  "set scope y offset",  POFFSET(ypos), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0,  1, FLAGS },
-    { "w",  "set scope width",     POFFSET(w),    AV_OPT_TYPE_INT,   {.i64=7},   1, 80, FLAGS },
-    { "h",  "set scope height",    POFFSET(h),    AV_OPT_TYPE_INT,   {.i64=7},   1, 80, FLAGS },
-    { "o",  "set window opacity",  POFFSET(o),    AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0,  1, FLAGS },
-    { "wx", "set window x offset", POFFSET(wx),   AV_OPT_TYPE_FLOAT, {.dbl=-1}, -1,  1, FLAGS },
-    { "wy", "set window y offset", POFFSET(wy),   AV_OPT_TYPE_FLOAT, {.dbl=-1}, -1,  1, FLAGS },
+    { "x",  "set scope x offset",  POFFSET(xpos), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0,  1, FLAGSR },
+    { "y",  "set scope y offset",  POFFSET(ypos), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0,  1, FLAGSR },
+    { "w",  "set scope width",     POFFSET(w),    AV_OPT_TYPE_INT,   {.i64=7},   1, 80, FLAGSR },
+    { "h",  "set scope height",    POFFSET(h),    AV_OPT_TYPE_INT,   {.i64=7},   1, 80, FLAGSR },
+    { "o",  "set window opacity",  POFFSET(o),    AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0,  1, FLAGSR },
+    { "wx", "set window x offset", POFFSET(wx),   AV_OPT_TYPE_FLOAT, {.dbl=-1}, -1,  1, FLAGSR },
+    { "wy", "set window y offset", POFFSET(wy),   AV_OPT_TYPE_FLOAT, {.dbl=-1}, -1,  1, FLAGSR },
     { NULL }
 };
 
@@ -709,6 +709,18 @@ static int pixscope_filter_frame(AVFilterLink *inlink, AVFrame *in)
     return ff_filter_frame(outlink, out);
 }
 
+static int pixscope_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 pixscope_config_input(ctx->inputs[0]);
+}
+
 static const AVFilterPad pixscope_inputs[] = {
     {
         .name           = "default",
@@ -736,6 +748,7 @@ AVFilter ff_vf_pixscope = {
     .inputs        = pixscope_inputs,
     .outputs       = pixscope_outputs,
     .flags         = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC,
+    .process_command = pixscope_process_command,
 };
 
 typedef struct PixelValues {



More information about the ffmpeg-cvslog mailing list