Remove obsolete init cruft from audio system because of diminished dependencies. All talk/voice dependency in playback.c should be imminently removable.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30401 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Sevakis 2011-09-01 07:32:07 +00:00
parent 67f5249559
commit 6d3a6f71d1
5 changed files with 25 additions and 63 deletions

View file

@ -411,25 +411,6 @@ static bool codec_loop_track_callback(void)
return global_settings.repeat_mode == REPEAT_ONE;
}
/* Initialize codec API */
void codec_init_codec_api(void)
{
ci.dsp = (struct dsp_config *)dsp_configure(NULL, DSP_MYDSP,
CODEC_IDX_AUDIO);
ci.codec_get_buffer = codec_get_buffer_callback;
ci.pcmbuf_insert = codec_pcmbuf_insert_callback;
ci.set_elapsed = audio_codec_update_elapsed;
ci.read_filebuf = codec_filebuf_callback;
ci.request_buffer = codec_request_buffer_callback;
ci.advance_buffer = codec_advance_buffer_callback;
ci.seek_buffer = codec_seek_buffer_callback;
ci.seek_complete = codec_seek_complete_callback;
ci.set_offset = audio_codec_update_offset;
ci.configure = codec_configure_callback;
ci.get_command = codec_get_command_callback;
ci.loop_track = codec_loop_track_callback;
}
/** --- CODEC THREAD --- **/
@ -626,25 +607,35 @@ static void NORETURN_ATTR codec_thread(void)
/** --- Miscellaneous external interfaces -- **/
/* Create the codec thread and init kernel objects */
void make_codec_thread(void)
/* Initialize playback's codec interface */
void codec_thread_init(void)
{
/* Init API */
ci.dsp = (struct dsp_config *)dsp_configure(NULL, DSP_MYDSP,
CODEC_IDX_AUDIO);
ci.codec_get_buffer = codec_get_buffer_callback;
ci.pcmbuf_insert = codec_pcmbuf_insert_callback;
ci.set_elapsed = audio_codec_update_elapsed;
ci.read_filebuf = codec_filebuf_callback;
ci.request_buffer = codec_request_buffer_callback;
ci.advance_buffer = codec_advance_buffer_callback;
ci.seek_buffer = codec_seek_buffer_callback;
ci.seek_complete = codec_seek_complete_callback;
ci.set_offset = audio_codec_update_offset;
ci.configure = codec_configure_callback;
ci.get_command = codec_get_command_callback;
ci.loop_track = codec_loop_track_callback;
/* Init threading */
queue_init(&codec_queue, false);
codec_thread_id = create_thread(
codec_thread, codec_stack, sizeof(codec_stack),
CREATE_THREAD_FROZEN,
codec_thread, codec_stack, sizeof(codec_stack), 0,
codec_thread_name IF_PRIO(, PRIORITY_PLAYBACK)
IF_COP(, CPU));
queue_enable_queue_send(&codec_queue, &codec_queue_sender_list,
codec_thread_id);
}
/* Unfreeze the codec thread */
void codec_thread_resume(void)
{
thread_thaw(codec_thread_id);
}
#ifdef HAVE_PRIORITY_SCHEDULING
/* Obtain codec thread's current priority */
int codec_thread_get_priority(void)

View file

@ -28,14 +28,12 @@
const char *get_codec_filename(int cod_spec);
/* codec thread */
void codec_thread_init(void);
/* Audio MUST be stopped before requesting callback! */
void codec_thread_do_callback(void (*fn)(void),
unsigned int *codec_thread_id);
void codec_init_codec_api(void);
void make_codec_thread(void);
void codec_thread_resume(void);
#ifdef HAVE_PRIORITY_SCHEDULING
int codec_thread_get_priority(void);
int codec_thread_set_priority(int priority);

View file

@ -3813,14 +3813,11 @@ void audio_init(void)
pcm_init();
codec_init_codec_api();
make_codec_thread();
codec_thread_init();
/* This thread does buffer, so match its priority */
audio_thread_id = create_thread(audio_thread, audio_stack,
sizeof(audio_stack), CREATE_THREAD_FROZEN,
audio_thread_name
sizeof(audio_stack), 0, audio_thread_name
IF_PRIO(, MIN(PRIORITY_BUFFERING, PRIORITY_USER_INTERFACE))
IF_COP(, CPU));
@ -3853,11 +3850,4 @@ void audio_init(void)
#ifdef HAVE_DISK_STORAGE
audio_set_buffer_margin(global_settings.buffer_margin);
#endif
/* It's safe to let the threads run now */
#ifdef PLAYBACK_VOICE
voice_thread_resume();
#endif
codec_thread_resume();
thread_thaw(audio_thread_id);
}

View file

@ -217,9 +217,6 @@ void mp3_play_data(const unsigned char* start, int size,
/* Stop current voice clip from playing */
void mp3_play_stop(void)
{
if(!audio_is_thread_ready())
return;
LOGFQUEUE("mp3 >| voice Q_VOICE_STOP");
queue_send(&voice_queue, Q_VOICE_STOP, 0);
}
@ -419,12 +416,6 @@ static void NORETURN_ATTR voice_thread(void)
voice_data_init(&td);
/* audio thread will only set this once after it finished the final
* audio hardware init so this little construct is safe - even
* cross-core. */
while (!audio_is_thread_ready())
sleep(0);
while (1)
{
switch (state)
@ -449,18 +440,11 @@ void voice_thread_init(void)
queue_init(&voice_queue, false);
voice_thread_id = create_thread(voice_thread, voice_stack,
sizeof(voice_stack), CREATE_THREAD_FROZEN,
voice_thread_name IF_PRIO(, PRIORITY_VOICE) IF_COP(, CPU));
sizeof(voice_stack), 0, voice_thread_name
IF_PRIO(, PRIORITY_VOICE) IF_COP(, CPU));
queue_enable_queue_send(&voice_queue, &voice_queue_sender_list,
voice_thread_id);
} /* voice_thread_init */
/* Unfreeze the voice thread */
void voice_thread_resume(void)
{
logf("Thawing voice thread");
thread_thaw(voice_thread_id);
}
#ifdef HAVE_PRIORITY_SCHEDULING

View file

@ -31,7 +31,6 @@ void voice_wait(void);
void voice_stop(void);
void voice_thread_init(void);
void voice_thread_resume(void);
#ifdef HAVE_PRIORITY_SCHEDULING
void voice_thread_set_priority(int priority);
#endif