diff options
author | waker <wakeroid@gmail.com> | 2009-08-08 10:39:29 +0200 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2009-08-08 10:39:29 +0200 |
commit | c2dbadc6ec891f9bf0287698eab18dccc7f1b52d (patch) | |
tree | f727724a672e76fca807cbcb19964f3e94ab8c19 /cgme.c | |
parent | ce429b6a60046d8fd75fcb3973a63a4b284c96f8 (diff) |
added duration calc to GME and FLAC
Diffstat (limited to 'cgme.c')
-rw-r--r-- | cgme.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -26,12 +26,6 @@ cgme_init (const char *fname, int track, float start, float end) { cgme.info.samplesPerSecond = p_get_rate (); reallength = inf.length; nzerosamples = 0; - if (inf.length == -1) { - cgme.info.duration = 300; - } - else { - cgme.info.duration = (float)inf.length/1000.f; - } cgme.info.position = 0; return 0; } @@ -47,8 +41,8 @@ cgme_free (void) { int cgme_read (char *bytes, int size) { float t = (size/4) / (float)cgme.info.samplesPerSecond; - if (cgme.info.position + t >= cgme.info.duration) { - t = cgme.info.duration - cgme.info.position; + if (cgme.info.position + t >= playlist_current.duration) { + t = playlist_current.duration - cgme.info.position; if (t <= 0) { return 0; } @@ -123,6 +117,12 @@ cgme_insert (playItem_t *after, const char *fname) { char trk[10]; snprintf (trk, 10, "%d", i+1); ps_add_meta (it, "track", trk); + if (inf.length == -1) { + it->duration = 300; + } + else { + it->duration = (float)inf.length/1000.f; + } after = ps_insert_item (after, it); } else { |