Support GME M3U playlists.
This commit is contained in:
parent
1dab2b6d27
commit
a7d1853853
3 changed files with 59 additions and 0 deletions
|
@ -63,6 +63,27 @@
|
||||||
ALog(@"GME: Error loading file: %@ %s", [url path], error);
|
ALog(@"GME: Error loading file: %@ %s", [url path], error);
|
||||||
return [NSArray arrayWithObject:url];
|
return [NSArray arrayWithObject:url];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSURL *m3uurl = [url URLByDeletingPathExtension];
|
||||||
|
m3uurl = [m3uurl URLByAppendingPathExtension:@"m3u"];
|
||||||
|
if ([source open:m3uurl])
|
||||||
|
{
|
||||||
|
if ([source seekable])
|
||||||
|
{
|
||||||
|
[source seek:0 whence:SEEK_END];
|
||||||
|
size = [source tell];
|
||||||
|
[source seek:0 whence:SEEK_SET];
|
||||||
|
|
||||||
|
data = malloc(size);
|
||||||
|
[source read:data amount:size];
|
||||||
|
|
||||||
|
error = gme_load_m3u_data(emu, data, size);
|
||||||
|
free(data);
|
||||||
|
|
||||||
|
ALog(@"M3U loaded: %s", error ? error : "no error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int track_count = gme_track_count(emu);
|
int track_count = gme_track_count(emu);
|
||||||
|
|
||||||
NSMutableArray *tracks = [NSMutableArray array];
|
NSMutableArray *tracks = [NSMutableArray array];
|
||||||
|
|
|
@ -78,6 +78,26 @@ gme_err_t readCallback( void* data, void* out, long count )
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSURL *m3uurl = [[source url] URLByDeletingPathExtension];
|
||||||
|
m3uurl = [m3uurl URLByAppendingPathExtension:@"m3u"];
|
||||||
|
id audioSourceClass = NSClassFromString(@"AudioSource");
|
||||||
|
id<CogSource> m3usrc = [audioSourceClass audioSourceForURL:m3uurl];
|
||||||
|
if ([m3usrc open:m3uurl])
|
||||||
|
{
|
||||||
|
if ([m3usrc seekable])
|
||||||
|
{
|
||||||
|
[source seek:0 whence:SEEK_END];
|
||||||
|
long size = [source tell];
|
||||||
|
[source seek:0 whence:SEEK_SET];
|
||||||
|
|
||||||
|
void *data = malloc(size);
|
||||||
|
[source read:data amount:size];
|
||||||
|
|
||||||
|
gme_load_m3u_data(emu, data, size);
|
||||||
|
free(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int track_num = [[[source url] fragment] intValue]; //What if theres no fragment? Assuming we get 0.
|
int track_num = [[[source url] fragment] intValue]; //What if theres no fragment? Assuming we get 0.
|
||||||
|
|
||||||
gme_info_t * info;
|
gme_info_t * info;
|
||||||
|
|
|
@ -71,6 +71,24 @@
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSURL *m3uurl = [url URLByDeletingPathExtension];
|
||||||
|
m3uurl = [m3uurl URLByAppendingPathExtension:@"m3u"];
|
||||||
|
if ([source open:m3uurl])
|
||||||
|
{
|
||||||
|
if ([source seekable])
|
||||||
|
{
|
||||||
|
[source seek:0 whence:SEEK_END];
|
||||||
|
long size = [source tell];
|
||||||
|
[source seek:0 whence:SEEK_SET];
|
||||||
|
|
||||||
|
void *data = malloc(size);
|
||||||
|
[source read:data amount:size];
|
||||||
|
|
||||||
|
gme_load_m3u_data(emu, data, size);
|
||||||
|
free(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int track_num;
|
int track_num;
|
||||||
if ([[url fragment] length] == 0)
|
if ([[url fragment] length] == 0)
|
||||||
track_num = 0;
|
track_num = 0;
|
||||||
|
|
Loading…
Reference in a new issue