diff options
author | Yoshihisa Uchida <uchida@rockbox.org> | 2010-03-22 10:02:05 +0000 |
---|---|---|
committer | Yoshihisa Uchida <uchida@rockbox.org> | 2010-03-22 10:02:05 +0000 |
commit | 7a3822c8b03a5438a1bcfd6e38c0e6860dda3348 (patch) | |
tree | e50740c7f0ccd6aff1aac0e292a000ac7ef6be14 /apps/codecs/aiff.c | |
parent | 20fccd84897352478c3306e41ca0fab0a5f4c65e (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/aiff.c')
-rw-r--r-- | apps/codecs/aiff.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/apps/codecs/aiff.c b/apps/codecs/aiff.c index 62d79ac340..4e16788e06 100644 --- a/apps/codecs/aiff.c +++ b/apps/codecs/aiff.c @@ -100,6 +100,9 @@ next_track: codec_set_replaygain(ci->id3); + /* Need to save offset for later use (cleared indirectly by advance_buffer) */ + bytesdone = ci->id3->offset; + /* assume the AIFF header is less than 1024 bytes */ buf = ci->request_buffer(&n, 1024); if (n < 54) { @@ -279,9 +282,26 @@ next_track: firstblockposn = 1024 - n; ci->advance_buffer(firstblockposn); + /* make sure we're at the correct offset */ + if (bytesdone > (uint32_t) firstblockposn) { + /* Round down to previous block */ + struct pcm_pos *newpos = codec->get_seek_pos(bytesdone - firstblockposn, + PCM_SEEK_POS, NULL); + + 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; + } + /* The main decoder loop */ - bytesdone = 0; - ci->set_elapsed(0); endofstream = 0; while (!endofstream) { @@ -290,8 +310,8 @@ next_track: break; if (ci->seek_time) { - /* 2nd args(read_buffer) is unnecessary in the format which AIFF supports. */ - struct pcm_pos *newpos = codec->get_seek_pos(ci->seek_time, NULL); + /* 3rd args(read_buffer) is unnecessary in the format which AIFF supports. */ + struct pcm_pos *newpos = codec->get_seek_pos(ci->seek_time, PCM_SEEK_TIME, NULL); if (newpos->pos > format.numbytes) break; |