diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2011-04-28 02:56:28 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2011-04-28 02:56:28 +0000 |
commit | ac724cca19b8e0564c921db7a2e1a1fc52ccbe18 (patch) | |
tree | 5a65db56eb1c921afd49188d938c7218baf04b08 /apps/codecs | |
parent | fa65362a42675d9d84a7ec57fdf5d8e1b575a4cd (diff) | |
download | rockbox-ac724cca19b8e0564c921db7a2e1a1fc52ccbe18.tar.gz rockbox-ac724cca19b8e0564c921db7a2e1a1fc52ccbe18.zip |
Get the NSF internal playlists working again. Fix a few wrongdoings in the metadata parser. Use the larger of track or playlist count to determine 'duration' so that the repeat-one switching to access the raw tracks works.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29793 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs')
-rw-r--r-- | apps/codecs/nsf.c | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/apps/codecs/nsf.c b/apps/codecs/nsf.c index b1bfb82dcd..92d0240200 100644 --- a/apps/codecs/nsf.c +++ b/apps/codecs/nsf.c | |||
@@ -4294,12 +4294,18 @@ jammed: | |||
4294 | 4294 | ||
4295 | /****************** rockbox interface ******************/ | 4295 | /****************** rockbox interface ******************/ |
4296 | 4296 | ||
4297 | /** Operational info **/ | ||
4298 | static int track = 0; | ||
4299 | static char last_path[MAX_PATH]; | ||
4300 | static int dontresettrack = 0; | ||
4301 | static bool repeat_one = false; | ||
4302 | |||
4297 | static void set_codec_track(int t, int d) { | 4303 | static void set_codec_track(int t, int d) { |
4298 | int track,fade,def=0; | 4304 | int track,fade,def=0; |
4299 | SetTrack(t); | 4305 | SetTrack(t); |
4300 | 4306 | ||
4301 | /* for REPEAT_ONE we disable track limits */ | 4307 | /* for REPEAT_ONE we disable track limits */ |
4302 | if (ci->global_settings->repeat_mode!=REPEAT_ONE) { | 4308 | if (!repeat_one) { |
4303 | if (!bIsExtended || nTrackTime[t]==-1) {track=60*2*1000; def=1;} | 4309 | if (!bIsExtended || nTrackTime[t]==-1) {track=60*2*1000; def=1;} |
4304 | else track=nTrackTime[t]; | 4310 | else track=nTrackTime[t]; |
4305 | if (!bIsExtended || nTrackFade[t]==-1) fade=5*1000; | 4311 | if (!bIsExtended || nTrackFade[t]==-1) fade=5*1000; |
@@ -4310,11 +4316,6 @@ static void set_codec_track(int t, int d) { | |||
4310 | ci->set_elapsed(d*1000); /* d is track no to display */ | 4316 | ci->set_elapsed(d*1000); /* d is track no to display */ |
4311 | } | 4317 | } |
4312 | 4318 | ||
4313 | /** Operational info **/ | ||
4314 | static int track = 0; | ||
4315 | static char last_path[MAX_PATH]; | ||
4316 | static int dontresettrack = 0; | ||
4317 | |||
4318 | /* this is the codec entry point */ | 4319 | /* this is the codec entry point */ |
4319 | enum codec_status codec_main(enum codec_entry_call_reason reason) | 4320 | enum codec_status codec_main(enum codec_entry_call_reason reason) |
4320 | { | 4321 | { |
@@ -4356,6 +4357,8 @@ enum codec_status codec_run(void) | |||
4356 | DEBUGF("NSF: file load failed\n"); | 4357 | DEBUGF("NSF: file load failed\n"); |
4357 | return CODEC_ERROR; | 4358 | return CODEC_ERROR; |
4358 | } | 4359 | } |
4360 | |||
4361 | repeat_one = ci->global_settings->repeat_mode == REPEAT_ONE; | ||
4359 | 4362 | ||
4360 | init_nsf: | 4363 | init_nsf: |
4361 | if(!NSFCore_Initialize()) { | 4364 | if(!NSFCore_Initialize()) { |
@@ -4368,21 +4371,11 @@ init_nsf: | |||
4368 | if(!LoadNSF(nDataBufferSize)) { | 4371 | if(!LoadNSF(nDataBufferSize)) { |
4369 | DEBUGF("NSF: LoadNSF failed\n"); return CODEC_ERROR;} | 4372 | DEBUGF("NSF: LoadNSF failed\n"); return CODEC_ERROR;} |
4370 | 4373 | ||
4371 | ci->id3->title=szGameTitle; | ||
4372 | ci->id3->artist=szArtist; | ||
4373 | ci->id3->album=szCopyright; | ||
4374 | if (usingplaylist) { | ||
4375 | ci->id3->length=nPlaylistSize*1000; | ||
4376 | } else { | ||
4377 | ci->id3->length=nTrackCount*1000; | ||
4378 | } | ||
4379 | |||
4380 | if (!dontresettrack||strcmp(ci->id3->path,last_path)) { | 4374 | if (!dontresettrack||strcmp(ci->id3->path,last_path)) { |
4381 | /* if this is the first time we're seeing this file, or if we haven't | 4375 | /* if this is the first time we're seeing this file, or if we haven't |
4382 | been asked to preserve the track number, default to the proper | 4376 | been asked to preserve the track number, default to the proper |
4383 | initial track */ | 4377 | initial track */ |
4384 | if (bIsExtended && | 4378 | if (bIsExtended && !repeat_one && nPlaylistSize>0) { |
4385 | ci->global_settings->repeat_mode!=REPEAT_ONE && nPlaylistSize>0) { | ||
4386 | /* decide to use the playlist */ | 4379 | /* decide to use the playlist */ |
4387 | usingplaylist=1; | 4380 | usingplaylist=1; |
4388 | track=0; | 4381 | track=0; |
@@ -4447,7 +4440,7 @@ init_nsf: | |||
4447 | 4440 | ||
4448 | print_timers(last_path,track); | 4441 | print_timers(last_path,track); |
4449 | 4442 | ||
4450 | if (ci->global_settings->repeat_mode==REPEAT_ONE) { | 4443 | if (repeat_one) { |
4451 | /* in repeat one mode just advance to the next track */ | 4444 | /* in repeat one mode just advance to the next track */ |
4452 | track++; | 4445 | track++; |
4453 | if (track>=nTrackCount) track=0; | 4446 | if (track>=nTrackCount) track=0; |