Updated vorbis decoder to make it better.
This commit is contained in:
parent
c810d2f492
commit
1e5c5f54e3
1 changed files with 15 additions and 10 deletions
|
@ -80,6 +80,7 @@ long sourceTell(void *datasource)
|
||||||
- (int)fillBuffer:(void *)buf ofSize:(UInt32)size
|
- (int)fillBuffer:(void *)buf ofSize:(UInt32)size
|
||||||
{
|
{
|
||||||
int numread;
|
int numread;
|
||||||
|
int total = 0;
|
||||||
|
|
||||||
if (currentSection != lastSection) {
|
if (currentSection != lastSection) {
|
||||||
vorbis_info *vi;
|
vorbis_info *vi;
|
||||||
|
@ -93,18 +94,22 @@ long sourceTell(void *datasource)
|
||||||
NSLog(@"Format changed...");
|
NSLog(@"Format changed...");
|
||||||
[self willChangeValueForKey:@"properties"];
|
[self willChangeValueForKey:@"properties"];
|
||||||
[self didChangeValueForKey:@"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
|
- (void)close
|
||||||
|
|
Loading…
Reference in a new issue