Commit 99ad832c authored by Bernd Bleßmann's avatar Bernd Bleßmann Committed by Michael Niedermayer

libavfilter/vf_scale: implement process_command

Signed-off-by: 's avatarBernd Bleßmann <bb@it-entwicklung.de>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent d32547a2
......@@ -8906,6 +8906,19 @@ scale=w='min(500\, iw*3/2):h=-1'
@end example
@end itemize
@subsection Commands
This filter supports the following commands:
@table @option
@item width, w
@item height, h
Set the output video dimension expression.
The command accepts the same syntax of the corresponding option.
If the specified expression is not valid, it is kept at its current
value.
@end table
@section separatefields
The @code{separatefields} takes a frame-based video input and splits
......
......@@ -544,6 +544,30 @@ static int filter_frame(AVFilterLink *link, 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)
{
ScaleContext *scale = ctx->priv;
int ret;
if ( !strcmp(cmd, "width") || !strcmp(cmd, "w")
|| !strcmp(cmd, "height") || !strcmp(cmd, "h")) {
int old_w = scale->w;
int old_h = scale->h;
AVFilterLink *outlink = ctx->outputs[0];
av_opt_set(scale, cmd, args, 0);
if ((ret = config_props(outlink)) < 0) {
scale->w = old_w;
scale->h = old_h;
}
} else
ret = AVERROR(ENOSYS);
return ret;
}
static const AVClass *child_class_next(const AVClass *prev)
{
return prev ? NULL : sws_get_class();
......@@ -619,4 +643,5 @@ AVFilter ff_vf_scale = {
.priv_class = &scale_class,
.inputs = avfilter_vf_scale_inputs,
.outputs = avfilter_vf_scale_outputs,
.process_command = process_command,
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment