summaryrefslogtreecommitdiff
path: root/cgme.c
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2009-08-08 10:39:29 +0200
committerGravatar waker <wakeroid@gmail.com>2009-08-08 10:39:29 +0200
commitc2dbadc6ec891f9bf0287698eab18dccc7f1b52d (patch)
treef727724a672e76fca807cbcb19964f3e94ab8c19 /cgme.c
parentce429b6a60046d8fd75fcb3973a63a4b284c96f8 (diff)
added duration calc to GME and FLAC
Diffstat (limited to 'cgme.c')
-rw-r--r--cgme.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/cgme.c b/cgme.c
index a1147a49..046f0f3e 100644
--- a/cgme.c
+++ b/cgme.c
@@ -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 {