diff options
author | Nicolas Pennequin <nicolas.pennequin@free.fr> | 2008-01-07 22:05:58 +0000 |
---|---|---|
committer | Nicolas Pennequin <nicolas.pennequin@free.fr> | 2008-01-07 22:05:58 +0000 |
commit | d5b96f5e166dc9b88c167db8b9295fd8af349ef3 (patch) | |
tree | 066d16b474e533f284f7418b76701b49713b0c10 /apps/playback.c | |
parent | 945c8a221ade41c462a93f8452320a806e5645b3 (diff) | |
download | rockbox-d5b96f5e166dc9b88c167db8b9295fd8af349ef3.tar.gz rockbox-d5b96f5e166dc9b88c167db8b9295fd8af349ef3.zip |
Make the playlist index be incremented after the PCM track change. This fixes FS#8206. Special treatment is required to avoid breaking auto dir change.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16019 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/playback.c')
-rw-r--r-- | apps/playback.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/apps/playback.c b/apps/playback.c index 8467614329..8843e00ca2 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -242,6 +242,7 @@ static unsigned long prev_track_elapsed = 0; /* Previous track elapsed time (C/A | |||
242 | /* Track change controls */ | 242 | /* Track change controls */ |
243 | static bool automatic_skip = false; /* Who initiated in-progress skip? (C/A-) */ | 243 | static bool automatic_skip = false; /* Who initiated in-progress skip? (C/A-) */ |
244 | static bool playlist_end = false; /* Has the current playlist ended? (A) */ | 244 | static bool playlist_end = false; /* Has the current playlist ended? (A) */ |
245 | static bool auto_dir_skip = false; /* Have we changed dirs automatically? */ | ||
245 | static bool dir_skip = false; /* Is a directory skip pending? (A) */ | 246 | static bool dir_skip = false; /* Is a directory skip pending? (A) */ |
246 | static bool new_playlist = false; /* Are we starting a new playlist? (A) */ | 247 | static bool new_playlist = false; /* Are we starting a new playlist? (A) */ |
247 | static int wps_offset = 0; /* Pending track change offset, to keep WPS responsive (A) */ | 248 | static int wps_offset = 0; /* Pending track change offset, to keep WPS responsive (A) */ |
@@ -1964,7 +1965,9 @@ static int audio_check_new_track(void) | |||
1964 | int track_count = audio_track_count(); | 1965 | int track_count = audio_track_count(); |
1965 | int old_track_ridx = track_ridx; | 1966 | int old_track_ridx = track_ridx; |
1966 | int i, idx; | 1967 | int i, idx; |
1968 | int next_playlist_index; | ||
1967 | bool forward; | 1969 | bool forward; |
1970 | bool end_of_playlist; /* Temporary flag, not the same as playlist_end */ | ||
1968 | 1971 | ||
1969 | if (dir_skip) | 1972 | if (dir_skip) |
1970 | { | 1973 | { |
@@ -1985,6 +1988,9 @@ static int audio_check_new_track(void) | |||
1985 | if (new_playlist) | 1988 | if (new_playlist) |
1986 | ci.new_track = 0; | 1989 | ci.new_track = 0; |
1987 | 1990 | ||
1991 | end_of_playlist = playlist_peek(ci.new_track) == NULL; | ||
1992 | auto_dir_skip = end_of_playlist && global_settings.next_folder; | ||
1993 | |||
1988 | /* If the playlist isn't that big */ | 1994 | /* If the playlist isn't that big */ |
1989 | if (!playlist_check(ci.new_track)) | 1995 | if (!playlist_check(ci.new_track)) |
1990 | { | 1996 | { |
@@ -2004,10 +2010,17 @@ static int audio_check_new_track(void) | |||
2004 | /* Update the playlist */ | 2010 | /* Update the playlist */ |
2005 | last_peek_offset -= ci.new_track; | 2011 | last_peek_offset -= ci.new_track; |
2006 | 2012 | ||
2007 | if (playlist_next(ci.new_track) < 0) | 2013 | if (auto_dir_skip || !automatic_skip) |
2008 | { | 2014 | { |
2009 | LOGFQUEUE("audio >|= codec Q_CODEC_REQUEST_FAILED"); | 2015 | /* If the track change was manual or the result of an auto dir skip, |
2010 | return Q_CODEC_REQUEST_FAILED; | 2016 | we need to update the playlist now */ |
2017 | next_playlist_index = playlist_next(ci.new_track); | ||
2018 | |||
2019 | if (next_playlist_index < 0) | ||
2020 | { | ||
2021 | LOGFQUEUE("audio >|= codec Q_CODEC_REQUEST_FAILED"); | ||
2022 | return Q_CODEC_REQUEST_FAILED; | ||
2023 | } | ||
2011 | } | 2024 | } |
2012 | 2025 | ||
2013 | if (new_playlist) | 2026 | if (new_playlist) |
@@ -2314,10 +2327,15 @@ static void audio_finalise_track_change(void) | |||
2314 | 2327 | ||
2315 | if (automatic_skip) | 2328 | if (automatic_skip) |
2316 | { | 2329 | { |
2330 | if (!auto_dir_skip) | ||
2331 | playlist_next(-wps_offset); | ||
2332 | |||
2317 | wps_offset = 0; | 2333 | wps_offset = 0; |
2318 | automatic_skip = false; | 2334 | automatic_skip = false; |
2319 | } | 2335 | } |
2320 | 2336 | ||
2337 | auto_dir_skip = false; | ||
2338 | |||
2321 | /* Invalidate prevtrack_id3 */ | 2339 | /* Invalidate prevtrack_id3 */ |
2322 | prevtrack_id3.path[0] = 0; | 2340 | prevtrack_id3.path[0] = 0; |
2323 | 2341 | ||