diff options
author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-04-06 19:11:40 +0000 |
---|---|---|
committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-04-06 19:11:40 +0000 |
commit | 3184cbe10add23e0e4e53523a06e311db0ba15cd (patch) | |
tree | 398f34c994e26a3255337b583824952721ab378e /apps | |
parent | c7227a76206960f8373def21aea71cd1b7e9e5c4 (diff) | |
download | rockbox-3184cbe10add23e0e4e53523a06e311db0ba15cd.tar.gz rockbox-3184cbe10add23e0e4e53523a06e311db0ba15cd.zip |
Fix FS#12043. Next track was resumed when pausing and shutting down the player in the last seconds of a track.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29682 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/playback.c | 2 | ||||
-rw-r--r-- | apps/playlist.c | 14 | ||||
-rw-r--r-- | apps/playlist.h | 1 |
3 files changed, 12 insertions, 5 deletions
diff --git a/apps/playback.c b/apps/playback.c index 2c34adf12d..ea26ed12ab 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -2207,6 +2207,8 @@ static void audio_thread(void) | |||
2207 | case Q_AUDIO_TRACK_CHANGED: | 2207 | case Q_AUDIO_TRACK_CHANGED: |
2208 | /* PCM track change done */ | 2208 | /* PCM track change done */ |
2209 | LOGFQUEUE("audio < Q_AUDIO_TRACK_CHANGED"); | 2209 | LOGFQUEUE("audio < Q_AUDIO_TRACK_CHANGED"); |
2210 | /* Set new playlist position for resuming. */ | ||
2211 | thistrack_id3->index = playlist_get_index(); | ||
2210 | if (filling != STATE_ENDING) | 2212 | if (filling != STATE_ENDING) |
2211 | audio_finalise_track_change(); | 2213 | audio_finalise_track_change(); |
2212 | else if (playing) | 2214 | else if (playing) |
diff --git a/apps/playlist.c b/apps/playlist.c index bbbbe22349..f65be48069 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -2612,24 +2612,28 @@ int playlist_get_resume_info(int *resume_index) | |||
2612 | return 0; | 2612 | return 0; |
2613 | } | 2613 | } |
2614 | 2614 | ||
2615 | /* Get current playlist index. */ | ||
2616 | int playlist_get_index(void) | ||
2617 | { | ||
2618 | return current_playlist.index; | ||
2619 | } | ||
2620 | |||
2615 | /* Update resume info for current playing song. Returns -1 on error. */ | 2621 | /* Update resume info for current playing song. Returns -1 on error. */ |
2616 | int playlist_update_resume_info(const struct mp3entry* id3) | 2622 | int playlist_update_resume_info(const struct mp3entry* id3) |
2617 | { | 2623 | { |
2618 | struct playlist_info* playlist = ¤t_playlist; | ||
2619 | |||
2620 | if (id3) | 2624 | if (id3) |
2621 | { | 2625 | { |
2622 | if (global_status.resume_index != playlist->index || | 2626 | if (global_status.resume_index != id3->index || |
2623 | global_status.resume_offset != id3->offset) | 2627 | global_status.resume_offset != id3->offset) |
2624 | { | 2628 | { |
2625 | global_status.resume_index = playlist->index; | 2629 | global_status.resume_index = id3->index; |
2626 | global_status.resume_offset = id3->offset; | 2630 | global_status.resume_offset = id3->offset; |
2627 | status_save(); | 2631 | status_save(); |
2628 | } | 2632 | } |
2629 | } | 2633 | } |
2630 | else | 2634 | else |
2631 | { | 2635 | { |
2632 | global_status.resume_index = -1; | 2636 | global_status.resume_index = -1; |
2633 | global_status.resume_offset = -1; | 2637 | global_status.resume_offset = -1; |
2634 | status_save(); | 2638 | status_save(); |
2635 | } | 2639 | } |
diff --git a/apps/playlist.h b/apps/playlist.h index 9c45769981..e5826202fb 100644 --- a/apps/playlist.h +++ b/apps/playlist.h | |||
@@ -131,6 +131,7 @@ const char *playlist_peek(int steps, char* buf, size_t buf_size); | |||
131 | int playlist_next(int steps); | 131 | int playlist_next(int steps); |
132 | bool playlist_next_dir(int direction); | 132 | bool playlist_next_dir(int direction); |
133 | int playlist_get_resume_info(int *resume_index); | 133 | int playlist_get_resume_info(int *resume_index); |
134 | int playlist_get_index(void); | ||
134 | int playlist_update_resume_info(const struct mp3entry* id3); | 135 | int playlist_update_resume_info(const struct mp3entry* id3); |
135 | int playlist_get_display_index(void); | 136 | int playlist_get_display_index(void); |
136 | int playlist_amount(void); | 137 | int playlist_amount(void); |