From 2bb02879aa3ebdb5d4e51d8d410c929fe26d58be Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 29 Oct 2014 21:54:59 +0100 Subject: player: don't display zero duration for files with unknown duration On OSD/terminal, just don't display the duration if unavailable. Make the "length" property unavailable if duration is unavailable. --- player/misc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'player/misc.c') diff --git a/player/misc.c b/player/misc.c index 6ddbc31f52..4fbef24d8e 100644 --- a/player/misc.c +++ b/player/misc.c @@ -65,12 +65,12 @@ double rel_time_to_abs(struct MPContext *mpctx, struct m_rel_time t) if (t.pos >= 0) { return start + t.pos; } else { - if (length != 0) + if (length >= 0) return MPMAX(start + length + t.pos, 0.0); } break; case REL_TIME_PERCENT: - if (length != 0) + if (length >= 0) return start + length * (t.pos / 100.0); break; case REL_TIME_CHAPTER: -- cgit v1.2.3