summaryrefslogtreecommitdiffstats
path: root/core/mplayer.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-11-20 17:20:45 +0100
committerwm4 <wm4@nowhere>2012-11-20 18:00:16 +0100
commit2cdbaaf31c85b27923c1795b5c4e3e576cdb4567 (patch)
tree8df97f6cfd4b3b6197cefc6338118f4bfe35dfb3 /core/mplayer.c
parent0e63702ef830f123d735cbbb436e3e805ad0b2d0 (diff)
downloadmpv-2cdbaaf31c85b27923c1795b5c4e3e576cdb4567.tar.bz2
mpv-2cdbaaf31c85b27923c1795b5c4e3e576cdb4567.tar.xz
osd: fix OSD status symbol display in some cases
The playback status symbol in the OSD status display on video (such as displayed when seeking or with the show_progress input command) sometimes kept displaying the last seek, without resetting the symbol. (For example: disable the OSD, seek, enable the OSD, run show_progress; but also other cases.) The main reason for that was the code clearing the OSD bar is also responsible for clearing the osd_function (which stores the playback symbol). If no OSD bar was set, the osd_function was never reset. Fix by always setting the timer for clearing the OSD bar and the osd_function whenever the osd_function is set. Clearing the OSD bar when it wasn't set is OK. If the OSD bar is set some time after osd_function is set, the timer is overwritten - that's a good thing, as it makes both disappear from the screen at exactly the same time. Always reset osd_function to 0 and determine the playback status explicitly from mpctx->paused when displaying the status on screen.
Diffstat (limited to 'core/mplayer.c')
-rw-r--r--core/mplayer.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/core/mplayer.c b/core/mplayer.c
index ebe6d8f9db..32c86d2dc7 100644
--- a/core/mplayer.c
+++ b/core/mplayer.c
@@ -1335,7 +1335,7 @@ 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);
- mpctx->osd_function = mpctx->paused ? OSD_PAUSE : OSD_PLAY;
+ mpctx->osd_function = 0;
}
}
@@ -1403,6 +1403,12 @@ void set_osd_bar(struct MPContext *mpctx, int type, const char *name,
name, ROUND(100 * (val - min) / (max - min)));
}
+void set_osd_function(struct MPContext *mpctx, int osd_function)
+{
+ mpctx->osd_function = osd_function;
+ mpctx->osd_visible = (GetTimerMS() + 1000) | 1;
+}
+
/**
* \brief Display text subtitles on the OSD
*/
@@ -1439,7 +1445,10 @@ static void sadd_osd_status(char *buffer, int len, struct MPContext *mpctx,
bool full)
{
bool fractions = mpctx->opts.osd_fractions;
- saddf_osd_function_sym(buffer, len, mpctx->osd_function);
+ int sym = mpctx->osd_function;
+ if (!sym)
+ sym = mpctx->paused || mpctx->step_frames ? OSD_PAUSE : OSD_PLAY;
+ saddf_osd_function_sym(buffer, len, sym);
sadd_hhmmssff(buffer, len, get_current_time(mpctx), fractions);
if (full) {
saddf(buffer, len, " / ");
@@ -2537,7 +2546,7 @@ void pause_player(struct MPContext *mpctx)
mpctx->paused = 1;
mpctx->step_frames = 0;
mpctx->time_frame -= get_relative_time(mpctx);
- mpctx->osd_function = OSD_PAUSE;
+ mpctx->osd_function = 0;
if (mpctx->video_out && mpctx->sh_video && mpctx->video_out->config_ok)
vo_control(mpctx->video_out, VOCTRL_PAUSE, NULL);
@@ -2558,8 +2567,7 @@ void unpause_player(struct MPContext *mpctx)
if (!mpctx->paused)
return;
mpctx->paused = 0;
- if (!mpctx->step_frames)
- mpctx->osd_function = OSD_PLAY;
+ mpctx->osd_function = 0;
if (mpctx->ao && mpctx->sh_audio)
ao_resume(mpctx->ao);
@@ -3393,7 +3401,7 @@ static void run_playloop(struct MPContext *mpctx)
// handle -sstep
if (step_sec > 0 && !mpctx->paused && !mpctx->restart_playback) {
- mpctx->osd_function = OSD_FFW;
+ set_osd_function(mpctx, OSD_FFW);
queue_seek(mpctx, MPSEEK_RELATIVE, step_sec, 0);
}
@@ -4316,7 +4324,6 @@ int main(int argc, char *argv[])
struct MPContext *mpctx = talloc(NULL, MPContext);
*mpctx = (struct MPContext){
- .osd_function = OSD_PLAY,
.begin_skip = MP_NOPTS_VALUE,
.file_format = DEMUXER_TYPE_UNKNOWN,
.last_dvb_step = 1,