forked from len0rd/rockbox
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
This commit is contained in:
parent
c7227a7620
commit
3184cbe10a
3 changed files with 12 additions and 5 deletions
|
|
@ -2207,6 +2207,8 @@ static void audio_thread(void)
|
||||||
case Q_AUDIO_TRACK_CHANGED:
|
case Q_AUDIO_TRACK_CHANGED:
|
||||||
/* PCM track change done */
|
/* PCM track change done */
|
||||||
LOGFQUEUE("audio < Q_AUDIO_TRACK_CHANGED");
|
LOGFQUEUE("audio < Q_AUDIO_TRACK_CHANGED");
|
||||||
|
/* Set new playlist position for resuming. */
|
||||||
|
thistrack_id3->index = playlist_get_index();
|
||||||
if (filling != STATE_ENDING)
|
if (filling != STATE_ENDING)
|
||||||
audio_finalise_track_change();
|
audio_finalise_track_change();
|
||||||
else if (playing)
|
else if (playing)
|
||||||
|
|
|
||||||
|
|
@ -2612,17 +2612,21 @@ int playlist_get_resume_info(int *resume_index)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Get current playlist index. */
|
||||||
|
int playlist_get_index(void)
|
||||||
|
{
|
||||||
|
return current_playlist.index;
|
||||||
|
}
|
||||||
|
|
||||||
/* Update resume info for current playing song. Returns -1 on error. */
|
/* Update resume info for current playing song. Returns -1 on error. */
|
||||||
int playlist_update_resume_info(const struct mp3entry* id3)
|
int playlist_update_resume_info(const struct mp3entry* id3)
|
||||||
{
|
{
|
||||||
struct playlist_info* playlist = ¤t_playlist;
|
|
||||||
|
|
||||||
if (id3)
|
if (id3)
|
||||||
{
|
{
|
||||||
if (global_status.resume_index != playlist->index ||
|
if (global_status.resume_index != id3->index ||
|
||||||
global_status.resume_offset != id3->offset)
|
global_status.resume_offset != id3->offset)
|
||||||
{
|
{
|
||||||
global_status.resume_index = playlist->index;
|
global_status.resume_index = id3->index;
|
||||||
global_status.resume_offset = id3->offset;
|
global_status.resume_offset = id3->offset;
|
||||||
status_save();
|
status_save();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -131,6 +131,7 @@ const char *playlist_peek(int steps, char* buf, size_t buf_size);
|
||||||
int playlist_next(int steps);
|
int playlist_next(int steps);
|
||||||
bool playlist_next_dir(int direction);
|
bool playlist_next_dir(int direction);
|
||||||
int playlist_get_resume_info(int *resume_index);
|
int playlist_get_resume_info(int *resume_index);
|
||||||
|
int playlist_get_index(void);
|
||||||
int playlist_update_resume_info(const struct mp3entry* id3);
|
int playlist_update_resume_info(const struct mp3entry* id3);
|
||||||
int playlist_get_display_index(void);
|
int playlist_get_display_index(void);
|
||||||
int playlist_amount(void);
|
int playlist_amount(void);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue