summaryrefslogtreecommitdiff
path: root/apps/codecs/aac.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/aac.c')
-rw-r--r--apps/codecs/aac.c35
1 files changed, 8 insertions, 27 deletions
diff --git a/apps/codecs/aac.c b/apps/codecs/aac.c
index 3c9a6372e9..4a9c7479f3 100644
--- a/apps/codecs/aac.c
+++ b/apps/codecs/aac.c
@@ -25,19 +25,8 @@
25 25
26CODEC_HEADER 26CODEC_HEADER
27 27
28#ifndef SIMULATOR
29extern char iramcopy[];
30extern char iramstart[];
31extern char iramend[];
32extern char iedata[];
33extern char iend[];
34#endif
35
36struct codec_api* rb;
37struct codec_api* ci;
38
39/* this is the codec entry point */ 28/* this is the codec entry point */
40enum codec_status codec_start(struct codec_api* api) 29enum codec_status codec_main(void)
41{ 30{
42 /* Note that when dealing with QuickTime/MPEG4 files, terminology is 31 /* Note that when dealing with QuickTime/MPEG4 files, terminology is
43 * a bit confusing. Files with sound are split up in chunks, where 32 * a bit confusing. Files with sound are split up in chunks, where
@@ -62,14 +51,6 @@ enum codec_status codec_start(struct codec_api* api)
62 unsigned char c = 0; 51 unsigned char c = 0;
63 52
64 /* Generic codec initialisation */ 53 /* Generic codec initialisation */
65 rb = api;
66 ci = api;
67
68#ifndef SIMULATOR
69 ci->memcpy(iramstart, iramcopy, iramend-iramstart);
70 ci->memset(iedata, 0, iend - iedata);
71#endif
72
73 ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*16)); 54 ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*16));
74 ci->configure(CODEC_SET_FILEBUF_WATERMARK, (int *)(1024*512)); 55 ci->configure(CODEC_SET_FILEBUF_WATERMARK, (int *)(1024*512));
75 56
@@ -79,7 +60,7 @@ enum codec_status codec_start(struct codec_api* api)
79next_track: 60next_track:
80 err = CODEC_OK; 61 err = CODEC_OK;
81 62
82 if (codec_init(api)) { 63 if (codec_init()) {
83 LOGF("FAAD: Codec init error\n"); 64 LOGF("FAAD: Codec init error\n");
84 err = CODEC_ERROR; 65 err = CODEC_ERROR;
85 goto exit; 66 goto exit;
@@ -90,8 +71,8 @@ next_track:
90 71
91 sound_samples_done = ci->id3->offset; 72 sound_samples_done = ci->id3->offset;
92 73
93 ci->configure(DSP_SWITCH_FREQUENCY, (long *)(rb->id3->frequency)); 74 ci->configure(DSP_SWITCH_FREQUENCY, (long *)(ci->id3->frequency));
94 codec_set_replaygain(rb->id3); 75 codec_set_replaygain(ci->id3);
95 76
96 stream_create(&input_stream,ci); 77 stream_create(&input_stream,ci);
97 78
@@ -139,7 +120,7 @@ next_track:
139 120
140 /* The main decoding loop */ 121 /* The main decoding loop */
141 while (i < demux_res.num_sample_byte_sizes) { 122 while (i < demux_res.num_sample_byte_sizes) {
142 rb->yield(); 123 ci->yield();
143 124
144 if (ci->stop_codec || ci->new_track) { 125 if (ci->stop_codec || ci->new_track) {
145 break; 126 break;
@@ -195,12 +176,12 @@ next_track:
195 ci->advance_buffer(n); 176 ci->advance_buffer(n);
196 177
197 /* Output the audio */ 178 /* Output the audio */
198 rb->yield(); 179 ci->yield();
199 while (!rb->pcmbuf_insert_split(decoder->time_out[0], 180 while (!ci->pcmbuf_insert_split(decoder->time_out[0],
200 decoder->time_out[1], 181 decoder->time_out[1],
201 frame_info.samples * 2)) 182 frame_info.samples * 2))
202 { 183 {
203 rb->sleep(1); 184 ci->sleep(1);
204 } 185 }
205 186
206 /* Update the elapsed-time indicator */ 187 /* Update the elapsed-time indicator */