1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-30 03:32:50 +00:00

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.
This commit is contained in:
wm4 2014-08-18 01:25:59 +02:00
parent eb2924054f
commit 9f31b73cda
2 changed files with 4 additions and 2 deletions

View File

@ -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;
}

View File

@ -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;
}
}