summaryrefslogtreecommitdiff
path: root/apps/playlist.h
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2023-03-30 12:24:02 +0100
committerAidan MacDonald <amachronic@protonmail.com>2023-10-28 14:54:02 -0400
commit90e35716e312b9446515263f75e9e7cb66483c2c (patch)
treebe7a60fd2e1934a3a5bcaf75d455e5c8752c4e26 /apps/playlist.h
parent1ee152b5a45b907958511e5477e0f8f18458fc15 (diff)
downloadrockbox-90e35716e312b9446515263f75e9e7cb66483c2c.tar.gz
rockbox-90e35716e312b9446515263f75e9e7cb66483c2c.zip
playlist: Rewrite playlist_save(), optimization & fixes
playlist_save() was a poorly thought out mess. This fixes the glaring issues and hopefully ensures that saving the playlist never loses state (such as queued tracks or modified status) after save+resume. Indices are now updated on the fly, which is faster and needs no extra memory. But if an error occurs, the playlist will be corrupted. There is currently no attempt to handle this since errors should be unlikely, but some error handling needs to be added in the future. Change-Id: If8a5dbd6a596460be08ee0b7bab9f24337886ea4
Diffstat (limited to 'apps/playlist.h')
-rw-r--r--apps/playlist.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/apps/playlist.h b/apps/playlist.h
index 101a3c1207..0dc5148acd 100644
--- a/apps/playlist.h
+++ b/apps/playlist.h
@@ -177,8 +177,7 @@ size_t playlist_get_required_bufsz(struct playlist_info* playlist,
177 bool include_namebuf, int num_indices); 177 bool include_namebuf, int num_indices);
178int playlist_get_track_info(struct playlist_info* playlist, int index, 178int playlist_get_track_info(struct playlist_info* playlist, int index,
179 struct playlist_track_info* info); 179 struct playlist_track_info* info);
180int playlist_save(struct playlist_info* playlist, char *filename, 180int playlist_save(struct playlist_info* playlist, char *filename);
181 void* temp_buffer, size_t temp_buffer_size);
182int playlist_directory_tracksearch(const char* dirname, bool recurse, 181int playlist_directory_tracksearch(const char* dirname, bool recurse,
183 int (*callback)(char*, void*), 182 int (*callback)(char*, void*),
184 void* context); 183 void* context);