summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2008-09-21 14:19:18 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2008-09-21 14:19:18 +0000
commit95f516e0b9ba03372b2f2b89c9c8adf99b069913 (patch)
tree0f9b045ebe853018d75da00c1d8bddd55029fc76
parent8cd2bb7f34bd12fc1a6571ebc88d361a24d5a150 (diff)
downloadrockbox-95f516e0b9ba03372b2f2b89c9c8adf99b069913.tar.gz
rockbox-95f516e0b9ba03372b2f2b89c9c8adf99b069913.zip
more slight playlist resume cleanuping... dont bother saving the playlist first index value. its reset to 0 before playlistcontrol is loaded anyway, and then reset to 0 after its finished so its completly useless in global_status.
runtimes, resume info, etc will be reset again... git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18561 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/playlist.c26
-rw-r--r--apps/settings.h1
-rw-r--r--apps/settings_list.c1
-rw-r--r--apps/settings_list.h2
4 files changed, 3 insertions, 27 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index 1d42ba3728..5d8d8495bf 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -297,9 +297,6 @@ static void empty_playlist(struct playlist_info* playlist, bool resume)
297 /* start with fresh playlist control file when starting new 297 /* start with fresh playlist control file when starting new
298 playlist */ 298 playlist */
299 create_control(playlist); 299 create_control(playlist);
300
301 /* Reset resume settings */
302 global_status.resume_first_index = 0;
303 } 300 }
304} 301}
305 302
@@ -788,11 +785,6 @@ static int add_track_to_playlist(struct playlist_info* playlist,
788 { 785 {
789 playlist->first_index++; 786 playlist->first_index++;
790 787
791 if (seek_pos < 0 && playlist->current)
792 {
793 global_status.resume_first_index = playlist->first_index;
794 status_save();
795 }
796 } 788 }
797 789
798 if (insert_position < playlist->last_insert_pos || 790 if (insert_position < playlist->last_insert_pos ||
@@ -903,12 +895,6 @@ static int remove_track_from_playlist(struct playlist_info* playlist,
903 if (position < playlist->first_index) 895 if (position < playlist->first_index)
904 { 896 {
905 playlist->first_index--; 897 playlist->first_index--;
906
907 if (write)
908 {
909 global_status.resume_first_index = playlist->first_index;
910 status_save();
911 }
912 } 898 }
913 899
914 if (position <= playlist->last_insert_pos) 900 if (position <= playlist->last_insert_pos)
@@ -1191,12 +1177,6 @@ static void find_and_set_playlist_index(struct playlist_info* playlist,
1191 { 1177 {
1192 playlist->index = playlist->first_index = i; 1178 playlist->index = playlist->first_index = i;
1193 1179
1194 if (playlist->current)
1195 {
1196 global_status.resume_first_index = i;
1197 status_save();
1198 }
1199
1200 break; 1180 break;
1201 } 1181 }
1202 } 1182 }
@@ -2354,7 +2334,6 @@ int playlist_resume(void)
2354 /* Terminate on EOF */ 2334 /* Terminate on EOF */
2355 if(nread <= 0) 2335 if(nread <= 0)
2356 { 2336 {
2357 playlist->first_index = global_status.resume_first_index;
2358 break; 2337 break;
2359 } 2338 }
2360 } 2339 }
@@ -2406,8 +2385,7 @@ int playlist_shuffle(int random_seed, int start_index)
2406 { 2385 {
2407 /* store the seek position before the shuffle */ 2386 /* store the seek position before the shuffle */
2408 seek_pos = playlist->indices[start_index]; 2387 seek_pos = playlist->indices[start_index];
2409 playlist->index = global_status.resume_first_index = 2388 playlist->index = playlist->first_index = start_index;
2410 playlist->first_index = start_index;
2411 start_current = true; 2389 start_current = true;
2412 } 2390 }
2413 2391
@@ -2541,7 +2519,7 @@ int playlist_next(int steps)
2541 playlist->amount > 1) 2519 playlist->amount > 1)
2542 { 2520 {
2543 /* Repeat shuffle mode. Re-shuffle playlist and resume play */ 2521 /* Repeat shuffle mode. Re-shuffle playlist and resume play */
2544 playlist->first_index = global_status.resume_first_index = 0; 2522 playlist->first_index = 0;
2545 sort_playlist(playlist, false, false); 2523 sort_playlist(playlist, false, false);
2546 randomise_playlist(playlist, current_tick, false, true); 2524 randomise_playlist(playlist, current_tick, false, true);
2547#if CONFIG_CODEC != SWCODEC 2525#if CONFIG_CODEC != SWCODEC
diff --git a/apps/settings.h b/apps/settings.h
index 855072a428..902956e471 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -269,7 +269,6 @@ bool set_option(const char* string, const void* variable, enum optiontype type,
269struct system_status 269struct system_status
270{ 270{
271 int resume_index; /* index in playlist (-1 for no active resume) */ 271 int resume_index; /* index in playlist (-1 for no active resume) */
272 int resume_first_index; /* index of first track in playlist */
273 uint32_t resume_offset; /* byte offset in mp3 file */ 272 uint32_t resume_offset; /* byte offset in mp3 file */
274 int runtime; /* current runtime since last charge */ 273 int runtime; /* current runtime since last charge */
275 int topruntime; /* top known runtime */ 274 int topruntime; /* top known runtime */
diff --git a/apps/settings_list.c b/apps/settings_list.c
index f94338cc48..e70f587b5a 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -425,7 +425,6 @@ const struct settings_list settings[] = {
425 /* playback */ 425 /* playback */
426 OFFON_SETTING(0, playlist_shuffle, LANG_SHUFFLE, false, "shuffle", NULL), 426 OFFON_SETTING(0, playlist_shuffle, LANG_SHUFFLE, false, "shuffle", NULL),
427 SYSTEM_SETTING(NVRAM(4), resume_index, -1), 427 SYSTEM_SETTING(NVRAM(4), resume_index, -1),
428 SYSTEM_SETTING(NVRAM(4), resume_first_index, 0),
429 SYSTEM_SETTING(NVRAM(4), resume_offset, -1), 428 SYSTEM_SETTING(NVRAM(4), resume_offset, -1),
430 CHOICE_SETTING(0, repeat_mode, LANG_REPEAT, REPEAT_ALL, "repeat", 429 CHOICE_SETTING(0, repeat_mode, LANG_REPEAT, REPEAT_ALL, "repeat",
431 "off,all,one,shuffle" 430 "off,all,one,shuffle"
diff --git a/apps/settings_list.h b/apps/settings_list.h
index 7d0f750ff9..c3a8cbaf3e 100644
--- a/apps/settings_list.h
+++ b/apps/settings_list.h
@@ -111,7 +111,7 @@ struct table_setting {
111 111
112#define F_NVRAM_BYTES_MASK 0xE0000 /*0-4 bytes can be stored */ 112#define F_NVRAM_BYTES_MASK 0xE0000 /*0-4 bytes can be stored */
113#define F_NVRAM_MASK_SHIFT 17 113#define F_NVRAM_MASK_SHIFT 17
114#define NVRAM_CONFIG_VERSION 5 114#define NVRAM_CONFIG_VERSION 6
115/* Above define should be bumped if 115/* Above define should be bumped if
116- a new NVRAM setting is added between 2 other NVRAM settings 116- a new NVRAM setting is added between 2 other NVRAM settings
117- number of bytes for a NVRAM setting is changed 117- number of bytes for a NVRAM setting is changed