summaryrefslogtreecommitdiff
path: root/apps/codecs/wav.c
diff options
context:
space:
mode:
authorYoshihisa Uchida <uchida@rockbox.org>2010-03-22 10:02:05 +0000
committerYoshihisa Uchida <uchida@rockbox.org>2010-03-22 10:02:05 +0000
commit7a3822c8b03a5438a1bcfd6e38c0e6860dda3348 (patch)
treee50740c7f0ccd6aff1aac0e292a000ac7ef6be14 /apps/codecs/wav.c
parent20fccd84897352478c3306e41ca0fab0a5f4c65e (diff)
fix bug: WAV file playback does not resume (FS#11077)
Not only WAV but also Sun audio, SMAF, vox and WAV64 can resume. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25289 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/wav.c')
-rw-r--r--apps/codecs/wav.c16
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:
/* make sure we're at the correct offset */
if (bytesdone > (uint32_t) firstblockposn) {
/* Round down to previous block */
- uint32_t offset = bytesdone - bytesdone % format.blockalign;
+ struct pcm_pos *newpos = codec->get_seek_pos(bytesdone - firstblockposn,
+ PCM_SEEK_POS, &read_buffer);
- ci->advance_buffer(offset-firstblockposn);
- bytesdone = offset - firstblockposn;
+ if (newpos->pos > format.numbytes)
+ goto done;
+ if (ci->seek_buffer(firstblockposn + newpos->pos))
+ {
+ bytesdone = newpos->pos;
+ decodedsamples = newpos->samples;
+ }
+ ci->seek_complete();
} else {
/* already where we need to be */
bytesdone = 0;
@@ -393,7 +400,8 @@ next_track:
}
if (ci->seek_time) {
- struct pcm_pos *newpos = codec->get_seek_pos(ci->seek_time, &read_buffer);
+ struct pcm_pos *newpos = codec->get_seek_pos(ci->seek_time, PCM_SEEK_TIME,
+ &read_buffer);
if (newpos->pos > format.numbytes)
break;