summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-10-06 22:19:24 +0200
committerwm4 <wm4@nowhere>2014-10-06 22:19:24 +0200
commita9e6ba1b9a8756e7c6163f74b3c57ff794a624b6 (patch)
tree7edd25e0b87e6b8a1eebabdfe44c8f817a2fa5e3
parent45c8b97efbaff7a5031b008223eeed56f7b0607a (diff)
downloadmpv-a9e6ba1b9a8756e7c6163f74b3c57ff794a624b6.tar.bz2
mpv-a9e6ba1b9a8756e7c6163f74b3c57ff794a624b6.tar.xz
osd: don't let slow commands cut OSD messages short
Done for screenshot commands, requested by a user.
-rw-r--r--player/core.h1
-rw-r--r--player/osd.c9
2 files changed, 9 insertions, 1 deletions
diff --git a/player/core.h b/player/core.h
index 3b4a9f1fa1..390f8da7b8 100644
--- a/player/core.h
+++ b/player/core.h
@@ -174,6 +174,7 @@ typedef struct MPContext {
int osd_function;
double osd_function_visible;
double osd_msg_visible;
+ double osd_msg_next_duration;
double osd_last_update;
bool osd_force_update;
char *osd_msg_text;
diff --git a/player/osd.c b/player/osd.c
index 2d15c9b904..605c4b6757 100644
--- a/player/osd.c
+++ b/player/osd.c
@@ -271,7 +271,7 @@ static bool set_osd_msg_va(struct MPContext *mpctx, int level, int time,
talloc_free(mpctx->osd_msg_text);
mpctx->osd_msg_text = talloc_vasprintf(mpctx, fmt, ap);
mpctx->osd_show_pos = false;
- mpctx->osd_msg_visible = mp_time_sec() + time / 1000.0;
+ mpctx->osd_msg_next_duration = time / 1000.0;
mpctx->osd_force_update = true;
mpctx->sleeptime = 0;
return true;
@@ -477,6 +477,13 @@ void update_osd_msg(struct MPContext *mpctx)
mpctx->osd_function = 0;
}
+ if (mpctx->osd_msg_next_duration > 0) {
+ // This is done to avoid cutting the OSD message short if slow commands
+ // are executed between setting the OSD message and showing it.
+ mpctx->osd_msg_visible = now + mpctx->osd_msg_next_duration;
+ mpctx->osd_msg_next_duration = 0;
+ }
+
if (mpctx->osd_msg_visible) {
double sleep = mpctx->osd_msg_visible - now;
if (sleep > 0) {