diff options
author | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2020-11-25 19:33:35 +0200 |
---|---|---|
committer | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2020-11-27 00:25:32 +0200 |
commit | 1bb2665e3d099a792cf9c4e5b119a6b4352d9b2f (patch) | |
tree | 2b9f2d8626430142002017808e7d36051d34f106 | |
parent | 9867f218307241961f9e7220085a9e3c23cab0af (diff) | |
download | mpv-1bb2665e3d099a792cf9c4e5b119a6b4352d9b2f.tar.bz2 mpv-1bb2665e3d099a792cf9c4e5b119a6b4352d9b2f.tar.xz |
vo_sixel: support --vo-sixel-exit-clear[=yes]
By default we still clear the screen, but now it's possible to leave the
last sixel image on screen.
Allows mpv to be used as img2sixel of sorts, but with our auto-fit and
various mpv scaling/filters etc.
-rw-r--r-- | DOCS/man/vo.rst | 4 | ||||
-rw-r--r-- | video/out/vo_sixel.c | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/DOCS/man/vo.rst b/DOCS/man/vo.rst index 833fbddb1b..4a1ffd4579 100644 --- a/DOCS/man/vo.rst +++ b/DOCS/man/vo.rst @@ -413,6 +413,10 @@ Available video output drivers are: to take into account padding at the report - this only works correctly when the overall padding per axis is smaller than the number of cells. + ``--vo-sixel-exit-clear=<yes|no>`` (default: yes) + Whether or not to clear the terminal on quit. When set to no - the last + sixel image stays on screen after quit, with the cursor following it. + Sixel image quality options: ``--vo-sixel-dither=<algo>`` diff --git a/video/out/vo_sixel.c b/video/out/vo_sixel.c index 8318c5190c..a1fb04bd59 100644 --- a/video/out/vo_sixel.c +++ b/video/out/vo_sixel.c @@ -63,6 +63,7 @@ struct priv { int opt_pad_x; int opt_rows; int opt_cols; + int opt_clear; // Internal data sixel_output_t *output; @@ -442,8 +443,10 @@ static void uninit(struct vo *vo) printf(ESC_RESTORE_CURSOR); - printf(ESC_CLEAR_SCREEN); - printf(ESC_GOTOXY, 1, 1); + if (priv->opt_clear) { + printf(ESC_CLEAR_SCREEN); + printf(ESC_GOTOXY, 1, 1); + } fflush(stdout); if (priv->output) { @@ -480,6 +483,7 @@ const struct vo_driver video_out_sixel = { .opt_pad_x = -1, .opt_rows = 0, .opt_cols = 0, + .opt_clear = 1, }, .options = (const m_option_t[]) { {"dither", OPT_CHOICE(opt_diffuse, @@ -503,6 +507,7 @@ const struct vo_driver video_out_sixel = { {"pad-x", OPT_INT(opt_pad_x)}, {"rows", OPT_INT(opt_rows)}, {"cols", OPT_INT(opt_cols)}, + {"exit-clear", OPT_FLAG(opt_clear), }, {0} }, .options_prefix = "vo-sixel", |