aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2015-09-02 06:06:02 +0000
committerPaul B Mahol <onemda@gmail.com>2015-09-03 09:12:14 +0000
commit8d2b4b8c8299ea9b957cff4a05f4707f43ddb453 (patch)
tree63f94e5846bab1c49971e870825d142e0dd62355
parent81f7a2579b08cba98eaf6a5b3bf73d0ec15b5af3 (diff)
downloadffmpeg-8d2b4b8c8299ea9b957cff4a05f4707f43ddb453.tar.gz
avfilter/vf_drawgraph: add rscroll slide mode
Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r--doc/filters.texi3
-rw-r--r--libavfilter/f_drawgraph.c18
2 files changed, 16 insertions, 5 deletions
diff --git a/doc/filters.texi b/doc/filters.texi
index 67fe420103..162958fab0 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.
+
+@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 d6959bc6ad..2b9340b500 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--)