summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Holmgren <magnushol@gmail.com>2006-08-23 08:19:29 +0000
committerMagnus Holmgren <magnushol@gmail.com>2006-08-23 08:19:29 +0000
commit8a3b6dad94a471f82ae39ed6507074f3c83caf7c (patch)
tree0a83d28d6f417204eacbfff316ac65649398d7d7
parent514ff097287882e6b70711dab181b3ab896904cb (diff)
downloadrockbox-8a3b6dad94a471f82ae39ed6507074f3c83caf7c.tar.gz
rockbox-8a3b6dad94a471f82ae39ed6507074f3c83caf7c.zip
Fix broken resume for wav files.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10710 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/codecs/wav.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/apps/codecs/wav.c b/apps/codecs/wav.c
index 6bf2cb5864..3c86e3f0c5 100644
--- a/apps/codecs/wav.c
+++ b/apps/codecs/wav.c
@@ -232,6 +232,7 @@ enum codec_status codec_start(struct codec_api *api)
232 uint16_t blockalign = 0; 232 uint16_t blockalign = 0;
233 uint32_t avgbytespersec = 0; 233 uint32_t avgbytespersec = 0;
234 off_t firstblockposn; /* position of the first block in file */ 234 off_t firstblockposn; /* position of the first block in file */
235
235 236
236 /* Generic codec initialisation */ 237 /* Generic codec initialisation */
237 rb = api; 238 rb = api;
@@ -253,9 +254,12 @@ next_track:
253 goto exit; 254 goto exit;
254 } 255 }
255 256
256 while (!*ci->taginfo_ready) 257 while (!*ci->taginfo_ready && !ci->stop_codec)
257 ci->yield(); 258 ci->sleep(1);
258 259
260 /* Need to save offset for later use (cleared indirectly by advance_buffer) */
261 bytesdone = ci->id3->offset;
262
259 /* get RIFF chunk header */ 263 /* get RIFF chunk header */
260 buf = ci->request_buffer(&n, 12); 264 buf = ci->request_buffer(&n, 12);
261 if (n < 12) { 265 if (n < 12) {
@@ -420,9 +424,9 @@ next_track:
420 } 424 }
421 425
422 /* make sure we're at the correct offset */ 426 /* make sure we're at the correct offset */
423 if (ci->id3->offset > (uint32_t) firstblockposn) { 427 if (bytesdone > (uint32_t) firstblockposn) {
424 /* Round down to previous block */ 428 /* Round down to previous block */
425 uint32_t offset = ci->id3->offset - ci->id3->offset % blockalign; 429 uint32_t offset = bytesdone - bytesdone % blockalign;
426 430
427 ci->advance_buffer(offset-firstblockposn); 431 ci->advance_buffer(offset-firstblockposn);
428 bytesdone = offset - firstblockposn; 432 bytesdone = offset - firstblockposn;