Commit 50ea6a4b authored by Max Kellermann's avatar Max Kellermann

cue_tag: added song duration support

Get duration from track_get_length().
parent 5649f223
...@@ -174,7 +174,7 @@ cue_tag_merge(struct tag *a, struct tag *b) ...@@ -174,7 +174,7 @@ cue_tag_merge(struct tag *a, struct tag *b)
struct tag * struct tag *
cue_tag(struct Cd *cd, unsigned tnum) cue_tag(struct Cd *cd, unsigned tnum)
{ {
struct tag *cd_tag, *track_tag; struct tag *cd_tag, *track_tag, *tag;
struct Track *track; struct Track *track;
assert(cd != NULL); assert(cd != NULL);
...@@ -190,7 +190,15 @@ cue_tag(struct Cd *cd, unsigned tnum) ...@@ -190,7 +190,15 @@ cue_tag(struct Cd *cd, unsigned tnum)
track_tag = cue_tag_track(track_get_cdtext(track), track_tag = cue_tag_track(track_get_cdtext(track),
track_get_rem(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 * struct tag *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment