Index: apps/plugins/pictureflow/pictureflow.c =================================================================== --- apps/plugins/pictureflow/pictureflow.c (Revision 21137) +++ apps/plugins/pictureflow/pictureflow.c (Arbeitskopie) @@ -255,6 +255,7 @@ uint32_t sort; int name_idx; long seek; + int fn_offset; /* offset to the filename in the string */ }; struct rect { @@ -758,6 +759,13 @@ return 0; } +char* get_track_filename(const int track_index) +{ + if ( track_index < track_count ) + return track_names + tracks[track_index].name_idx + tracks[track_index].fn_offset; + return 0; +} + /** Compare two unsigned ints passed via pointers. */ @@ -791,28 +799,38 @@ tracks = (struct track_data*)(track_names + borrowed); while (rb->tagcache_get_next(&tcs)) { + char buf[MAX_PATH]; + int len = 0, fn_off = 0; + avail -= sizeof(struct track_data); track_num = rb->tagcache_get_numeric(&tcs, tag_tracknumber) - 1; disc_num = rb->tagcache_get_numeric(&tcs, tag_discnumber); - int len = 0; + if (disc_num < 0) disc_num = 0; retry: if (track_num >= 0) { if (disc_num) - len = 1 + rb->snprintf(track_names + string_index , avail, - "%d.%02d: %s", disc_num, track_num + 1, tcs.result); + fn_off = 1 + rb->snprintf(track_names + string_index , avail, + "%d.%02d: %s\n", disc_num, track_num + 1, tcs.result); else - len = 1 + rb->snprintf(track_names + string_index , avail, - "%d: %s", track_num + 1, tcs.result); + fn_off = 1 + rb->snprintf(track_names + string_index , avail, + "%d: %s\n", track_num + 1, tcs.result); } else { track_num = 0; - len = tcs.result_len; - rb->strncpy(track_names + string_index, tcs.result, avail); + fn_off = 1 + rb->snprintf(track_names + string_index, avail, + "%s\n", tcs.result); } + rb->tagcache_retrieve(&tcs, tcs.idx_id, tag_filename, + buf, sizeof buf); + rb->strcat(track_names + string_index, buf); + fn_off -= 1; + len = fn_off + rb->strlen(buf) + 1; + *(track_names + string_index + fn_off -1) = 0; + if (len > avail) { while (len > avail) @@ -839,6 +857,7 @@ tracks->sort = ((disc_num - 1) << 24) + (track_num << 14) + track_count; tracks->name_idx = string_index; tracks->seek = tcs.result_seek; + tracks->fn_offset = fn_off; track_count++; string_index += len; } @@ -2297,6 +2316,33 @@ } } +/* + * Puts the current tracklist into a newly created playlist and starts playling + */ +void start_playback(void) +{ + static int old_playlist = -1; + if (center_slide.slide_index == old_playlist) + { + rb->playlist_start(selected_track, 0); + } + /* First, replace the current playlist with a new one */ + else if ((rb->playlist_remove_all_tracks(NULL) == 0) && + (rb->playlist_create(PLUGIN_DEMOS_DIR, NULL) == 0)) + { + int count = 0; + do { + rb->playlist_add(get_track_filename(count)); + } while(++count < track_count); + + rb->playlist_sync(NULL); + + rb->playlist_start(selected_track, 0); + } + old_playlist = center_slide.slide_index; + +} + /** Draw the current album name */ @@ -2597,6 +2643,9 @@ if ( pf_state == pf_idle ) { pf_state = pf_cover_in; } + else if ( pf_state == pf_show_tracks ) { + start_playback(); + } break; default: @@ -2615,7 +2664,7 @@ enum plugin_status plugin_start(const void *parameter) { int ret; - (void) parameter; + (void)parameter; #if LCD_DEPTH > 1 rb->lcd_set_backdrop(NULL); #endif Index: apps/plugin.c =================================================================== --- apps/plugin.c (Revision 21137) +++ apps/plugin.c (Arbeitskopie) @@ -644,13 +644,18 @@ appsversion, /* new stuff at the end, sort into place next time the API gets incompatible */ + #ifdef HAVE_TOUCHSCREEN action_get_touchscreen_press, #endif #if defined(HAVE_TAGCACHE) && defined(HAVE_TC_RAMCACHE) - tagcache_fill_tags + tagcache_fill_tags, #endif + playlist_add, + playlist_sync, + playlist_remove_all_tracks, + playlist_create, }; int plugin_load(const char* plugin, const void* parameter) Index: apps/plugin.h =================================================================== --- apps/plugin.h (Revision 21137) +++ apps/plugin.h (Arbeitskopie) @@ -88,6 +88,7 @@ #include "tree.h" #include "color_picker.h" #include "buffering.h" +#include "tagtree.h" #include "tagcache.h" #include "viewport.h" #include "ata_idle_notify.h" @@ -813,6 +814,10 @@ #if defined(HAVE_TAGCACHE) && defined(HAVE_TC_RAMCACHE) bool (*tagcache_fill_tags)(struct mp3entry *id3, const char *filename); #endif + int (*playlist_add)(const char *filename); + void (*playlist_sync)(struct playlist_info* playlist); + int (*playlist_remove_all_tracks)(struct playlist_info *playlist); + int (*playlist_create)(const char *dir, const char *file); }; /* plugin header */ Index: apps/tagtree.c =================================================================== --- apps/tagtree.c (Revision 21137) +++ apps/tagtree.c (Arbeitskopie) @@ -51,6 +51,11 @@ #include "storage.h" #include "dir_uncached.h" +#ifdef HAVE_LCD_BITMAP +#include "plugin.h" /* to plugin_load() pictureflow */ +#endif + + #define FILE_SEARCH_INSTRUCTIONS ROCKBOX_DIR "/tagnavi.config" static int tagtree_play_folder(struct tree_context* c); @@ -62,6 +67,9 @@ NAVIBROWSE, ALLSUBENTRIES, PLAYTRACK, +#ifdef HAVE_LCD_BITMAP + PICTUREFLOW, +#endif }; static const struct id3_to_search_mapping { @@ -1159,6 +1167,16 @@ dptr++; current_entry_count++; } +#ifdef HAVE_LCD_BITMAP + if (offset <= 2 && tag == tag_album) + { + dptr->newtable = PICTUREFLOW; + dptr->name = ""; + dptr++; + current_entry_count++; + special_entry_count++; + } +#endif special_entry_count+=2; } @@ -1358,7 +1376,9 @@ case ROOT: count = load_root(c); break; - +#ifdef HAVE_LCD_BITMAP + case PICTUREFLOW: +#endif case ALLSUBENTRIES: case NAVIBROWSE: logf("navibrowse..."); @@ -1408,6 +1428,17 @@ } newextra = dptr->newtable; +#ifdef HAVE_LCD_BITMAP + /* Start pictureflow, and return as we're leaving the db browser + * and also we still want to be in the album node after exiting + */ + if (newextra == PICTUREFLOW) + { + plugin_load(PLUGIN_DEMOS_DIR "/pictureflow.rock", NULL); + return 0; + } +#endif + if (c->dirlevel >= MAX_DIR_LEVELS) return 0;