mirror of
https://github.com/mpv-player/mpv
synced 2024-11-07 01:47:00 +01:00
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).
This commit is contained in:
parent
bad027277c
commit
68daee220c
@ -127,8 +127,9 @@ typedef struct MPContext {
|
||||
subtitle subs; // subtitle list used when reading subtitles from demuxer
|
||||
|
||||
int add_osd_seek_info; // bitfield of enum mp_osd_seek_info
|
||||
unsigned int osd_visible;
|
||||
unsigned int osd_visible; // for the osd bar only
|
||||
int osd_function;
|
||||
unsigned int osd_function_visible;
|
||||
|
||||
struct playlist *playlist;
|
||||
char *filename; // currently playing file
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user