Skip to content

Commit

Permalink
db/ProxyDatabasePlugin: read millisecond values for range start and end
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
datasone committed Apr 12, 2023
1 parent b0c8b87 commit 212f6dc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/db/plugins/ProxyDatabasePlugin.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 212f6dc

Please sign in to comment.