Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

playlist: remove support for PLAYLIST_COMMAND_CLEAR

Although this breaks compatibility with playlist control
file versions 3-5, i.e. control files generated by any RB
build between Jan 29 2023 (commit 25bd3bc) and Oct 26 2024
(commit 7592d2c), compatibility with v2 of the control file
that was in use from 2003 to 2023 is maintained.

Change-Id: I7fd3394e31131bb0563e41d921bcaf940dd999bc

+23 -40
+23 -39
apps/playlist.c
··· 140 140 * a supported position for (A)dd or (Q)eue commands. 141 141 * v6 removed the (C)lear command. 142 142 */ 143 - #define PLAYLIST_CONTROL_FILE_MIN_VERSION 2 143 + #define PLAYLIST_CONTROL_FILE_LTS_VERSION 2 /* v2 still supported */ 144 + #define PLAYLIST_CONTROL_FILE_MIN_VERSION 6 144 145 #define PLAYLIST_CONTROL_FILE_VERSION 6 145 146 146 147 #define PLAYLIST_COMMAND_SIZE (MAX_PATH+12) ··· 1174 1175 /* 1175 1176 * remove all tracks, leaving the current track queued 1176 1177 */ 1177 - static int remove_all_tracks_unlocked(struct playlist_info *playlist, bool write) 1178 + static int remove_all_tracks_unlocked(struct playlist_info *playlist) 1178 1179 { 1179 1180 char filename[MAX_PATH]; 1180 1181 int seek_pos = -1; ··· 1182 1183 if (playlist->amount <= 0) 1183 1184 return 0; 1184 1185 1185 - if (write) /* Write control file commands to disk */ 1186 - { 1187 - if (playlist->control_fd < 0) 1188 - return -1; 1186 + if (playlist->control_fd < 0) 1187 + return -1; 1189 1188 1190 - if (get_track_filename(playlist, playlist->index, 1191 - filename, sizeof(filename)) != 0) 1192 - return -1; 1189 + if (get_track_filename(playlist, playlist->index, 1190 + filename, sizeof(filename)) != 0) 1191 + return -1; 1193 1192 1194 - /* Start over with fresh control file for emptied dynamic playlist */ 1195 - pl_close_control(playlist); 1196 - create_control_unlocked(playlist); 1197 - update_control_unlocked(playlist, PLAYLIST_COMMAND_PLAYLIST, 1198 - PLAYLIST_CONTROL_FILE_VERSION, -1, 1199 - "", "", NULL); 1200 - update_control_unlocked(playlist, PLAYLIST_COMMAND_QUEUE, 1201 - 0, 0, filename, NULL, &seek_pos); 1202 - sync_control_unlocked(playlist); 1203 - } 1193 + /* Start over with fresh control file for emptied dynamic playlist */ 1194 + pl_close_control(playlist); 1195 + create_control_unlocked(playlist); 1196 + update_control_unlocked(playlist, PLAYLIST_COMMAND_PLAYLIST, 1197 + PLAYLIST_CONTROL_FILE_VERSION, -1, 1198 + "", "", NULL); 1199 + update_control_unlocked(playlist, PLAYLIST_COMMAND_QUEUE, 1200 + 0, 0, filename, NULL, &seek_pos); 1201 + sync_control_unlocked(playlist); 1204 1202 1205 1203 /* Move current track down to position 0 */ 1206 1204 playlist->indices[0] = playlist->indices[playlist->index]; ··· 1348 1346 break; 1349 1347 } 1350 1348 case PLAYLIST_REPLACE: 1351 - if (remove_all_tracks_unlocked(playlist, true) < 0) 1349 + if (remove_all_tracks_unlocked(playlist) < 0) 1352 1350 return -1; 1353 1351 int newpos = playlist->index + 1; 1354 1352 playlist->last_insert_pos = position = insert_position = newpos; ··· 2426 2424 2427 2425 if (position == PLAYLIST_REPLACE) 2428 2426 { 2429 - if (remove_all_tracks_unlocked(playlist, true) == 0) 2427 + if (remove_all_tracks_unlocked(playlist) == 0) 2430 2428 position = PLAYLIST_INSERT_LAST; 2431 2429 else 2432 2430 { ··· 3092 3090 dc_thread_stop(playlist); 3093 3091 playlist_write_lock(playlist); 3094 3092 3095 - result = remove_all_tracks_unlocked(playlist, true); 3093 + result = remove_all_tracks_unlocked(playlist); 3096 3094 3097 3095 playlist_write_unlock(playlist); 3098 3096 dc_thread_start(playlist, false); ··· 3129 3127 return PLAYLIST_COMMAND_UNSHUFFLE; 3130 3128 case 'R': 3131 3129 return PLAYLIST_COMMAND_RESET; 3132 - case 'C': 3133 - return PLAYLIST_COMMAND_CLEAR; 3134 3130 case 'F': 3135 3131 return PLAYLIST_COMMAND_FLAGS; 3136 3132 case '#': ··· 3293 3289 * (It's not a big deal since the error message will 3294 3290 * be practically the same either way...) 3295 3291 */ 3296 - if (version < PLAYLIST_CONTROL_FILE_MIN_VERSION || 3297 - version > PLAYLIST_CONTROL_FILE_VERSION) 3292 + if ((version < PLAYLIST_CONTROL_FILE_MIN_VERSION || 3293 + version > PLAYLIST_CONTROL_FILE_VERSION) 3294 + && version != PLAYLIST_CONTROL_FILE_LTS_VERSION) 3298 3295 { 3299 3296 result = -3; 3300 3297 goto out; ··· 3426 3423 case PLAYLIST_COMMAND_RESET: 3427 3424 { 3428 3425 playlist->last_insert_pos = -1; 3429 - break; 3430 - } 3431 - /* FIXME: Deprecated. 3432 - * Adjust PLAYLIST_CONTROL_FILE_MIN_VERSION after removal */ 3433 - case PLAYLIST_COMMAND_CLEAR: 3434 - { 3435 - if (strp[0]) 3436 - playlist->index = atoi(strp[0]); 3437 - if (remove_all_tracks_unlocked(playlist, false) < 0) 3438 - { 3439 - result = -16; 3440 - goto out; 3441 - } 3442 3426 break; 3443 3427 } 3444 3428 case PLAYLIST_COMMAND_FLAGS:
-1
apps/playlist.h
··· 51 51 PLAYLIST_COMMAND_SHUFFLE, 52 52 PLAYLIST_COMMAND_UNSHUFFLE, 53 53 PLAYLIST_COMMAND_RESET, 54 - PLAYLIST_COMMAND_CLEAR, 55 54 PLAYLIST_COMMAND_FLAGS, 56 55 PLAYLIST_COMMAND_COMMENT, 57 56 PLAYLIST_COMMAND_ERROR = PLAYLIST_COMMAND_COMMENT + 1 /* Internal */