summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2011-04-07 20:33:00 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2011-04-07 20:33:00 +0000
commit4df825be4325919a843cdb1181bc435645212a51 (patch)
treeb182fd1f5a5fbbc0fa0c8867e6974e7e5cc1dc22 /apps
parent37990206dd28c10ab0470e4d7171ca993013a93c (diff)
downloadrockbox-4df825be4325919a843cdb1181bc435645212a51.tar.gz
rockbox-4df825be4325919a843cdb1181bc435645212a51.tar.bz2
rockbox-4df825be4325919a843cdb1181bc435645212a51.zip
Fix regressions of r29682. Update playlist index resume position when playlist changes (e.g. shuffling, inserting, removing, ...).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29690 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-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);
/**************************************/
+/** Playlist callback */
+
+/* This callback is required to update the resume index in case of changing
+ * a playlist and pausing/resuming before the next track change. */
+void playback_set_playlist_index(int index)
+{
+ thistrack_id3->index = index;
+}
/** Pcmbuf callbacks */
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);
void audio_pre_ff_rewind(void);
void audio_skip(int direction);
void audio_hard_stop(void); /* Stops audio from serving playback */
+void playback_set_playlist_index(int index);
#ifdef HAVE_CROSSFADE
void audio_set_crossfade(int enable);
#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,
playlist->amount++;
playlist->num_inserted_tracks++;
+
+ /* Update index for resume. */
+ playback_set_playlist_index(playlist->index);
return insert_position;
}
@@ -919,6 +922,9 @@ static int remove_track_from_playlist(struct playlist_info* playlist,
sync_control(playlist, false);
}
+
+ /* Update index for resume. */
+ playback_set_playlist_index(playlist->index);
return 0;
}
@@ -978,6 +984,9 @@ static int randomise_playlist(struct playlist_info* playlist,
update_control(playlist, PLAYLIST_COMMAND_SHUFFLE, seed,
playlist->first_index, NULL, NULL, NULL);
}
+
+ /* Update index for resume. */
+ playback_set_playlist_index(playlist->index);
return 0;
}
@@ -1018,6 +1027,9 @@ static int sort_playlist(struct playlist_info* playlist, bool start_current,
update_control(playlist, PLAYLIST_COMMAND_UNSHUFFLE,
playlist->first_index, -1, NULL, NULL, NULL);
}
+
+ /* Update index for resume. */
+ playback_set_playlist_index(playlist->index);
return 0;
}
@@ -1191,6 +1203,9 @@ static void find_and_set_playlist_index(struct playlist_info* playlist,
break;
}
}
+
+ /* Update index for resume. */
+ playback_set_playlist_index(playlist->index);
}
/*
@@ -3174,6 +3189,9 @@ int playlist_move(struct playlist_info* playlist, int index, int new_index)
queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0);
#endif
+ /* Update index for resume. */
+ playback_set_playlist_index(playlist->index);
+
return result;
}