summaryrefslogtreecommitdiffstats
path: root/mplayer.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-10-21 00:22:04 +0200
committerwm4 <wm4@nowhere>2012-10-21 00:22:04 +0200
commit32053a0e10be40800c2b7aee569fd30a3742d156 (patch)
treef0ce3efb9c8c7e9eddf7705835566081f7eb7468 /mplayer.c
parentdfcfe058850b07ae9077eea8415cf5315deb1937 (diff)
downloadmpv-32053a0e10be40800c2b7aee569fd30a3742d156.tar.bz2
mpv-32053a0e10be40800c2b7aee569fd30a3742d156.tar.xz
mplayer: make terminal status playback time consistent with OSD
Always use the same function as the OSD does (get_current_time()). This loses the logic to display "???" if the time is unknown, as get_current_time() returns 0 in this case. (The function has far too many uses to change that now, and it seems to happen rarely in practice.)
Diffstat (limited to 'mplayer.c')
-rw-r--r--mplayer.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/mplayer.c b/mplayer.c
index 0109778c17..fc8f17a346 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -1107,19 +1107,11 @@ static void print_status(struct MPContext *mpctx, double a_pos, bool at_frame)
saddf(line, 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, width, " %.1f ", cur);
- saddf(line, width, "(");
- sadd_hhmmssff(line, width, cur, mpctx->opts.osd_fractions);
- saddf(line, width, ")");
- } else
- saddf(line, width, " ???");
+ double cur = get_current_time(mpctx);
+ saddf(line, width, " %.1f ", cur);
+ saddf(line, width, "(");
+ sadd_hhmmssff(line, width, cur, mpctx->opts.osd_fractions);
+ saddf(line, width, ")");
double len = get_time_length(mpctx);
if (len >= 0) {
@@ -2874,7 +2866,9 @@ double get_current_time(struct MPContext *mpctx)
double apts = playing_audio_pts(mpctx);
if (apts != MP_NOPTS_VALUE)
return apts;
- return mpctx->last_seek_pts;
+ if (mpctx->last_seek_pts != MP_NOPTS_VALUE)
+ return mpctx->last_seek_pts;
+ return 0;
}
int get_percent_pos(struct MPContext *mpctx)