Fixed file types for multi-track game music files.

CQTexperiment
vspader 2007-10-20 03:17:43 +00:00
parent 1889973c74
commit 8d74a3ccef
3 changed files with 18 additions and 24 deletions

View File

@ -15,17 +15,8 @@
+ (NSArray *)fileTypes
{
NSMutableArray *types = [NSMutableArray array];
gme_type_t const* type = gme_type_list();
while(*type)
{
//We're digging a little deep here, but there seems to be no other choice.
[types addObject:[NSString stringWithCString:(*type)->extension_ encoding: NSASCIIStringEncoding]];
type++;
}
return [[types copy] autorelease];
//There doesn't seem to be a way to get this list. These are the only multitrack types.
return [NSArray arrayWithObjects:@"ay", @"gbs", @"nsf", @"nsfe", @"sap", nil];
}
+ (NSArray *)mimeTypes
@ -37,7 +28,7 @@
+ (NSArray *)urlsForContainerURL:(NSURL *)url
{
if (![url isFileURL]) {
return [NSArray array];
return nil;
}
gme_err_t error;
@ -45,12 +36,6 @@
error = gme_open_file([[url path] UTF8String], &emu, 44100);
int track_count = gme_track_count(emu);
//If there is only one track, we shouldn't append the #
if (track_count == 1) {
NSLog(@"Track count is 1...%@", url);
return [NSArray arrayWithObject:url];
}
NSMutableArray *tracks = [NSMutableArray array];
int i;

View File

@ -7,7 +7,6 @@
//
#import "GameDecoder.h"
#import "GameContainer.h"
@implementation GameDecoder
@ -158,12 +157,22 @@ gme_err_t readCallback( void* data, void* out, long count )
+ (NSArray *)fileTypes
{
return [GameContainer fileTypes];
NSMutableArray *types = [NSMutableArray array];
gme_type_t const* type = gme_type_list();
while(*type)
{
//We're digging a little deep here, but there seems to be no other choice.
[types addObject:[NSString stringWithCString:(*type)->extension_ encoding: NSASCIIStringEncoding]];
type++;
}
return [[types copy] autorelease];
}
+ (NSArray *)mimeTypes
{
return [GameContainer fileTypes];
return nil;
}
- (void)setSource:(id<CogSource>)s

View File

@ -8,7 +8,7 @@
#import "GameMetadataReader.h"
#import "GameContainer.h"
#import "GameDecoder.h"
#import <GME/gme.h>
@ -16,12 +16,12 @@
+ (NSArray *)fileTypes
{
return [GameContainer fileTypes];
return [GameDecoder fileTypes];
}
+ (NSArray *)mimeTypes
{
return [GameContainer mimeTypes];
return [GameDecoder mimeTypes];
}
+ (NSDictionary *)metadataForURL:(NSURL *)url