mirror of
https://github.com/mpv-player/mpv
synced 2025-01-30 11:42:04 +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:
parent
eb2924054f
commit
9f31b73cda
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user