summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-12-16 20:05:51 +0100
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-12-16 20:05:51 +0100
commit8cec6efeaeccaa1a8bf94d7824674712ca532b8d (patch)
tree74fde674ffdeb9fc77b668d61939bb403d916e77 /plugins
parent5af66f6090a2fc2757a1ac94e1082e526581e4e4 (diff)
fixed mp3 cue track switching
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mpgmad/mpgmad.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/plugins/mpgmad/mpgmad.c b/plugins/mpgmad/mpgmad.c
index 2262df53..567c8405 100644
--- a/plugins/mpgmad/mpgmad.c
+++ b/plugins/mpgmad/mpgmad.c
@@ -657,11 +657,12 @@ static int
cmp3_decode_cut (int framesize) {
if (buffer.duration >= 0) {
if (buffer.currentsample + buffer.readsize / (framesize * buffer.channels) > buffer.endsample) {
- buffer.readsize = (buffer.endsample - buffer.currentsample + 1) * framesize * buffer.channels;
+ int sz = (buffer.endsample - buffer.currentsample + 1) * framesize * buffer.channels;
trace ("size truncated to %d bytes, cursample=%d, endsample=%d, totalsamples=%d\n", buffer.readsize, buffer.currentsample, buffer.endsample, buffer.totalsamples);
- if (buffer.readsize <= 0) {
+ if (sz <= 0) {
return 1;
}
+ buffer.readsize = sz;
}
}
return 0;
@@ -818,6 +819,7 @@ cmp3_decode_int16 (void) {
static int
cmp3_decode_float32 (void) {
if (cmp3_decode_cut (8)) {
+ trace ("read request ignored (end of track passed)\n");
return 0;
}
int eof = 0;
@@ -850,6 +852,8 @@ cmp3_read_int16 (char *bytes, int size) {
buffer.readsize = size;
buffer.out = bytes;
cmp3_decode_int16 ();
+ buffer.currentsample += (size - buffer.readsize) / 4;
+ plugin.info.readpos = (float)(buffer.currentsample - buffer.startsample) / buffer.samplerate;
return size - buffer.readsize;
}
@@ -858,6 +862,8 @@ cmp3_read_float32 (char *bytes, int size) {
buffer.readsize = size;
buffer.out = bytes;
cmp3_decode_float32 ();
+ buffer.currentsample += (size - buffer.readsize) / 8;
+ plugin.info.readpos = (float)(buffer.currentsample - buffer.startsample) / buffer.samplerate;
return size - buffer.readsize;
}