Fixed seeking
parent
bf3cc599e4
commit
f32632abd0
|
@ -10,7 +10,7 @@
|
|||
#import "PlaylistEntry.h"
|
||||
#import "Shuffle.h"
|
||||
|
||||
extern NSArray * getCoreAudioExtensions();
|
||||
#import "CoreAudioUtils.h"
|
||||
|
||||
@implementation PlaylistController
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
SInt64 _totalPackets;
|
||||
|
||||
UInt32 _maxPacketSize;
|
||||
UInt32 _framesPerPacket;
|
||||
|
||||
AudioConverterRef _converter;
|
||||
void *_convBuf;
|
||||
|
|
|
@ -224,6 +224,8 @@ OSStatus ACInputProc(AudioConverterRef inAudioConverter, UInt32 *ioNumberDataPac
|
|||
channels = asbd.mChannelsPerFrame;
|
||||
frequency = asbd.mSampleRate;
|
||||
|
||||
_framesPerPacket = asbd.mFramesPerPacket;
|
||||
|
||||
// mBitsPerChannel will only be set for lpcm formats
|
||||
if(0 == bitsPerSample) {
|
||||
bitsPerSample = 16;
|
||||
|
@ -331,11 +333,18 @@ OSStatus ACInputProc(AudioConverterRef inAudioConverter, UInt32 *ioNumberDataPac
|
|||
|
||||
- (double) seekToTime:(double)milliseconds
|
||||
{
|
||||
double newTime;
|
||||
|
||||
NSLog(@"Seeking to: %lf", milliseconds);
|
||||
NSLog(@"Max frames: %lli", _totalPackets);
|
||||
[_countLock lock];
|
||||
_packetCount = ((milliseconds / 1000.f) * frequency);
|
||||
_packetCount = ((milliseconds / 1000.f) * frequency)/_framesPerPacket;
|
||||
NSLog(@"Seeking in coreaudio: %lli", _packetCount);
|
||||
[_countLock unlock];
|
||||
|
||||
return YES;
|
||||
newTime = ((_packetCount * _framesPerPacket)/frequency)*1000.0;
|
||||
|
||||
return newTime;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in New Issue