diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c index ddc2221ce6..f455999b2a 100644 --- a/apps/gui/skin_engine/skin_tokens.c +++ b/apps/gui/skin_engine/skin_tokens.c @@ -563,18 +563,16 @@ static struct mp3entry* get_mp3entry_from_offset(int offset, char **filename) fname = playlist_peek(offset, filename_buf, sizeof(filename_buf)); *filename = (char*)fname; #if CONFIG_CODEC == SWCODEC -#if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE) static struct mp3entry tempid3; - if (tagcache_fill_tags(&tempid3, fname)) + if ( +#if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE) + tagcache_fill_tags(&tempid3, fname) || +#endif + audio_peek_track(&tempid3, offset) + ) { pid3 = &tempid3; } - else -#endif - { - if (!audio_peek_track(&pid3, offset)) - pid3 = NULL; - } #endif } return pid3; diff --git a/apps/playback.c b/apps/playback.c index 3a7faa3d8d..a99a22372e 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -628,8 +628,8 @@ struct mp3entry* audio_next_track(void) return NULL; } -/* gets a pointer to the id3 data, Not thread safe!, DON'T yield()/sleep() */ -bool audio_peek_track(struct mp3entry** id3, int offset) +/* gets a copy of the id3 data */ +bool audio_peek_track(struct mp3entry* id3, int offset) { int next_idx; int new_offset = ci.new_track + wps_offset + offset; @@ -640,8 +640,13 @@ bool audio_peek_track(struct mp3entry** id3, int offset) if (tracks[next_idx].id3_hid >= 0) { - return bufgetdata(tracks[next_idx].id3_hid, 0, (void**)id3) - == sizeof(struct mp3entry); + struct mp3entry *id3src; + if (bufgetdata(tracks[next_idx].id3_hid, 0, (void**)&id3src) + == sizeof(struct mp3entry)) + { + copy_mp3entry(id3, id3src); + return true; + } } return false; } diff --git a/firmware/export/audio.h b/firmware/export/audio.h index 34bcfb6b8f..910791c7fd 100644 --- a/firmware/export/audio.h +++ b/firmware/export/audio.h @@ -60,7 +60,7 @@ void audio_ff_rewind(long newpos); void audio_flush_and_reload_tracks(void); struct mp3entry* audio_current_track(void); struct mp3entry* audio_next_track(void); -bool audio_peek_track(struct mp3entry** id3, int offset); +bool audio_peek_track(struct mp3entry* id3, int offset); #ifdef HAVE_DISK_STORAGE void audio_set_buffer_margin(int setting); #endif