Cog Audio: Remove seek mess from previous commit
parent
f1d70aaa54
commit
2633e713a3
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
@class BufferChain;
|
@class BufferChain;
|
||||||
@class OutputNode;
|
@class OutputNode;
|
||||||
@protocol CogDecoder;
|
|
||||||
|
|
||||||
@interface AudioPlayer : NSObject
|
@interface AudioPlayer : NSObject
|
||||||
{
|
{
|
||||||
|
@ -21,10 +20,6 @@
|
||||||
|
|
||||||
NSMutableArray *chainQueue;
|
NSMutableArray *chainQueue;
|
||||||
|
|
||||||
NSURL *currentStream;
|
|
||||||
id currentUserInfo;
|
|
||||||
NSDictionary *currentRGInfo;
|
|
||||||
|
|
||||||
NSURL *nextStream;
|
NSURL *nextStream;
|
||||||
id nextStreamUserInfo;
|
id nextStreamUserInfo;
|
||||||
NSDictionary *nextStreamRGInfo;
|
NSDictionary *nextStreamRGInfo;
|
||||||
|
@ -35,7 +30,6 @@
|
||||||
BOOL endOfInputReached;
|
BOOL endOfInputReached;
|
||||||
BOOL startedPaused;
|
BOOL startedPaused;
|
||||||
BOOL initialBufferFilled;
|
BOOL initialBufferFilled;
|
||||||
BOOL paused;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)init;
|
- (id)init;
|
||||||
|
@ -47,7 +41,6 @@
|
||||||
- (void)play:(NSURL *)url withUserInfo:(id)userInfo withRGInfo:(NSDictionary*)rgi;
|
- (void)play:(NSURL *)url withUserInfo:(id)userInfo withRGInfo:(NSDictionary*)rgi;
|
||||||
- (void)play:(NSURL *)url withUserInfo:(id)userInfo withRGInfo:(NSDictionary*)rgi startPaused:(BOOL)paused;
|
- (void)play:(NSURL *)url withUserInfo:(id)userInfo withRGInfo:(NSDictionary*)rgi startPaused:(BOOL)paused;
|
||||||
- (void)play:(NSURL *)url withUserInfo:(id)userInfo withRGInfo:(NSDictionary*)rgi startPaused:(BOOL)paused andSeekTo:(double)time;
|
- (void)play:(NSURL *)url withUserInfo:(id)userInfo withRGInfo:(NSDictionary*)rgi startPaused:(BOOL)paused andSeekTo:(double)time;
|
||||||
- (void)play:(id<CogDecoder>)decoder startPaused:(BOOL)paused;
|
|
||||||
|
|
||||||
- (void)stop;
|
- (void)stop;
|
||||||
- (void)pause;
|
- (void)pause;
|
||||||
|
|
|
@ -60,7 +60,10 @@
|
||||||
|
|
||||||
- (void)play:(NSURL *)url withUserInfo:(id)userInfo withRGInfo:(NSDictionary *)rgi startPaused:(BOOL)paused andSeekTo:(double)time
|
- (void)play:(NSURL *)url withUserInfo:(id)userInfo withRGInfo:(NSDictionary *)rgi startPaused:(BOOL)paused andSeekTo:(double)time
|
||||||
{
|
{
|
||||||
@synchronized(chainQueue) {
|
output = [[OutputNode alloc] initWithController:self previous:nil];
|
||||||
|
[output setup];
|
||||||
|
[output setVolume: volume];
|
||||||
|
@synchronized(chainQueue) {
|
||||||
for (id anObject in chainQueue)
|
for (id anObject in chainQueue)
|
||||||
{
|
{
|
||||||
[anObject setShouldContinue:NO];
|
[anObject setShouldContinue:NO];
|
||||||
|
@ -74,17 +77,10 @@
|
||||||
bufferChain = nil;
|
bufferChain = nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
output = [[OutputNode alloc] initWithController:self previous:nil];
|
|
||||||
[output setup];
|
|
||||||
[output setVolume: volume];
|
|
||||||
|
|
||||||
bufferChain = [[BufferChain alloc] initWithController:self];
|
bufferChain = [[BufferChain alloc] initWithController:self];
|
||||||
[self notifyStreamChanged:userInfo];
|
[self notifyStreamChanged:userInfo];
|
||||||
|
|
||||||
currentStream = url;
|
|
||||||
currentUserInfo = userInfo;
|
|
||||||
currentRGInfo = rgi;
|
|
||||||
|
|
||||||
while (![bufferChain open:url withOutputFormat:[output format] withRGInfo:rgi])
|
while (![bufferChain open:url withOutputFormat:[output format] withRGInfo:rgi])
|
||||||
{
|
{
|
||||||
bufferChain = nil;
|
bufferChain = nil;
|
||||||
|
@ -100,10 +96,6 @@
|
||||||
userInfo = nextStreamUserInfo;
|
userInfo = nextStreamUserInfo;
|
||||||
rgi = nextStreamRGInfo;
|
rgi = nextStreamRGInfo;
|
||||||
|
|
||||||
currentStream = url;
|
|
||||||
currentUserInfo = userInfo;
|
|
||||||
currentRGInfo = rgi;
|
|
||||||
|
|
||||||
[self notifyStreamChanged:userInfo];
|
[self notifyStreamChanged:userInfo];
|
||||||
|
|
||||||
bufferChain = [[BufferChain alloc] initWithController:self];
|
bufferChain = [[BufferChain alloc] initWithController:self];
|
||||||
|
@ -127,75 +119,6 @@
|
||||||
|
|
||||||
if (paused)
|
if (paused)
|
||||||
[self setPlaybackStatus:CogStatusPaused waitUntilDone:YES];
|
[self setPlaybackStatus:CogStatusPaused waitUntilDone:YES];
|
||||||
|
|
||||||
self->paused = paused;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)play:(id<CogDecoder>)decoder startPaused:(BOOL)paused
|
|
||||||
{
|
|
||||||
@synchronized(chainQueue) {
|
|
||||||
for (id anObject in chainQueue)
|
|
||||||
{
|
|
||||||
[anObject setShouldContinue:NO];
|
|
||||||
}
|
|
||||||
[chainQueue removeAllObjects];
|
|
||||||
endOfInputReached = NO;
|
|
||||||
if (bufferChain)
|
|
||||||
{
|
|
||||||
[bufferChain setShouldContinue:NO];
|
|
||||||
|
|
||||||
bufferChain = nil;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
output = [[OutputNode alloc] initWithController:self previous:nil];
|
|
||||||
[output setup];
|
|
||||||
[output setVolume: volume];
|
|
||||||
|
|
||||||
bufferChain = [[BufferChain alloc] initWithController:self];
|
|
||||||
[self notifyStreamChanged:currentUserInfo];
|
|
||||||
|
|
||||||
NSURL *url = currentStream;
|
|
||||||
id userInfo = currentUserInfo;
|
|
||||||
NSDictionary *rgi = currentRGInfo;
|
|
||||||
|
|
||||||
while (![bufferChain openWithDecoder:decoder withOutputFormat:[output format] withRGInfo:rgi])
|
|
||||||
{
|
|
||||||
bufferChain = nil;
|
|
||||||
|
|
||||||
[self requestNextStream: userInfo];
|
|
||||||
|
|
||||||
url = nextStream;
|
|
||||||
if (url == nil)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
userInfo = nextStreamUserInfo;
|
|
||||||
rgi = nextStreamRGInfo;
|
|
||||||
|
|
||||||
currentStream = url;
|
|
||||||
currentUserInfo = userInfo;
|
|
||||||
currentRGInfo = rgi;
|
|
||||||
|
|
||||||
[self notifyStreamChanged:userInfo];
|
|
||||||
|
|
||||||
bufferChain = [[BufferChain alloc] initWithController:self];
|
|
||||||
}
|
|
||||||
|
|
||||||
[bufferChain setUserInfo:userInfo];
|
|
||||||
|
|
||||||
[self setShouldContinue:YES];
|
|
||||||
|
|
||||||
outputLaunched = NO;
|
|
||||||
startedPaused = paused;
|
|
||||||
initialBufferFilled = NO;
|
|
||||||
|
|
||||||
[bufferChain launchThreads];
|
|
||||||
|
|
||||||
if (paused)
|
|
||||||
[self setPlaybackStatus:CogStatusPaused waitUntilDone:YES];
|
|
||||||
|
|
||||||
self->paused = paused;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)stop
|
- (void)stop
|
||||||
|
@ -210,8 +133,6 @@
|
||||||
[output pause];
|
[output pause];
|
||||||
|
|
||||||
[self setPlaybackStatus:CogStatusPaused waitUntilDone:YES];
|
[self setPlaybackStatus:CogStatusPaused waitUntilDone:YES];
|
||||||
|
|
||||||
paused = YES;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)resume
|
- (void)resume
|
||||||
|
@ -226,8 +147,6 @@
|
||||||
[output resume];
|
[output resume];
|
||||||
|
|
||||||
[self setPlaybackStatus:CogStatusPlaying waitUntilDone:YES];
|
[self setPlaybackStatus:CogStatusPlaying waitUntilDone:YES];
|
||||||
|
|
||||||
paused = NO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)seekToTime:(double)time
|
- (void)seekToTime:(double)time
|
||||||
|
|
Loading…
Reference in New Issue