summaryrefslogtreecommitdiff
path: root/apps/codecs/au.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/au.c')
-rw-r--r--apps/codecs/au.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/apps/codecs/au.c b/apps/codecs/au.c
index 19348bc299..1e6af25924 100644
--- a/apps/codecs/au.c
+++ b/apps/codecs/au.c
@@ -135,6 +135,9 @@ next_track:
135 135
136 codec_set_replaygain(ci->id3); 136 codec_set_replaygain(ci->id3);
137 137
138 /* Need to save offset for later use (cleared indirectly by advance_buffer) */
139 bytesdone = ci->id3->offset;
140
138 ci->memset(&format, 0, sizeof(struct pcm_format)); 141 ci->memset(&format, 0, sizeof(struct pcm_format));
139 format.is_signed = true; 142 format.is_signed = true;
140 format.is_little_endian = false; 143 format.is_little_endian = false;
@@ -191,7 +194,6 @@ next_track:
191 194
192 decodedsamples = 0; 195 decodedsamples = 0;
193 codec = 0; 196 codec = 0;
194 bytesdone = 0;
195 197
196 /* get codec */ 198 /* get codec */
197 codec = get_au_codec(format.formattag); 199 codec = get_au_codec(format.formattag);
@@ -236,6 +238,25 @@ next_track:
236 goto done; 238 goto done;
237 } 239 }
238 240
241 /* make sure we're at the correct offset */
242 if (bytesdone > (uint32_t) firstblockposn) {
243 /* Round down to previous block */
244 struct pcm_pos *newpos = codec->get_seek_pos(bytesdone - firstblockposn,
245 PCM_SEEK_POS, NULL);
246
247 if (newpos->pos > format.numbytes)
248 goto done;
249 if (ci->seek_buffer(firstblockposn + newpos->pos))
250 {
251 bytesdone = newpos->pos;
252 decodedsamples = newpos->samples;
253 }
254 ci->seek_complete();
255 } else {
256 /* already where we need to be */
257 bytesdone = 0;
258 }
259
239 /* The main decoder loop */ 260 /* The main decoder loop */
240 endofstream = 0; 261 endofstream = 0;
241 262
@@ -246,8 +267,8 @@ next_track:
246 } 267 }
247 268
248 if (ci->seek_time) { 269 if (ci->seek_time) {
249 /* 2nd args(read_buffer) is unnecessary in the format which Sun Audio supports. */ 270 /* 3rd args(read_buffer) is unnecessary in the format which Sun Audio supports. */
250 struct pcm_pos *newpos = codec->get_seek_pos(ci->seek_time, NULL); 271 struct pcm_pos *newpos = codec->get_seek_pos(ci->seek_time, PCM_SEEK_TIME, NULL);
251 272
252 if (newpos->pos > format.numbytes) 273 if (newpos->pos > format.numbytes)
253 break; 274 break;