summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMohamed Tarek <mt@rockbox.org>2009-08-04 18:36:44 +0000
committerMohamed Tarek <mt@rockbox.org>2009-08-04 18:36:44 +0000
commitac2ce3a44992f88088985245295b7c04990963a2 (patch)
tree0097dff61c0324865118121ba79ada1d8a88f33b /apps
parent2b3b36a480a0d8f04a4f88c3604619e92730ecb1 (diff)
downloadrockbox-ac2ce3a44992f88088985245295b7c04990963a2.tar.gz
rockbox-ac2ce3a44992f88088985245295b7c04990963a2.tar.bz2
rockbox-ac2ce3a44992f88088985245295b7c04990963a2.zip
Enhance seeking in a52_rm ; it was a bit choppy, and fix a bug (request_buffer was called after eos and gave a seg fault) by changing the the
condition for the decoding loop. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22162 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/codecs/a52_rm.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/apps/codecs/a52_rm.c b/apps/codecs/a52_rm.c
index 12352ed903..c75dea598f 100644
--- a/apps/codecs/a52_rm.c
+++ b/apps/codecs/a52_rm.c
@@ -157,15 +157,16 @@ next_track:
ci->advance_buffer(rmctx.data_offset + DATA_HEADER_SIZE );
/* The main decoding loop */
- while(pkt.timestamp < rmctx.duration) {
+ while(rmctx.audio_pkt_cnt < rmctx.nb_packets) {
ci->yield();
if (ci->stop_codec || ci->new_track)
break;
if (ci->seek_time) {
- packet_offset = ci->seek_time / (((rmctx.block_align + PACKET_HEADER_SIZE)*8*1000)/rmctx.bit_rate);
+ packet_offset = ci->seek_time / ((rmctx.block_align*8*1000)/rmctx.bit_rate);
ci->seek_buffer(rmctx.data_offset + DATA_HEADER_SIZE + packet_offset*(rmctx.block_align + PACKET_HEADER_SIZE));
- samplesdone = A52_SAMPLESPERFRAME * packet_offset;
+ rmctx.audio_pkt_cnt = packet_offset;
+ samplesdone = (rmctx.sample_rate/1000 * ci->seek_time);
ci->seek_complete();
}