summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--player/core.h1
-rw-r--r--player/osd.c22
-rw-r--r--player/playloop.c2
-rw-r--r--player/video.c3
4 files changed, 18 insertions, 10 deletions
diff --git a/player/core.h b/player/core.h
index 11421ce485..a60e13a3e7 100644
--- a/player/core.h
+++ b/player/core.h
@@ -184,6 +184,7 @@ typedef struct MPContext {
int osd_function;
double osd_function_visible;
double osd_last_update;
+ bool osd_force_update;
struct osd_progbar_state osd_progbar;
struct playlist *playlist;
diff --git a/player/osd.c b/player/osd.c
index 26fee5dec3..757af6a4c6 100644
--- a/player/osd.c
+++ b/player/osd.c
@@ -287,6 +287,7 @@ static mp_osd_msg_t *add_osd_msg(struct MPContext *mpctx, int level, int time)
.msg = "",
.time = time / 1000.0,
});
+ mpctx->osd_force_update = true;
return mpctx->osd_msg_stack;
}
@@ -519,20 +520,23 @@ static void add_seek_osd_messages(struct MPContext *mpctx)
mpctx->add_osd_seek_info = 0;
}
-/**
- * \brief Update the OSD message line.
- *
- * This function displays the current message on the vo OSD or on the term.
- * If the stack is empty and the OSD level is high enough the timer
- * is displayed (only on the vo OSD).
- *
- */
-
+// Update the OSD text (both on VO and terminal status line).
void update_osd_msg(struct MPContext *mpctx)
{
struct MPOpts *opts = mpctx->opts;
struct osd_state *osd = mpctx->osd;
+ if (!mpctx->osd_force_update) {
+ double now = mp_time_sec();
+ double delay = 0.050; // update the OSD at most this often
+ double diff = now - mpctx->osd_last_update;
+ if (diff < delay) {
+ mpctx->sleeptime = MPMIN(mpctx->sleeptime, delay - diff);
+ return;
+ }
+ }
+ mpctx->osd_force_update = false;
+
add_seek_osd_messages(mpctx);
double pos = get_current_pos_ratio(mpctx, false);
update_osd_bar(mpctx, OSD_BAR_SEEK, 0, 1, MPCLAMP(pos, 0, 1));
diff --git a/player/playloop.c b/player/playloop.c
index 00067302f2..c9eba1b9c2 100644
--- a/player/playloop.c
+++ b/player/playloop.c
@@ -87,6 +87,7 @@ void pause_player(struct MPContext *mpctx)
mpctx->step_frames = 0;
mpctx->time_frame -= get_relative_time(mpctx);
mpctx->osd_function = 0;
+ mpctx->osd_force_update = true;
mpctx->paused_for_cache = false;
if (mpctx->ao && mpctx->d_audio)
@@ -112,6 +113,7 @@ void unpause_player(struct MPContext *mpctx)
goto end;
mpctx->paused = false;
mpctx->osd_function = 0;
+ mpctx->osd_force_update = true;
if (mpctx->ao && mpctx->d_audio)
ao_resume(mpctx->ao);
diff --git a/player/video.c b/player/video.c
index 028132860f..61c7914920 100644
--- a/player/video.c
+++ b/player/video.c
@@ -776,8 +776,9 @@ void write_video(struct MPContext *mpctx, double endpts)
mpctx->last_vo_pts = mpctx->video_pts;
mpctx->playback_pts = mpctx->video_pts;
- update_subtitles(mpctx);
+ mpctx->osd_force_update = true;
update_osd_msg(mpctx);
+ update_subtitles(mpctx);
vo_queue_frame(vo, mpctx->next_frame[0], pts, duration);
mpctx->next_frame[0] = NULL;