History

avfilter/vf_datascope: add commands support

Paul B Mahol committed 5 years ago

Commit aa8adc91 parent 82aab8a2 files · +29 −12Browse files

Unified · Split

2 files
  1. doc/filters.texi +4 −0
  2. libavfilter/vf_datascope.c +25 −12
doc/filters.texi+4−0
@@ -9358,6 +9358,10 @@ Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{he · 9357 unmodified lines
93589358 Set pixel components to display. By default all pixel components are displayed.
93599359 @end table
93609360
9361+@subsection Commands
9362+
9363+This filter supports same @ref{commands} as options excluding @code{size} option.
9364+
93619365 @section dblur
93629366 Apply Directional blur filter.
93639367
libavfilter/vf_datascope.c+25−12
@@ -61,18 +61,18 @@ typedef struct DatascopeContext { · 60 unmodified lines
6161 static const AVOption datascope_options[] = {
6262 { "size", "set output size", OFFSET(ow), AV_OPT_TYPE_IMAGE_SIZE, {.str="hd720"}, 0, 0, FLAGS },
6363 { "s", "set output size", OFFSET(ow), AV_OPT_TYPE_IMAGE_SIZE, {.str="hd720"}, 0, 0, FLAGS },
64− { "x", "set x offset", OFFSET(x), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGS },
65− { "y", "set y offset", OFFSET(y), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGS },
66− { "mode", "set scope mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 2, FLAGS, "mode" },
67− { "mono", NULL, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "mode" },
68− { "color", NULL, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "mode" },
69− { "color2", NULL, 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGS, "mode" },
70− { "axis", "draw column/row numbers", OFFSET(axis), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
71− { "opacity", "set background opacity", OFFSET(opacity), AV_OPT_TYPE_FLOAT, {.dbl=0.75}, 0, 1, FLAGS },
72− { "format", "set display number format", OFFSET(dformat), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, "format" },
73− { "hex", NULL, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "format" },
74− { "dec", NULL, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "format" },
75− { "components", "set components to display", OFFSET(components), AV_OPT_TYPE_INT, {.i64=15}, 1, 15, FLAGS },
64+ { "x", "set x offset", OFFSET(x), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGSR },
65+ { "y", "set y offset", OFFSET(y), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGSR },
66+ { "mode", "set scope mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 2, FLAGSR, "mode" },
67+ { "mono", NULL, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGSR, "mode" },
68+ { "color", NULL, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGSR, "mode" },
69+ { "color2", NULL, 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGSR, "mode" },
70+ { "axis", "draw column/row numbers", OFFSET(axis), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGSR },
71+ { "opacity", "set background opacity", OFFSET(opacity), AV_OPT_TYPE_FLOAT, {.dbl=0.75}, 0, 1, FLAGSR },
72+ { "format", "set display number format", OFFSET(dformat), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGSR, "format" },
73+ { "hex", NULL, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGSR, "format" },
74+ { "dec", NULL, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGSR, "format" },
75+ { "components", "set components to display", OFFSET(components), AV_OPT_TYPE_INT, {.i64=15}, 1, 15, FLAGSR },
7676 { NULL }
7777 };
7878
@@ -419,6 +419,18 @@ static int config_output(AVFilterLink *outlink) · 340 unmodified lines
419419 return 0;
420420 }
421421
422+static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
423+ char *res, int res_len, int flags)
424+{
425+ int ret;
426+
427+ ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags);
428+ if (ret < 0)
429+ return ret;
430+
431+ return config_input(ctx->inputs[0]);
432+}
433+
422434 static const AVFilterPad inputs[] = {
423435 {
424436 .name = "default",
@@ -447,6 +459,7 @@ AVFilter ff_vf_datascope = { · 22 unmodified lines
447459 .inputs = inputs,
448460 .outputs = outputs,
449461 .flags = AVFILTER_FLAG_SLICE_THREADS,
462+ .process_command = process_command,
450463 };
451464
452465 typedef struct PixscopeContext {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t