summaryrefslogtreecommitdiffstats
path: root/player/playloop.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-12-20 17:31:58 +0100
committerwm4 <wm4@nowhere>2014-12-20 17:31:58 +0100
commit7d43a7ea840e752221c0da5cd99e11cf8b3fd834 (patch)
tree5d8a68968fcf0026530c2b7a47bf8f45097f74d4 /player/playloop.c
parenta69f168dff3ec01833d487b830a06589e5b24e88 (diff)
downloadmpv-7d43a7ea840e752221c0da5cd99e11cf8b3fd834.tar.bz2
mpv-7d43a7ea840e752221c0da5cd99e11cf8b3fd834.tar.xz
player: don't show "0%" percentage in infinite streams
Diffstat (limited to 'player/playloop.c')
-rw-r--r--player/playloop.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/player/playloop.c b/player/playloop.c
index 597d1094a2..25ab5ae0f9 100644
--- a/player/playloop.c
+++ b/player/playloop.c
@@ -422,10 +422,11 @@ double get_current_pos_ratio(struct MPContext *mpctx, bool use_range)
return ans;
}
+// 0-100, -1 if unknown
int get_percent_pos(struct MPContext *mpctx)
{
- int pos = get_current_pos_ratio(mpctx, false) * 100;
- return MPCLAMP(pos, 0, 100);
+ double pos = get_current_pos_ratio(mpctx, false);
+ return pos < 0 ? -1 : pos * 100;
}
// -2 is no chapters, -1 is before first chapter