From 845f32732f9dcac03b3eef07c09f8f093879191b Mon Sep 17 00:00:00 2001 From: Kevin Mitchell Date: Sat, 13 Jan 2018 23:20:17 -0800 Subject: 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 --- player/osd.c | 44 ++++++++++++++++++++++++-------------------- 1 file 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); } -- cgit v1.2.3