mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 13:12:37 -05:00
playlist: Rework playlist modified detection and dirplay
The modified state is now an explicit flag that has to be set whenever a user-triggered modification occurs. This is recorded in the control file to ensure it doesn't get lost after resume. There may be some places I missed where the modified flag should be set/cleared, but it seems to work well enough right now. Change-Id: I3bdba358fc495b4ca84e389ac6e7bcbef820c219
This commit is contained in:
parent
781f955aa2
commit
7ccbd705f4
8 changed files with 101 additions and 50 deletions
|
|
@ -38,6 +38,9 @@
|
|||
|
||||
#define DEFAULT_DYNAMIC_PLAYLIST_NAME "/dynamic.m3u8"
|
||||
|
||||
#define PLAYLIST_FLAG_MODIFIED (1u << 0) /* playlist was manually modified */
|
||||
#define PLAYLIST_FLAG_DIRPLAY (1u << 1) /* enable directory skipping */
|
||||
|
||||
enum playlist_command {
|
||||
PLAYLIST_COMMAND_PLAYLIST,
|
||||
PLAYLIST_COMMAND_ADD,
|
||||
|
|
@ -47,6 +50,7 @@ enum playlist_command {
|
|||
PLAYLIST_COMMAND_UNSHUFFLE,
|
||||
PLAYLIST_COMMAND_RESET,
|
||||
PLAYLIST_COMMAND_CLEAR,
|
||||
PLAYLIST_COMMAND_FLAGS,
|
||||
PLAYLIST_COMMAND_COMMENT
|
||||
};
|
||||
|
||||
|
|
@ -64,8 +68,7 @@ struct playlist_info
|
|||
{
|
||||
bool utf8; /* playlist is in .m3u8 format */
|
||||
bool control_created; /* has control file been created? */
|
||||
bool modified; /* has playlist been modified by the user? */
|
||||
bool dirplay; /* are we playing a directory directly? */
|
||||
unsigned int flags; /* flags for misc. state */
|
||||
int fd; /* descriptor of the open playlist file */
|
||||
int control_fd; /* descriptor of the open control file */
|
||||
int max_playlist_size; /* Max number of files in playlist. Mirror of
|
||||
|
|
@ -161,6 +164,7 @@ int playlist_randomise(struct playlist_info* playlist, unsigned int seed,
|
|||
int playlist_sort(struct playlist_info* playlist, bool start_current);
|
||||
bool playlist_modified(const struct playlist_info* playlist);
|
||||
void playlist_set_modified(struct playlist_info* playlist, bool modified);
|
||||
bool playlist_allow_dirplay(const struct playlist_info* playlist);
|
||||
int playlist_get_first_index(const struct playlist_info* playlist);
|
||||
int playlist_get_seed(const struct playlist_info* playlist);
|
||||
int playlist_amount_ex(const struct playlist_info* playlist);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue