summaryrefslogtreecommitdiffstats
path: root/player/osd.c
diff options
context:
space:
mode:
authorKevin Mitchell <kevmitch@gmail.com>2018-01-13 23:20:17 -0800
committerKevin Mitchell <kevmitch@gmail.com>2018-01-14 00:31:47 -0800
commit845f32732f9dcac03b3eef07c09f8f093879191b (patch)
tree3e7b712f0c19dc2ef9750770a8b2520e68763431 /player/osd.c
parent48fa7da86501870daff27c8a7f1cb4cc74d62e0a (diff)
downloadmpv-845f32732f9dcac03b3eef07c09f8f093879191b.tar.bz2
mpv-845f32732f9dcac03b3eef07c09f8f093879191b.tar.xz
osd: treat user provided term-status-msg the same as the default
This is achieved by adding the new function get_term_status_msg that returns the status message specified by the user, or the mpv default. Previously, term_osd_print_status_lazy would exit early as soon as a user status message had been set, which potentially skipped adding the term_osd_bar if the user also requested that. fixes #3280
Diffstat (limited to 'player/osd.c')
-rw-r--r--player/osd.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/player/osd.c b/player/osd.c
index eeb13037d5..875bc446db 100644
--- a/player/osd.c
+++ b/player/osd.c
@@ -156,28 +156,12 @@ static bool is_busy(struct MPContext *mpctx)
return !mpctx->restart_complete && mp_time_sec() - mpctx->start_timestamp > 0.3;
}
-static void term_osd_print_status_lazy(struct MPContext *mpctx)
+static char *get_term_status_msg(struct MPContext *mpctx)
{
struct MPOpts *opts = mpctx->opts;
- update_window_title(mpctx, false);
- update_vo_playback_state(mpctx);
-
- if (!opts->use_terminal)
- return;
-
- if (opts->quiet || !mpctx->playback_initialized || !mpctx->playing_msg_shown)
- {
- term_osd_set_status_lazy(mpctx, "");
- return;
- }
-
- if (opts->status_msg) {
- char *r = mp_property_expand_escaped_string(mpctx, opts->status_msg);
- term_osd_set_status_lazy(mpctx, r);
- talloc_free(r);
- return;
- }
+ if (opts->status_msg)
+ return mp_property_expand_escaped_string(mpctx, opts->status_msg);
char *line = NULL;
@@ -272,6 +256,27 @@ static void term_osd_print_status_lazy(struct MPContext *mpctx)
}
}
+ return line;
+}
+
+static void term_osd_print_status_lazy(struct MPContext *mpctx)
+{
+ struct MPOpts *opts = mpctx->opts;
+
+ update_window_title(mpctx, false);
+ update_vo_playback_state(mpctx);
+
+ if (!opts->use_terminal)
+ return;
+
+ if (opts->quiet || !mpctx->playback_initialized || !mpctx->playing_msg_shown)
+ {
+ term_osd_set_status_lazy(mpctx, "");
+ return;
+ }
+
+ char *line = get_term_status_msg(mpctx);
+
if (opts->term_osd_bar) {
saddf(&line, "\n");
int w = 80, h = 24;
@@ -279,7 +284,6 @@ static void term_osd_print_status_lazy(struct MPContext *mpctx)
add_term_osd_bar(mpctx, &line, w);
}
- // end
term_osd_set_status_lazy(mpctx, line);
talloc_free(line);
}