Add decoder open error indicator
When decoder is redirected to the internal silence decoder, show an icon on the playlist indicating a playback error. Signed-off-by: Christopher Snowhill <kode54@gmail.com>CQTexperiment
parent
8f1143818b
commit
5ff1f95481
|
@ -768,6 +768,11 @@ NSDictionary *makeRGInfo(PlaylistEntry *pe) {
|
|||
[[NSNotificationCenter defaultCenter] postNotificationName:CogPlaybackDidBeginNotficiation object:pe];
|
||||
}
|
||||
|
||||
- (void)audioPlayer:(AudioPlayer *)player setError:(NSNumber *)status toTrack:(id)userInfo {
|
||||
PlaylistEntry *pe = (PlaylistEntry *)userInfo;
|
||||
[pe setError:[status boolValue]];
|
||||
}
|
||||
|
||||
- (void)removeHDCD:(id)sender {
|
||||
MainWindow *mainWindow = (MainWindow *)appController.mainWindow;
|
||||
[mainWindow showHDCDLogo:NO];
|
||||
|
|
|
@ -127,4 +127,5 @@
|
|||
- (void)audioPlayer:(AudioPlayer *)player sustainHDCD:(id)userInfo;
|
||||
- (void)audioPlayer:(AudioPlayer *)player restartPlaybackAtCurrentPosition:(id)userInfo;
|
||||
- (void)audioPlayer:(AudioPlayer *)player pushInfo:(NSDictionary *)info toTrack:(id)userInfo;
|
||||
- (void)audioPlayer:(AudioPlayer *)player setError:(NSNumber *)status toTrack:(id)userInfo;
|
||||
@end
|
||||
|
|
|
@ -492,6 +492,10 @@
|
|||
[self sendDelegateMethod:@selector(audioPlayer:sustainHDCD:) withObject:[bufferChain userInfo] waitUntilDone:NO];
|
||||
}
|
||||
|
||||
- (void)setError:(BOOL)status {
|
||||
[self sendDelegateMethod:@selector(audioPlayer:setError:toTrack:) withObject:[NSNumber numberWithBool:status] withObject:[bufferChain userInfo] waitUntilDone:NO];
|
||||
}
|
||||
|
||||
- (void)setPlaybackStatus:(int)status {
|
||||
[self setPlaybackStatus:status waitUntilDone:NO];
|
||||
}
|
||||
|
|
|
@ -79,4 +79,6 @@
|
|||
|
||||
- (void)pushInfo:(NSDictionary *)info;
|
||||
|
||||
- (void)setError:(BOOL)status;
|
||||
|
||||
@end
|
||||
|
|
|
@ -268,4 +268,8 @@
|
|||
[controller pushInfo:info];
|
||||
}
|
||||
|
||||
- (void)setError:(BOOL)status {
|
||||
[controller setError:status];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -139,6 +139,16 @@
|
|||
BOOL shouldClose = YES;
|
||||
BOOL seekError = NO;
|
||||
|
||||
BOOL isError = NO;
|
||||
|
||||
if([decoder respondsToSelector:@selector(isSilence)]) {
|
||||
if([decoder isSilence]) {
|
||||
isError = YES;
|
||||
}
|
||||
}
|
||||
|
||||
[controller setError:isError];
|
||||
|
||||
while([self shouldContinue] == YES && [self endOfStream] == NO) {
|
||||
if(shouldSeek == YES) {
|
||||
BufferChain *bufferChain = [[controller controller] bufferChain];
|
||||
|
@ -159,6 +169,10 @@
|
|||
shouldSeek = NO;
|
||||
DLog(@"Seeked! Resetting Buffer");
|
||||
initialBufferFilled = NO;
|
||||
|
||||
if(seekError) {
|
||||
[controller setError:YES];
|
||||
}
|
||||
}
|
||||
|
||||
if(amountInBuffer < CHUNK_SIZE) {
|
||||
|
|
|
@ -53,6 +53,8 @@
|
|||
// These are in NSObject, so as long as you are a subclass of that, you are ok.
|
||||
- (void)addObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options context:(void *)context;
|
||||
- (void)removeObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath;
|
||||
|
||||
- (BOOL)isSilence;
|
||||
@end
|
||||
|
||||
@protocol CogMetadataReader <NSObject>
|
||||
|
|
|
@ -122,4 +122,10 @@
|
|||
return n;
|
||||
}
|
||||
|
||||
- (BOOL)isSilence {
|
||||
if([decoder respondsToSelector:@selector(isSilence)])
|
||||
return [decoder isSilence];
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -295,4 +295,10 @@
|
|||
return n;
|
||||
}
|
||||
|
||||
- (BOOL)isSilence {
|
||||
if([decoder respondsToSelector:@selector(isSilence)])
|
||||
return [decoder isSilence];
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -85,6 +85,10 @@ enum { channels = 2 };
|
|||
return source;
|
||||
}
|
||||
|
||||
- (BOOL)isSilence {
|
||||
return YES;
|
||||
}
|
||||
|
||||
+ (NSArray *)fileTypes {
|
||||
return @[];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue