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.
This commit is contained in:
wm4 2015-11-29 17:51:48 +01:00
parent 66d93c711b
commit 3fa76c84be
1 changed files with 8 additions and 14 deletions

View File

@ -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) 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 text = ""; // disable
talloc_free(mpctx->term_osd_text); talloc_free(mpctx->term_osd_text);
mpctx->term_osd_text = talloc_strdup(mpctx, 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)); 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); 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; int osd_level = opts->osd_level;
if (mpctx->osd_msg_text && mpctx->osd_show_pos) if (mpctx->osd_show_pos)
osd_level = 3; osd_level = 3;
// clear, or if OSD level demands it, show the status
char *text = NULL; char *text = NULL;
sadd_osd_status(&text, mpctx, osd_level); 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); osd_set_text(osd, OSDTYPE_OSD, text);
talloc_free(text); talloc_free(text);
// always clear (term-osd has separate status line)
term_osd_set_text(mpctx, "");
} }