diff options
author | Paul B Mahol <onemda@gmail.com> | 2020-12-15 20:31:25 +0100 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2020-12-15 20:35:01 +0100 |
commit | 32586a42da8c9dedd30c6e4c0417c9da91c1f283 (patch) | |
tree | 6d38aa68817486bd12c8ec5d109b864e1953e6d1 /libavfilter/vf_limiter.c | |
parent | cd821c18dc8bc5949f4b4d13f07157928ae22bba (diff) | |
download | ffmpeg-32586a42da8c9dedd30c6e4c0417c9da91c1f283.tar.gz |
avfilter/vf_limiter: add support for commands
Diffstat (limited to 'libavfilter/vf_limiter.c')
-rw-r--r-- | libavfilter/vf_limiter.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/libavfilter/vf_limiter.c b/libavfilter/vf_limiter.c index 8db28fee64..1779c63944 100644 --- a/libavfilter/vf_limiter.c +++ b/libavfilter/vf_limiter.c @@ -46,7 +46,7 @@ typedef struct LimiterContext { } LimiterContext; #define OFFSET(x) offsetof(LimiterContext, x) -#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM +#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM static const AVOption limiter_options[] = { { "min", "set min value", OFFSET(min), AV_OPT_TYPE_INT, {.i64=0}, 0, 65535, .flags = FLAGS }, @@ -133,7 +133,7 @@ static void limiter16(const uint8_t *ssrc, uint8_t *ddst, } } -static int config_props(AVFilterLink *inlink) +static int config_input(AVFilterLink *inlink) { AVFilterContext *ctx = inlink->dst; LimiterContext *s = ctx->priv; @@ -230,12 +230,24 @@ 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) +{ + int ret; + + ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags); + if (ret < 0) + return ret; + + return config_input(ctx->inputs[0]); +} + static const AVFilterPad inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, - .config_props = config_props, + .config_props = config_input, }, { NULL } }; @@ -258,4 +270,5 @@ AVFilter ff_vf_limiter = { .inputs = inputs, .outputs = outputs, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, + .process_command = process_command, }; |