summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMichael Giacomelli <giac2000@hotmail.com>2008-03-09 22:55:38 +0000
committerMichael Giacomelli <giac2000@hotmail.com>2008-03-09 22:55:38 +0000
commit191b7e8380dc324ced5ad75174b7aa99206f8f8d (patch)
tree75a67c2063fa53485781cd4f8a834e47856d63bd /apps
parent6ab1c90513922212788e6abd9c426d6884b64cbe (diff)
downloadrockbox-191b7e8380dc324ced5ad75174b7aa99206f8f8d.tar.gz
rockbox-191b7e8380dc324ced5ad75174b7aa99206f8f8d.zip
Don't assume reading the duration field advances the buffer 12 bytes, instead check the return value and seek accordingly. Improves (fixes?) seeking in sample submitted by Lear.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16595 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/codecs/wma.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/apps/codecs/wma.c b/apps/codecs/wma.c
index a4a78c29ce..03b000686c 100644
--- a/apps/codecs/wma.c
+++ b/apps/codecs/wma.c
@@ -389,6 +389,10 @@ static int get_timestamp(int *duration)
389 datap += 4; 389 datap += 4;
390 *duration = get_short_le(datap); 390 *duration = get_short_le(datap);
391 391
392 /*the get_timestamp function advances us 12-13 bytes past the packet start,
393 need to undo this here so that we stay synced with the packet*/
394 ci->seek_buffer(ci->curpos-bytesread);
395
392 return send_time; 396 return send_time;
393} 397}
394 398
@@ -430,8 +434,6 @@ static int seek(int ms, asf_waveformatex_t* wfx)
430 } 434 }
431 435
432 if ((time+duration>=ms && time<=ms) || count > 10) { 436 if ((time+duration>=ms && time<=ms) || count > 10) {
433 /*the get_timestamp function advances us 12 bytes past the packet start*/
434 ci->seek_buffer(ci->curpos-12);
435 DEBUGF("Found our packet! Now at %d packet\n", packet_num); 437 DEBUGF("Found our packet! Now at %d packet\n", packet_num);
436 return time; 438 return time;
437 } else { 439 } else {