Implement framework for dynamic metadata updates
Signed-off-by: Christopher Snowhill <kode54@gmail.com>CQTexperiment
parent
b927f4c02b
commit
7cea254f4c
|
@ -760,6 +760,14 @@ NSDictionary *makeRGInfo(PlaylistEntry *pe) {
|
||||||
[player play:[pe URL] withUserInfo:pe withRGInfo:makeRGInfo(pe) startPaused:paused andSeekTo:[pe currentPosition]];
|
[player play:[pe URL] withUserInfo:pe withRGInfo:makeRGInfo(pe) startPaused:paused andSeekTo:[pe currentPosition]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)audioPlayer:(AudioPlayer *)player pushInfo:(NSDictionary *)info toTrack:(id)userInfo {
|
||||||
|
PlaylistEntry *pe = (PlaylistEntry *)userInfo;
|
||||||
|
[pe setMetadata:info];
|
||||||
|
[playlistView refreshCurrentTrack:self];
|
||||||
|
[self sendMetaData];
|
||||||
|
[[NSNotificationCenter defaultCenter] postNotificationName:CogPlaybackDidBeginNotficiation object:pe];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)removeHDCD:(id)sender {
|
- (void)removeHDCD:(id)sender {
|
||||||
MainWindow *mainWindow = (MainWindow *)appController.mainWindow;
|
MainWindow *mainWindow = (MainWindow *)appController.mainWindow;
|
||||||
[mainWindow showHDCDLogo:NO];
|
[mainWindow showHDCDLogo:NO];
|
||||||
|
|
|
@ -78,6 +78,8 @@
|
||||||
|
|
||||||
- (void)restartPlaybackAtCurrentPosition;
|
- (void)restartPlaybackAtCurrentPosition;
|
||||||
|
|
||||||
|
- (void)pushInfo:(NSDictionary *)info;
|
||||||
|
|
||||||
+ (NSArray *)fileTypes;
|
+ (NSArray *)fileTypes;
|
||||||
+ (NSArray *)schemes;
|
+ (NSArray *)schemes;
|
||||||
+ (NSArray *)containerTypes;
|
+ (NSArray *)containerTypes;
|
||||||
|
@ -124,4 +126,5 @@
|
||||||
- (void)audioPlayer:(AudioPlayer *)player removeEqualizer:(AudioUnit)eq;
|
- (void)audioPlayer:(AudioPlayer *)player removeEqualizer:(AudioUnit)eq;
|
||||||
- (void)audioPlayer:(AudioPlayer *)player sustainHDCD:(id)userInfo;
|
- (void)audioPlayer:(AudioPlayer *)player sustainHDCD:(id)userInfo;
|
||||||
- (void)audioPlayer:(AudioPlayer *)player restartPlaybackAtCurrentPosition:(id)userInfo;
|
- (void)audioPlayer:(AudioPlayer *)player restartPlaybackAtCurrentPosition:(id)userInfo;
|
||||||
|
- (void)audioPlayer:(AudioPlayer *)player pushInfo:(NSDictionary *)info toTrack:(id)userInfo;
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -224,6 +224,10 @@
|
||||||
[self sendDelegateMethod:@selector(audioPlayer:restartPlaybackAtCurrentPosition:) withObject:[bufferChain userInfo] waitUntilDone:NO];
|
[self sendDelegateMethod:@selector(audioPlayer:restartPlaybackAtCurrentPosition:) withObject:[bufferChain userInfo] waitUntilDone:NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)pushInfo:(NSDictionary *)info {
|
||||||
|
[self sendDelegateMethod:@selector(audioPlayer:pushInfo:toTrack:) withObject:info withObject:[bufferChain userInfo] waitUntilDone:NO];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)setShouldContinue:(BOOL)s {
|
- (void)setShouldContinue:(BOOL)s {
|
||||||
shouldContinue = s;
|
shouldContinue = s;
|
||||||
|
|
||||||
|
|
|
@ -77,4 +77,6 @@
|
||||||
|
|
||||||
- (void)restartPlaybackAtCurrentPosition;
|
- (void)restartPlaybackAtCurrentPosition;
|
||||||
|
|
||||||
|
- (void)pushInfo:(NSDictionary *)info;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -264,4 +264,8 @@
|
||||||
[controller restartPlaybackAtCurrentPosition];
|
[controller restartPlaybackAtCurrentPosition];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)pushInfo:(NSDictionary *)info {
|
||||||
|
[controller pushInfo:info];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -116,6 +116,18 @@
|
||||||
nodeLossless = [[properties valueForKey:@"encoding"] isEqualToString:@"lossless"];
|
nodeLossless = [[properties valueForKey:@"encoding"] isEqualToString:@"lossless"];
|
||||||
} else if([keyPath isEqual:@"metadata"]) {
|
} else if([keyPath isEqual:@"metadata"]) {
|
||||||
// Inform something of metadata change
|
// Inform something of metadata change
|
||||||
|
NSMutableDictionary *entryInfo = [NSMutableDictionary dictionaryWithCapacity:32];
|
||||||
|
|
||||||
|
NSDictionary *entryProperties = [decoder properties];
|
||||||
|
if(entryProperties == nil)
|
||||||
|
return;
|
||||||
|
|
||||||
|
[entryInfo addEntriesFromDictionary:entryProperties];
|
||||||
|
[entryInfo addEntriesFromDictionary:[decoder metadata]];
|
||||||
|
|
||||||
|
NSDictionary * info = [NSDictionary dictionaryWithDictionary:entryInfo];
|
||||||
|
|
||||||
|
[controller pushInfo:info];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,11 @@ NSArray *sortClassesByPriority(NSArray *theClasses) {
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSDictionary *)metadata {
|
||||||
|
if(theDecoder != nil) return [theDecoder metadata];
|
||||||
|
return @{};
|
||||||
|
}
|
||||||
|
|
||||||
- (int)readAudio:(void *)buffer frames:(UInt32)frames {
|
- (int)readAudio:(void *)buffer frames:(UInt32)frames {
|
||||||
if(theDecoder != nil) return [theDecoder readAudio:buffer frames:frames];
|
if(theDecoder != nil) return [theDecoder readAudio:buffer frames:frames];
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
// For KVO
|
// For KVO
|
||||||
//- (void)setProperties:(NSDictionary *)p;
|
//- (void)setProperties:(NSDictionary *)p;
|
||||||
- (NSDictionary *)properties;
|
- (NSDictionary *)properties;
|
||||||
|
- (NSDictionary *)metadata; // Only to be implemented for dynamic metadata, send events on change
|
||||||
|
|
||||||
- (int)readAudio:(void *)buffer frames:(UInt32)frames;
|
- (int)readAudio:(void *)buffer frames:(UInt32)frames;
|
||||||
|
|
||||||
|
|
|
@ -24,4 +24,6 @@
|
||||||
|
|
||||||
- (IBAction)scrollToCurrentEntry:(id)sender;
|
- (IBAction)scrollToCurrentEntry:(id)sender;
|
||||||
|
|
||||||
|
- (IBAction)refreshCurrentTrack:(id)sender;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -405,6 +405,11 @@
|
||||||
return [super validateUserInterfaceItem:anItem];
|
return [super validateUserInterfaceItem:anItem];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (IBAction)refreshCurrentTrack:(id)sender {
|
||||||
|
unsigned long columns = [[self tableColumns] count];
|
||||||
|
[self reloadDataForRowIndexes:[NSIndexSet indexSetWithIndex:[[playlistController currentEntry] index]] columnIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, columns)]];
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal
|
- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,7 +28,11 @@
|
||||||
|
|
||||||
// Need to alter length
|
// Need to alter length
|
||||||
[properties setObject:[NSNumber numberWithLong:trackLength] forKey:@"totalFrames"];
|
[properties setObject:[NSNumber numberWithLong:trackLength] forKey:@"totalFrames"];
|
||||||
return properties;
|
return [NSDictionary dictionaryWithDictionary:properties];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSDictionary *)metadata {
|
||||||
|
return @{};
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)open:(id<CogSource>)s {
|
- (BOOL)open:(id<CogSource>)s {
|
||||||
|
|
|
@ -92,6 +92,10 @@ static CAdPlugDatabase *g_database = NULL;
|
||||||
@"endian": @"host"};
|
@"endian": @"host"};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSDictionary *)metadata {
|
||||||
|
return @{};
|
||||||
|
}
|
||||||
|
|
||||||
- (int)readAudio:(void *)buf frames:(UInt32)frames {
|
- (int)readAudio:(void *)buf frames:(UInt32)frames {
|
||||||
int total = 0;
|
int total = 0;
|
||||||
bool dont_loop = !IsRepeatOneSet();
|
bool dont_loop = !IsRepeatOneSet();
|
||||||
|
|
|
@ -402,4 +402,8 @@ static SInt64 getSizeProc(void *clientData) {
|
||||||
@"encoding": _audioFile_is_lossy ? @"lossy" : @"lossless"};
|
@"encoding": _audioFile_is_lossy ? @"lossy" : @"lossless"};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSDictionary *)metadata {
|
||||||
|
return @{};
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -40,7 +40,11 @@
|
||||||
// Need to alter length
|
// Need to alter length
|
||||||
[properties setObject:[NSNumber numberWithLong:(trackEnd - trackStart)] forKey:@"totalFrames"];
|
[properties setObject:[NSNumber numberWithLong:(trackEnd - trackStart)] forKey:@"totalFrames"];
|
||||||
|
|
||||||
return properties;
|
return [NSDictionary dictionaryWithDictionary:properties];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSDictionary *)metadata {
|
||||||
|
return @{};
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)open:(id<CogSource>)s {
|
- (BOOL)open:(id<CogSource>)s {
|
||||||
|
|
|
@ -647,6 +647,10 @@ int64_t ffmpeg_seek(void *opaque, int64_t offset, int whence) {
|
||||||
@"encoding": lossy ? @"lossy" : @"lossless"};
|
@"encoding": lossy ? @"lossy" : @"lossless"};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSDictionary *)metadata {
|
||||||
|
return @{};
|
||||||
|
}
|
||||||
|
|
||||||
+ (NSArray *)fileTypes {
|
+ (NSArray *)fileTypes {
|
||||||
return @[@"wma", @"asf", @"tak", @"mp4", @"m4a", @"aac", @"mp3", @"mp2", @"m2a", @"mpa", @"ape", @"ac3", @"dts", @"dtshd", @"wav", @"tta", @"vqf", @"vqe", @"vql", @"ra", @"rm", @"rmj", @"mka", @"weba"];
|
return @[@"wma", @"asf", @"tak", @"mp4", @"m4a", @"aac", @"mp3", @"mp2", @"m2a", @"mpa", @"ape", @"ac3", @"dts", @"dtshd", @"wav", @"tta", @"vqf", @"vqe", @"vql", @"ra", @"rm", @"rmj", @"mka", @"weba"];
|
||||||
}
|
}
|
||||||
|
|
|
@ -366,6 +366,10 @@ void ErrorCallback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorS
|
||||||
@"encoding": @"lossless"};
|
@"encoding": @"lossless"};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSDictionary *)metadata {
|
||||||
|
return @{};
|
||||||
|
}
|
||||||
|
|
||||||
+ (NSArray *)fileTypes {
|
+ (NSArray *)fileTypes {
|
||||||
return @[@"flac"];
|
return @[@"flac"];
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,6 +151,10 @@ gme_err_t readCallback(void *data, void *out, int count) {
|
||||||
@"encoding": @"synthesized"};
|
@"encoding": @"synthesized"};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSDictionary *)metadata {
|
||||||
|
return @{};
|
||||||
|
}
|
||||||
|
|
||||||
- (int)readAudio:(void *)buf frames:(UInt32)frames {
|
- (int)readAudio:(void *)buf frames:(UInt32)frames {
|
||||||
int numSamples = frames * 2; // channels = 2
|
int numSamples = frames * 2; // channels = 2
|
||||||
|
|
||||||
|
|
|
@ -91,6 +91,10 @@ static void oneTimeInit(void) {
|
||||||
@"encoding": @"synthesized"};
|
@"encoding": @"synthesized"};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSDictionary *)metadata {
|
||||||
|
return @{};
|
||||||
|
}
|
||||||
|
|
||||||
- (int)readAudio:(void *)buf frames:(UInt32)frames {
|
- (int)readAudio:(void *)buf frames:(UInt32)frames {
|
||||||
BOOL repeatone = IsRepeatOneSet();
|
BOOL repeatone = IsRepeatOneSet();
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,10 @@ static OSType getOSType(const char *in_) {
|
||||||
@"encoding": @"synthesized"};
|
@"encoding": @"synthesized"};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSDictionary *)metadata {
|
||||||
|
return @{};
|
||||||
|
}
|
||||||
|
|
||||||
- (BOOL)initDecoder {
|
- (BOOL)initDecoder {
|
||||||
NSString *soundFontPath = @"";
|
NSString *soundFontPath = @"";
|
||||||
|
|
||||||
|
|
|
@ -191,6 +191,10 @@ mpc_bool_t CanSeekProc(mpc_reader *p_reader) {
|
||||||
@"encoding": @"lossy"};
|
@"encoding": @"lossy"};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSDictionary *)metadata {
|
||||||
|
return @{};
|
||||||
|
}
|
||||||
|
|
||||||
+ (NSArray *)fileTypes {
|
+ (NSArray *)fileTypes {
|
||||||
return @[@"mpc"];
|
return @[@"mpc"];
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,6 +104,10 @@ static void g_push_archive_extensions(std::vector<std::string> &list) {
|
||||||
@"encoding": @"synthesized"};
|
@"encoding": @"synthesized"};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSDictionary *)metadata {
|
||||||
|
return @{};
|
||||||
|
}
|
||||||
|
|
||||||
- (int)readAudio:(void *)buf frames:(UInt32)frames {
|
- (int)readAudio:(void *)buf frames:(UInt32)frames {
|
||||||
mod->set_repeat_count(IsRepeatOneSet() ? -1 : 0);
|
mod->set_repeat_count(IsRepeatOneSet() ? -1 : 0);
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,10 @@ static void g_push_archive_extensions(std::vector<std::string> &list) {
|
||||||
@"encoding": @"synthesized"};
|
@"encoding": @"synthesized"};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSDictionary *)metadata {
|
||||||
|
return @{};
|
||||||
|
}
|
||||||
|
|
||||||
- (int)readAudio:(void *)buf frames:(UInt32)frames {
|
- (int)readAudio:(void *)buf frames:(UInt32)frames {
|
||||||
mod->set_repeat_count(IsRepeatOneSet() ? -1 : 0);
|
mod->set_repeat_count(IsRepeatOneSet() ? -1 : 0);
|
||||||
|
|
||||||
|
|
|
@ -188,6 +188,10 @@ opus_int64 sourceTell(void *_stream) {
|
||||||
@"encoding": @"lossy"};
|
@"encoding": @"lossy"};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSDictionary *)metadata {
|
||||||
|
return @{};
|
||||||
|
}
|
||||||
|
|
||||||
+ (NSArray *)fileTypes {
|
+ (NSArray *)fileTypes {
|
||||||
return @[@"opus", @"ogg"];
|
return @[@"opus", @"ogg"];
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,10 @@
|
||||||
@"encoding": @"lossless"};
|
@"encoding": @"lossless"};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSDictionary *)metadata {
|
||||||
|
return @{};
|
||||||
|
}
|
||||||
|
|
||||||
+ (NSArray *)fileTypes {
|
+ (NSArray *)fileTypes {
|
||||||
return @[@"shn"];
|
return @[@"shn"];
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,10 @@ enum { channels = 2 };
|
||||||
@"encoding": @"synthesized"};
|
@"encoding": @"synthesized"};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSDictionary *)metadata {
|
||||||
|
return @{};
|
||||||
|
}
|
||||||
|
|
||||||
- (int)readAudio:(void *)buf frames:(UInt32)frames {
|
- (int)readAudio:(void *)buf frames:(UInt32)frames {
|
||||||
int total = frames;
|
int total = frames;
|
||||||
|
|
||||||
|
|
|
@ -171,6 +171,10 @@ long sourceTell(void *datasource) {
|
||||||
@"encoding": @"lossy"};
|
@"encoding": @"lossy"};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSDictionary *)metadata {
|
||||||
|
return @{};
|
||||||
|
}
|
||||||
|
|
||||||
+ (NSArray *)fileTypes {
|
+ (NSArray *)fileTypes {
|
||||||
return @[@"ogg"];
|
return @[@"ogg"];
|
||||||
}
|
}
|
||||||
|
|
|
@ -294,6 +294,10 @@ int32_t WriteBytesProc(void *ds, void *data, int32_t bcount) {
|
||||||
@"encoding": isLossy ? @"lossy" : @"lossless"};
|
@"encoding": isLossy ? @"lossy" : @"lossless"};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSDictionary *)metadata {
|
||||||
|
return @{};
|
||||||
|
}
|
||||||
|
|
||||||
+ (NSArray *)fileTypes {
|
+ (NSArray *)fileTypes {
|
||||||
return @[@"wv", @"wvp"];
|
return @[@"wv", @"wvp"];
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,6 +189,10 @@ const int masterVol = 0x10000; // Fixed point 16.16
|
||||||
@"encoding": @"synthesized"};
|
@"encoding": @"synthesized"};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSDictionary *)metadata {
|
||||||
|
return @{};
|
||||||
|
}
|
||||||
|
|
||||||
- (int)readAudio:(void*)buf frames:(UInt32)frames {
|
- (int)readAudio:(void*)buf frames:(UInt32)frames {
|
||||||
if([self trackEnded])
|
if([self trackEnded])
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -199,6 +199,10 @@ static void sidTuneLoader(const char *fileName, std::vector<uint8_t> &bufferRef)
|
||||||
@"encoding": @"synthesized"};
|
@"encoding": @"synthesized"};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSDictionary *)metadata {
|
||||||
|
return @{};
|
||||||
|
}
|
||||||
|
|
||||||
- (int)readAudio:(void *)buf frames:(UInt32)frames {
|
- (int)readAudio:(void *)buf frames:(UInt32)frames {
|
||||||
int total = 0;
|
int total = 0;
|
||||||
int16_t *sampleBuffer = (int16_t *)buf;
|
int16_t *sampleBuffer = (int16_t *)buf;
|
||||||
|
|
|
@ -295,6 +295,10 @@ static NSString *get_description_tag(const char *description, const char *tag, c
|
||||||
@"encoding": @"lossy/lossless"};
|
@"encoding": @"lossy/lossless"};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSDictionary *)metadata {
|
||||||
|
return @{};
|
||||||
|
}
|
||||||
|
|
||||||
- (int)readAudio:(void *)buf frames:(UInt32)frames {
|
- (int)readAudio:(void *)buf frames:(UInt32)frames {
|
||||||
UInt32 framesMax = frames;
|
UInt32 framesMax = frames;
|
||||||
UInt32 framesDone = 0;
|
UInt32 framesDone = 0;
|
||||||
|
|
Loading…
Reference in New Issue