From 212f6dc57cda104f1f7533b5a76c2e0c9f0e0f4c Mon Sep 17 00:00:00 2001 From: datasone Date: Tue, 11 Apr 2023 23:56:01 +0800 Subject: [PATCH] db/ProxyDatabasePlugin: read millisecond values for range start and end Range `start` and `end` values in `mpd_song` (libmpdclient) is stored in seconds only, which makes range times in `ProxySong` truncated to seconds and leads to precision loss on satellite cue track range times. This commit reads the added `start_ms` and `end_ms` value from libmpdclient, which represent range start and end time in milliseconds. And uses them to set `start_time` and `end_time` of `ProxySong`. --- src/db/plugins/ProxyDatabasePlugin.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/db/plugins/ProxyDatabasePlugin.cxx b/src/db/plugins/ProxyDatabasePlugin.cxx index 509498b855..29ff450543 100644 --- a/src/db/plugins/ProxyDatabasePlugin.cxx +++ b/src/db/plugins/ProxyDatabasePlugin.cxx @@ -211,8 +211,8 @@ ProxySong::ProxySong(const mpd_song *song) if (_mtime > 0) mtime = std::chrono::system_clock::from_time_t(_mtime); - start_time = SongTime::FromS(mpd_song_get_start(song)); - end_time = SongTime::FromS(mpd_song_get_end(song)); + start_time = SongTime::FromMS(mpd_song_get_start_ms(song)); + end_time = SongTime::FromMS(mpd_song_get_end_ms(song)); const auto *af = mpd_song_get_audio_format(song); if (af != nullptr) {