diff options
author | Björn Stenberg <bjorn@haxx.se> | 2002-08-16 14:41:47 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2002-08-16 14:41:47 +0000 |
commit | 6224cdb16677cae7b65b0598eec3381a6fb6a4aa (patch) | |
tree | 9ad9b39557492606c853e7f14c359bca5e0a3b65 /apps/playlist.c | |
parent | 085e77467565aba251c31721e92bc7ebd7baa61f (diff) | |
download | rockbox-6224cdb16677cae7b65b0598eec3381a6fb6a4aa.tar.gz rockbox-6224cdb16677cae7b65b0598eec3381a6fb6a4aa.zip |
Added resume. Works in dirs and playlists, shuffled or not. Resumes mid-song, but press pause on players before you shutdown so they get a chance to store the position on disk. Recorders use RTC ram. Todo: Time display is wrong after mid-track resume and ffd/rew is not handled.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1787 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/playlist.c')
-rw-r--r-- | apps/playlist.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/apps/playlist.c b/apps/playlist.c index 0cb9d09f32..f3081397f6 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -66,7 +66,7 @@ int playlist_add(char *filename) | |||
66 | return 0; | 66 | return 0; |
67 | } | 67 | } |
68 | 68 | ||
69 | char* playlist_next(int steps) | 69 | char* playlist_next(int steps, int* index) |
70 | { | 70 | { |
71 | int seek; | 71 | int seek; |
72 | int max; | 72 | int max; |
@@ -103,7 +103,9 @@ char* playlist_next(int steps) | |||
103 | else | 103 | else |
104 | return NULL; | 104 | return NULL; |
105 | } | 105 | } |
106 | 106 | ||
107 | if (index) | ||
108 | *index = playlist.index; | ||
107 | 109 | ||
108 | /* Zero-terminate the file name */ | 110 | /* Zero-terminate the file name */ |
109 | seek=0; | 111 | seek=0; |
@@ -165,7 +167,11 @@ char* playlist_next(int steps) | |||
165 | } | 167 | } |
166 | } | 168 | } |
167 | 169 | ||
168 | void play_list(char *dir, char *file, int start_index) | 170 | void play_list(char *dir, |
171 | char *file, | ||
172 | int start_index, | ||
173 | int start_offset, | ||
174 | int random_seed ) | ||
169 | { | 175 | { |
170 | char *sep=""; | 176 | char *sep=""; |
171 | int dirlen; | 177 | int dirlen; |
@@ -211,7 +217,7 @@ void play_list(char *dir, char *file, int start_index) | |||
211 | status_draw(); | 217 | status_draw(); |
212 | lcd_update(); | 218 | lcd_update(); |
213 | } | 219 | } |
214 | randomise_playlist( current_tick ); | 220 | randomise_playlist( random_seed ); |
215 | } | 221 | } |
216 | 222 | ||
217 | if(!playlist.in_ram) { | 223 | if(!playlist.in_ram) { |
@@ -220,7 +226,7 @@ void play_list(char *dir, char *file, int start_index) | |||
220 | lcd_update(); | 226 | lcd_update(); |
221 | } | 227 | } |
222 | /* also make the first song get playing */ | 228 | /* also make the first song get playing */ |
223 | mpeg_play(playlist_next(0)); | 229 | mpeg_play(start_offset); |
224 | } | 230 | } |
225 | 231 | ||
226 | /* | 232 | /* |