From 2cdbaaf31c85b27923c1795b5c4e3e576cdb4567 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 20 Nov 2012 17:20:45 +0100 Subject: 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. --- core/command.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'core/command.c') diff --git a/core/command.c b/core/command.c index 739f0feb13..7f2940fbaa 100644 --- a/core/command.c +++ b/core/command.c @@ -1756,23 +1756,21 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) float v = cmd->args[0].v.f; int abs = (cmd->nargs > 1) ? cmd->args[1].v.i : 0; int exact = (cmd->nargs > 2) ? cmd->args[2].v.i : 0; - int function; if (abs == 2) { // Absolute seek to a timestamp in seconds queue_seek(mpctx, MPSEEK_ABSOLUTE, v, exact); - function = v > get_current_time(mpctx) ? OSD_FFW : OSD_REW; + set_osd_function(mpctx, + v > get_current_time(mpctx) ? OSD_FFW : OSD_REW); } else if (abs) { /* Absolute seek by percentage */ queue_seek(mpctx, MPSEEK_FACTOR, v / 100.0, exact); - function = OSD_FFW; // Direction isn't set correctly + set_osd_function(mpctx, OSD_FFW); // Direction isn't set correctly } else { queue_seek(mpctx, MPSEEK_RELATIVE, v, exact); - function = (v > 0) ? OSD_FFW : OSD_REW; + set_osd_function(mpctx, (v > 0) ? OSD_FFW : OSD_REW); } if (bar_osd) mpctx->add_osd_seek_info |= OSD_SEEK_INFO_BAR; if (msg_osd && !auto_osd) mpctx->add_osd_seek_info |= OSD_SEEK_INFO_TEXT; - if (mpctx->add_osd_seek_info) - mpctx->osd_function = function; break; } -- cgit v1.2.3