History

avfilter/vf_atadenoise: add support for commands

Paul B Mahol committed 7 years ago

Commit 357f11e1 parent 824b0262 files · +25 −4Browse files

Unified · Split

2 files
  1. doc/filters.texi +4 −0
  2. libavfilter/vf_atadenoise.c +21 −4
doc/filters.texi+4−0
@@ -6281,6 +6281,10 @@ Parallel will abort early on first change being greater then thresholds, while s · 6280 unmodified lines
62816281 will continue processing other side of frames if they are equal or bellow thresholds.
62826282 @end table
62836283
6284+@subsection Commands
6285+This filter supports same @ref{commands} as options except option @code{s}.
6286+The command accepts the same syntax of the corresponding option.
6287+
62846288 @section avgblur
62856289
62866290 Apply average blur filter.
libavfilter/vf_atadenoise.c+21−4
@@ -64,7 +64,8 @@ typedef struct ATADenoiseContext { · 63 unmodified lines
6464 } ATADenoiseContext;
6565
6666 #define OFFSET(x) offsetof(ATADenoiseContext, x)
67−#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
67+#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
68+#define VF AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
6869
6970 static const AVOption atadenoise_options[] = {
7071 { "0a", "set threshold A for 1st plane", OFFSET(fthra[0]), AV_OPT_TYPE_FLOAT, {.dbl=0.02}, 0, 0.3, FLAGS },
@@ -73,11 +74,11 @@ static const AVOption atadenoise_options[] = { · 2 unmodified lines
7374 { "1b", "set threshold B for 2nd plane", OFFSET(fthrb[1]), AV_OPT_TYPE_FLOAT, {.dbl=0.04}, 0, 5.0, FLAGS },
7475 { "2a", "set threshold A for 3rd plane", OFFSET(fthra[2]), AV_OPT_TYPE_FLOAT, {.dbl=0.02}, 0, 0.3, FLAGS },
7576 { "2b", "set threshold B for 3rd plane", OFFSET(fthrb[2]), AV_OPT_TYPE_FLOAT, {.dbl=0.04}, 0, 5.0, FLAGS },
76− { "s", "set how many frames to use", OFFSET(size), AV_OPT_TYPE_INT, {.i64=9}, 5, SIZE, FLAGS },
77+ { "s", "set how many frames to use", OFFSET(size), AV_OPT_TYPE_INT, {.i64=9}, 5, SIZE, VF },
7778 { "p", "set what planes to filter", OFFSET(planes), AV_OPT_TYPE_FLAGS, {.i64=7}, 0, 15, FLAGS },
7879 { "a", "set variant of algorithm", OFFSET(algorithm),AV_OPT_TYPE_INT, {.i64=PARALLEL}, 0, NB_ATAA-1, FLAGS, "a" },
79− { "p", "parallel", 0, AV_OPT_TYPE_CONST, {.i64=PARALLEL}, 0, 0, FLAGS, "a" },
80− { "s", "serial", 0, AV_OPT_TYPE_CONST, {.i64=SERIAL}, 0, 0, FLAGS, "a" },
80+ { "p", "parallel", 0, AV_OPT_TYPE_CONST, {.i64=PARALLEL}, 0, 0, FLAGS, "a" },
81+ { "s", "serial", 0, AV_OPT_TYPE_CONST, {.i64=SERIAL}, 0, 0, FLAGS, "a" },
8182 { NULL }
8283 };
8384
@@ -404,6 +405,21 @@ static av_cold void uninit(AVFilterContext *ctx) · 320 unmodified lines
404405 ff_bufqueue_discard_all(&s->q);
405406 }
406407
408+static int process_command(AVFilterContext *ctx,
409+ const char *cmd,
410+ const char *arg,
411+ char *res,
412+ int res_len,
413+ int flags)
414+{
415+ int ret = ff_filter_process_command(ctx, cmd, arg, res, res_len, flags);
416+
417+ if (ret < 0)
418+ return ret;
419+
420+ return config_input(ctx->inputs[0]);
421+}
422+
407423 static const AVFilterPad inputs[] = {
408424 {
409425 .name = "default",
@@ -434,4 +450,5 @@ AVFilter ff_vf_atadenoise = { · 24 unmodified lines
434450 .inputs = inputs,
435451 .outputs = outputs,
436452 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS,
453+ .process_command = process_command,
437454 };

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