diff options
author | Ricardo Garcia <commits@rg3.name> | 2020-05-01 20:24:44 +0200 |
---|---|---|
committer | wm4 <1387750+wm4@users.noreply.github.com> | 2020-05-01 20:48:16 +0200 |
commit | d061f28397937f0eae8fc7ba3b13913bbf29a9b7 (patch) | |
tree | aaa0121b06c8816eab1fb25be8d1057c1af18a96 | |
parent | 92db8731dd5ef700c7a7b96cf5f2f5aebc6d3d88 (diff) | |
download | mpv-d061f28397937f0eae8fc7ba3b13913bbf29a9b7.tar.bz2 mpv-d061f28397937f0eae8fc7ba3b13913bbf29a9b7.tar.xz |
player: round position percentage to the nearest integer
This brings the displayed percentage closer to the exact number and
allows mpv to more frequently display 100% when it finishes playing a
typical video or audio file.
-rw-r--r-- | player/playloop.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/player/playloop.c b/player/playloop.c index c2e9f5efef..7b8b65e0f0 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -573,7 +573,7 @@ double get_current_pos_ratio(struct MPContext *mpctx, bool use_range) int get_percent_pos(struct MPContext *mpctx) { double pos = get_current_pos_ratio(mpctx, false); - return pos < 0 ? -1 : pos * 100; + return pos < 0 ? -1 : (int)round(pos * 100); } // -2 is no chapters, -1 is before first chapter |