diff options
author | wm4 <wm4@nowhere> | 2014-07-21 19:35:20 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-07-21 19:35:20 +0200 |
commit | 17256f13dcf47dd8493f888ff7879b6c25928852 (patch) | |
tree | 48c679ad8bb3a835716525cad368bef5ec0acb7e /player | |
parent | a84517c1d852525206dee83649257b34589f86db (diff) | |
download | mpv-17256f13dcf47dd8493f888ff7879b6c25928852.tar.bz2 mpv-17256f13dcf47dd8493f888ff7879b6c25928852.tar.xz |
osd: properly handle OSD bar timeout
This could just remain stuck on the screen, until the playloop happened
to be run again.
Diffstat (limited to 'player')
-rw-r--r-- | player/osd.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/player/osd.c b/player/osd.c index 41d0b8d160..2c0986e2df 100644 --- a/player/osd.c +++ b/player/osd.c @@ -295,10 +295,15 @@ static mp_osd_msg_t *get_osd_msg(struct MPContext *mpctx) double now = mp_time_sec(); double diff; - if (mpctx->osd_visible && now >= mpctx->osd_visible) { - mpctx->osd_visible = 0; - mpctx->osd_progbar.type = -1; // disable - osd_set_progbar(mpctx->osd, &mpctx->osd_progbar); + if (mpctx->osd_visible) { + double sleep = mpctx->osd_visible - now; + if (sleep > 0) { + mpctx->sleeptime = MPMIN(mpctx->sleeptime, sleep); + } else { + mpctx->osd_visible = 0; + mpctx->osd_progbar.type = -1; // disable + osd_set_progbar(mpctx->osd, &mpctx->osd_progbar); + } } if (mpctx->osd_function_visible && now >= mpctx->osd_function_visible) { mpctx->osd_function_visible = 0; @@ -342,6 +347,7 @@ void set_osd_bar(struct MPContext *mpctx, int type, const char* name, if (mpctx->video_out && opts->term_osd != 1) { mpctx->osd_visible = mp_time_sec() + opts->osd_duration / 1000.0; + mpctx->sleeptime = 0; mpctx->osd_progbar.type = type; mpctx->osd_progbar.value = (val - min) / (max - min); mpctx->osd_progbar.num_stops = 0; |