summaryrefslogtreecommitdiffstats
path: root/player/osd.c
diff options
context:
space:
mode:
Diffstat (limited to 'player/osd.c')
-rw-r--r--player/osd.c49
1 files changed, 15 insertions, 34 deletions
diff --git a/player/osd.c b/player/osd.c
index da14f8ff2b..da1fb41521 100644
--- a/player/osd.c
+++ b/player/osd.c
@@ -103,7 +103,7 @@ static void term_osd_update(struct MPContext *mpctx)
}
}
-static void term_osd_set_subs(struct MPContext *mpctx, const char *text)
+void term_osd_set_subs(struct MPContext *mpctx, const char *text)
{
if (mpctx->video_out || !text)
text = ""; // disable
@@ -116,7 +116,8 @@ static 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);
@@ -164,6 +165,7 @@ static void print_status(struct MPContext *mpctx)
struct MPOpts *opts = mpctx->opts;
update_window_title(mpctx, false);
+ update_vo_playback_state(mpctx);
if (!opts->use_terminal)
return;
@@ -234,14 +236,10 @@ static void print_status(struct MPContext *mpctx)
// VO stats
if (mpctx->d_video) {
if (mpctx->display_sync_active) {
- char *f =
- mp_property_expand_string(mpctx, "${audio-speed-correction}");
- if (f)
- saddf(&line, " DS: %s", f);
- talloc_free(f);
- int64_t m = vo_get_missed_count(mpctx->video_out);
- if (m > 0)
- saddf(&line, " Missed: %"PRId64, m);
+ char *r = mp_property_expand_string(mpctx, "${vsync-ratio}");
+ saddf(&line, " DS: %s/%"PRId64, r,
+ vo_get_delayed_count(mpctx->video_out));
+ talloc_free(r);
}
int64_t c = vo_get_drop_count(mpctx->video_out);
if (c > 0 || mpctx->dropped_frames_total > 0) {
@@ -368,8 +366,7 @@ void set_osd_bar_chapters(struct MPContext *mpctx, int type)
} else {
int num = get_chapter_count(mpctx);
for (int n = 0; n < num; n++) {
- double time = chapter_start_time(mpctx, n) -
- get_start_time(mpctx);
+ double time = chapter_start_time(mpctx, n);
if (time >= 0) {
float pos = time / len;
MP_TARRAY_APPEND(mpctx, mpctx->osd_progbar.stops,
@@ -392,15 +389,6 @@ void set_osd_function(struct MPContext *mpctx, int osd_function)
mpctx->sleeptime = 0;
}
-/**
- * \brief Display text subtitles on the OSD
- */
-void set_osd_subtitle(struct MPContext *mpctx, const char *text)
-{
- osd_set_text(mpctx->osd, OSDTYPE_SUB, text);
- term_osd_set_subs(mpctx, text);
-}
-
void get_current_osd_sym(struct MPContext *mpctx, char *buf, size_t buf_size)
{
int sym = mpctx->osd_function;
@@ -556,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, "");
}