VLCEngine: Fix track progress

Fixes #941
This commit is contained in:
Jonas Kvinge 2022-04-29 00:09:29 +02:00
parent 94c5ffa92e
commit 0f40b5f022
1 changed files with 3 additions and 6 deletions

View File

@ -200,8 +200,7 @@ qint64 VLCEngine::position_nanosec() const {
if (state_ == Engine::Empty) return 0;
const qint64 result = (position() * kNsecPerMsec);
return qint64(qMax(0LL, result));
return qMax(0LL, result);
}
@ -261,7 +260,7 @@ uint VLCEngine::position() const {
if (!Initialized() || !libvlc_media_player_is_playing(player_)) return 0;
float pos = libvlc_media_player_get_position(player_);
return (static_cast<uint>(pos) * length());
return static_cast<uint>(pos * static_cast<float>(length()));
}
@ -269,9 +268,7 @@ uint VLCEngine::length() const {
if (!Initialized() || !libvlc_media_player_is_playing(player_)) return 0;
libvlc_time_t len = libvlc_media_player_get_length(player_);
return len;
return libvlc_media_player_get_length(player_);
}