aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist
diff options
context:
space:
mode:
authorOrivej Desh <smpuj@bk.ru>2010-03-28 19:34:16 +0200
committerMax Kellermann <max@duempel.org>2010-03-28 19:34:16 +0200
commit635791d1cdb1db47096572cfbb13351ab6e3f57f (patch)
tree9b8977659bae42fbe866b610cddd39dcc66436a7 /src/playlist
parente9beea072d17ec01a124c189c42df1a1350a4106 (diff)
downloadmpd-635791d1cdb1db47096572cfbb13351ab6e3f57f.tar.gz
mpd-635791d1cdb1db47096572cfbb13351ab6e3f57f.tar.xz
mpd-635791d1cdb1db47096572cfbb13351ab6e3f57f.zip
cue: prepend pregap to the beginning of the track
.. rather then append to the end of the previous one Cuebreakpoints from the cuetools package has three modes of operation, and the default is to append pregap (INDEX 00) to the end of the previous track. This is the behavior most compliant to the existing cue files. Here is the patch which fixes the issue. I borrowed bits of implementation from cuebreakpoints. I assumed that the whole audio file must be covered by head-to-head going tracks, which is how hardware CD players probably work. In cue_tag I changed rounding from rounding up to rounding down because the thing in mpd which calculates actual track duration (and current position) rounds it down, and I didn't want to see in my playlist values different from whose in a now-playing progress bar. I've compared the resultant mpd behaviour with "mplayer -ss MM:SS.MS" where the time was supplied by cuebreakpoints and noticed that mplayer started each track a bit earlier then mpd, though this was the same before the patch.
Diffstat (limited to 'src/playlist')
-rw-r--r--src/playlist/cue_playlist_plugin.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/playlist/cue_playlist_plugin.c b/src/playlist/cue_playlist_plugin.c
index 4dd5a7c79..d2959dab2 100644
--- a/src/playlist/cue_playlist_plugin.c
+++ b/src/playlist/cue_playlist_plugin.c
@@ -102,10 +102,21 @@ cue_playlist_read(struct playlist_provider *_playlist)
song = song_remote_new(filename);
song->tag = tag;
- song->start_ms = (track_get_start(track) * 1000) / 75;
- song->end_ms = ((track_get_start(track) + track_get_length(track))
+ song->start_ms = ((track_get_start(track)
+ + track_get_index(track, 1)
+ - track_get_zero_pre(track)) * 1000) / 75;
+ song->end_ms = ((track_get_start(track) + track_get_length(track)
+ - track_get_index(track, 1)
+ + track_get_zero_pre(track))
* 1000) / 75;
+ /* append pregap of the next track to the end of this one */
+ track = cd_get_track(playlist->cd, playlist->next);
+ if (track != NULL)
+ song->end_ms = ((track_get_start(track)
+ + track_get_index(track, 1)
+ - track_get_zero_pre(track)) * 1000) / 75;
+
return song;
}