From ac2ce3a44992f88088985245295b7c04990963a2 Mon Sep 17 00:00:00 2001 From: Mohamed Tarek Date: Tue, 4 Aug 2009 18:36:44 +0000 Subject: 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 --- apps/codecs/a52_rm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'apps') 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(); } -- cgit v1.2.3