summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/playback.c8
-rw-r--r--apps/playback.h1
-rw-r--r--apps/playlist.c18
3 files changed, 27 insertions, 0 deletions
diff --git a/apps/playback.c b/apps/playback.c
index ea26ed12ab..457553067e 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -233,6 +233,14 @@ static void audio_stop_playback(void);
233 233
234/**************************************/ 234/**************************************/
235 235
236/** Playlist callback */
237
238/* This callback is required to update the resume index in case of changing
239 * a playlist and pausing/resuming before the next track change. */
240void playback_set_playlist_index(int index)
241{
242 thistrack_id3->index = index;
243}
236 244
237/** Pcmbuf callbacks */ 245/** Pcmbuf callbacks */
238 246
diff --git a/apps/playback.h b/apps/playback.h
index 76c394603f..3597ff542f 100644
--- a/apps/playback.h
+++ b/apps/playback.h
@@ -67,6 +67,7 @@ long audio_filebufused(void);
67void audio_pre_ff_rewind(void); 67void audio_pre_ff_rewind(void);
68void audio_skip(int direction); 68void audio_skip(int direction);
69void audio_hard_stop(void); /* Stops audio from serving playback */ 69void audio_hard_stop(void); /* Stops audio from serving playback */
70void playback_set_playlist_index(int index);
70#ifdef HAVE_CROSSFADE 71#ifdef HAVE_CROSSFADE
71void audio_set_crossfade(int enable); 72void audio_set_crossfade(int enable);
72#endif 73#endif
diff --git a/apps/playlist.c b/apps/playlist.c
index f65be48069..c15c394b4c 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -819,6 +819,9 @@ static int add_track_to_playlist(struct playlist_info* playlist,
819 819
820 playlist->amount++; 820 playlist->amount++;
821 playlist->num_inserted_tracks++; 821 playlist->num_inserted_tracks++;
822
823 /* Update index for resume. */
824 playback_set_playlist_index(playlist->index);
822 825
823 return insert_position; 826 return insert_position;
824} 827}
@@ -919,6 +922,9 @@ static int remove_track_from_playlist(struct playlist_info* playlist,
919 922
920 sync_control(playlist, false); 923 sync_control(playlist, false);
921 } 924 }
925
926 /* Update index for resume. */
927 playback_set_playlist_index(playlist->index);
922 928
923 return 0; 929 return 0;
924} 930}
@@ -978,6 +984,9 @@ static int randomise_playlist(struct playlist_info* playlist,
978 update_control(playlist, PLAYLIST_COMMAND_SHUFFLE, seed, 984 update_control(playlist, PLAYLIST_COMMAND_SHUFFLE, seed,
979 playlist->first_index, NULL, NULL, NULL); 985 playlist->first_index, NULL, NULL, NULL);
980 } 986 }
987
988 /* Update index for resume. */
989 playback_set_playlist_index(playlist->index);
981 990
982 return 0; 991 return 0;
983} 992}
@@ -1018,6 +1027,9 @@ static int sort_playlist(struct playlist_info* playlist, bool start_current,
1018 update_control(playlist, PLAYLIST_COMMAND_UNSHUFFLE, 1027 update_control(playlist, PLAYLIST_COMMAND_UNSHUFFLE,
1019 playlist->first_index, -1, NULL, NULL, NULL); 1028 playlist->first_index, -1, NULL, NULL, NULL);
1020 } 1029 }
1030
1031 /* Update index for resume. */
1032 playback_set_playlist_index(playlist->index);
1021 1033
1022 return 0; 1034 return 0;
1023} 1035}
@@ -1191,6 +1203,9 @@ static void find_and_set_playlist_index(struct playlist_info* playlist,
1191 break; 1203 break;
1192 } 1204 }
1193 } 1205 }
1206
1207 /* Update index for resume. */
1208 playback_set_playlist_index(playlist->index);
1194} 1209}
1195 1210
1196/* 1211/*
@@ -3174,6 +3189,9 @@ int playlist_move(struct playlist_info* playlist, int index, int new_index)
3174 queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0); 3189 queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0);
3175#endif 3190#endif
3176 3191
3192 /* Update index for resume. */
3193 playback_set_playlist_index(playlist->index);
3194
3177 return result; 3195 return result;
3178} 3196}
3179 3197