diff options
Diffstat (limited to 'apps/codecs/wav.c')
-rw-r--r-- | apps/codecs/wav.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/apps/codecs/wav.c b/apps/codecs/wav.c index 14d7136592..e286f4dc6a 100644 --- a/apps/codecs/wav.c +++ b/apps/codecs/wav.c | |||
@@ -374,10 +374,17 @@ next_track: | |||
374 | /* make sure we're at the correct offset */ | 374 | /* make sure we're at the correct offset */ |
375 | if (bytesdone > (uint32_t) firstblockposn) { | 375 | if (bytesdone > (uint32_t) firstblockposn) { |
376 | /* Round down to previous block */ | 376 | /* Round down to previous block */ |
377 | uint32_t offset = bytesdone - bytesdone % format.blockalign; | 377 | struct pcm_pos *newpos = codec->get_seek_pos(bytesdone - firstblockposn, |
378 | PCM_SEEK_POS, &read_buffer); | ||
378 | 379 | ||
379 | ci->advance_buffer(offset-firstblockposn); | 380 | if (newpos->pos > format.numbytes) |
380 | bytesdone = offset - firstblockposn; | 381 | goto done; |
382 | if (ci->seek_buffer(firstblockposn + newpos->pos)) | ||
383 | { | ||
384 | bytesdone = newpos->pos; | ||
385 | decodedsamples = newpos->samples; | ||
386 | } | ||
387 | ci->seek_complete(); | ||
381 | } else { | 388 | } else { |
382 | /* already where we need to be */ | 389 | /* already where we need to be */ |
383 | bytesdone = 0; | 390 | bytesdone = 0; |
@@ -393,7 +400,8 @@ next_track: | |||
393 | } | 400 | } |
394 | 401 | ||
395 | if (ci->seek_time) { | 402 | if (ci->seek_time) { |
396 | struct pcm_pos *newpos = codec->get_seek_pos(ci->seek_time, &read_buffer); | 403 | struct pcm_pos *newpos = codec->get_seek_pos(ci->seek_time, PCM_SEEK_TIME, |
404 | &read_buffer); | ||
397 | 405 | ||
398 | if (newpos->pos > format.numbytes) | 406 | if (newpos->pos > format.numbytes) |
399 | break; | 407 | break; |