forked from len0rd/rockbox
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
This commit is contained in:
parent
cc5689c153
commit
6f030a01c9
4 changed files with 34 additions and 30 deletions
|
@ -557,8 +557,8 @@ static const struct plugin_api rockbox_api = {
|
||||||
codec_thread_do_callback,
|
codec_thread_do_callback,
|
||||||
codec_load_file,
|
codec_load_file,
|
||||||
get_codec_filename,
|
get_codec_filename,
|
||||||
get_metadata,
|
|
||||||
#endif
|
#endif
|
||||||
|
get_metadata,
|
||||||
mp3info,
|
mp3info,
|
||||||
count_mp3_frames,
|
count_mp3_frames,
|
||||||
create_xing_header,
|
create_xing_header,
|
||||||
|
|
|
@ -127,12 +127,12 @@ void* plugin_get_buffer(size_t *buffer_size);
|
||||||
#define PLUGIN_MAGIC 0x526F634B /* RocK */
|
#define PLUGIN_MAGIC 0x526F634B /* RocK */
|
||||||
|
|
||||||
/* increase this every time the api struct changes */
|
/* increase this every time the api struct changes */
|
||||||
#define PLUGIN_API_VERSION 143
|
#define PLUGIN_API_VERSION 144
|
||||||
|
|
||||||
/* update this to latest version if a change to the api struct breaks
|
/* update this to latest version if a change to the api struct breaks
|
||||||
backwards compatibility (and please take the opportunity to sort in any
|
backwards compatibility (and please take the opportunity to sort in any
|
||||||
new function which are "waiting" at the end of the function table) */
|
new function which are "waiting" at the end of the function table) */
|
||||||
#define PLUGIN_MIN_API_VERSION 143
|
#define PLUGIN_MIN_API_VERSION 144
|
||||||
|
|
||||||
/* plugin return codes */
|
/* plugin return codes */
|
||||||
enum plugin_status {
|
enum plugin_status {
|
||||||
|
@ -698,8 +698,8 @@ struct plugin_api {
|
||||||
unsigned int *audio_thread_id);
|
unsigned int *audio_thread_id);
|
||||||
int (*codec_load_file)(const char* codec, struct codec_api *api);
|
int (*codec_load_file)(const char* codec, struct codec_api *api);
|
||||||
const char *(*get_codec_filename)(int cod_spec);
|
const char *(*get_codec_filename)(int cod_spec);
|
||||||
bool (*get_metadata)(struct mp3entry* id3, int fd, const char* trackname);
|
|
||||||
#endif
|
#endif
|
||||||
|
bool (*get_metadata)(struct mp3entry* id3, int fd, const char* trackname);
|
||||||
bool (*mp3info)(struct mp3entry *entry, const char *filename);
|
bool (*mp3info)(struct mp3entry *entry, const char *filename);
|
||||||
int (*count_mp3_frames)(int fd, int startpos, int filesize,
|
int (*count_mp3_frames)(int fd, int startpos, int filesize,
|
||||||
void (*progressfunc)(int));
|
void (*progressfunc)(int));
|
||||||
|
|
|
@ -56,7 +56,7 @@ text_editor.c
|
||||||
wavview.c
|
wavview.c
|
||||||
robotfindskitten.c
|
robotfindskitten.c
|
||||||
|
|
||||||
#if defined(HAVE_TAGCACHE) && (CONFIG_CODEC == SWCODEC)
|
#if defined(HAVE_TAGCACHE)
|
||||||
pictureflow.c
|
pictureflow.c
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -286,8 +286,8 @@ static int selected_track;
|
||||||
static int selected_track_pulse;
|
static int selected_track_pulse;
|
||||||
void reset_track_list(void);
|
void reset_track_list(void);
|
||||||
|
|
||||||
void * plugin_buf;
|
void * buf;
|
||||||
size_t plugin_buf_size;
|
size_t buf_size;
|
||||||
|
|
||||||
static int old_drawmode;
|
static int old_drawmode;
|
||||||
|
|
||||||
|
@ -566,43 +566,43 @@ void init_reflect_table(void)
|
||||||
*/
|
*/
|
||||||
int create_album_index(void)
|
int create_album_index(void)
|
||||||
{
|
{
|
||||||
plugin_buf_size -= UNIQBUF_SIZE * sizeof(long);
|
buf_size -= UNIQBUF_SIZE * sizeof(long);
|
||||||
long *uniqbuf = (long *)(plugin_buf_size + (char *)plugin_buf);
|
long *uniqbuf = (long *)(buf_size + (char *)buf);
|
||||||
album = ((struct album_data *)uniqbuf) - 1;
|
album = ((struct album_data *)uniqbuf) - 1;
|
||||||
rb->memset(&tcs, 0, sizeof(struct tagcache_search) );
|
rb->memset(&tcs, 0, sizeof(struct tagcache_search) );
|
||||||
album_count = 0;
|
album_count = 0;
|
||||||
rb->tagcache_search(&tcs, tag_album);
|
rb->tagcache_search(&tcs, tag_album);
|
||||||
rb->tagcache_search_set_uniqbuf(&tcs, uniqbuf, UNIQBUF_SIZE);
|
rb->tagcache_search_set_uniqbuf(&tcs, uniqbuf, UNIQBUF_SIZE);
|
||||||
unsigned int l, old_l = 0;
|
unsigned int l, old_l = 0;
|
||||||
album_names = plugin_buf;
|
album_names = buf;
|
||||||
album[0].name_idx = 0;
|
album[0].name_idx = 0;
|
||||||
while (rb->tagcache_get_next(&tcs))
|
while (rb->tagcache_get_next(&tcs))
|
||||||
{
|
{
|
||||||
plugin_buf_size -= sizeof(struct album_data);
|
buf_size -= sizeof(struct album_data);
|
||||||
l = rb->strlen(tcs.result) + 1;
|
l = rb->strlen(tcs.result) + 1;
|
||||||
if ( album_count > 0 )
|
if ( album_count > 0 )
|
||||||
album[-album_count].name_idx = album[1-album_count].name_idx + old_l;
|
album[-album_count].name_idx = album[1-album_count].name_idx + old_l;
|
||||||
|
|
||||||
if ( l > plugin_buf_size )
|
if ( l > buf_size )
|
||||||
/* not enough memory */
|
/* not enough memory */
|
||||||
return ERROR_BUFFER_FULL;
|
return ERROR_BUFFER_FULL;
|
||||||
|
|
||||||
rb->strcpy(plugin_buf, tcs.result);
|
rb->strcpy(buf, tcs.result);
|
||||||
plugin_buf_size -= l;
|
buf_size -= l;
|
||||||
plugin_buf = l + (char *)plugin_buf;
|
buf = l + (char *)buf;
|
||||||
album[-album_count].seek = tcs.result_seek;
|
album[-album_count].seek = tcs.result_seek;
|
||||||
old_l = l;
|
old_l = l;
|
||||||
album_count++;
|
album_count++;
|
||||||
}
|
}
|
||||||
rb->tagcache_search_finish(&tcs);
|
rb->tagcache_search_finish(&tcs);
|
||||||
ALIGN_BUFFER(plugin_buf, plugin_buf_size, 4);
|
ALIGN_BUFFER(buf, buf_size, 4);
|
||||||
int i;
|
int i;
|
||||||
struct album_data* tmp_album = (struct album_data*)plugin_buf;
|
struct album_data* tmp_album = (struct album_data*)buf;
|
||||||
for (i = album_count - 1; i >= 0; i--)
|
for (i = album_count - 1; i >= 0; i--)
|
||||||
tmp_album[i] = album[-i];
|
tmp_album[i] = album[-i];
|
||||||
album = tmp_album;
|
album = tmp_album;
|
||||||
plugin_buf = album + album_count;
|
buf = album + album_count;
|
||||||
plugin_buf_size += UNIQBUF_SIZE * sizeof(long);
|
buf_size += UNIQBUF_SIZE * sizeof(long);
|
||||||
return (album_count > 0) ? 0 : ERROR_NO_ALBUMS;
|
return (album_count > 0) ? 0 : ERROR_NO_ALBUMS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -817,11 +817,11 @@ bool create_albumart_cache(void)
|
||||||
if (!get_albumart_for_index_from_db(i, albumart_file, MAX_PATH))
|
if (!get_albumart_for_index_from_db(i, albumart_file, MAX_PATH))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
input_bmp.data = plugin_buf;
|
input_bmp.data = buf;
|
||||||
input_bmp.width = DISPLAY_WIDTH;
|
input_bmp.width = DISPLAY_WIDTH;
|
||||||
input_bmp.height = DISPLAY_HEIGHT;
|
input_bmp.height = DISPLAY_HEIGHT;
|
||||||
ret = scaled_read_bmp_file(albumart_file, &input_bmp,
|
ret = scaled_read_bmp_file(albumart_file, &input_bmp,
|
||||||
plugin_buf_size, format, &format_transposed);
|
buf_size, format, &format_transposed);
|
||||||
if (ret <= 0) {
|
if (ret <= 0) {
|
||||||
rb->splash(HZ, "Could not read bmp");
|
rb->splash(HZ, "Could not read bmp");
|
||||||
continue; /* skip missing/broken files */
|
continue; /* skip missing/broken files */
|
||||||
|
@ -1810,9 +1810,9 @@ int create_empty_slide(bool force)
|
||||||
#if LCD_DEPTH > 1
|
#if LCD_DEPTH > 1
|
||||||
input_bmp.format = FORMAT_NATIVE;
|
input_bmp.format = FORMAT_NATIVE;
|
||||||
#endif
|
#endif
|
||||||
input_bmp.data = (char*)plugin_buf;
|
input_bmp.data = (char*)buf;
|
||||||
ret = scaled_read_bmp_file(EMPTY_SLIDE_BMP, &input_bmp,
|
ret = scaled_read_bmp_file(EMPTY_SLIDE_BMP, &input_bmp,
|
||||||
plugin_buf_size,
|
buf_size,
|
||||||
FORMAT_NATIVE|FORMAT_RESIZE|FORMAT_KEEP_ASPECT,
|
FORMAT_NATIVE|FORMAT_RESIZE|FORMAT_KEEP_ASPECT,
|
||||||
&format_transposed);
|
&format_transposed);
|
||||||
if (!save_pfraw(EMPTY_SLIDE, &input_bmp))
|
if (!save_pfraw(EMPTY_SLIDE, &input_bmp))
|
||||||
|
@ -2197,7 +2197,7 @@ int main(void)
|
||||||
|
|
||||||
init_reflect_table();
|
init_reflect_table();
|
||||||
|
|
||||||
ALIGN_BUFFER(plugin_buf, plugin_buf_size, 4);
|
ALIGN_BUFFER(buf, buf_size, 4);
|
||||||
ret = create_album_index();
|
ret = create_album_index();
|
||||||
if (ret == ERROR_BUFFER_FULL) {
|
if (ret == ERROR_BUFFER_FULL) {
|
||||||
rb->splash(HZ, "Not enough memory for album names");
|
rb->splash(HZ, "Not enough memory for album names");
|
||||||
|
@ -2207,7 +2207,7 @@ int main(void)
|
||||||
return PLUGIN_ERROR;
|
return PLUGIN_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALIGN_BUFFER(plugin_buf, plugin_buf_size, 4);
|
ALIGN_BUFFER(buf, buf_size, 4);
|
||||||
number_of_slides = album_count;
|
number_of_slides = album_count;
|
||||||
if ((cache_version != CACHE_VERSION) && !create_albumart_cache()) {
|
if ((cache_version != CACHE_VERSION) && !create_albumart_cache()) {
|
||||||
rb->splash(HZ, "Could not create album art cache");
|
rb->splash(HZ, "Could not create album art cache");
|
||||||
|
@ -2224,17 +2224,17 @@ int main(void)
|
||||||
|
|
||||||
#ifdef USEGSLIB
|
#ifdef USEGSLIB
|
||||||
long grey_buf_used;
|
long grey_buf_used;
|
||||||
if (!grey_init(plugin_buf, plugin_buf_size, GREY_BUFFERED|GREY_ON_COP,
|
if (!grey_init(buf, buf_size, GREY_BUFFERED|GREY_ON_COP,
|
||||||
LCD_WIDTH, LCD_HEIGHT, &grey_buf_used))
|
LCD_WIDTH, LCD_HEIGHT, &grey_buf_used))
|
||||||
{
|
{
|
||||||
rb->splash(HZ, "Greylib init failed!");
|
rb->splash(HZ, "Greylib init failed!");
|
||||||
return PLUGIN_ERROR;
|
return PLUGIN_ERROR;
|
||||||
}
|
}
|
||||||
grey_setfont(FONT_UI);
|
grey_setfont(FONT_UI);
|
||||||
plugin_buf_size -= grey_buf_used;
|
buf_size -= grey_buf_used;
|
||||||
plugin_buf = (void*)(grey_buf_used + (char*)plugin_buf);
|
buf = (void*)(grey_buf_used + (char*)buf);
|
||||||
#endif
|
#endif
|
||||||
buflib_init(&buf_ctx, (void *)plugin_buf, plugin_buf_size);
|
buflib_init(&buf_ctx, (void *)buf, buf_size);
|
||||||
|
|
||||||
if (!(empty_slide_hid = read_pfraw(EMPTY_SLIDE, 0)))
|
if (!(empty_slide_hid = read_pfraw(EMPTY_SLIDE, 0)))
|
||||||
{
|
{
|
||||||
|
@ -2444,7 +2444,11 @@ enum plugin_status plugin_start(const void *parameter)
|
||||||
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
||||||
rb->cpu_boost(true);
|
rb->cpu_boost(true);
|
||||||
#endif
|
#endif
|
||||||
plugin_buf = rb->plugin_get_buffer(&plugin_buf_size);
|
#if PLUGIN_BUFFER_SIZE > 0x10000
|
||||||
|
buf = rb->plugin_get_buffer(&buf_size);
|
||||||
|
#else
|
||||||
|
buf = rb->plugin_get_audio_buffer(&buf_size);
|
||||||
|
#endif
|
||||||
ret = main();
|
ret = main();
|
||||||
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
||||||
rb->cpu_boost(false);
|
rb->cpu_boost(false);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue