summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHardeep Sidhu <dyp@pobox.com>2005-11-08 06:28:05 +0000
committerHardeep Sidhu <dyp@pobox.com>2005-11-08 06:28:05 +0000
commit8fef62bdacd1d10b02c2ffb2de94a4764a669137 (patch)
treeeeb5e2596f55134a1a931e578146942beea5cdf7
parent859d4da8deac1c77c704051d322cb88b8914344d (diff)
downloadrockbox-8fef62bdacd1d10b02c2ffb2de94a4764a669137.zip
rockbox-8fef62bdacd1d10b02c2ffb2de94a4764a669137.tar.gz
rockbox-8fef62bdacd1d10b02c2ffb2de94a4764a669137.tar.bz2
rockbox-8fef62bdacd1d10b02c2ffb2de94a4764a669137.tar.xz
If no previous track found, check if we're really at the end of playback or if a new playlist is starting. Fixes problem with previous not working with move to next folder feature.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7786 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/mpeg.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index 8f97a0b..c164df5 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -1016,6 +1016,19 @@ static void stop_playing(void)
reset_mp3_buffer();
}
+/* Is this a really the end of playback or is a new playlist starting */
+static void check_playlist_end(int direction)
+{
+ /* Use the largest possible step size to account for skipped tracks */
+ int steps = playlist_amount();
+
+ if (direction < 0)
+ steps = -steps;
+
+ if (playlist_next(steps) < 0)
+ is_playing = false;
+}
+
static void update_playlist(void)
{
if (num_tracks_in_memory() > 0)
@@ -1026,8 +1039,7 @@ static void update_playlist(void)
else
{
/* End of playlist? */
- if (playlist_next(playlist_amount()) < 0)
- is_playing = false;
+ check_playlist_end(1);
}
playlist_update_resume_info(audio_current_track());
@@ -1363,7 +1375,7 @@ static void mpeg_thread(void)
DEBUGF("No more files to play\n");
filling = false;
- update_playlist();
+ check_playlist_end(1);
current_track_counter++;
} else {
/* Make it read more data */
@@ -1402,6 +1414,9 @@ static void mpeg_thread(void)
if (new_file(-1) < 0) {
DEBUGF("No more files to play\n");
filling = false;
+
+ check_playlist_end(-1);
+ current_track_counter++;
} else {
/* Make it read more data */
filling = true;