mirror of
https://github.com/mpv-player/mpv
synced 2025-03-25 04:38:01 +00:00
mplayer: redo terminal status line output
Instead of displaying audio and video separately, there's now one position printed. The idea is that displaying both audio and video position is redundant. The A/V synchronisation is still printed, so that you can see if the video time is off. Also, always print the duration of the file, not only when playing audio only. Print "ct" (average A/V sync change) and the number of dropped frame only if they're significant. Remove output of outdated and crapified things, like frame position (these can't be reasonably done with modern media formats, and the playback code paths for these don't touch them). This will break some slave mode applications, because they attempt to parse the status line.
This commit is contained in:
parent
87cb5c683d
commit
128c5839ed
60
mplayer.c
60
mplayer.c
@ -1148,59 +1148,51 @@ static void print_status(struct MPContext *mpctx, double a_pos, bool at_frame)
|
||||
#endif
|
||||
line = malloc(width + 1); // one additional char for the terminating null
|
||||
|
||||
// Audio time
|
||||
if (mpctx->sh_audio) {
|
||||
if (a_pos != MP_NOPTS_VALUE)
|
||||
saddf(line, &pos, width, "A:%6.1f ", a_pos);
|
||||
else
|
||||
saddf(line, &pos, width, "A: ??? ");
|
||||
if (!sh_video && a_pos != MP_NOPTS_VALUE) {
|
||||
float len = get_time_length(mpctx);
|
||||
saddf(line, &pos, width, "(");
|
||||
sadd_hhmmssf(line, &pos, width, a_pos);
|
||||
saddf(line, &pos, width, ") of %.1f (", len);
|
||||
sadd_hhmmssf(line, &pos, width, len);
|
||||
saddf(line, &pos, width, ") ");
|
||||
}
|
||||
// Playback position
|
||||
double cur = MP_NOPTS_VALUE;
|
||||
if (mpctx->sh_audio && a_pos != MP_NOPTS_VALUE) {
|
||||
cur = a_pos;
|
||||
} else if (mpctx->sh_video && mpctx->video_pts != MP_NOPTS_VALUE) {
|
||||
cur = mpctx->video_pts;
|
||||
}
|
||||
if (cur != MP_NOPTS_VALUE) {
|
||||
saddf(line, &pos, width, "T:%6.1f ", cur);
|
||||
saddf(line, &pos, width, "(");
|
||||
sadd_hhmmssf(line, &pos, width, cur);
|
||||
saddf(line, &pos, width, ") ");
|
||||
} else
|
||||
saddf(line, &pos, width, "T: ??? ");
|
||||
|
||||
// Video time
|
||||
if (sh_video) {
|
||||
if (mpctx->video_pts != MP_NOPTS_VALUE)
|
||||
saddf(line, &pos, width, "V:%6.1f ", mpctx->video_pts);
|
||||
else
|
||||
saddf(line, &pos, width, "V: ??? ", mpctx->video_pts);
|
||||
double len = get_time_length(mpctx);
|
||||
if (len >= 0) {
|
||||
saddf(line, &pos, width, "of %.1f (", len);
|
||||
sadd_hhmmssf(line, &pos, width, len);
|
||||
saddf(line, &pos, width, ") ");
|
||||
}
|
||||
|
||||
// A-V sync
|
||||
if (mpctx->sh_audio && sh_video) {
|
||||
if (mpctx->last_av_difference != MP_NOPTS_VALUE)
|
||||
saddf(line, &pos, width, "A-V:%7.3f ct:%7.3f ",
|
||||
mpctx->last_av_difference, mpctx->total_avsync_change);
|
||||
saddf(line, &pos, width, "A-V:%7.3f ", mpctx->last_av_difference);
|
||||
else
|
||||
saddf(line, &pos, width, "A-V: ??? ct:%7.3f ",
|
||||
mpctx->total_avsync_change);
|
||||
saddf(line, &pos, width, "A-V: ??? ");
|
||||
if (fabs(mpctx->total_avsync_change) > 0.01)
|
||||
saddf(line, &pos, width, "ct:%7.3f ", mpctx->total_avsync_change);
|
||||
}
|
||||
|
||||
// Video stats
|
||||
if (sh_video)
|
||||
saddf(line, &pos, width, "%3d/%3d ",
|
||||
(int)sh_video->num_frames,
|
||||
(int)sh_video->num_frames_decoded);
|
||||
|
||||
// VO stats
|
||||
if (sh_video)
|
||||
saddf(line, &pos, width, "%d ", drop_frame_cnt);
|
||||
if (sh_video && drop_frame_cnt)
|
||||
saddf(line, &pos, width, "Dropped: %d ", drop_frame_cnt);
|
||||
|
||||
#ifdef CONFIG_STREAM_CACHE
|
||||
// cache stats
|
||||
if (stream_cache_size > 0)
|
||||
saddf(line, &pos, width, "%d%% ", cache_fill_status(mpctx->stream));
|
||||
saddf(line, &pos, width, "Cache: %d%% ", cache_fill_status(mpctx->stream));
|
||||
#endif
|
||||
|
||||
// other
|
||||
if (opts->playback_speed != 1)
|
||||
saddf(line, &pos, width, "%4.2fx ", opts->playback_speed);
|
||||
saddf(line, &pos, width, "Speed: %4.2fx ", opts->playback_speed);
|
||||
|
||||
// end
|
||||
if (erase_to_end_of_line) {
|
||||
|
Loading…
Reference in New Issue
Block a user