aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cue/cue_tag.c11
-rw-r--r--src/playlist/cue_playlist_plugin.c15
2 files changed, 22 insertions, 4 deletions
diff --git a/src/cue/cue_tag.c b/src/cue/cue_tag.c
index 67919ce37..d5bfe26d3 100644
--- a/src/cue/cue_tag.c
+++ b/src/cue/cue_tag.c
@@ -178,9 +178,16 @@ cue_tag(struct Cd *cd, unsigned tnum)
if (tag == NULL)
return NULL;
+ tag->time = track_get_length(track)
+ - track_get_index(track, 1)
+ + track_get_zero_pre(track);
+ track = cd_get_track(cd, tnum+1);
+ if (track != NULL)
+ tag->time += track_get_index(track, 1)
+ - track_get_zero_pre(track);
/* libcue returns the track duration in frames, and there are
- 75 frames per second; this formula rounds up */
- tag->time = (track_get_length(track) + 74) / 75;
+ 75 frames per second; this formula rounds down */
+ tag->time = tag->time / 75;
return tag;
}
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;
}