From 5086b2d4568bfd8b39a4418a2db4dbfbb1fae92f Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 28 Aug 2016 18:15:37 +0200 Subject: player: add option to disable video OSD Normally, OSD can be disabled with --osd-level=0. But this also disables terminal OSD, and some users want _only_ the terminal OSD. Add --video-osd=no, which essentially disables the video OSD. Ideally, it should probably be possible to control terminal and video OSD levels independently, but that would require separate OSD timers (and other state) for both components, so don't do it. But because the current situation isn't too ideal, add a threat to the manpage that might be changed in the future. Fixes #3387. --- player/osd.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'player/osd.c') diff --git a/player/osd.c b/player/osd.c index 48bf22b346..6f26e9361c 100644 --- a/player/osd.c +++ b/player/osd.c @@ -117,8 +117,8 @@ void term_osd_set_subs(struct MPContext *mpctx, const char *text) static void term_osd_set_text_lazy(struct MPContext *mpctx, const char *text) { - if ((mpctx->video_out && mpctx->opts->term_osd != 1) || - !mpctx->opts->term_osd || !text) + bool video_osd = mpctx->video_out && mpctx->opts->video_osd; + if ((video_osd && mpctx->opts->term_osd != 1) || !text) text = ""; // disable talloc_free(mpctx->term_osd_text); mpctx->term_osd_text = talloc_strdup(mpctx, text); @@ -325,7 +325,8 @@ void set_osd_bar(struct MPContext *mpctx, int type, double min, double max, double neutral, double val) { struct MPOpts *opts = mpctx->opts; - if (opts->osd_level < 1 || !opts->osd_bar_visible || !mpctx->video_out) + bool video_osd = mpctx->video_out && mpctx->opts->video_osd; + if (opts->osd_level < 1 || !opts->osd_bar_visible || !video_osd) return; mpctx->osd_visible = mp_time_sec() + opts->osd_duration / 1000.0; @@ -460,7 +461,8 @@ static void add_seek_osd_messages(struct MPContext *mpctx) } if (mpctx->add_osd_seek_info & OSD_SEEK_INFO_TEXT) { // Never in term-osd mode - if (mpctx->video_out && mpctx->opts->term_osd != 1) { + bool video_osd = mpctx->video_out && mpctx->opts->video_osd; + if (video_osd && mpctx->opts->term_osd != 1) { if (set_osd_msg(mpctx, 1, mpctx->opts->osd_duration, "")) mpctx->osd_show_pos = true; } @@ -564,6 +566,9 @@ void update_osd_msg(struct MPContext *mpctx) term_osd_print_status_lazy(mpctx); term_osd_update(mpctx); + if (!opts->video_osd) + return; + int osd_level = opts->osd_level; if (mpctx->osd_show_pos) osd_level = 3; -- cgit v1.2.3