diff options
Diffstat (limited to 'apps/codec_thread.c')
-rw-r--r-- | apps/codec_thread.c | 51 |
1 files changed, 21 insertions, 30 deletions
diff --git a/apps/codec_thread.c b/apps/codec_thread.c index 90cf07be9f..0498858be2 100644 --- a/apps/codec_thread.c +++ b/apps/codec_thread.c | |||
@@ -411,25 +411,6 @@ static bool codec_loop_track_callback(void) | |||
411 | return global_settings.repeat_mode == REPEAT_ONE; | 411 | return global_settings.repeat_mode == REPEAT_ONE; |
412 | } | 412 | } |
413 | 413 | ||
414 | /* Initialize codec API */ | ||
415 | void codec_init_codec_api(void) | ||
416 | { | ||
417 | ci.dsp = (struct dsp_config *)dsp_configure(NULL, DSP_MYDSP, | ||
418 | CODEC_IDX_AUDIO); | ||
419 | ci.codec_get_buffer = codec_get_buffer_callback; | ||
420 | ci.pcmbuf_insert = codec_pcmbuf_insert_callback; | ||
421 | ci.set_elapsed = audio_codec_update_elapsed; | ||
422 | ci.read_filebuf = codec_filebuf_callback; | ||
423 | ci.request_buffer = codec_request_buffer_callback; | ||
424 | ci.advance_buffer = codec_advance_buffer_callback; | ||
425 | ci.seek_buffer = codec_seek_buffer_callback; | ||
426 | ci.seek_complete = codec_seek_complete_callback; | ||
427 | ci.set_offset = audio_codec_update_offset; | ||
428 | ci.configure = codec_configure_callback; | ||
429 | ci.get_command = codec_get_command_callback; | ||
430 | ci.loop_track = codec_loop_track_callback; | ||
431 | } | ||
432 | |||
433 | 414 | ||
434 | /** --- CODEC THREAD --- **/ | 415 | /** --- CODEC THREAD --- **/ |
435 | 416 | ||
@@ -626,25 +607,35 @@ static void NORETURN_ATTR codec_thread(void) | |||
626 | 607 | ||
627 | /** --- Miscellaneous external interfaces -- **/ | 608 | /** --- Miscellaneous external interfaces -- **/ |
628 | 609 | ||
629 | /* Create the codec thread and init kernel objects */ | 610 | /* Initialize playback's codec interface */ |
630 | void make_codec_thread(void) | 611 | void codec_thread_init(void) |
631 | { | 612 | { |
613 | /* Init API */ | ||
614 | ci.dsp = (struct dsp_config *)dsp_configure(NULL, DSP_MYDSP, | ||
615 | CODEC_IDX_AUDIO); | ||
616 | ci.codec_get_buffer = codec_get_buffer_callback; | ||
617 | ci.pcmbuf_insert = codec_pcmbuf_insert_callback; | ||
618 | ci.set_elapsed = audio_codec_update_elapsed; | ||
619 | ci.read_filebuf = codec_filebuf_callback; | ||
620 | ci.request_buffer = codec_request_buffer_callback; | ||
621 | ci.advance_buffer = codec_advance_buffer_callback; | ||
622 | ci.seek_buffer = codec_seek_buffer_callback; | ||
623 | ci.seek_complete = codec_seek_complete_callback; | ||
624 | ci.set_offset = audio_codec_update_offset; | ||
625 | ci.configure = codec_configure_callback; | ||
626 | ci.get_command = codec_get_command_callback; | ||
627 | ci.loop_track = codec_loop_track_callback; | ||
628 | |||
629 | /* Init threading */ | ||
632 | queue_init(&codec_queue, false); | 630 | queue_init(&codec_queue, false); |
633 | codec_thread_id = create_thread( | 631 | codec_thread_id = create_thread( |
634 | codec_thread, codec_stack, sizeof(codec_stack), | 632 | codec_thread, codec_stack, sizeof(codec_stack), 0, |
635 | CREATE_THREAD_FROZEN, | ||
636 | codec_thread_name IF_PRIO(, PRIORITY_PLAYBACK) | 633 | codec_thread_name IF_PRIO(, PRIORITY_PLAYBACK) |
637 | IF_COP(, CPU)); | 634 | IF_COP(, CPU)); |
638 | queue_enable_queue_send(&codec_queue, &codec_queue_sender_list, | 635 | queue_enable_queue_send(&codec_queue, &codec_queue_sender_list, |
639 | codec_thread_id); | 636 | codec_thread_id); |
640 | } | 637 | } |
641 | 638 | ||
642 | /* Unfreeze the codec thread */ | ||
643 | void codec_thread_resume(void) | ||
644 | { | ||
645 | thread_thaw(codec_thread_id); | ||
646 | } | ||
647 | |||
648 | #ifdef HAVE_PRIORITY_SCHEDULING | 639 | #ifdef HAVE_PRIORITY_SCHEDULING |
649 | /* Obtain codec thread's current priority */ | 640 | /* Obtain codec thread's current priority */ |
650 | int codec_thread_get_priority(void) | 641 | int codec_thread_get_priority(void) |