diff options
Diffstat (limited to 'player/osd.c')
-rw-r--r-- | player/osd.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/player/osd.c b/player/osd.c index 5bf7fa699b..d3ab644c77 100644 --- a/player/osd.c +++ b/player/osd.c @@ -22,7 +22,6 @@ #include <limits.h> #include <assert.h> -#include "config.h" #include "mpv_talloc.h" #include "common/msg.h" @@ -113,7 +112,7 @@ static void term_osd_update_title(struct MPContext *mpctx) void term_osd_set_subs(struct MPContext *mpctx, const char *text) { - if (mpctx->video_out || !text || !mpctx->opts->subs_rend->sub_visibility) + if (mpctx->video_out || !text || !mpctx->opts->subs_shared->sub_visibility[0]) text = ""; // disable if (strcmp(mpctx->term_osd_subs ? mpctx->term_osd_subs : "", text) == 0) return; @@ -135,11 +134,6 @@ static void term_osd_set_status_lazy(struct MPContext *mpctx, const char *text) { talloc_free(mpctx->term_osd_status); mpctx->term_osd_status = talloc_strdup(mpctx, text); - - int w = 80, h = 24; - terminal_get_size(&w, &h); - if (strlen(mpctx->term_osd_status) > w && !strchr(mpctx->term_osd_status, '\n')) - mpctx->term_osd_status[w] = '\0'; } static void add_term_osd_bar(struct MPContext *mpctx, char **line, int width) @@ -251,12 +245,12 @@ static char *get_term_status_msg(struct MPContext *mpctx) struct demux_reader_state s; demux_get_reader_state(mpctx->demuxer, &s); - if (s.ts_duration < 0) { + if (s.ts_info.duration < 0) { saddf(&line, "???"); - } else if (s.ts_duration < 10) { - saddf(&line, "%2.1fs", s.ts_duration); + } else if (s.ts_info.duration < 10) { + saddf(&line, "%2.1fs", s.ts_info.duration); } else { - saddf(&line, "%2ds", (int)s.ts_duration); + saddf(&line, "%2ds", (int)s.ts_info.duration); } int64_t cache_size = s.fw_bytes; if (cache_size > 0) { @@ -282,13 +276,10 @@ static void term_osd_print_status_lazy(struct MPContext *mpctx) if (!opts->use_terminal) return; - if (opts->quiet || !mpctx->playback_initialized || - !mpctx->playing_msg_shown || mpctx->stop_play) + if (opts->quiet || !mpctx->playback_initialized || !mpctx->playing_msg_shown) { - if (!mpctx->playing || mpctx->stop_play) { - mp_msg_flush_status_line(mpctx->log); + if (!mpctx->playing) term_osd_set_status_lazy(mpctx, ""); - } return; } @@ -421,6 +412,8 @@ void get_current_osd_sym(struct MPContext *mpctx, char *buf, size_t buf_size) sym = OSD_CLOCK; } else if (mpctx->paused || mpctx->step_frames) { sym = OSD_PAUSE; + } else if (mpctx->play_dir < 0 ) { + sym = OSD_REV; } else { sym = OSD_PLAY; } @@ -460,7 +453,7 @@ static void sadd_osd_status(char **buffer, struct MPContext *mpctx, int level) } } -// OSD messages initated by seeking commands are added lazily with this +// OSD messages initiated by seeking commands are added lazily with this // function, because multiple successive seek commands can be coalesced. static void add_seek_osd_messages(struct MPContext *mpctx) { |