diff options
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/SOURCES | 2 | ||||
-rw-r--r-- | apps/plugins/pictureflow.c | 54 |
2 files changed, 30 insertions, 26 deletions
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES index 7854ef3e1d..d9ed9ac24f 100644 --- a/apps/plugins/SOURCES +++ b/apps/plugins/SOURCES | |||
@@ -56,7 +56,7 @@ text_editor.c | |||
56 | wavview.c | 56 | wavview.c |
57 | robotfindskitten.c | 57 | robotfindskitten.c |
58 | 58 | ||
59 | #if defined(HAVE_TAGCACHE) && (CONFIG_CODEC == SWCODEC) | 59 | #if defined(HAVE_TAGCACHE) |
60 | pictureflow.c | 60 | pictureflow.c |
61 | #endif | 61 | #endif |
62 | 62 | ||
diff --git a/apps/plugins/pictureflow.c b/apps/plugins/pictureflow.c index 58d2869ecc..59b7c84f55 100644 --- a/apps/plugins/pictureflow.c +++ b/apps/plugins/pictureflow.c | |||
@@ -286,8 +286,8 @@ static int selected_track; | |||
286 | static int selected_track_pulse; | 286 | static int selected_track_pulse; |
287 | void reset_track_list(void); | 287 | void reset_track_list(void); |
288 | 288 | ||
289 | void * plugin_buf; | 289 | void * buf; |
290 | size_t plugin_buf_size; | 290 | size_t buf_size; |
291 | 291 | ||
292 | static int old_drawmode; | 292 | static int old_drawmode; |
293 | 293 | ||
@@ -566,43 +566,43 @@ void init_reflect_table(void) | |||
566 | */ | 566 | */ |
567 | int create_album_index(void) | 567 | int create_album_index(void) |
568 | { | 568 | { |
569 | plugin_buf_size -= UNIQBUF_SIZE * sizeof(long); | 569 | buf_size -= UNIQBUF_SIZE * sizeof(long); |
570 | long *uniqbuf = (long *)(plugin_buf_size + (char *)plugin_buf); | 570 | long *uniqbuf = (long *)(buf_size + (char *)buf); |
571 | album = ((struct album_data *)uniqbuf) - 1; | 571 | album = ((struct album_data *)uniqbuf) - 1; |
572 | rb->memset(&tcs, 0, sizeof(struct tagcache_search) ); | 572 | rb->memset(&tcs, 0, sizeof(struct tagcache_search) ); |
573 | album_count = 0; | 573 | album_count = 0; |
574 | rb->tagcache_search(&tcs, tag_album); | 574 | rb->tagcache_search(&tcs, tag_album); |
575 | rb->tagcache_search_set_uniqbuf(&tcs, uniqbuf, UNIQBUF_SIZE); | 575 | rb->tagcache_search_set_uniqbuf(&tcs, uniqbuf, UNIQBUF_SIZE); |
576 | unsigned int l, old_l = 0; | 576 | unsigned int l, old_l = 0; |
577 | album_names = plugin_buf; | 577 | album_names = buf; |
578 | album[0].name_idx = 0; | 578 | album[0].name_idx = 0; |
579 | while (rb->tagcache_get_next(&tcs)) | 579 | while (rb->tagcache_get_next(&tcs)) |
580 | { | 580 | { |
581 | plugin_buf_size -= sizeof(struct album_data); | 581 | buf_size -= sizeof(struct album_data); |
582 | l = rb->strlen(tcs.result) + 1; | 582 | l = rb->strlen(tcs.result) + 1; |
583 | if ( album_count > 0 ) | 583 | if ( album_count > 0 ) |
584 | album[-album_count].name_idx = album[1-album_count].name_idx + old_l; | 584 | album[-album_count].name_idx = album[1-album_count].name_idx + old_l; |
585 | 585 | ||
586 | if ( l > plugin_buf_size ) | 586 | if ( l > buf_size ) |
587 | /* not enough memory */ | 587 | /* not enough memory */ |
588 | return ERROR_BUFFER_FULL; | 588 | return ERROR_BUFFER_FULL; |
589 | 589 | ||
590 | rb->strcpy(plugin_buf, tcs.result); | 590 | rb->strcpy(buf, tcs.result); |
591 | plugin_buf_size -= l; | 591 | buf_size -= l; |
592 | plugin_buf = l + (char *)plugin_buf; | 592 | buf = l + (char *)buf; |
593 | album[-album_count].seek = tcs.result_seek; | 593 | album[-album_count].seek = tcs.result_seek; |
594 | old_l = l; | 594 | old_l = l; |
595 | album_count++; | 595 | album_count++; |
596 | } | 596 | } |
597 | rb->tagcache_search_finish(&tcs); | 597 | rb->tagcache_search_finish(&tcs); |
598 | ALIGN_BUFFER(plugin_buf, plugin_buf_size, 4); | 598 | ALIGN_BUFFER(buf, buf_size, 4); |
599 | int i; | 599 | int i; |
600 | struct album_data* tmp_album = (struct album_data*)plugin_buf; | 600 | struct album_data* tmp_album = (struct album_data*)buf; |
601 | for (i = album_count - 1; i >= 0; i--) | 601 | for (i = album_count - 1; i >= 0; i--) |
602 | tmp_album[i] = album[-i]; | 602 | tmp_album[i] = album[-i]; |
603 | album = tmp_album; | 603 | album = tmp_album; |
604 | plugin_buf = album + album_count; | 604 | buf = album + album_count; |
605 | plugin_buf_size += UNIQBUF_SIZE * sizeof(long); | 605 | buf_size += UNIQBUF_SIZE * sizeof(long); |
606 | return (album_count > 0) ? 0 : ERROR_NO_ALBUMS; | 606 | return (album_count > 0) ? 0 : ERROR_NO_ALBUMS; |
607 | } | 607 | } |
608 | 608 | ||
@@ -817,11 +817,11 @@ bool create_albumart_cache(void) | |||
817 | if (!get_albumart_for_index_from_db(i, albumart_file, MAX_PATH)) | 817 | if (!get_albumart_for_index_from_db(i, albumart_file, MAX_PATH)) |
818 | continue; | 818 | continue; |
819 | 819 | ||
820 | input_bmp.data = plugin_buf; | 820 | input_bmp.data = buf; |
821 | input_bmp.width = DISPLAY_WIDTH; | 821 | input_bmp.width = DISPLAY_WIDTH; |
822 | input_bmp.height = DISPLAY_HEIGHT; | 822 | input_bmp.height = DISPLAY_HEIGHT; |
823 | ret = scaled_read_bmp_file(albumart_file, &input_bmp, | 823 | ret = scaled_read_bmp_file(albumart_file, &input_bmp, |
824 | plugin_buf_size, format, &format_transposed); | 824 | buf_size, format, &format_transposed); |
825 | if (ret <= 0) { | 825 | if (ret <= 0) { |
826 | rb->splash(HZ, "Could not read bmp"); | 826 | rb->splash(HZ, "Could not read bmp"); |
827 | continue; /* skip missing/broken files */ | 827 | continue; /* skip missing/broken files */ |
@@ -1810,9 +1810,9 @@ int create_empty_slide(bool force) | |||
1810 | #if LCD_DEPTH > 1 | 1810 | #if LCD_DEPTH > 1 |
1811 | input_bmp.format = FORMAT_NATIVE; | 1811 | input_bmp.format = FORMAT_NATIVE; |
1812 | #endif | 1812 | #endif |
1813 | input_bmp.data = (char*)plugin_buf; | 1813 | input_bmp.data = (char*)buf; |
1814 | ret = scaled_read_bmp_file(EMPTY_SLIDE_BMP, &input_bmp, | 1814 | ret = scaled_read_bmp_file(EMPTY_SLIDE_BMP, &input_bmp, |
1815 | plugin_buf_size, | 1815 | buf_size, |
1816 | FORMAT_NATIVE|FORMAT_RESIZE|FORMAT_KEEP_ASPECT, | 1816 | FORMAT_NATIVE|FORMAT_RESIZE|FORMAT_KEEP_ASPECT, |
1817 | &format_transposed); | 1817 | &format_transposed); |
1818 | if (!save_pfraw(EMPTY_SLIDE, &input_bmp)) | 1818 | if (!save_pfraw(EMPTY_SLIDE, &input_bmp)) |
@@ -2197,7 +2197,7 @@ int main(void) | |||
2197 | 2197 | ||
2198 | init_reflect_table(); | 2198 | init_reflect_table(); |
2199 | 2199 | ||
2200 | ALIGN_BUFFER(plugin_buf, plugin_buf_size, 4); | 2200 | ALIGN_BUFFER(buf, buf_size, 4); |
2201 | ret = create_album_index(); | 2201 | ret = create_album_index(); |
2202 | if (ret == ERROR_BUFFER_FULL) { | 2202 | if (ret == ERROR_BUFFER_FULL) { |
2203 | rb->splash(HZ, "Not enough memory for album names"); | 2203 | rb->splash(HZ, "Not enough memory for album names"); |
@@ -2207,7 +2207,7 @@ int main(void) | |||
2207 | return PLUGIN_ERROR; | 2207 | return PLUGIN_ERROR; |
2208 | } | 2208 | } |
2209 | 2209 | ||
2210 | ALIGN_BUFFER(plugin_buf, plugin_buf_size, 4); | 2210 | ALIGN_BUFFER(buf, buf_size, 4); |
2211 | number_of_slides = album_count; | 2211 | number_of_slides = album_count; |
2212 | if ((cache_version != CACHE_VERSION) && !create_albumart_cache()) { | 2212 | if ((cache_version != CACHE_VERSION) && !create_albumart_cache()) { |
2213 | rb->splash(HZ, "Could not create album art cache"); | 2213 | rb->splash(HZ, "Could not create album art cache"); |
@@ -2224,17 +2224,17 @@ int main(void) | |||
2224 | 2224 | ||
2225 | #ifdef USEGSLIB | 2225 | #ifdef USEGSLIB |
2226 | long grey_buf_used; | 2226 | long grey_buf_used; |
2227 | if (!grey_init(plugin_buf, plugin_buf_size, GREY_BUFFERED|GREY_ON_COP, | 2227 | if (!grey_init(buf, buf_size, GREY_BUFFERED|GREY_ON_COP, |
2228 | LCD_WIDTH, LCD_HEIGHT, &grey_buf_used)) | 2228 | LCD_WIDTH, LCD_HEIGHT, &grey_buf_used)) |
2229 | { | 2229 | { |
2230 | rb->splash(HZ, "Greylib init failed!"); | 2230 | rb->splash(HZ, "Greylib init failed!"); |
2231 | return PLUGIN_ERROR; | 2231 | return PLUGIN_ERROR; |
2232 | } | 2232 | } |
2233 | grey_setfont(FONT_UI); | 2233 | grey_setfont(FONT_UI); |
2234 | plugin_buf_size -= grey_buf_used; | 2234 | buf_size -= grey_buf_used; |
2235 | plugin_buf = (void*)(grey_buf_used + (char*)plugin_buf); | 2235 | buf = (void*)(grey_buf_used + (char*)buf); |
2236 | #endif | 2236 | #endif |
2237 | buflib_init(&buf_ctx, (void *)plugin_buf, plugin_buf_size); | 2237 | buflib_init(&buf_ctx, (void *)buf, buf_size); |
2238 | 2238 | ||
2239 | if (!(empty_slide_hid = read_pfraw(EMPTY_SLIDE, 0))) | 2239 | if (!(empty_slide_hid = read_pfraw(EMPTY_SLIDE, 0))) |
2240 | { | 2240 | { |
@@ -2444,7 +2444,11 @@ enum plugin_status plugin_start(const void *parameter) | |||
2444 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | 2444 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
2445 | rb->cpu_boost(true); | 2445 | rb->cpu_boost(true); |
2446 | #endif | 2446 | #endif |
2447 | plugin_buf = rb->plugin_get_buffer(&plugin_buf_size); | 2447 | #if PLUGIN_BUFFER_SIZE > 0x10000 |
2448 | buf = rb->plugin_get_buffer(&buf_size); | ||
2449 | #else | ||
2450 | buf = rb->plugin_get_audio_buffer(&buf_size); | ||
2451 | #endif | ||
2448 | ret = main(); | 2452 | ret = main(); |
2449 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | 2453 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
2450 | rb->cpu_boost(false); | 2454 | rb->cpu_boost(false); |