diff options
author | Paul B Mahol <onemda@gmail.com> | 2015-12-28 20:14:46 +0300 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2015-12-28 20:16:10 +0300 |
commit | 67771ac4b894112b743b37e6df24b0d4f27a120b (patch) | |
tree | 27d3090e1ffeee0ff3496bbb05514ea6e9c2beda /libavfilter/avf_showspectrum.c | |
parent | b9c46b5242bf338f6e57bc6a4380e69be83c058c (diff) |
avfilter/avf_showspectrum: add rscroll sliding mode
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavfilter/avf_showspectrum.c')
-rw-r--r-- | libavfilter/avf_showspectrum.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c index f6f16fc655..384bad5802 100644 --- a/libavfilter/avf_showspectrum.c +++ b/libavfilter/avf_showspectrum.c @@ -38,7 +38,7 @@ enum DisplayMode { COMBINED, SEPARATE, NB_MODES }; enum DisplayScale { LINEAR, SQRT, CBRT, LOG, NB_SCALES }; enum ColorMode { CHANNEL, INTENSITY, NB_CLMODES }; enum WindowFunc { WFUNC_NONE, WFUNC_HANN, WFUNC_HAMMING, WFUNC_BLACKMAN, NB_WFUNC }; -enum SlideMode { REPLACE, SCROLL, FULLFRAME, NB_SLIDES }; +enum SlideMode { REPLACE, SCROLL, FULLFRAME, RSCROLL, NB_SLIDES }; typedef struct { const AVClass *class; @@ -66,9 +66,10 @@ typedef struct { static const AVOption showspectrum_options[] = { { "size", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "640x512"}, 0, 0, FLAGS }, { "s", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "640x512"}, 0, 0, FLAGS }, - { "slide", "set sliding mode", OFFSET(sliding), AV_OPT_TYPE_INT, {.i64 = 0}, 0, NB_SLIDES, FLAGS, "slide" }, + { "slide", "set sliding mode", OFFSET(sliding), AV_OPT_TYPE_INT, {.i64 = 0}, 0, NB_SLIDES-1, FLAGS, "slide" }, { "replace", "replace old columns with new", 0, AV_OPT_TYPE_CONST, {.i64=REPLACE}, 0, 0, FLAGS, "slide" }, { "scroll", "scroll from right to left", 0, AV_OPT_TYPE_CONST, {.i64=SCROLL}, 0, 0, FLAGS, "slide" }, + { "rscroll", "scroll from left to right", 0, AV_OPT_TYPE_CONST, {.i64=RSCROLL}, 0, 0, FLAGS, "slide" }, { "fullframe", "return full frames", 0, AV_OPT_TYPE_CONST, {.i64=FULLFRAME}, 0, 0, FLAGS, "slide" }, { "mode", "set channel display mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=COMBINED}, COMBINED, NB_MODES-1, FLAGS, "mode" }, { "combined", "combined mode", 0, AV_OPT_TYPE_CONST, {.i64=COMBINED}, 0, 0, FLAGS, "mode" }, @@ -442,6 +443,15 @@ static int plot_spectrum_column(AVFilterLink *inlink, AVFrame *insamples) } } s->xpos = outlink->w - 1; + } else if (s->sliding == RSCROLL) { + for (plane = 0; plane < 3; plane++) { + for (y = 0; y < outlink->h; y++) { + uint8_t *p = outpicref->data[plane] + + y * outpicref->linesize[plane]; + memmove(p + 1, p, outlink->w - 1); + } + } + s->xpos = 0; } for (plane = 0; plane < 3; plane++) { uint8_t *p = outpicref->data[plane] + |