summaryrefslogtreecommitdiff
path: root/apps/playlist.h
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2023-03-29 10:58:30 +0100
committerAidan MacDonald <amachronic@protonmail.com>2023-10-01 11:05:29 -0400
commit7ccbd705f43553ff358d6713c8d6ac7cc9e3c343 (patch)
treecbd8b34688194715632f03e9248bb3a2e8a3dda7 /apps/playlist.h
parent781f955aa2fb813dd87986cbcc22c1676a2dd9a9 (diff)
downloadrockbox-7ccbd705f43553ff358d6713c8d6ac7cc9e3c343.tar.gz
rockbox-7ccbd705f43553ff358d6713c8d6ac7cc9e3c343.zip
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
Diffstat (limited to 'apps/playlist.h')
-rw-r--r--apps/playlist.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/apps/playlist.h b/apps/playlist.h
index 6d86270bc4..4c8800e594 100644
--- a/apps/playlist.h
+++ b/apps/playlist.h
@@ -38,6 +38,9 @@
38 38
39#define DEFAULT_DYNAMIC_PLAYLIST_NAME "/dynamic.m3u8" 39#define DEFAULT_DYNAMIC_PLAYLIST_NAME "/dynamic.m3u8"
40 40
41#define PLAYLIST_FLAG_MODIFIED (1u << 0) /* playlist was manually modified */
42#define PLAYLIST_FLAG_DIRPLAY (1u << 1) /* enable directory skipping */
43
41enum playlist_command { 44enum playlist_command {
42 PLAYLIST_COMMAND_PLAYLIST, 45 PLAYLIST_COMMAND_PLAYLIST,
43 PLAYLIST_COMMAND_ADD, 46 PLAYLIST_COMMAND_ADD,
@@ -47,6 +50,7 @@ enum playlist_command {
47 PLAYLIST_COMMAND_UNSHUFFLE, 50 PLAYLIST_COMMAND_UNSHUFFLE,
48 PLAYLIST_COMMAND_RESET, 51 PLAYLIST_COMMAND_RESET,
49 PLAYLIST_COMMAND_CLEAR, 52 PLAYLIST_COMMAND_CLEAR,
53 PLAYLIST_COMMAND_FLAGS,
50 PLAYLIST_COMMAND_COMMENT 54 PLAYLIST_COMMAND_COMMENT
51}; 55};
52 56
@@ -64,8 +68,7 @@ struct playlist_info
64{ 68{
65 bool utf8; /* playlist is in .m3u8 format */ 69 bool utf8; /* playlist is in .m3u8 format */
66 bool control_created; /* has control file been created? */ 70 bool control_created; /* has control file been created? */
67 bool modified; /* has playlist been modified by the user? */ 71 unsigned int flags; /* flags for misc. state */
68 bool dirplay; /* are we playing a directory directly? */
69 int fd; /* descriptor of the open playlist file */ 72 int fd; /* descriptor of the open playlist file */
70 int control_fd; /* descriptor of the open control file */ 73 int control_fd; /* descriptor of the open control file */
71 int max_playlist_size; /* Max number of files in playlist. Mirror of 74 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,
161int playlist_sort(struct playlist_info* playlist, bool start_current); 164int playlist_sort(struct playlist_info* playlist, bool start_current);
162bool playlist_modified(const struct playlist_info* playlist); 165bool playlist_modified(const struct playlist_info* playlist);
163void playlist_set_modified(struct playlist_info* playlist, bool modified); 166void playlist_set_modified(struct playlist_info* playlist, bool modified);
167bool playlist_allow_dirplay(const struct playlist_info* playlist);
164int playlist_get_first_index(const struct playlist_info* playlist); 168int playlist_get_first_index(const struct playlist_info* playlist);
165int playlist_get_seed(const struct playlist_info* playlist); 169int playlist_get_seed(const struct playlist_info* playlist);
166int playlist_amount_ex(const struct playlist_info* playlist); 170int playlist_amount_ex(const struct playlist_info* playlist);