summaryrefslogtreecommitdiffstats
path: root/core/mplayer.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-02-20 23:05:02 +0100
committerwm4 <wm4@nowhere>2013-02-20 23:43:15 +0100
commit68daee220c305220bfeb8f4f473b981b2d34af70 (patch)
treef2147659ae544c35b3b2ea309a61a03aa504d45f /core/mplayer.c
parentbad027277c8106e1f0176d801d6752a4b18df8e6 (diff)
downloadmpv-68daee220c305220bfeb8f4f473b981b2d34af70.tar.bz2
mpv-68daee220c305220bfeb8f4f473b981b2d34af70.tar.xz
osd: prevent osd bar from sticking around on seeks
This was supposed to be fixed in f897138, but there's another corner case. Basically, set_osd_function() reset the OSD time, which is not nice at all and breaks the logic of letting OSD elements disappear when they're not wanted anymore. Fix this by adding a separate timer for this. Additionally, make sure the OSD bar is _really_ always updated when visible. Also, redraw the OSD only if the OSD bar actually changes to prevent redrawing too often (every vo_osd_changed() will flag that the OSD should be redrawn, even if nothing changes).
Diffstat (limited to 'core/mplayer.c')
-rw-r--r--core/mplayer.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/core/mplayer.c b/core/mplayer.c
index f442fa24a8..0e4e1076b8 100644
--- a/core/mplayer.c
+++ b/core/mplayer.c
@@ -1311,6 +1311,11 @@ static mp_osd_msg_t *get_osd_msg(struct MPContext *mpctx)
mpctx->osd_visible = 0;
mpctx->osd->progbar_type = -1; // disable
vo_osd_changed(OSDTYPE_PROGBAR);
+ }
+ }
+ if (mpctx->osd_function_visible) {
+ if (mpctx->osd_function_visible - now > 36000000) {
+ mpctx->osd_function_visible = 0;
mpctx->osd_function = 0;
}
}
@@ -1380,8 +1385,11 @@ static void update_osd_bar(struct MPContext *mpctx, int type,
double min, double max, double val)
{
if (mpctx->osd->progbar_type == type) {
- mpctx->osd->progbar_value = 256 * (val - min) / (max - min);
- vo_osd_changed(OSDTYPE_PROGBAR);
+ int new_value = 256 * (val - min) / (max - min);
+ if (new_value != mpctx->osd->progbar_value) {
+ mpctx->osd->progbar_value = new_value;
+ vo_osd_changed(OSDTYPE_PROGBAR);
+ }
}
}
@@ -1390,7 +1398,7 @@ void set_osd_function(struct MPContext *mpctx, int osd_function)
struct MPOpts *opts = &mpctx->opts;
mpctx->osd_function = osd_function;
- mpctx->osd_visible = (GetTimerMS() + opts->osd_duration) | 1;
+ mpctx->osd_function_visible = (GetTimerMS() + opts->osd_duration) | 1;
}
/**
@@ -1502,6 +1510,7 @@ static void update_osd_msg(struct MPContext *mpctx)
struct osd_state *osd = mpctx->osd;
add_seek_osd_messages(mpctx);
+ update_osd_bar(mpctx, OSD_BAR_SEEK, 0, 100, get_percent_pos(mpctx));
// Look if we have a msg
mp_osd_msg_t *msg = get_osd_msg(mpctx);
@@ -1535,9 +1544,6 @@ static void update_osd_msg(struct MPContext *mpctx)
osd_set_text(osd, text);
talloc_free(text);
-
- if (msg && msg->show_position)
- update_osd_bar(mpctx, OSD_BAR_SEEK, 0, 100, get_percent_pos(mpctx));
return;
}