diff options
author | Mohamed Tarek <mt@rockbox.org> | 2009-08-04 18:36:44 +0000 |
---|---|---|
committer | Mohamed Tarek <mt@rockbox.org> | 2009-08-04 18:36:44 +0000 |
commit | ac2ce3a44992f88088985245295b7c04990963a2 (patch) | |
tree | 0097dff61c0324865118121ba79ada1d8a88f33b | |
parent | 2b3b36a480a0d8f04a4f88c3604619e92730ecb1 (diff) | |
download | rockbox-ac2ce3a44992f88088985245295b7c04990963a2.tar.gz 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
-rw-r--r-- | apps/codecs/a52_rm.c | 7 |
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: | |||
157 | ci->advance_buffer(rmctx.data_offset + DATA_HEADER_SIZE ); | 157 | ci->advance_buffer(rmctx.data_offset + DATA_HEADER_SIZE ); |
158 | 158 | ||
159 | /* The main decoding loop */ | 159 | /* The main decoding loop */ |
160 | while(pkt.timestamp < rmctx.duration) { | 160 | while(rmctx.audio_pkt_cnt < rmctx.nb_packets) { |
161 | ci->yield(); | 161 | ci->yield(); |
162 | if (ci->stop_codec || ci->new_track) | 162 | if (ci->stop_codec || ci->new_track) |
163 | break; | 163 | break; |
164 | 164 | ||
165 | if (ci->seek_time) { | 165 | if (ci->seek_time) { |
166 | packet_offset = ci->seek_time / (((rmctx.block_align + PACKET_HEADER_SIZE)*8*1000)/rmctx.bit_rate); | 166 | packet_offset = ci->seek_time / ((rmctx.block_align*8*1000)/rmctx.bit_rate); |
167 | ci->seek_buffer(rmctx.data_offset + DATA_HEADER_SIZE + packet_offset*(rmctx.block_align + PACKET_HEADER_SIZE)); | 167 | ci->seek_buffer(rmctx.data_offset + DATA_HEADER_SIZE + packet_offset*(rmctx.block_align + PACKET_HEADER_SIZE)); |
168 | samplesdone = A52_SAMPLESPERFRAME * packet_offset; | 168 | rmctx.audio_pkt_cnt = packet_offset; |
169 | samplesdone = (rmctx.sample_rate/1000 * ci->seek_time); | ||
169 | ci->seek_complete(); | 170 | ci->seek_complete(); |
170 | } | 171 | } |
171 | 172 | ||