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 playlist_get_required_bufsz

Change-Id: I00cf26a2502f1b31cab8d896bf8eb1ae2626020a

+6 -26
+1 -19
apps/playlist.c
··· 2030 2030 2031 2031 if (index_buffer) 2032 2032 { 2033 - int num_indices = index_buffer_size / 2034 - playlist_get_required_bufsz(playlist, false, 1); 2033 + int num_indices = index_buffer_size / sizeof(*playlist->indices); 2035 2034 2036 2035 if (num_indices > global_settings.max_files_in_playlist) 2037 2036 num_indices = global_settings.max_files_in_playlist; ··· 2340 2339 return NULL; 2341 2340 2342 2341 return buf; 2343 - } 2344 - 2345 - /* return size of buffer needed for playlist to initialize num_indices entries */ 2346 - size_t playlist_get_required_bufsz(struct playlist_info* playlist, 2347 - bool include_namebuf, 2348 - int num_indices) 2349 - { 2350 - size_t namebuf = 0; 2351 - 2352 - if (!playlist) 2353 - playlist = &current_playlist; 2354 - 2355 - size_t unit_size = sizeof (*playlist->indices); 2356 - if (include_namebuf) 2357 - namebuf = AVERAGE_FILENAME_LENGTH * global_settings.max_files_in_dir; 2358 - 2359 - return (num_indices * unit_size) + namebuf; 2360 2342 } 2361 2343 2362 2344 /* Get resume info for current playing song. If return value is -1 then
-2
apps/playlist.h
··· 180 180 int buf_size); 181 181 char *playlist_get_name(const struct playlist_info* playlist, char *buf, 182 182 int buf_size); 183 - size_t playlist_get_required_bufsz(struct playlist_info* playlist, 184 - bool include_namebuf, int num_indices); 185 183 int playlist_get_track_info(struct playlist_info* playlist, int index, 186 184 struct playlist_track_info* info); 187 185 int playlist_save(struct playlist_info* playlist, char *filename);
+5 -5
apps/playlist_viewer.c
··· 424 424 { 425 425 /* Something is playing, try to accommodate 426 426 * global_settings.max_files_in_playlist entries */ 427 - index_buffer_size = playlist_get_required_bufsz(viewer->playlist, 428 - false, global_settings.max_files_in_playlist); 427 + index_buffer_size = (global_settings.max_files_in_playlist * 428 + sizeof(*viewer->playlist->indices)); 429 429 430 430 if ((unsigned)index_buffer_size >= buffer_size - MAX_PATH) 431 431 index_buffer_size = buffer_size - (MAX_PATH + 1); ··· 551 551 ) 552 552 track->attr |= PLAYLIST_ATTR_RETRIEVE_ID3_SUCCEEDED; 553 553 } 554 - /* Yield to reduce as much as possible the perceived UI lag, 554 + /* Yield to reduce as much as possible the perceived UI lag, 555 555 because retrieving id3 tags is an expensive operation */ 556 556 yield(); 557 557 } 558 558 } 559 - 559 + 560 560 if (!(track->attr & PLAYLIST_ATTR_RETRIEVE_ID3_SUCCEEDED)) 561 561 { 562 562 /* Simply use a formatted file name */ ··· 1316 1316 return ret; 1317 1317 } 1318 1318 backlight_on(); 1319 - struct playlist_search_data s_data = {.track = &track, .found_indicies = found_indicies}; 1319 + struct playlist_search_data s_data = {.track = &track, .found_indicies = found_indicies}; 1320 1320 gui_synclist_init(&playlist_lists, playlist_search_callback_name, 1321 1321 &s_data, false, 1, NULL); 1322 1322 gui_synclist_set_title(&playlist_lists, str(LANG_SEARCH_RESULTS), NOICON);