summaryrefslogtreecommitdiffstats
path: root/player/osd.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-09-16 14:24:15 +0200
committerwm4 <wm4@nowhere>2016-09-16 14:39:45 +0200
commit03fec24e192ea1b5c0cf957a5a64c0db9d33e67a (patch)
tree75f58b93ce56c3f6cd3afdbd3ce028f93dcf35bb /player/osd.c
parentb8ade7c99b830ee9870040bcfc1f2c3d3a64d172 (diff)
downloadmpv-03fec24e192ea1b5c0cf957a5a64c0db9d33e67a.tar.bz2
mpv-03fec24e192ea1b5c0cf957a5a64c0db9d33e67a.tar.xz
player: litter code with explicit wakeup calls
This does 3 kinds of changes: - change sleeptime=x to mp_set_timeout() - change sleeptime=0 to mp_wakeup_core() calls (to be more explicit) - change commands etc. to call mp_wakeup_core() if they do changes that require the playloop to be rerun This is preparation for the following changes. The goal is to process client API requests without having to rerun the playloop every time. As of this commit, the changes should not change behavior. In particular, the playloop is still implicitly woken up on every command.
Diffstat (limited to 'player/osd.c')
-rw-r--r--player/osd.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/player/osd.c b/player/osd.c
index 6f26e9361c..4dbdfe4024 100644
--- a/player/osd.c
+++ b/player/osd.c
@@ -304,7 +304,7 @@ static bool set_osd_msg_va(struct MPContext *mpctx, int level, int time,
mpctx->osd_show_pos = false;
mpctx->osd_msg_next_duration = time / 1000.0;
mpctx->osd_force_update = true;
- mpctx->sleeptime = 0;
+ mp_wakeup_core(mpctx);
if (mpctx->osd_msg_next_duration <= 0)
mpctx->osd_msg_visible = mp_time_sec();
return true;
@@ -330,7 +330,6 @@ void set_osd_bar(struct MPContext *mpctx, int type,
return;
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;
@@ -340,6 +339,7 @@ void set_osd_bar(struct MPContext *mpctx, int type,
mpctx->osd_progbar.num_stops, pos);
}
osd_set_progbar(mpctx->osd, &mpctx->osd_progbar);
+ mp_wakeup_core(mpctx);
}
// Update a currently displayed bar of the same type, without resetting the
@@ -387,6 +387,7 @@ void set_osd_bar_chapters(struct MPContext *mpctx, int type)
}
}
osd_set_progbar(mpctx->osd, &mpctx->osd_progbar);
+ mp_wakeup_core(mpctx);
}
// osd_function is the symbol appearing in the video status, such as OSD_PLAY
@@ -397,7 +398,7 @@ void set_osd_function(struct MPContext *mpctx, int osd_function)
mpctx->osd_function = osd_function;
mpctx->osd_function_visible = mp_time_sec() + opts->osd_duration / 1000.0;
mpctx->osd_force_update = true;
- mpctx->sleeptime = 0;
+ mp_wakeup_core(mpctx);
}
void get_current_osd_sym(struct MPContext *mpctx, char *buf, size_t buf_size)
@@ -504,7 +505,7 @@ void update_osd_msg(struct MPContext *mpctx)
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);
+ mp_set_timeout(mpctx, delay - diff);
return;
}
}
@@ -515,7 +516,7 @@ void update_osd_msg(struct MPContext *mpctx)
if (mpctx->osd_visible) {
double sleep = mpctx->osd_visible - now;
if (sleep > 0) {
- mpctx->sleeptime = MPMIN(mpctx->sleeptime, sleep);
+ mp_set_timeout(mpctx, sleep);
mpctx->osd_idle_update = true;
} else {
mpctx->osd_visible = 0;
@@ -527,7 +528,7 @@ void update_osd_msg(struct MPContext *mpctx)
if (mpctx->osd_function_visible) {
double sleep = mpctx->osd_function_visible - now;
if (sleep > 0) {
- mpctx->sleeptime = MPMIN(mpctx->sleeptime, sleep);
+ mp_set_timeout(mpctx, sleep);
mpctx->osd_idle_update = true;
} else {
mpctx->osd_function_visible = 0;
@@ -545,7 +546,7 @@ void update_osd_msg(struct MPContext *mpctx)
if (mpctx->osd_msg_visible) {
double sleep = mpctx->osd_msg_visible - now;
if (sleep > 0) {
- mpctx->sleeptime = MPMIN(mpctx->sleeptime, sleep);
+ mp_set_timeout(mpctx, sleep);
mpctx->osd_idle_update = true;
} else {
talloc_free(mpctx->osd_msg_text);