diff options
author | Stefano Sabatini <stefasab@gmail.com> | 2013-06-11 16:02:39 +0200 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2013-06-13 01:21:47 +0200 |
commit | e0135a4bcdc1bc74760c1f2fcd88f92b3445e822 (patch) | |
tree | 65e4421e713683534ec8f94a662303083e5818c8 /libavfilter/vf_rotate.c | |
parent | 6397264e84901aecd3c98e2954258d07af79db73 (diff) | |
download | ffmpeg-e0135a4bcdc1bc74760c1f2fcd88f92b3445e822.tar.gz |
lavfi/rotate: add angle command
Diffstat (limited to 'libavfilter/vf_rotate.c')
-rw-r--r-- | libavfilter/vf_rotate.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/libavfilter/vf_rotate.c b/libavfilter/vf_rotate.c index b2fe66197d..a032f99086 100644 --- a/libavfilter/vf_rotate.c +++ b/libavfilter/vf_rotate.c @@ -409,6 +409,29 @@ 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) +{ + RotContext *rot = ctx->priv; + int ret; + + if (!strcmp(cmd, "angle") || !strcmp(cmd, "a")) { + AVExpr *old = rot->angle_expr; + ret = av_expr_parse(&rot->angle_expr, args, var_names, + NULL, NULL, NULL, NULL, 0, ctx); + if (ret < 0) { + av_log(ctx, AV_LOG_ERROR, + "Error when parsing the expression '%s' for angle command\n", args); + rot->angle_expr = old; + return ret; + } + av_expr_free(old); + } else + ret = AVERROR(ENOSYS); + + return ret; +} + static const AVFilterPad rotate_inputs[] = { { .name = "default", @@ -434,6 +457,7 @@ AVFilter avfilter_vf_rotate = { .init = init, .uninit = uninit, .query_formats = query_formats, + .process_command = process_command, .inputs = rotate_inputs, .outputs = rotate_outputs, .priv_class = &rotate_class, |