[FFmpeg-cvslog] lavfi/rotate: add angle command

Stefano Sabatini git at videolan.org
Thu Jun 13 01:43:10 CEST 2013


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Tue Jun 11 16:02:39 2013 +0200| [e0135a4bcdc1bc74760c1f2fcd88f92b3445e822] | committer: Stefano Sabatini

lavfi/rotate: add angle command

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e0135a4bcdc1bc74760c1f2fcd88f92b3445e822
---

 doc/filters.texi        |   13 +++++++++++++
 libavfilter/version.h   |    2 +-
 libavfilter/vf_rotate.c |   24 ++++++++++++++++++++++++
 3 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 282355a..c0bd281 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -5883,6 +5883,19 @@ rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
 @end example
 @end itemize
 
+ at subsection Commands
+
+The filter supports the following commands:
+
+ at table @option
+ at item a, angle
+Set the angle 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.
+ at end table
+
 @section sab
 
 Apply Shape Adaptive Blur.
diff --git a/libavfilter/version.h b/libavfilter/version.h
index c71cce6..4485a7f 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -31,7 +31,7 @@
 
 #define LIBAVFILTER_VERSION_MAJOR  3
 #define LIBAVFILTER_VERSION_MINOR  76
-#define LIBAVFILTER_VERSION_MICRO 100
+#define LIBAVFILTER_VERSION_MICRO 101
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
                                                LIBAVFILTER_VERSION_MINOR, \
diff --git a/libavfilter/vf_rotate.c b/libavfilter/vf_rotate.c
index b2fe661..a032f99 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,



More information about the ffmpeg-cvslog mailing list