summaryrefslogtreecommitdiff
path: root/lib/rbcodec/codecs/aac.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbcodec/codecs/aac.c')
-rw-r--r--lib/rbcodec/codecs/aac.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/rbcodec/codecs/aac.c b/lib/rbcodec/codecs/aac.c
index 11a84cfa24..15c75708e1 100644
--- a/lib/rbcodec/codecs/aac.c
+++ b/lib/rbcodec/codecs/aac.c
@@ -28,7 +28,7 @@
28CODEC_HEADER 28CODEC_HEADER
29 29
30/* The maximum buffer size handled by faad. 12 bytes are required by libfaad 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 31 * as headroom (see libfaad/bits.c). FAAD_BYTE_BUFFER_SIZE bytes are buffered
32 * for each frame. */ 32 * for each frame. */
33#define FAAD_BYTE_BUFFER_SIZE (2048-12) 33#define FAAD_BYTE_BUFFER_SIZE (2048-12)
34 34
@@ -62,7 +62,7 @@ enum codec_status codec_run(void)
62 int framelength; 62 int framelength;
63 int lead_trim = 0; 63 int lead_trim = 0;
64 unsigned int frame_samples; 64 unsigned int frame_samples;
65 unsigned int i; 65 uint32_t i;
66 unsigned char* buffer; 66 unsigned char* buffer;
67 NeAACDecFrameInfo frame_info; 67 NeAACDecFrameInfo frame_info;
68 NeAACDecHandle decoder; 68 NeAACDecHandle decoder;
@@ -129,7 +129,7 @@ enum codec_status codec_run(void)
129#endif 129#endif
130 130
131 i = 0; 131 i = 0;
132 132
133 if (param) { 133 if (param) {
134 elapsed_time = param; 134 elapsed_time = param;
135 action = CODEC_ACTION_SEEK_TIME; 135 action = CODEC_ACTION_SEEK_TIME;
@@ -138,7 +138,7 @@ enum codec_status codec_run(void)
138 * upsampling files the resulting sound_samples_done must be expanded 138 * upsampling files the resulting sound_samples_done must be expanded
139 * by a factor of 2. This is done via using sbr_fac. */ 139 * by a factor of 2. This is done via using sbr_fac. */
140 if (m4a_seek_raw(&demux_res, &input_stream, file_offset, 140 if (m4a_seek_raw(&demux_res, &input_stream, file_offset,
141 &sound_samples_done, (int*) &i, &seek_idx)) { 141 &sound_samples_done, &i, &seek_idx)) {
142 sound_samples_done *= sbr_fac; 142 sound_samples_done *= sbr_fac;
143 } else { 143 } else {
144 sound_samples_done = 0; 144 sound_samples_done = 0;
@@ -151,8 +151,8 @@ enum codec_status codec_run(void)
151 } 151 }
152 152
153 ci->set_elapsed(elapsed_time); 153 ci->set_elapsed(elapsed_time);
154 154
155 if (i == 0) 155 if (i == 0)
156 { 156 {
157 lead_trim = ci->id3->lead_trim; 157 lead_trim = ci->id3->lead_trim;
158 } 158 }
@@ -168,17 +168,17 @@ enum codec_status codec_run(void)
168 /* Deal with any pending seek requests */ 168 /* Deal with any pending seek requests */
169 if (action == CODEC_ACTION_SEEK_TIME) { 169 if (action == CODEC_ACTION_SEEK_TIME) {
170 /* Seek to the desired time position. Important: When seeking in SBR 170 /* Seek to the desired time position. Important: When seeking in SBR
171 * upsampling files the seek_time must be divided by 2 when calling 171 * upsampling files the seek_time must be divided by 2 when calling
172 * m4a_seek and the resulting sound_samples_done must be expanded 172 * m4a_seek and the resulting sound_samples_done must be expanded
173 * by a factor 2. This is done via using sbr_fac. */ 173 * by a factor 2. This is done via using sbr_fac. */
174 if (m4a_seek(&demux_res, &input_stream, 174 if (m4a_seek(&demux_res, &input_stream,
175 (uint64_t) param * ci->id3->frequency / sbr_fac / 1000ULL, 175 (uint64_t) param * ci->id3->frequency / sbr_fac / 1000ULL,
176 &sound_samples_done, (int*) &i, &seek_idx)) { 176 &sound_samples_done, &i, &seek_idx)) {
177 sound_samples_done *= sbr_fac; 177 sound_samples_done *= sbr_fac;
178 elapsed_time = sound_samples_done * 1000LL / ci->id3->frequency; 178 elapsed_time = sound_samples_done * 1000LL / ci->id3->frequency;
179 ci->set_elapsed(elapsed_time); 179 ci->set_elapsed(elapsed_time);
180 180
181 if (i == 0) 181 if (i == 0)
182 { 182 {
183 lead_trim = ci->id3->lead_trim; 183 lead_trim = ci->id3->lead_trim;
184 } 184 }
@@ -190,9 +190,9 @@ enum codec_status codec_run(void)
190 action = CODEC_ACTION_NULL; 190 action = CODEC_ACTION_NULL;
191 191
192 /* There can be gaps between chunks, so skip ahead if needed. It 192 /* There can be gaps between chunks, so skip ahead if needed. It
193 * doesn't seem to happen much, but it probably means that a 193 * doesn't seem to happen much, but it probably means that a
194 * "proper" file can have chunks out of order. Why one would want 194 * "proper" file can have chunks out of order. Why one would want
195 * that an good question (but files with gaps do exist, so who 195 * that an good question (but files with gaps do exist, so who
196 * knows?), so we don't support that - for now, at least. 196 * knows?), so we don't support that - for now, at least.
197 */ 197 */
198 file_offset = m4a_check_sample_offset(&demux_res, i, &seek_idx); 198 file_offset = m4a_check_sample_offset(&demux_res, i, &seek_idx);
@@ -219,7 +219,7 @@ enum codec_status codec_run(void)
219 219
220 /* Output the audio */ 220 /* Output the audio */
221 ci->yield(); 221 ci->yield();
222 222
223 frame_samples = frame_info.samples >> 1; 223 frame_samples = frame_info.samples >> 1;
224 224
225 if (empty_first_frame) 225 if (empty_first_frame)
@@ -238,7 +238,7 @@ enum codec_status codec_run(void)
238 238
239 /* Gather number of samples for the decoded frame. */ 239 /* Gather number of samples for the decoded frame. */
240 framelength = frame_samples - lead_trim; 240 framelength = frame_samples - lead_trim;
241 241
242 if (i == demux_res.num_sample_byte_sizes - 1) 242 if (i == demux_res.num_sample_byte_sizes - 1)
243 { 243 {
244 // Size of the last frame 244 // Size of the last frame