summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-11-29 17:51:48 +0100
committerwm4 <wm4@nowhere>2015-11-29 17:56:08 +0100
commit3fa76c84bee5786518d8fb855d0c36f8598263d9 (patch)
tree92666b2541af4a1e0a2ce405061352e7c590daec /player
parent66d93c711b303d3049e7f91ec17be94ebcf5cc88 (diff)
downloadmpv-3fa76c84bee5786518d8fb855d0c36f8598263d9.tar.bz2
mpv-3fa76c84bee5786518d8fb855d0c36f8598263d9.tar.xz
osd: do not let OSD messages overwrite --osd-msgN text
Requested. Don't overwrite permanent OSD text set with e.g. --osd-msg1. Instead, append the OSD message to it (on the next line). Note that with --osd-msg1, seeking will still overwrite the OSD with the playback status for a while. If you do not want this, use --osd-msg3 --osd-level=3 instead.
Diffstat (limited to 'player')
-rw-r--r--player/osd.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/player/osd.c b/player/osd.c
index 353c301942..da1fb41521 100644
--- a/player/osd.c
+++ b/player/osd.c
@@ -116,7 +116,8 @@ void term_osd_set_subs(struct MPContext *mpctx, const char *text)
static void term_osd_set_text(struct MPContext *mpctx, const char *text)
{
- if ((mpctx->video_out && mpctx->opts->term_osd != 1) || !mpctx->opts->term_osd)
+ if ((mpctx->video_out && mpctx->opts->term_osd != 1) ||
+ !mpctx->opts->term_osd || !text)
text = ""; // disable
talloc_free(mpctx->term_osd_text);
mpctx->term_osd_text = talloc_strdup(mpctx, text);
@@ -543,26 +544,19 @@ void update_osd_msg(struct MPContext *mpctx)
update_osd_bar(mpctx, OSD_BAR_SEEK, 0, 1, MPCLAMP(pos, 0, 1));
}
+ term_osd_set_text(mpctx, mpctx->osd_msg_text);
print_status(mpctx);
- // Look if we have a msg
- if (mpctx->osd_msg_text && !mpctx->osd_show_pos) {
- osd_set_text(osd, OSDTYPE_OSD, mpctx->osd_msg_text);
- term_osd_set_text(mpctx, mpctx->osd_msg_text);
- return;
- }
-
int osd_level = opts->osd_level;
- if (mpctx->osd_msg_text && mpctx->osd_show_pos)
+ if (mpctx->osd_show_pos)
osd_level = 3;
- // clear, or if OSD level demands it, show the status
char *text = NULL;
sadd_osd_status(&text, mpctx, osd_level);
-
+ if (mpctx->osd_msg_text && mpctx->osd_msg_text[0]) {
+ text = talloc_asprintf_append(text, "%s%s", text ? "\n" : "",
+ mpctx->osd_msg_text);
+ }
osd_set_text(osd, OSDTYPE_OSD, text);
talloc_free(text);
-
- // always clear (term-osd has separate status line)
- term_osd_set_text(mpctx, "");
}