Index: apps/gui/skin_engine/skin_display.c =================================================================== --- apps/gui/skin_engine/skin_display.c (revision 25615) +++ apps/gui/skin_engine/skin_display.c (working copy) @@ -178,7 +178,7 @@ } } -bool audio_peek_track(struct mp3entry* id3, int offset); +bool audio_peek_track_noblock(struct mp3entry* id3, int offset); static void draw_playlist_viewer_list(struct gui_wps *gwps, struct playlistviewer *viewer) { @@ -210,7 +210,8 @@ pid3 = state->nid3; } #if CONFIG_CODEC == SWCODEC - else if ((i>cur_playlist_pos) && audio_peek_track(&id3, i-cur_playlist_pos)) + else if ((i>cur_playlist_pos) && + audio_peek_track_noblock(&id3, i-cur_playlist_pos)) { pid3 = &id3; } Index: apps/playback.c =================================================================== --- apps/playback.c (revision 25615) +++ apps/playback.c (working copy) @@ -646,6 +646,24 @@ return false; } +bool audio_peek_track_noblock(struct mp3entry* id3, int offset) +{ + int next_idx; + int new_offset = ci.new_track + wps_offset + offset; + + if (!audio_have_tracks()) + return false; + next_idx = (track_ridx + new_offset) & MAX_TRACK_MASK; + + if (tracks[next_idx].id3_hid >= 0 && + (bufavailable(tracks[next_idx].id3_hid) == sizeof(struct mp3entry))) + { + return bufread(tracks[next_idx].id3_hid, sizeof(struct mp3entry), id3) + == sizeof(struct mp3entry); + } + return false; +} + #ifdef HAVE_ALBUMART int playback_current_aa_hid(int slot) { Index: apps/buffering.c =================================================================== --- apps/buffering.c (revision 25615) +++ apps/buffering.c (working copy) @@ -1307,6 +1307,19 @@ return adjusted_size; } +ssize_t bufavailable(int handle_id) +{ + const struct memory_handle *h; + + h = find_handle(handle_id); + + if (!h) + return ERR_HANDLE_NOT_FOUND; + + return h->available; +} + + ssize_t bufgettail(int handle_id, size_t size, void **data) { size_t tidx; Index: apps/buffering.h =================================================================== --- apps/buffering.h (revision 25615) +++ apps/buffering.h (working copy) @@ -64,6 +64,7 @@ * bufadvance: Move handle reading index, relatively to current position * bufread : Copy data from a handle to a buffer * bufgetdata: Obtain a pointer for linear access to a "size" amount of data + * bufavailable: Get the number of bytes currently available for the handle * bufgettail: Out-of-band get the last size bytes of a handle. * bufcuttail: Out-of-band remove the trailing 'size' bytes of a handle. * @@ -82,6 +83,7 @@ int bufadvance(int handle_id, off_t offset); ssize_t bufread(int handle_id, size_t size, void *dest); ssize_t bufgetdata(int handle_id, size_t size, void **data); +ssize_t bufavailable(int handle_id); ssize_t bufgettail(int handle_id, size_t size, void **data); ssize_t bufcuttail(int handle_id, size_t size);