1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Dave Chapman 2007-05-07 23:54:10 +00:00
parent 3d53e10341
commit 4ae85e6886
5 changed files with 22 additions and 11 deletions

View file

@ -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

View file

@ -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);

View file

@ -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)

View file

@ -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 */

View file

@ -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;