diff options
author | wm4 <wm4@nowhere> | 2014-06-08 23:52:58 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-06-08 23:52:58 +0200 |
commit | da89af10768f75ceec9b9c0256649da6f4d843a2 (patch) | |
tree | a8f593ba7df6da4e6d70d10039ff55d475d48662 /player/osd.c | |
parent | cc74bc3fecd9d44d62ff162394cff02ad436a9cc (diff) | |
download | mpv-da89af10768f75ceec9b9c0256649da6f4d843a2.tar.bz2 mpv-da89af10768f75ceec9b9c0256649da6f4d843a2.tar.xz |
player: show "neutral" position markers for OSD bars
This commit implements them for volume and some video properties.
Diffstat (limited to 'player/osd.c')
-rw-r--r-- | player/osd.c | 11 |
1 files changed, 8 insertions, 3 deletions
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) { |