mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
92db8731dd
commit
d061f28397
|
@ -573,7 +573,7 @@ double get_current_pos_ratio(struct MPContext *mpctx, bool use_range)
|
||||||
int get_percent_pos(struct MPContext *mpctx)
|
int get_percent_pos(struct MPContext *mpctx)
|
||||||
{
|
{
|
||||||
double pos = get_current_pos_ratio(mpctx, false);
|
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
|
// -2 is no chapters, -1 is before first chapter
|
||||||
|
|
Loading…
Reference in New Issue