From da89af10768f75ceec9b9c0256649da6f4d843a2 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 8 Jun 2014 23:52:58 +0200 Subject: player: show "neutral" position markers for OSD bars This commit implements them for volume and some video properties. --- player/osd.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'player/osd.c') diff --git a/player/osd.c b/player/osd.c index 57dd4aff97..32533eac1d 100644 --- a/player/osd.c +++ b/player/osd.c @@ -332,8 +332,8 @@ static mp_osd_msg_t *get_osd_msg(struct MPContext *mpctx) // type: mp_osd_font_codepoints, ASCII, or OSD_BAR_* // name: fallback for terminal OSD -void set_osd_bar(struct MPContext *mpctx, int type, const char *name, - double min, double max, double val) +void set_osd_bar(struct MPContext *mpctx, int type, const char* name, + double min, double max, double neutral, double val) { struct MPOpts *opts = mpctx->opts; if (opts->osd_level < 1 || !opts->osd_bar_visible) @@ -344,6 +344,11 @@ void set_osd_bar(struct MPContext *mpctx, int type, const char *name, mpctx->osd_progbar.type = type; mpctx->osd_progbar.value = (val - min) / (max - min); mpctx->osd_progbar.num_stops = 0; + if (neutral > min && neutral < max) { + float pos = (neutral - min) / (max - min); + MP_TARRAY_APPEND(mpctx, mpctx->osd_progbar.stops, + mpctx->osd_progbar.num_stops, pos); + } osd_set_progbar(mpctx->osd, &mpctx->osd_progbar); return; } @@ -450,7 +455,7 @@ static void add_seek_osd_messages(struct MPContext *mpctx) { if (mpctx->add_osd_seek_info & OSD_SEEK_INFO_BAR) { double pos = get_current_pos_ratio(mpctx, false); - set_osd_bar(mpctx, OSD_BAR_SEEK, "Position", 0, 1, MPCLAMP(pos, 0, 1)); + set_osd_bar(mpctx, OSD_BAR_SEEK, "Position", 0, 1, 0, MPCLAMP(pos, 0, 1)); set_osd_bar_chapters(mpctx, OSD_BAR_SEEK); } if (mpctx->add_osd_seek_info & OSD_SEEK_INFO_TEXT) { -- cgit v1.2.3