summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Mahone <andrew.mahone@gmail.com>2009-03-06 01:08:02 +0000
committerAndrew Mahone <andrew.mahone@gmail.com>2009-03-06 01:08:02 +0000
commit6f030a01c97063b4ec0e1c30a62016cbfd8eea05 (patch)
tree338971bd842dffbd886870d1dccb3751f410f0b1
parentcc5689c153fd24fa10bfce2019967a3e6c068c83 (diff)
downloadrockbox-6f030a01c97063b4ec0e1c30a62016cbfd8eea05.tar.gz
rockbox-6f030a01c97063b4ec0e1c30a62016cbfd8eea05.zip
add the needed plugin API exports for pictureflow to hwcodec, use the audio buffer if plugin buffer is too small, build on any target with bitmap + tagcache
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20213 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugin.c2
-rw-r--r--apps/plugin.h6
-rw-r--r--apps/plugins/SOURCES2
-rw-r--r--apps/plugins/pictureflow.c54
4 files changed, 34 insertions, 30 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index 115db060bf..d72e439bec 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -557,8 +557,8 @@ static const struct plugin_api rockbox_api = {
557 codec_thread_do_callback, 557 codec_thread_do_callback,
558 codec_load_file, 558 codec_load_file,
559 get_codec_filename, 559 get_codec_filename,
560 get_metadata,
561#endif 560#endif
561 get_metadata,
562 mp3info, 562 mp3info,
563 count_mp3_frames, 563 count_mp3_frames,
564 create_xing_header, 564 create_xing_header,
diff --git a/apps/plugin.h b/apps/plugin.h
index 1c8682f43b..fd3e276dcd 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -127,12 +127,12 @@ void* plugin_get_buffer(size_t *buffer_size);
127#define PLUGIN_MAGIC 0x526F634B /* RocK */ 127#define PLUGIN_MAGIC 0x526F634B /* RocK */
128 128
129/* increase this every time the api struct changes */ 129/* increase this every time the api struct changes */
130#define PLUGIN_API_VERSION 143 130#define PLUGIN_API_VERSION 144
131 131
132/* update this to latest version if a change to the api struct breaks 132/* update this to latest version if a change to the api struct breaks
133 backwards compatibility (and please take the opportunity to sort in any 133 backwards compatibility (and please take the opportunity to sort in any
134 new function which are "waiting" at the end of the function table) */ 134 new function which are "waiting" at the end of the function table) */
135#define PLUGIN_MIN_API_VERSION 143 135#define PLUGIN_MIN_API_VERSION 144
136 136
137/* plugin return codes */ 137/* plugin return codes */
138enum plugin_status { 138enum plugin_status {
@@ -698,8 +698,8 @@ struct plugin_api {
698 unsigned int *audio_thread_id); 698 unsigned int *audio_thread_id);
699 int (*codec_load_file)(const char* codec, struct codec_api *api); 699 int (*codec_load_file)(const char* codec, struct codec_api *api);
700 const char *(*get_codec_filename)(int cod_spec); 700 const char *(*get_codec_filename)(int cod_spec);
701 bool (*get_metadata)(struct mp3entry* id3, int fd, const char* trackname);
702#endif 701#endif
702 bool (*get_metadata)(struct mp3entry* id3, int fd, const char* trackname);
703 bool (*mp3info)(struct mp3entry *entry, const char *filename); 703 bool (*mp3info)(struct mp3entry *entry, const char *filename);
704 int (*count_mp3_frames)(int fd, int startpos, int filesize, 704 int (*count_mp3_frames)(int fd, int startpos, int filesize,
705 void (*progressfunc)(int)); 705 void (*progressfunc)(int));
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
56wavview.c 56wavview.c
57robotfindskitten.c 57robotfindskitten.c
58 58
59#if defined(HAVE_TAGCACHE) && (CONFIG_CODEC == SWCODEC) 59#if defined(HAVE_TAGCACHE)
60pictureflow.c 60pictureflow.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;
286static int selected_track_pulse; 286static int selected_track_pulse;
287void reset_track_list(void); 287void reset_track_list(void);
288 288
289void * plugin_buf; 289void * buf;
290size_t plugin_buf_size; 290size_t buf_size;
291 291
292static int old_drawmode; 292static int old_drawmode;
293 293
@@ -566,43 +566,43 @@ void init_reflect_table(void)
566 */ 566 */
567int create_album_index(void) 567int 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);