mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 13:12:37 -05:00
Playlists: Fix resuming from control commands with first_index > 0
add_track_to_playlist_unlocked only increased a playlist's first index as necessary when its position parameter was negative (i.e. one of the special insert positions was specified). A negative value was not stored in the control file, but was always converted into an absolute position. Thus, any adjustments to first_index weren't repeated when resuming from the control file. In particular, shuffled playlists were affected (in case of first_index > 0), when inserting at positions <= first_index, including appending a track to the end of a playlist. This works by inserting at first_index and increasing first_index by 1 afterwards. Similarly, adding tracks in a shuffled fashion could increase first index, whenever that was the value randomly calculated for a track position, effectively appending it (I assume this is on purpose). To make sure that first_index adjustments are recovered when resuming from the control file, and to be able to differentiate between a prepended or appended track, store the special value PLAYLIST_INSERT_LAST_ROTATED as the insert position in the control file whenever first_index would have been used before, and a special position (other than PLAYLIST_PREPEND) was provided to the function. Change-Id: I31f26796627fb136daeddd046cb1892bdf1b4014
This commit is contained in:
parent
dd1063fc2c
commit
e9b4275d1f
2 changed files with 35 additions and 7 deletions
|
|
@ -62,7 +62,8 @@ enum {
|
|||
PLAYLIST_INSERT_FIRST = -4,
|
||||
PLAYLIST_INSERT_SHUFFLED = -5,
|
||||
PLAYLIST_REPLACE = -6,
|
||||
PLAYLIST_INSERT_LAST_SHUFFLED = -7
|
||||
PLAYLIST_INSERT_LAST_SHUFFLED = -7,
|
||||
PLAYLIST_INSERT_LAST_ROTATED = -8
|
||||
};
|
||||
|
||||
struct playlist_info
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue