1
0
mirror of https://github.com/mpv-player/mpv synced 2025-04-28 06:09:32 +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:
wm4 2012-07-30 01:02:08 +02:00
parent 87cb5c683d
commit 128c5839ed

View File

@ -1148,59 +1148,51 @@ static void print_status(struct MPContext *mpctx, double a_pos, bool at_frame)
#endif #endif
line = malloc(width + 1); // one additional char for the terminating null line = malloc(width + 1); // one additional char for the terminating null
// Audio time // Playback position
if (mpctx->sh_audio) { double cur = MP_NOPTS_VALUE;
if (a_pos != MP_NOPTS_VALUE) if (mpctx->sh_audio && a_pos != MP_NOPTS_VALUE) {
saddf(line, &pos, width, "A:%6.1f ", a_pos); cur = a_pos;
else } else if (mpctx->sh_video && mpctx->video_pts != MP_NOPTS_VALUE) {
saddf(line, &pos, width, "A: ??? "); cur = mpctx->video_pts;
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, ") ");
}
} }
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 double len = get_time_length(mpctx);
if (sh_video) { if (len >= 0) {
if (mpctx->video_pts != MP_NOPTS_VALUE) saddf(line, &pos, width, "of %.1f (", len);
saddf(line, &pos, width, "V:%6.1f ", mpctx->video_pts); sadd_hhmmssf(line, &pos, width, len);
else saddf(line, &pos, width, ") ");
saddf(line, &pos, width, "V: ??? ", mpctx->video_pts);
} }
// A-V sync // A-V sync
if (mpctx->sh_audio && sh_video) { if (mpctx->sh_audio && sh_video) {
if (mpctx->last_av_difference != MP_NOPTS_VALUE) if (mpctx->last_av_difference != MP_NOPTS_VALUE)
saddf(line, &pos, width, "A-V:%7.3f ct:%7.3f ", saddf(line, &pos, width, "A-V:%7.3f ", mpctx->last_av_difference);
mpctx->last_av_difference, mpctx->total_avsync_change);
else else
saddf(line, &pos, width, "A-V: ??? ct:%7.3f ", saddf(line, &pos, width, "A-V: ??? ");
mpctx->total_avsync_change); 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 // VO stats
if (sh_video) if (sh_video && drop_frame_cnt)
saddf(line, &pos, width, "%d ", drop_frame_cnt); saddf(line, &pos, width, "Dropped: %d ", drop_frame_cnt);
#ifdef CONFIG_STREAM_CACHE #ifdef CONFIG_STREAM_CACHE
// cache stats // cache stats
if (stream_cache_size > 0) 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 #endif
// other // other
if (opts->playback_speed != 1) 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 // end
if (erase_to_end_of_line) { if (erase_to_end_of_line) {