[FFmpeg-cvslog] avfilter/vf_avgblur: add support for commands
Paul B Mahol
git at videolan.org
Sun Oct 6 16:47:14 EEST 2019
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Oct 6 15:44:20 2019 +0200| [66d45af13c043d2bb555cef462d73906761ea1ba] | committer: Paul B Mahol
avfilter/vf_avgblur: add support for commands
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=66d45af13c043d2bb555cef462d73906761ea1ba
---
doc/filters.texi | 7 +++++++
libavfilter/vf_avgblur.c | 17 +++++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/doc/filters.texi b/doc/filters.texi
index 59bac58166..777dc3014c 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -6211,6 +6211,13 @@ Set vertical radius size, if zero it will be same as @code{sizeX}.
Default is @code{0}.
@end table
+ at subsection Commands
+This filter supports same commands as options.
+The command accepts the same syntax of the corresponding option.
+
+If the specified expression is not valid, it is kept at its current
+value.
+
@section bbox
Compute the bounding box for the non-black pixels in the input frame
diff --git a/libavfilter/vf_avgblur.c b/libavfilter/vf_avgblur.c
index fdc9d39ce1..a1f6c9b80e 100644
--- a/libavfilter/vf_avgblur.c
+++ b/libavfilter/vf_avgblur.c
@@ -287,6 +287,22 @@ 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)
+{
+ AverageBlurContext *s = ctx->priv;
+ int ret = 0;
+
+ if ( !strcmp(cmd, "sizeX") || !strcmp(cmd, "sizeY")
+ || !strcmp(cmd, "planes")) {
+ av_opt_set(s, cmd, args, 0);
+ } else {
+ ret = AVERROR(ENOSYS);
+ }
+
+ return ret;
+}
+
static av_cold void uninit(AVFilterContext *ctx)
{
AverageBlurContext *s = ctx->priv;
@@ -322,4 +338,5 @@ AVFilter ff_vf_avgblur = {
.inputs = avgblur_inputs,
.outputs = avgblur_outputs,
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS,
+ .process_command = process_command,
};
More information about the ffmpeg-cvslog
mailing list