diff options
Diffstat (limited to 'apps/codecs/a52_rm.c')
-rw-r--r-- | apps/codecs/a52_rm.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/apps/codecs/a52_rm.c b/apps/codecs/a52_rm.c index 32b66d2826..1fe7312e03 100644 --- a/apps/codecs/a52_rm.c +++ b/apps/codecs/a52_rm.c | |||
@@ -131,7 +131,8 @@ enum codec_status codec_main(void) | |||
131 | size_t n; | 131 | size_t n; |
132 | uint8_t *filebuf; | 132 | uint8_t *filebuf; |
133 | int retval, consumed, packet_offset; | 133 | int retval, consumed, packet_offset; |
134 | int playback_on = -1; | 134 | int playback_on = -1; |
135 | size_t resume_offset = ci->id3->offset; | ||
135 | 136 | ||
136 | /* Generic codec initialisation */ | 137 | /* Generic codec initialisation */ |
137 | ci->configure(DSP_SET_STEREO_MODE, STEREO_NONINTERLEAVED); | 138 | ci->configure(DSP_SET_STEREO_MODE, STEREO_NONINTERLEAVED); |
@@ -155,6 +156,14 @@ next_track: | |||
155 | ci->memset(&pkt,0,sizeof(RMPacket)); | 156 | ci->memset(&pkt,0,sizeof(RMPacket)); |
156 | init_rm(&rmctx); | 157 | init_rm(&rmctx); |
157 | 158 | ||
159 | /* check for a mid-track resume and force a seek time accordingly */ | ||
160 | if(resume_offset > rmctx.data_offset + DATA_HEADER_SIZE) { | ||
161 | resume_offset -= rmctx.data_offset + DATA_HEADER_SIZE; | ||
162 | /* put number of subpackets to skip in resume_offset */ | ||
163 | resume_offset /= (rmctx.block_align + PACKET_HEADER_SIZE); | ||
164 | ci->seek_time = (int)resume_offset * ((rmctx.block_align * 8 * 1000)/rmctx.bit_rate); | ||
165 | } | ||
166 | |||
158 | /* Seek to the first packet */ | 167 | /* Seek to the first packet */ |
159 | ci->advance_buffer(rmctx.data_offset + DATA_HEADER_SIZE ); | 168 | ci->advance_buffer(rmctx.data_offset + DATA_HEADER_SIZE ); |
160 | 169 | ||