aboutsummaryrefslogtreecommitdiffstats
path: root/src/cue
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-12-16 22:04:24 +0100
committerMax Kellermann <max@duempel.org>2009-12-16 22:15:27 +0100
commit50ea6a4b5c7ee1229b442c046cd9200f8262d8f7 (patch)
treed3460e8885d94c3590bb196a7eee7f35fedb5fc3 /src/cue
parent5649f223229222f88ae4b278d5d6530079a18fa2 (diff)
downloadmpd-50ea6a4b5c7ee1229b442c046cd9200f8262d8f7.tar.gz
mpd-50ea6a4b5c7ee1229b442c046cd9200f8262d8f7.tar.xz
mpd-50ea6a4b5c7ee1229b442c046cd9200f8262d8f7.zip
cue_tag: added song duration support
Get duration from track_get_length().
Diffstat (limited to 'src/cue')
-rw-r--r--src/cue/cue_tag.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/cue/cue_tag.c b/src/cue/cue_tag.c
index 3f8fc327e..46dfb1b50 100644
--- a/src/cue/cue_tag.c
+++ b/src/cue/cue_tag.c
@@ -174,7 +174,7 @@ cue_tag_merge(struct tag *a, struct tag *b)
struct tag *
cue_tag(struct Cd *cd, unsigned tnum)
{
- struct tag *cd_tag, *track_tag;
+ struct tag *cd_tag, *track_tag, *tag;
struct Track *track;
assert(cd != NULL);
@@ -190,7 +190,15 @@ cue_tag(struct Cd *cd, unsigned tnum)
track_tag = cue_tag_track(track_get_cdtext(track),
track_get_rem(track));
- return cue_tag_merge(cd_tag, track_tag);
+ tag = cue_tag_merge(cd_tag, track_tag);
+ if (tag == NULL)
+ return NULL;
+
+ /* 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;
+
+ return tag;
}
struct tag *