diff options
Diffstat (limited to 'lib/rbcodec/codecs/aiff.c')
-rw-r--r-- | lib/rbcodec/codecs/aiff.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/rbcodec/codecs/aiff.c b/lib/rbcodec/codecs/aiff.c index 3bedfa5760..9fee781c03 100644 --- a/lib/rbcodec/codecs/aiff.c +++ b/lib/rbcodec/codecs/aiff.c | |||
@@ -99,6 +99,7 @@ enum codec_status codec_run(void) | |||
99 | codec_set_replaygain(ci->id3); | 99 | codec_set_replaygain(ci->id3); |
100 | 100 | ||
101 | /* Need to save offset for later use (cleared indirectly by advance_buffer) */ | 101 | /* Need to save offset for later use (cleared indirectly by advance_buffer) */ |
102 | param = ci->id3->elapsed; | ||
102 | bytesdone = ci->id3->offset; | 103 | bytesdone = ci->id3->offset; |
103 | 104 | ||
104 | /* assume the AIFF header is less than 1024 bytes */ | 105 | /* assume the AIFF header is less than 1024 bytes */ |
@@ -270,10 +271,20 @@ enum codec_status codec_run(void) | |||
270 | ci->advance_buffer(firstblockposn); | 271 | ci->advance_buffer(firstblockposn); |
271 | 272 | ||
272 | /* make sure we're at the correct offset */ | 273 | /* make sure we're at the correct offset */ |
273 | if (bytesdone > (uint32_t) firstblockposn) { | 274 | if (bytesdone > (uint32_t) firstblockposn || param) { |
275 | uint32_t seek_val; | ||
276 | int seek_mode; | ||
277 | |||
278 | if (bytesdone) { | ||
279 | seek_val = bytesdone - MIN((uint32_t) firstblockposn, bytesdone); | ||
280 | seek_mode = PCM_SEEK_POS; | ||
281 | } else { | ||
282 | seek_val = param; | ||
283 | seek_mode = PCM_SEEK_TIME; | ||
284 | } | ||
285 | |||
274 | /* Round down to previous block */ | 286 | /* Round down to previous block */ |
275 | struct pcm_pos *newpos = codec->get_seek_pos(bytesdone - firstblockposn, | 287 | struct pcm_pos *newpos = codec->get_seek_pos(seek_val, seek_mode, NULL); |
276 | PCM_SEEK_POS, NULL); | ||
277 | 288 | ||
278 | if (newpos->pos > format.numbytes) | 289 | if (newpos->pos > format.numbytes) |
279 | return CODEC_OK; | 290 | return CODEC_OK; |