diff options
Diffstat (limited to 'apps/plugins/pictureflow')
-rw-r--r-- | apps/plugins/pictureflow/pictureflow.c | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c index 3ccfc0d3a2..2a292fa594 100644 --- a/apps/plugins/pictureflow/pictureflow.c +++ b/apps/plugins/pictureflow/pictureflow.c | |||
@@ -24,7 +24,7 @@ | |||
24 | ****************************************************************************/ | 24 | ****************************************************************************/ |
25 | 25 | ||
26 | #include "plugin.h" | 26 | #include "plugin.h" |
27 | #include <albumart.h> | 27 | #include "albumart.h" |
28 | #include "lib/read_image.h" | 28 | #include "lib/read_image.h" |
29 | #include "lib/pluginlib_actions.h" | 29 | #include "lib/pluginlib_actions.h" |
30 | #include "lib/pluginlib_exit.h" | 30 | #include "lib/pluginlib_exit.h" |
@@ -34,16 +34,9 @@ | |||
34 | #include "lib/mylcd.h" | 34 | #include "lib/mylcd.h" |
35 | #include "lib/feature_wrappers.h" | 35 | #include "lib/feature_wrappers.h" |
36 | 36 | ||
37 | 37 | #ifndef ALIGN_DOWN | |
38 | 38 | #define ALIGN_DOWN(n, a) ((typeof(n))((uintptr_t)(n)/(a)*(a))) | |
39 | |||
40 | /* Capacity 10 000 entries (for example 10k different albums) */ | ||
41 | #if PLUGIN_BUFFER_SIZE > 0x10000 | ||
42 | #define UNIQBUF_SIZE (64*1024) | ||
43 | #else /*Bugfix -- Several players havent enough Ram to allow such a large buffer */ | ||
44 | #define UNIQBUF_SIZE (16*1024) | ||
45 | #endif | 39 | #endif |
46 | static long uniqbuf[UNIQBUF_SIZE / sizeof(long)]; | ||
47 | 40 | ||
48 | /******************************* Globals ***********************************/ | 41 | /******************************* Globals ***********************************/ |
49 | 42 | ||
@@ -248,6 +241,7 @@ typedef fb_data pix_t; | |||
248 | 241 | ||
249 | #define THREAD_STACK_SIZE DEFAULT_STACK_SIZE + 0x200 | 242 | #define THREAD_STACK_SIZE DEFAULT_STACK_SIZE + 0x200 |
250 | #define CACHE_PREFIX PLUGIN_DEMOS_DATA_DIR "/pictureflow" | 243 | #define CACHE_PREFIX PLUGIN_DEMOS_DATA_DIR "/pictureflow" |
244 | #define ALBUM_INDEX CACHE_PREFIX "/PF_album_idx.tmp" | ||
251 | 245 | ||
252 | #define EV_EXIT 9999 | 246 | #define EV_EXIT 9999 |
253 | #define EV_WAKEUP 1337 | 247 | #define EV_WAKEUP 1337 |
@@ -457,6 +451,8 @@ void reset_track_list(void); | |||
457 | 451 | ||
458 | void * buf; | 452 | void * buf; |
459 | size_t buf_size; | 453 | size_t buf_size; |
454 | void * uniqbuf; | ||
455 | size_t uniqbuf_size; | ||
460 | 456 | ||
461 | static bool thread_is_running; | 457 | static bool thread_is_running; |
462 | 458 | ||
@@ -904,8 +900,8 @@ static int create_album_index(void) | |||
904 | artist_seek = artist[j].seek; | 900 | artist_seek = artist[j].seek; |
905 | rb->memset(&tcs, 0, sizeof(struct tagcache_search) ); | 901 | rb->memset(&tcs, 0, sizeof(struct tagcache_search) ); |
906 | rb->tagcache_search(&tcs, tag_album); | 902 | rb->tagcache_search(&tcs, tag_album); |
907 | /* Prevent duplicate entries in the search list. */ | 903 | /* Prevent duplicate entries in the search list. */ |
908 | rb->tagcache_search_set_uniqbuf(&tcs, uniqbuf, UNIQBUF_SIZE); | 904 | rb->tagcache_search_set_uniqbuf(&tcs, uniqbuf, uniqbuf_size); |
909 | rb->tagcache_search_add_filter(&tcs, tag_albumartist, artist_seek); | 905 | rb->tagcache_search_add_filter(&tcs, tag_albumartist, artist_seek); |
910 | while (rb->tagcache_get_next(&tcs)) | 906 | while (rb->tagcache_get_next(&tcs)) |
911 | { | 907 | { |
@@ -941,8 +937,7 @@ static int create_album_index(void) | |||
941 | next time PictureFlow is launched*/ | 937 | next time PictureFlow is launched*/ |
942 | 938 | ||
943 | static int save_album_index(void){ | 939 | static int save_album_index(void){ |
944 | int fd; | 940 | int fd = rb->creat(ALBUM_INDEX,0666); |
945 | fd = rb->creat(PLUGIN_DIR "/demos/album_ndx.tmp",0666); | ||
946 | if(fd >= 0) | 941 | if(fd >= 0) |
947 | { | 942 | { |
948 | int unsigned_size = sizeof(unsigned int); | 943 | int unsigned_size = sizeof(unsigned int); |
@@ -965,7 +960,7 @@ static int save_album_index(void){ | |||
965 | /*Loads the artists+albums index information stored in the hard drive*/ | 960 | /*Loads the artists+albums index information stored in the hard drive*/ |
966 | 961 | ||
967 | static int load_album_index(void){ | 962 | static int load_album_index(void){ |
968 | int fr = rb->open(PLUGIN_DIR "/demos/album_ndx.tmp", O_RDONLY); | 963 | int fr = rb->open(ALBUM_INDEX, O_RDONLY); |
969 | if (fr >= 0){ | 964 | if (fr >= 0){ |
970 | int unsigned_size = sizeof(unsigned int); | 965 | int unsigned_size = sizeof(unsigned int); |
971 | int int_size = sizeof(int); | 966 | int int_size = sizeof(int); |
@@ -1041,7 +1036,8 @@ static int get_wps_current_index(void) | |||
1041 | for( i=0; i < album_count; i++ ) | 1036 | for( i=0; i < album_count; i++ ) |
1042 | { | 1037 | { |
1043 | if(!rb->strcmp(album_names + album[i].name_idx, id3->album) && | 1038 | if(!rb->strcmp(album_names + album[i].name_idx, id3->album) && |
1044 | !rb->strcmp(artist_names + artist[album[i].artist_idx].name_idx, id3->albumartist)) | 1039 | !rb->strcmp(artist_names + artist[album[i].artist_idx].name_idx, |
1040 | id3->albumartist)) | ||
1045 | return i; | 1041 | return i; |
1046 | } | 1042 | } |
1047 | } | 1043 | } |
@@ -1071,7 +1067,9 @@ static void create_track_index(const int slide_index) | |||
1071 | goto fail; | 1067 | goto fail; |
1072 | 1068 | ||
1073 | rb->tagcache_search_add_filter(&tcs, tag_album, album[slide_index].seek); | 1069 | rb->tagcache_search_add_filter(&tcs, tag_album, album[slide_index].seek); |
1074 | rb->tagcache_search_add_filter(&tcs, tag_albumartist, artist[album[slide_index].artist_idx].seek); | 1070 | rb->tagcache_search_add_filter(&tcs, tag_albumartist, |
1071 | artist[album[slide_index].artist_idx].seek); | ||
1072 | |||
1075 | track_count=0; | 1073 | track_count=0; |
1076 | int string_index = 0, track_num; | 1074 | int string_index = 0, track_num; |
1077 | int disc_num; | 1075 | int disc_num; |
@@ -1187,7 +1185,8 @@ static bool get_albumart_for_index_from_db(const int slide_index, char *buf, | |||
1187 | bool result; | 1185 | bool result; |
1188 | /* find the first track of the album */ | 1186 | /* find the first track of the album */ |
1189 | rb->tagcache_search_add_filter(&tcs, tag_album, album[slide_index].seek); | 1187 | rb->tagcache_search_add_filter(&tcs, tag_album, album[slide_index].seek); |
1190 | rb->tagcache_search_add_filter(&tcs, tag_albumartist, artist[album[slide_index].artist_idx].seek); | 1188 | rb->tagcache_search_add_filter(&tcs, tag_albumartist, |
1189 | artist[album[slide_index].artist_idx].seek); | ||
1191 | 1190 | ||
1192 | if ( rb->tagcache_get_next(&tcs) ) { | 1191 | if ( rb->tagcache_get_next(&tcs) ) { |
1193 | struct mp3entry id3; | 1192 | struct mp3entry id3; |
@@ -3175,6 +3174,11 @@ enum plugin_status plugin_start(const void *parameter) | |||
3175 | } | 3174 | } |
3176 | #endif | 3175 | #endif |
3177 | #endif | 3176 | #endif |
3177 | /* create unique entry buffer with 1/4 of the plugin buffer */ | ||
3178 | uniqbuf = buf; | ||
3179 | uniqbuf_size = ALIGN_DOWN(buf_size / 4, 0x8); | ||
3180 | buf += uniqbuf_size; | ||
3181 | buf_size -= uniqbuf_size; | ||
3178 | 3182 | ||
3179 | #ifdef USEGSLIB | 3183 | #ifdef USEGSLIB |
3180 | long grey_buf_used; | 3184 | long grey_buf_used; |