avfilter/vf_lumakey: add support for commands

This commit is contained in:
Paul B Mahol 2019-11-21 16:59:39 +01:00
parent 6b9862f614
commit ae6c4168e6
2 changed files with 22 additions and 2 deletions

View File

@ -12609,13 +12609,20 @@ Default value is @code{0}.
@item tolerance
Set the range of luma values to be keyed out.
Default value is @code{0}.
Default value is @code{0.01}.
@item softness
Set the range of softness. Default value is @code{0}.
Use this to control gradual transition from zero to full transparency.
@end table
@subsection Commands
This filter supports same @ref{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 lut, lutrgb, lutyuv
Compute a look-up table for binding each pixel component input value

View File

@ -163,6 +163,18 @@ static av_cold int query_formats(AVFilterContext *ctx)
return ff_set_common_formats(ctx, formats);
}
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 lumakey_inputs[] = {
{
.name = "default",
@ -182,7 +194,7 @@ static const AVFilterPad lumakey_outputs[] = {
};
#define OFFSET(x) offsetof(LumakeyContext, 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 lumakey_options[] = {
{ "threshold", "set the threshold value", OFFSET(threshold), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, 1, FLAGS },
@ -202,4 +214,5 @@ AVFilter ff_vf_lumakey = {
.inputs = lumakey_inputs,
.outputs = lumakey_outputs,
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS,
.process_command = process_command,
};