forked from len0rd/rockbox
Fix queued track when resuming after PLAYLIST_COMMAND_CLEAR
PLAYLIST_COMMAND_CLEAR needs to save the index of the currently playing track, or a track with index 0 will be left queued after resuming from control commands Change-Id: If7449bff92acd556b03c46e82301e8fec5c997d7
This commit is contained in:
parent
ba14aecd5e
commit
a82b30735d
1 changed files with 6 additions and 3 deletions
|
@ -434,7 +434,7 @@ static int update_control_unlocked(struct playlist_info* playlist,
|
|||
result = write(fd, "R\n", 2);
|
||||
break;
|
||||
case PLAYLIST_COMMAND_CLEAR:
|
||||
result = write(fd, "C\n", 2);
|
||||
result = fdprintf(fd, "C:%d\n", i1);
|
||||
break;
|
||||
case PLAYLIST_COMMAND_FLAGS:
|
||||
result = fdprintf(fd, "F:%u:%u\n", i1, i2);
|
||||
|
@ -1178,7 +1178,6 @@ static int remove_all_tracks_unlocked(struct playlist_info *playlist, bool write
|
|||
#endif
|
||||
|
||||
/* Update playlist state as if by remove_track_unlocked() */
|
||||
playlist->index = 0;
|
||||
playlist->first_index = 0;
|
||||
playlist->amount = 1;
|
||||
playlist->indices[0] |= PLAYLIST_QUEUED;
|
||||
|
@ -1191,10 +1190,12 @@ static int remove_all_tracks_unlocked(struct playlist_info *playlist, bool write
|
|||
if (write && playlist->control_fd >= 0)
|
||||
{
|
||||
update_control_unlocked(playlist, PLAYLIST_COMMAND_CLEAR,
|
||||
-1, -1, NULL, NULL, NULL);
|
||||
playlist->index, -1, NULL, NULL, NULL);
|
||||
sync_control_unlocked(playlist);
|
||||
}
|
||||
|
||||
playlist->index = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -3353,6 +3354,8 @@ int playlist_resume(void)
|
|||
}
|
||||
case PLAYLIST_COMMAND_CLEAR:
|
||||
{
|
||||
if (strp[0])
|
||||
playlist->index = atoi(strp[0]);
|
||||
if (remove_all_tracks_unlocked(playlist, false) < 0)
|
||||
{
|
||||
result = -16;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue