diff options
author | Alexey Yakovenko <wakeroid@gmail.com> | 2009-09-22 22:33:42 +0200 |
---|---|---|
committer | Alexey Yakovenko <wakeroid@gmail.com> | 2009-09-22 22:33:42 +0200 |
commit | e876a708be569c7fef2faf81c261cd4bec84f1e6 (patch) | |
tree | 024281ace8273803cc36d743731d81b0b8573069 /plugins/mpgmad/mpgmad.c | |
parent | f793d8c45fb9313a5101224af8c25b59b1e98921 (diff) |
fixed vbr seeking
Diffstat (limited to 'plugins/mpgmad/mpgmad.c')
-rw-r--r-- | plugins/mpgmad/mpgmad.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/plugins/mpgmad/mpgmad.c b/plugins/mpgmad/mpgmad.c index 0fb59c23..2fe20bd2 100644 --- a/plugins/mpgmad/mpgmad.c +++ b/plugins/mpgmad/mpgmad.c @@ -506,7 +506,7 @@ cmp3_init (DB_playItem_t *it) { buffer.timestart = 0; buffer.timeend = it->duration; buffer.startsample = 0; - buffer.endsample = it->duration * buffer.samplerate - 1; + buffer.endsample = buffer.totalsamples-1; buffer.skipsamples = buffer.startdelay; buffer.currentsample = buffer.startdelay; fseek (buffer.file, buffer.startoffset, SEEK_SET); @@ -807,7 +807,8 @@ cmp3_seek_sample (int sample) { return -1; } sample += buffer.startsample + buffer.startdelay; - if (sample >= buffer.totalsamples) { + if (sample > buffer.endsample) { + trace ("seek sample %d is beyond end of track (%d)\n", sample, buffer.endsample); return -1; // eof } // restart file, and load until we hit required pos @@ -832,6 +833,7 @@ cmp3_seek_sample (int sample) { } if (cmp3_scan_stream (&buffer, sample) == -1) { + trace ("failed to seek to sample %d\n", sample); plugin.info.readpos = 0; return -1; } |