[FFmpeg-cvslog] avfilter/vf_drawgraph: add rscroll slide mode

Paul B Mahol git at videolan.org
Thu Sep 3 11:28:04 CEST 2015


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Wed Sep  2 06:06:02 2015 +0000| [8d2b4b8c8299ea9b957cff4a05f4707f43ddb453] | committer: Paul B Mahol

avfilter/vf_drawgraph: add rscroll slide mode

Signed-off-by: Paul B Mahol <onemda at gmail.com>

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

 doc/filters.texi          |    3 +++
 libavfilter/f_drawgraph.c |   18 +++++++++++++-----
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 67fe420..162958f 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -4496,6 +4496,9 @@ Replace old columns with new ones.
 
 @item scroll
 Scroll from right to left.
+
+ at item rscroll
+Scroll from left to right.
 @end table
 
 Default is @code{frame}.
diff --git a/libavfilter/f_drawgraph.c b/libavfilter/f_drawgraph.c
index d6959bc..2b9340b 100644
--- a/libavfilter/f_drawgraph.c
+++ b/libavfilter/f_drawgraph.c
@@ -65,10 +65,11 @@ static const AVOption drawgraph_options[] = {
         {"bar", "draw bars", OFFSET(mode), AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "mode"},
         {"dot", "draw dots", OFFSET(mode), AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "mode"},
         {"line", "draw lines", OFFSET(mode), AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGS, "mode"},
-    { "slide", "set slide mode", OFFSET(slide), AV_OPT_TYPE_INT, {.i64=0}, 0, 2, FLAGS, "slide" },
+    { "slide", "set slide mode", OFFSET(slide), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS, "slide" },
         {"frame", "draw new frames", OFFSET(slide), AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "slide"},
         {"replace", "replace old columns with new", OFFSET(slide), AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "slide"},
         {"scroll", "scroll from right to left", OFFSET(slide), AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGS, "slide"},
+        {"rscroll", "scroll from left to right", OFFSET(slide), AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, FLAGS, "slide"},
     { "size", "set graph size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str="900x256"}, 0, 0, FLAGS },
     { "s", "set graph size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str="900x256"}, 0, 0, FLAGS },
     { NULL }
@@ -181,7 +182,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
         fg = av_expr_eval(s->fg_expr[i], values, NULL);
         bg = AV_RN32(s->bg);
 
-        if (i == 0 && s->x >= outlink->w) {
+        if (i == 0 && (s->x >= outlink->w || s->slide == 3)) {
             if (s->slide == 0 || s->slide == 1)
                 s->x = 0;
 
@@ -192,6 +193,13 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
                             out->data[0] + j * out->linesize[0] + 4,
                             (outlink->w - 1) * 4);
                 }
+            } else if (s->slide == 3) {
+                s->x = 0;
+                for (j = 0; j < outlink->h; j++) {
+                    memmove(out->data[0] + j * out->linesize[0] + 4,
+                            out->data[0] + j * out->linesize[0],
+                            (outlink->w - 1) * 4);
+                }
             } else if (s->slide == 0) {
                 clear_image(s, out, outlink);
             }
@@ -202,7 +210,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 
         switch (s->mode) {
         case 0:
-            if (i == 0 && (s->slide == 1 || s->slide == 2))
+            if (i == 0 && (s->slide > 0))
                 for (j = 0; j < outlink->h; j++)
                     draw_dot(bg, x, j, out);
 
@@ -218,7 +226,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
             }
             break;
         case 1:
-            if (i == 0 && (s->slide == 1 || s->slide == 2))
+            if (i == 0 && (s->slide > 0))
                 for (j = 0; j < outlink->h; j++)
                     draw_dot(bg, x, j, out);
             draw_dot(fg, x, y, out);
@@ -229,7 +237,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
                 s->prev_y[i] = y;
             }
 
-            if (i == 0 && (s->slide == 1 || s->slide == 2)) {
+            if (i == 0 && (s->slide > 0)) {
                 for (j = 0; j < y; j++)
                     draw_dot(bg, x, j, out);
                 for (j = outlink->h - 1; j > y; j--)



More information about the ffmpeg-cvslog mailing list