diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2023-01-22 13:35:27 +0000 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2023-03-23 13:01:23 -0400 |
commit | a64cad847e7d24dc4d01d5ab22f6c8dc42f960ae (patch) | |
tree | 90bd4418ff3bdfbd03a225aa40e1695032682e09 /apps/playlist.h | |
parent | d40a598970b04bfe3a867a5e12debc45c149b46b (diff) | |
download | rockbox-a64cad847e7d24dc4d01d5ab22f6c8dc42f960ae.tar.gz rockbox-a64cad847e7d24dc4d01d5ab22f6c8dc42f960ae.zip |
playlist: Simplify playlist modified detection
Any modifications to the playlist (insert, delete, shuffle, etc)
will cause the modified flag to be set. The flag is cleared when
the playlist is saved. Code that generates playlists can manually
clear the modified flag if appropriate; there is now a proper API
for this so the tagcache and pictureflow don't need to resort to
hacks.
Change-Id: I8d3c723265a41db07a13de3f1d2abb0444528d57
Diffstat (limited to 'apps/playlist.h')
-rw-r--r-- | apps/playlist.h | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/apps/playlist.h b/apps/playlist.h index d56a6fd659..cb79eea96c 100644 --- a/apps/playlist.h +++ b/apps/playlist.h | |||
@@ -75,11 +75,11 @@ struct playlist_info | |||
75 | bool utf8; /* playlist is in .m3u8 format */ | 75 | bool utf8; /* playlist is in .m3u8 format */ |
76 | bool control_created; /* has control file been created? */ | 76 | bool control_created; /* has control file been created? */ |
77 | bool in_ram; /* playlist stored in ram (dirplay) */ | 77 | bool in_ram; /* playlist stored in ram (dirplay) */ |
78 | bool modified; /* has playlist been modified by the user? */ | ||
78 | int fd; /* descriptor of the open playlist file */ | 79 | int fd; /* descriptor of the open playlist file */ |
79 | int control_fd; /* descriptor of the open control file */ | 80 | int control_fd; /* descriptor of the open control file */ |
80 | int max_playlist_size; /* Max number of files in playlist. Mirror of | 81 | int max_playlist_size; /* Max number of files in playlist. Mirror of |
81 | global_settings.max_files_in_playlist */ | 82 | global_settings.max_files_in_playlist */ |
82 | int num_inserted_tracks; /* number of tracks inserted */ | ||
83 | unsigned long *indices; /* array of indices */ | 83 | unsigned long *indices; /* array of indices */ |
84 | 84 | ||
85 | struct chunk_alloc_header name_chunk_buffer; /* chunk buffer for | 85 | struct chunk_alloc_header name_chunk_buffer; /* chunk buffer for |
@@ -89,11 +89,8 @@ struct playlist_info | |||
89 | int first_index; /* index of first song in playlist */ | 89 | int first_index; /* index of first song in playlist */ |
90 | int amount; /* number of tracks in the index */ | 90 | int amount; /* number of tracks in the index */ |
91 | int last_insert_pos; /* last position we inserted a track */ | 91 | int last_insert_pos; /* last position we inserted a track */ |
92 | bool deleted; /* have any tracks been deleted? */ | ||
93 | bool started; /* has playlist been started? */ | 92 | bool started; /* has playlist been started? */ |
94 | bool pending_control_sync; /* control file needs to be synced */ | 93 | bool pending_control_sync; /* control file needs to be synced */ |
95 | bool shuffle_modified; /* has playlist been shuffled with | ||
96 | inserted tracks? */ | ||
97 | int last_shuffled_start; /* number of tracks when insert last | 94 | int last_shuffled_start; /* number of tracks when insert last |
98 | shuffled command start */ | 95 | shuffled command start */ |
99 | int seed; /* shuffle seed */ | 96 | int seed; /* shuffle seed */ |
@@ -166,6 +163,7 @@ int playlist_randomise(struct playlist_info* playlist, unsigned int seed, | |||
166 | bool start_current); | 163 | bool start_current); |
167 | int playlist_sort(struct playlist_info* playlist, bool start_current); | 164 | int playlist_sort(struct playlist_info* playlist, bool start_current); |
168 | bool playlist_modified(const struct playlist_info* playlist); | 165 | bool playlist_modified(const struct playlist_info* playlist); |
166 | void playlist_set_modified(struct playlist_info* playlist, bool modified); | ||
169 | int playlist_get_first_index(const struct playlist_info* playlist); | 167 | int playlist_get_first_index(const struct playlist_info* playlist); |
170 | int playlist_get_seed(const struct playlist_info* playlist); | 168 | int playlist_get_seed(const struct playlist_info* playlist); |
171 | int playlist_amount_ex(const struct playlist_info* playlist); | 169 | int playlist_amount_ex(const struct playlist_info* playlist); |