1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Andree Buschmann 2011-04-07 20:33:00 +00:00
parent 37990206dd
commit 4df825be43
3 changed files with 27 additions and 0 deletions

View file

@ -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 */ /** Pcmbuf callbacks */

View file

@ -67,6 +67,7 @@ long audio_filebufused(void);
void audio_pre_ff_rewind(void); void audio_pre_ff_rewind(void);
void audio_skip(int direction); void audio_skip(int direction);
void audio_hard_stop(void); /* Stops audio from serving playback */ void audio_hard_stop(void); /* Stops audio from serving playback */
void playback_set_playlist_index(int index);
#ifdef HAVE_CROSSFADE #ifdef HAVE_CROSSFADE
void audio_set_crossfade(int enable); void audio_set_crossfade(int enable);
#endif #endif

View file

@ -819,6 +819,9 @@ static int add_track_to_playlist(struct playlist_info* playlist,
playlist->amount++; playlist->amount++;
playlist->num_inserted_tracks++; playlist->num_inserted_tracks++;
/* Update index for resume. */
playback_set_playlist_index(playlist->index);
return insert_position; return insert_position;
} }
@ -919,6 +922,9 @@ static int remove_track_from_playlist(struct playlist_info* playlist,
sync_control(playlist, false); sync_control(playlist, false);
} }
/* Update index for resume. */
playback_set_playlist_index(playlist->index);
return 0; return 0;
} }
@ -978,6 +984,9 @@ static int randomise_playlist(struct playlist_info* playlist,
update_control(playlist, PLAYLIST_COMMAND_SHUFFLE, seed, update_control(playlist, PLAYLIST_COMMAND_SHUFFLE, seed,
playlist->first_index, NULL, NULL, NULL); playlist->first_index, NULL, NULL, NULL);
} }
/* Update index for resume. */
playback_set_playlist_index(playlist->index);
return 0; return 0;
} }
@ -1018,6 +1027,9 @@ static int sort_playlist(struct playlist_info* playlist, bool start_current,
update_control(playlist, PLAYLIST_COMMAND_UNSHUFFLE, update_control(playlist, PLAYLIST_COMMAND_UNSHUFFLE,
playlist->first_index, -1, NULL, NULL, NULL); playlist->first_index, -1, NULL, NULL, NULL);
} }
/* Update index for resume. */
playback_set_playlist_index(playlist->index);
return 0; return 0;
} }
@ -1191,6 +1203,9 @@ static void find_and_set_playlist_index(struct playlist_info* playlist,
break; 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); queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0);
#endif #endif
/* Update index for resume. */
playback_set_playlist_index(playlist->index);
return result; return result;
} }