From 540b64b67fbaf5b5fe650e8011e8731c32d466cf Mon Sep 17 00:00:00 2001 From: jdgordon Date: Thu, 6 May 2010 09:22:55 +0000 Subject: [PATCH] If dircache and database "load to ram" is enabled then get the id3 info from the database in the WPS playlist viewer for non buffered tracks git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25841 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/skin_engine/skin_display.c | 15 ++++++++++++--- apps/gui/skin_engine/wps_internals.h | 3 +++ apps/tagcache.c | 2 ++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c index 4d7b264ef..0d7824aaf 100644 --- a/apps/gui/skin_engine/skin_display.c +++ b/apps/gui/skin_engine/skin_display.c @@ -40,6 +40,7 @@ #include "screen_access.h" #include "playlist.h" #include "audio.h" +#include "tagcache.h" #ifdef HAVE_LCD_BITMAP #include "peakmeter.h" @@ -198,10 +199,12 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps, struct mp3entry *pid3; char buf[MAX_PATH*2], tempbuf[MAX_PATH]; + char *filename; gwps->display->set_viewport(viewer->vp); for(i=start_item; (i-start_item)id3; @@ -213,8 +216,15 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps, #if CONFIG_CODEC == SWCODEC else if (i>cur_playlist_pos) { - if (!audio_peek_track(&pid3, i-cur_playlist_pos)) - pid3 = NULL; +#ifdef HAVE_TC_RAMCACHE + if (tagcache_fill_tags(&viewer->tempid3, filename)) + { + pid3 = &viewer->tempid3; + } + else +#endif + if (!audio_peek_track(&pid3, i-cur_playlist_pos)) + pid3 = NULL; } #endif else @@ -224,7 +234,6 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps, int line = pid3 ? TRACK_HAS_INFO : TRACK_HAS_NO_INFO; int j = 0, cur_string = 0; - char *filename = playlist_peek(i-cur_playlist_pos); unsigned int line_len = 0; buf[0] = '\0'; while (j < viewer->lines[line].count && line_len < sizeof(buf)) diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h index edfae68e8..211d9a13e 100644 --- a/apps/gui/skin_engine/wps_internals.h +++ b/apps/gui/skin_engine/wps_internals.h @@ -241,6 +241,9 @@ struct playlistviewer { struct viewport *vp; bool show_icons; int start_offset; +#ifdef HAVE_TC_RAMCACHE + struct mp3entry tempid3; +#endif struct { enum wps_token_type tokens[MAX_PLAYLISTLINE_TOKENS]; char strings[MAX_PLAYLISTLINE_STRINGS][MAX_PLAYLISTLINE_STRLEN]; diff --git a/apps/tagcache.c b/apps/tagcache.c index 0d06d8f56..1efb7a862 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c @@ -1618,6 +1618,8 @@ bool tagcache_fill_tags(struct mp3entry *id3, const char *filename) entry = &hdr->indices[idx_id]; + memset(id3, 0, sizeof(struct mp3entry)); + id3->title = get_tag_string(entry, tag_title); id3->artist = get_tag_string(entry, tag_artist); id3->album = get_tag_string(entry, tag_album); -- 2.11.4.GIT