summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorShreesh Adiga <16567adigashreesh@gmail.com>2020-12-02 11:05:39 +0200
committeravih <avih@users.noreply.github.com>2020-12-02 17:06:11 +0200
commitda48bb6709b83b2cc7ba4aa370fb4ef0daf24ae7 (patch)
tree20533803e6dd85adfa4002d101fd348436fcdb39 /video
parent3fd656ee7b85bf431c73251ebeaf535fb58e8ccb (diff)
downloadmpv-da48bb6709b83b2cc7ba4aa370fb4ef0daf24ae7.tar.bz2
mpv-da48bb6709b83b2cc7ba4aa370fb4ef0daf24ae7.tar.xz
vo_sixel: re-fit image on terminal resize
The obvious approach would be SIGWINCH, however, integrating it would be tricky, so instead we simply poll the size on draw_frame. This means the image won't resize automatically when still - e.g. cover art or when paused, though it would re-fit on OSD changes.
Diffstat (limited to 'video')
-rw-r--r--video/out/vo_sixel.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/video/out/vo_sixel.c b/video/out/vo_sixel.c
index 961e531ce3..627e69f81a 100644
--- a/video/out/vo_sixel.c
+++ b/video/out/vo_sixel.c
@@ -346,7 +346,26 @@ static void draw_frame(struct vo *vo, struct vo_frame *frame)
SIXELSTATUS status;
struct mp_image *mpi = NULL;
- if (frame->repeat && !frame->redraw) {
+ int prev_rows = priv->num_rows;
+ int prev_cols = priv->num_cols;
+ int prev_height = vo->dheight;
+ int prev_width = vo->dwidth;
+ bool resized = false;
+ update_canvas_dimensions(vo);
+
+ if (prev_rows != priv->num_rows || prev_cols != priv->num_cols ||
+ prev_width != vo->dwidth || prev_height != vo->dheight)
+ {
+ set_sixel_output_parameters(vo);
+ // Not checking for vo->config_ok because draw_frame is never called
+ // with a failed reconfig.
+ update_sixel_swscaler(vo, vo->params);
+
+ printf(ESC_CLEAR_SCREEN);
+ resized = true;
+ }
+
+ if (frame->repeat && !frame->redraw && !resized) {
// Frame is repeated, and no need to update OSD either
priv->skip_frame_draw = true;
return;