summaryrefslogtreecommitdiffstats
path: root/player/osd.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-09-21 23:40:45 +0200
committerwm4 <wm4@nowhere>2014-09-21 23:48:24 +0200
commit903bd1d8939c1510649b71389554d2d485952784 (patch)
treec1a58c0cec14069290ba3e277d65e0662ec458a9 /player/osd.c
parent4a0bbe256ef866d0f80ee56af4d5fd4c65cd8d5b (diff)
downloadmpv-903bd1d8939c1510649b71389554d2d485952784.tar.bz2
mpv-903bd1d8939c1510649b71389554d2d485952784.tar.xz
command: simplify OSD property display code
Probably not many user-visible changes. One notable change is that the terminal OSD code for OSD bar fallback handling is removed with no replacement. Instead, terminal OSD gets the same text message as normal OSD. For volume, this is ok, because the text message is reasonable. Other properties will look worse, but could be adjusted, and there are in fact no other such properties that would be useful in audio-only mode. The fallback message for seeking falls away as well, but that message was useless anyway - the terminal status line provides all information anyway. I believe the show_property_osd() code is now much easier to follow.
Diffstat (limited to 'player/osd.c')
-rw-r--r--player/osd.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/player/osd.c b/player/osd.c
index 55ddbf8708..cfbc0a9319 100644
--- a/player/osd.c
+++ b/player/osd.c
@@ -364,15 +364,14 @@ 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,
+void set_osd_bar(struct MPContext *mpctx, int type,
double min, double max, double neutral, double val)
{
struct MPOpts *opts = mpctx->opts;
if (opts->osd_level < 1 || !opts->osd_bar_visible)
return;
- if (mpctx->video_out && opts->term_osd != 1) {
+ if (mpctx->video_out) {
mpctx->osd_visible = mp_time_sec() + opts->osd_duration / 1000.0;
mpctx->sleeptime = 0;
mpctx->osd_progbar.type = type;
@@ -384,11 +383,7 @@ void set_osd_bar(struct MPContext *mpctx, int type, const char* name,
mpctx->osd_progbar.num_stops, pos);
}
osd_set_progbar(mpctx->osd, &mpctx->osd_progbar);
- return;
}
-
- set_osd_msg(mpctx, 1, opts->osd_duration, "%s: %d %%",
- name, ROUND(100 * (val - min) / (max - min)));
}
// Update a currently displayed bar of the same type, without resetting the
@@ -496,7 +491,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, 0, MPCLAMP(pos, 0, 1));
+ set_osd_bar(mpctx, OSD_BAR_SEEK, 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) {