summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/playback.c2
-rw-r--r--apps/playlist.c14
-rw-r--r--apps/playlist.h1
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. */
2616int 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. */
2616int playlist_update_resume_info(const struct mp3entry* id3) 2622int playlist_update_resume_info(const struct mp3entry* id3)
2617{ 2623{
2618 struct playlist_info* playlist = &current_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);
131int playlist_next(int steps); 131int playlist_next(int steps);
132bool playlist_next_dir(int direction); 132bool playlist_next_dir(int direction);
133int playlist_get_resume_info(int *resume_index); 133int playlist_get_resume_info(int *resume_index);
134int playlist_get_index(void);
134int playlist_update_resume_info(const struct mp3entry* id3); 135int playlist_update_resume_info(const struct mp3entry* id3);
135int playlist_get_display_index(void); 136int playlist_get_display_index(void);
136int playlist_amount(void); 137int playlist_amount(void);