summaryrefslogtreecommitdiff
path: root/apps/codecs
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs')
-rw-r--r--apps/codecs/mpa.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/apps/codecs/mpa.c b/apps/codecs/mpa.c
index 5cf4eb8730..5d6f7d29ad 100644
--- a/apps/codecs/mpa.c
+++ b/apps/codecs/mpa.c
@@ -39,12 +39,6 @@ void abort(void) {
39 39
40 40
41#define INPUT_CHUNK_SIZE 8192 41#define INPUT_CHUNK_SIZE 8192
42#define OUTPUT_BUFFER_SIZE 65536 /* Must be an integer multiple of 4. */
43
44unsigned char OutputBuffer[OUTPUT_BUFFER_SIZE];
45unsigned char *OutputPtr;
46unsigned char *GuardPtr = NULL;
47const unsigned char *OutputBufferEnd = OutputBuffer + OUTPUT_BUFFER_SIZE;
48 42
49mad_fixed_t mad_frame_overlap[2][32][18] IDATA_ATTR; 43mad_fixed_t mad_frame_overlap[2][32][18] IDATA_ATTR;
50unsigned char mad_main_data[MAD_BUFFER_MDLEN] IDATA_ATTR; 44unsigned char mad_main_data[MAD_BUFFER_MDLEN] IDATA_ATTR;
@@ -115,7 +109,6 @@ enum codec_status codec_start(struct codec_api* api)
115 109
116 first_frame = false; 110 first_frame = false;
117 file_end = 0; 111 file_end = 0;
118 OutputPtr = OutputBuffer;
119 112
120 while (!*ci->taginfo_ready) 113 while (!*ci->taginfo_ready)
121 ci->yield(); 114 ci->yield();
@@ -195,7 +188,7 @@ enum codec_status codec_start(struct codec_api* api)
195 } 188 }
196 else if(MAD_RECOVERABLE(Stream.error)) 189 else if(MAD_RECOVERABLE(Stream.error))
197 { 190 {
198 if(Stream.error!=MAD_ERROR_LOSTSYNC || Stream.this_frame!=GuardPtr) 191 if(Stream.error!=MAD_ERROR_LOSTSYNC)
199 { 192 {
200 // rb->splash(HZ*1, true, "Recoverable...!"); 193 // rb->splash(HZ*1, true, "Recoverable...!");
201 } 194 }
@@ -209,9 +202,9 @@ enum codec_status codec_start(struct codec_api* api)
209 Status=1; 202 Status=1;
210 break; 203 break;
211 } 204 }
205 break ;
212 } 206 }
213 if (Stream.next_frame) 207
214 ci->advance_buffer_loc((void *)Stream.next_frame);
215 file_end = false; 208 file_end = false;
216 /* ?? Do we need the timer module? */ 209 /* ?? Do we need the timer module? */
217 // mad_timer_add(&Timer,Frame.header.duration); 210 // mad_timer_add(&Timer,Frame.header.duration);
@@ -222,7 +215,7 @@ enum codec_status codec_start(struct codec_api* api)
222 /* We skip start_skip number of samples here, this should only happen for 215 /* We skip start_skip number of samples here, this should only happen for
223 very first frame in the stream. */ 216 very first frame in the stream. */
224 /* TODO: possible for start_skip to exceed one frames worth of samples? */ 217 /* TODO: possible for start_skip to exceed one frames worth of samples? */
225 218
226 if (MAD_NCHANNELS(&Frame.header) == 2) { 219 if (MAD_NCHANNELS(&Frame.header) == 2) {
227 if (current_stereo_mode != STEREO_NONINTERLEAVED) { 220 if (current_stereo_mode != STEREO_NONINTERLEAVED) {
228 ci->configure(DSP_SET_STEREO_MODE, (int *)STEREO_NONINTERLEAVED); 221 ci->configure(DSP_SET_STEREO_MODE, (int *)STEREO_NONINTERLEAVED);
@@ -241,6 +234,11 @@ enum codec_status codec_start(struct codec_api* api)
241 } 234 }
242 start_skip = 0; /* not very elegant, and might want to keep this value */ 235 start_skip = 0; /* not very elegant, and might want to keep this value */
243 236
237 if (Stream.next_frame)
238 ci->advance_buffer_loc((void *)Stream.next_frame);
239 else
240 ci->advance_buffer(size);
241
244 samplesdone += Synth.pcm.length; 242 samplesdone += Synth.pcm.length;
245 samplecount -= Synth.pcm.length; 243 samplecount -= Synth.pcm.length;
246 ci->set_elapsed(samplesdone / (frequency_divider / 10)); 244 ci->set_elapsed(samplesdone / (frequency_divider / 10));