summaryrefslogtreecommitdiff
path: root/apps/codecs/raac.c
diff options
context:
space:
mode:
authorMohamed Tarek <mt@rockbox.org>2009-11-18 00:41:46 +0000
committerMohamed Tarek <mt@rockbox.org>2009-11-18 00:41:46 +0000
commit9669bbc135f3026858f8359555c1c3221d970f7f (patch)
tree0b52a67baa9e7538d8b96606740d1b5531d2e030 /apps/codecs/raac.c
parent9ccccce65505541548bfba6dcf5b280f3ebc785e (diff)
Handle mid-track resumes in RM.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23659 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/raac.c')
-rw-r--r--apps/codecs/raac.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/apps/codecs/raac.c b/apps/codecs/raac.c
index b886136bd9..516828093d 100644
--- a/apps/codecs/raac.c
+++ b/apps/codecs/raac.c
@@ -48,6 +48,7 @@ enum codec_status codec_main(void)
uint32_t s = 0; /* sample rate */
unsigned char c = 0; /* channels */
int playback_on = -1;
+ size_t resume_offset = ci->id3->offset;
/* Generic codec initialisation */
ci->configure(DSP_SET_STEREO_MODE, STEREO_INTERLEAVED);
@@ -91,6 +92,15 @@ next_track:
err = CODEC_ERROR;
goto done;
}
+
+ /* check for a mid-track resume and force a seek time accordingly */
+ if(resume_offset > rmctx.data_offset + DATA_HEADER_SIZE) {
+ resume_offset -= rmctx.data_offset + DATA_HEADER_SIZE;
+ /* put number of subpackets to skip in resume_offset */
+ resume_offset /= (rmctx.block_align + PACKET_HEADER_SIZE);
+ ci->seek_time = (int)resume_offset * ((rmctx.block_align * 8 * 1000)/rmctx.bit_rate);
+ }
+
ci->id3->frequency = s;
ci->set_elapsed(0);
ci->advance_buffer(rmctx.data_offset + DATA_HEADER_SIZE);