avfilter/vf_frei0r: add support for commands

This commit is contained in:
Paul B Mahol 2020-11-19 11:53:10 +01:00
parent 17a0dfebf5
commit 381ab69042
2 changed files with 20 additions and 1 deletions

View File

@ -11784,6 +11784,10 @@ frei0r=perspective:0.2/0.2|0.8/0.2
For more information, see
@url{http://frei0r.dyne.org}
@subsection Commands
This filter supports the @option{filter_params} option as @ref{commands}.
@section fspp
Apply fast and simple postprocessing. It is a faster version of @ref{spp}.

View File

@ -371,11 +371,25 @@ 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)
{
Frei0rContext *s = ctx->priv;
int ret;
ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags);
if (ret < 0)
return ret;
return set_params(ctx, s->params);
}
#define OFFSET(x) offsetof(Frei0rContext, x)
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
#define TFLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_RUNTIME_PARAM
static const AVOption frei0r_options[] = {
{ "filter_name", NULL, OFFSET(dl_name), AV_OPT_TYPE_STRING, .flags = FLAGS },
{ "filter_params", NULL, OFFSET(params), AV_OPT_TYPE_STRING, .flags = FLAGS },
{ "filter_params", NULL, OFFSET(params), AV_OPT_TYPE_STRING, .flags = TFLAGS },
{ NULL }
};
@ -409,6 +423,7 @@ AVFilter ff_vf_frei0r = {
.priv_class = &frei0r_class,
.inputs = avfilter_vf_frei0r_inputs,
.outputs = avfilter_vf_frei0r_outputs,
.process_command = process_command,
};
static av_cold int source_init(AVFilterContext *ctx)