2007-10-20 15:46:39 +00:00
//Plugins! HOORAY!
2007-02-24 20:36:27 +00:00
2007-03-02 01:36:52 +00:00
@ protocol CogSource < NSObject >
+ ( NSArray * ) schemes ; //http, file, etc
2007-02-24 20:36:27 +00:00
2007-03-04 04:36:10 +00:00
- ( NSURL * ) url ;
2007-10-14 17:31:20 +00:00
- ( NSString * ) mimeType ;
2007-02-24 20:36:27 +00:00
- ( BOOL ) open : ( NSURL * ) url ;
2007-03-02 01:36:52 +00:00
- ( BOOL ) seekable ;
- ( BOOL ) seek : ( long ) position whence : ( int ) whence ;
- ( long ) tell ;
2013-10-03 08:00:58 +00:00
- ( long ) read : ( void * ) buffer amount : ( long ) amount ; //reads UP TO amount, returns amount read.
2007-03-02 01:36:52 +00:00
- ( void ) close ;
2016-06-19 19:57:18 +00:00
- ( void ) dealloc ;
2007-03-02 01:36:52 +00:00
@ end
2007-10-09 01:20:46 +00:00
@ protocol CogContainer < NSObject >
+ ( NSArray * ) fileTypes ; //mp3, ogg, etc
2007-10-14 18:56:23 +00:00
+ ( NSArray * ) mimeTypes ;
2015-04-13 07:39:24 +00:00
+ ( float ) priority ;
2007-10-09 01:20:46 +00:00
+ ( NSArray * ) urlsForContainerURL : ( NSURL * ) url ;
@ end
2007-03-03 17:19:37 +00:00
@ protocol CogDecoder < NSObject >
2007-11-24 20:16:27 +00:00
@ required
2007-10-14 17:31:20 +00:00
+ ( NSArray * ) mimeTypes ;
2007-03-02 01:36:52 +00:00
+ ( NSArray * ) fileTypes ; //mp3, ogg, etc
Implemented support for multiple decoders per file name extension, with a floating point priority control per interface. In the event that more than one input is registered to a given extension, and we match that extension, it will be passed off to an instance of the multi-decoder wrapper, which will try opening the file with all of the decoders in order of priority, until either one of them accepts it, or all of them have failed. This paves the way for adding a VGMSTREAM input, so I can give it a very low priority, since it has several formats that are verified by file name extension only. All current inputs have been given a priority of 1.0, except for CoreAudio, which was given a priority of 0.5, because it contains an MP3 and AC3 decoders that I'd rather not use if I don't have to.
2013-10-21 17:54:11 +00:00
+ ( float ) priority ; // should be 0.0 ... 1.0, higher means you get selected first, should default to 1.0 unless you know a reason why any of your extensions may behave badly, ie. greedily taking over some file type extension without performing any header validation on it
2007-03-02 01:36:52 +00:00
2007-03-03 17:19:37 +00:00
//For KVO
//- (void)setProperties:(NSDictionary *)p;
2007-02-24 20:36:27 +00:00
- ( NSDictionary * ) properties ;
2007-03-03 17:19:37 +00:00
2007-11-24 20:16:27 +00:00
- ( int ) readAudio : ( void * ) buffer frames : ( UInt32 ) frames ;
2007-03-03 17:19:37 +00:00
- ( BOOL ) open : ( id < CogSource > ) source ;
2007-11-24 20:16:27 +00:00
- ( long ) seek : ( long ) frame ;
2007-02-24 20:36:27 +00:00
- ( void ) close ;
2007-11-24 20:16:27 +00:00
@ optional
2016-06-19 19:57:18 +00:00
- ( void ) dealloc ;
2007-11-24 20:16:27 +00:00
- ( BOOL ) setTrack : ( NSURL * ) track ;
//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 ;
2007-02-24 20:36:27 +00:00
@ end
2007-03-02 01:36:52 +00:00
@ protocol CogMetadataReader < NSObject >
2007-02-24 20:36:27 +00:00
+ ( NSArray * ) fileTypes ;
2007-10-14 18:56:23 +00:00
+ ( NSArray * ) mimeTypes ;
2015-04-13 07:39:24 +00:00
+ ( float ) priority ;
2007-10-09 01:20:46 +00:00
+ ( NSDictionary * ) metadataForURL : ( NSURL * ) url ;
2007-02-24 20:36:27 +00:00
@ end
2008-11-21 15:14:23 +00:00
@ protocol CogMetadataWriter < NSObject >
//+ (NSArray *)fileTypes;
//+ (NSArray *)mimeTypes;
2013-10-03 08:00:58 +00:00
+ ( int ) putMetadataInURL : ( NSURL * ) url tagData : ( NSDictionary * ) tagData ;
2008-11-21 15:14:23 +00:00
@ end
2007-03-02 01:36:52 +00:00
@ protocol CogPropertiesReader < NSObject >
2007-02-24 20:36:27 +00:00
+ ( NSArray * ) fileTypes ;
2007-10-14 17:31:20 +00:00
+ ( NSArray * ) mimeTypes ;
2015-04-13 07:39:24 +00:00
+ ( float ) priority ;
2007-03-02 01:36:52 +00:00
+ ( NSDictionary * ) propertiesForSource : ( id < CogSource > ) source ;
2007-02-24 20:36:27 +00:00
@ end
2007-10-09 01:20:46 +00:00
@ protocol CogPluginController < NSObject >
2007-10-20 15:53:52 +00:00
+ ( id < CogPluginController > ) sharedPluginController ;
2007-10-20 15:46:39 +00:00
- ( NSDictionary * ) sources ;
- ( NSDictionary * ) containers ;
- ( NSDictionary * ) metadataReaders ;
- ( NSDictionary * ) propertiesReadersByExtension ;
- ( NSDictionary * ) propertiesReadersByMimeType ;
- ( NSDictionary * ) decodersByExtension ;
- ( NSDictionary * ) decodersByMimeType ;
2007-10-09 01:20:46 +00:00
- ( id < CogSource > ) audioSourceForURL : ( NSURL * ) url ;
- ( NSArray * ) urlsForContainerURL : ( NSURL * ) url ;
- ( NSDictionary * ) metadataForURL : ( NSURL * ) url ;
- ( NSDictionary * ) propertiesForURL : ( NSURL * ) url ;
2007-10-14 18:12:15 +00:00
- ( id < CogDecoder > ) audioDecoderForSource : ( id < CogSource > ) source ;
2008-11-21 15:14:23 +00:00
- ( int ) putMetadataInURL : ( NSURL * ) url ;
2007-10-09 01:20:46 +00:00
@ end
2007-02-24 20:36:27 +00:00
2007-03-02 01:36:52 +00:00