summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2021-02-13 12:32:59 +0100
committerPaul B Mahol <onemda@gmail.com>2021-02-13 12:38:15 +0100
commitbbf6183e11e1d4514d87edc61d5c3f1e2951ffa2 (patch)
tree68a9b8e8b507632014347916752d91dc0b94fb16
parent59bb9dc2a670cbe5d659585392b6d79f7bb6d40f (diff)
avfilter/vf_datascope: pixscope: add commands support
-rw-r--r--doc/filters.texi4
-rw-r--r--libavfilter/vf_datascope.c27
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
+@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 {