Updated vorbis decoder to make it better.
parent
c810d2f492
commit
1e5c5f54e3
|
@ -80,6 +80,7 @@ long sourceTell(void *datasource)
|
|||
- (int)fillBuffer:(void *)buf ofSize:(UInt32)size
|
||||
{
|
||||
int numread;
|
||||
int total = 0;
|
||||
|
||||
if (currentSection != lastSection) {
|
||||
vorbis_info *vi;
|
||||
|
@ -93,18 +94,22 @@ long sourceTell(void *datasource)
|
|||
NSLog(@"Format changed...");
|
||||
[self willChangeValueForKey:@"properties"];
|
||||
[self didChangeValueForKey:@"properties"];
|
||||
NSLog(@"Done with format change...");
|
||||
}
|
||||
|
||||
lastSection = currentSection;
|
||||
do {
|
||||
numread = ov_read(&vorbisRef, (char *)buf, size, 0, bitsPerSample/8, 1, ¤tSection);
|
||||
if (numread < 0) {
|
||||
NSLog(@"SOME KINDA ERROR!");
|
||||
}
|
||||
} while (numread < 0);
|
||||
|
||||
return numread;
|
||||
do {
|
||||
lastSection = currentSection;
|
||||
numread = ov_read(&vorbisRef, &((char *)buf)[total], size - total, 0, bitsPerSample/8, 1, ¤tSection);
|
||||
if (numread > 0) {
|
||||
total += numread;
|
||||
}
|
||||
|
||||
if (currentSection != lastSection) {
|
||||
break;
|
||||
}
|
||||
|
||||
} while (total != size && numread != 0);
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
- (void)close
|
||||
|
|
Loading…
Reference in New Issue