summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2007-05-07 23:54:10 +0000
committerDave Chapman <dave@dchapman.com>2007-05-07 23:54:10 +0000
commit4ae85e6886ac70f2cd2f5616f99428015ff22d48 (patch)
tree312ac3752ad336a17810f1f7c69c3fcdd606c79f
parent3d53e103413d61b7c5366a0e7399ba15a03cf71f (diff)
downloadrockbox-4ae85e6886ac70f2cd2f5616f99428015ff22d48.tar.gz
rockbox-4ae85e6886ac70f2cd2f5616f99428015ff22d48.zip
Revert the addition of the steal_codec_stack function. Replace by accessing the threads structure to grab the codec stack. Maybe a better solution exists.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13349 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/playback.c7
-rw-r--r--apps/playback.h1
-rw-r--r--apps/plugin.c4
-rw-r--r--apps/plugin.h2
-rw-r--r--apps/plugins/test_codec.c19
5 files changed, 22 insertions, 11 deletions
diff --git a/apps/playback.c b/apps/playback.c
index 33fbaf94a2..889cf9406e 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -299,13 +299,6 @@ struct thread_entry *codec_thread_p; /* For modifying thread priority later. */
static volatile int current_codec IDATA_ATTR; /* Current codec (normal/voice) */
-/* test_codec steals the codec stack */
-void steal_codec_stack(unsigned char** stack, size_t* size)
-{
- *stack = (unsigned char*)codec_stack;
- *size = sizeof(codec_stack);
-}
-
/* Voice thread */
#ifdef PLAYBACK_VOICE
diff --git a/apps/playback.h b/apps/playback.h
index 89fc5fde53..eaab4386e0 100644
--- a/apps/playback.h
+++ b/apps/playback.h
@@ -63,7 +63,6 @@ void audio_set_track_buffer_event(void (*handler)(struct mp3entry *id3,
bool last_track));
void audio_set_track_unbuffer_event(void (*handler)(struct mp3entry *id3,
bool last_track));
-void steal_codec_stack(unsigned char** stack, size_t* size);
#if CONFIG_CODEC == SWCODEC /* This #ifdef is better here than gui/gwps.c */
extern void audio_next_dir(void);
diff --git a/apps/plugin.c b/apps/plugin.c
index a7832efa92..1478805e2c 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -62,6 +62,8 @@ static int plugin_size = 0;
static bool (*pfn_tsr_exit)(bool reenter) = NULL; /* TSR exit callback */
static char current_plugin[MAX_PATH];
+extern struct thread_entry threads[MAXTHREADS];
+
static const struct plugin_api rockbox_api = {
/* lcd */
@@ -493,8 +495,8 @@ static const struct plugin_api rockbox_api = {
codec_load_file,
get_metadata,
get_codec_filename,
- steal_codec_stack,
#endif
+ threads,
};
int plugin_load(const char* plugin, void* parameter)
diff --git a/apps/plugin.h b/apps/plugin.h
index daecee760f..e04b0e20d5 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -611,8 +611,8 @@ struct plugin_api {
bool (*get_metadata)(struct track_info* track, int fd, const char* trackname,
bool v1first);
const char *(*get_codec_filename)(int cod_spec);
- void (*steal_codec_stack)(unsigned char** stack, size_t* size);
#endif
+ struct thread_entry* threads;
};
/* plugin header */
diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c
index 6fe717bc3b..2df501786a 100644
--- a/apps/plugins/test_codec.c
+++ b/apps/plugins/test_codec.c
@@ -243,6 +243,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
size_t n;
int fd;
+ int i;
unsigned long starttick;
unsigned long ticks;
unsigned long speed;
@@ -260,7 +261,23 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
return PLUGIN_ERROR;
}
- rb->steal_codec_stack(&codec_stack,&codec_stack_size);
+ /* Borrow the codec thread's stack (in IRAM on most targets) */
+ codec_stack = NULL;
+ for (i = 0; i < MAXTHREADS; i++)
+ {
+ if (rb->strcmp(rb->threads[i].name,"codec")==0)
+ {
+ codec_stack = rb->threads[i].stack;
+ codec_stack_size = rb->threads[i].stack_size;
+ break;
+ }
+ }
+
+ if (codec_stack == NULL)
+ {
+ rb->splash(HZ*2, "No codec thread!");
+ return PLUGIN_ERROR;
+ }
codec_mallocbuf = rb->plugin_get_audio_buffer(&audiosize);
codec_stack_copy = codec_mallocbuf + 512*1024;