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.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/apps/codecs/aac.c b/apps/codecs/aac.c
index 849d87bedf..6bb5ac50ae 100644
--- a/apps/codecs/aac.c
+++ b/apps/codecs/aac.c
@@ -27,6 +27,11 @@
27 27
28CODEC_HEADER 28CODEC_HEADER
29 29
30/* The maximum buffer size handled by faad. 12 bytes are required by libfaad
31 * as headroom (see libfaad/bits.c). FAAD_BYTE_BUFFER_SIZE bytes are buffered
32 * for each frame. */
33#define FAAD_BYTE_BUFFER_SIZE (2048-12)
34
30/* Global buffers to be used in the mdct synthesis. This way the arrays can 35/* Global buffers to be used in the mdct synthesis. This way the arrays can
31 * be moved to IRAM for some targets */ 36 * be moved to IRAM for some targets */
32#define GB_BUF_SIZE 1024 37#define GB_BUF_SIZE 1024
@@ -159,7 +164,7 @@ next_track:
159 /* Resume the desired (byte) position. Important: When resuming SBR 164 /* Resume the desired (byte) position. Important: When resuming SBR
160 * upsampling files the resulting sound_samples_done must be expanded 165 * upsampling files the resulting sound_samples_done must be expanded
161 * by a factor of 2. This is done via using sbr_fac. */ 166 * by a factor of 2. This is done via using sbr_fac. */
162 if (alac_seek_raw(&demux_res, &input_stream, file_offset, 167 if (m4a_seek_raw(&demux_res, &input_stream, file_offset,
163 &sound_samples_done, (int*) &i)) { 168 &sound_samples_done, (int*) &i)) {
164 sound_samples_done *= sbr_fac; 169 sound_samples_done *= sbr_fac;
165 elapsed_time = (sound_samples_done * 10) / (ci->id3->frequency / 100); 170 elapsed_time = (sound_samples_done * 10) / (ci->id3->frequency / 100);
@@ -188,9 +193,9 @@ next_track:
188 if (ci->seek_time) { 193 if (ci->seek_time) {
189 /* Seek to the desired time position. Important: When seeking in SBR 194 /* Seek to the desired time position. Important: When seeking in SBR
190 * upsampling files the seek_time must be divided by 2 when calling 195 * upsampling files the seek_time must be divided by 2 when calling
191 * alac_seek and the resulting sound_samples_done must be expanded 196 * m4a_seek and the resulting sound_samples_done must be expanded
192 * by a factor 2. This is done via using sbr_fac. */ 197 * by a factor 2. This is done via using sbr_fac. */
193 if (alac_seek(&demux_res, &input_stream, 198 if (m4a_seek(&demux_res, &input_stream,
194 ((ci->seek_time-1)/10/sbr_fac)*(ci->id3->frequency/100), 199 ((ci->seek_time-1)/10/sbr_fac)*(ci->id3->frequency/100),
195 &sound_samples_done, (int*) &i)) { 200 &sound_samples_done, (int*) &i)) {
196 sound_samples_done *= sbr_fac; 201 sound_samples_done *= sbr_fac;
@@ -211,7 +216,7 @@ next_track:
211 * that an good question (but files with gaps do exist, so who 216 * that an good question (but files with gaps do exist, so who
212 * knows?), so we don't support that - for now, at least. 217 * knows?), so we don't support that - for now, at least.
213 */ 218 */
214 file_offset = get_sample_offset(&demux_res, i); 219 file_offset = m4a_check_sample_offset(&demux_res, i);
215 220
216 if (file_offset > ci->curpos) 221 if (file_offset > ci->curpos)
217 { 222 {
@@ -225,7 +230,7 @@ next_track:
225 } 230 }
226 231
227 /* Request the required number of bytes from the input buffer */ 232 /* Request the required number of bytes from the input buffer */
228 buffer=ci->request_buffer(&n, demux_res.sample_byte_size[i]); 233 buffer=ci->request_buffer(&n, FAAD_BYTE_BUFFER_SIZE);
229 234
230 /* Decode one block - returned samples will be host-endian */ 235 /* Decode one block - returned samples will be host-endian */
231 ret = NeAACDecDecode(decoder, &frame_info, buffer, n); 236 ret = NeAACDecDecode(decoder, &frame_info, buffer, n);