avfilter/vf_limiter: add support for commands

This commit is contained in:
Paul B Mahol 2020-12-15 20:31:25 +01:00
parent cd821c18dc
commit 32586a42da
2 changed files with 20 additions and 3 deletions

View File

@ -13551,6 +13551,10 @@ Upper bound. Defaults to the highest allowed value for the input.
Specify which planes will be processed. Defaults to all available.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@section loop
Loop video frames.

View File

@ -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,
};