From 9f31b73cda23eba00924b179b7bee8d34692f382 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 18 Aug 2014 01:25:59 +0200 Subject: player: never print status messages before playback begins After a new file is loaded, playback never starts instantly. Rather, it takes some playloop iterations until initial audio and video have been decoded, and the outputs have been (lazily) initialized. This means you will get status line updates between the messages that inform of the initialized outputs. This is a bit annoying and clutters the terminal output needlessly. Fix this by never printing the status line before playback isn't fully initialized. Do this by reusing the --term-playing-msg code (which prints a message once playback is initialized). This also makes sure the status line _is_ shown during playback restart when doing seeks. It's possible that the change will make the output more confusing if for some reason is stuck forever initializing playback, but that seems like an obscure corner case that never happens, so forget about it. --- player/osd.c | 4 +++- player/playloop.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'player') diff --git a/player/osd.c b/player/osd.c index 094e99e5b6..e3fe9e1c9b 100644 --- a/player/osd.c +++ b/player/osd.c @@ -155,7 +155,9 @@ static void print_status(struct MPContext *mpctx) if (!opts->use_terminal) return; - if (opts->quiet || !(mpctx->initialized_flags & INITIALIZED_PLAYBACK)) { + if (opts->quiet || !(mpctx->initialized_flags & INITIALIZED_PLAYBACK) || + !mpctx->playing_msg_shown) + { term_osd_set_status(mpctx, ""); return; } diff --git a/player/playloop.c b/player/playloop.c index 5b4c7c7fab..a8c47d8e66 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -852,12 +852,12 @@ void run_playloop(struct MPContext *mpctx) mp_notify(mpctx, MPV_EVENT_PLAYBACK_RESTART, NULL); mpctx->restart_complete = true; if (opts->playing_msg && !mpctx->playing_msg_shown) { - mpctx->playing_msg_shown = true; char *msg = mp_property_expand_escaped_string(mpctx, opts->playing_msg); MP_INFO(mpctx, "%s\n", msg); talloc_free(msg); } + mpctx->playing_msg_shown = true; } } -- cgit v1.2.3