diff options
Diffstat (limited to 'apps/codecs/atrac3_rm.c')
-rw-r--r-- | apps/codecs/atrac3_rm.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/apps/codecs/atrac3_rm.c b/apps/codecs/atrac3_rm.c index 75c0d1581b..d3e00c0e6f 100644 --- a/apps/codecs/atrac3_rm.c +++ b/apps/codecs/atrac3_rm.c | |||
@@ -45,6 +45,7 @@ enum codec_status codec_main(void) | |||
45 | uint32_t packet_count; | 45 | uint32_t packet_count; |
46 | int scrambling_unit_size, num_units, elapsed = 0; | 46 | int scrambling_unit_size, num_units, elapsed = 0; |
47 | int playback_on = -1; | 47 | int playback_on = -1; |
48 | size_t resume_offset = ci->id3->offset; | ||
48 | 49 | ||
49 | next_track: | 50 | next_track: |
50 | if (codec_init()) { | 51 | if (codec_init()) { |
@@ -80,6 +81,15 @@ next_track: | |||
80 | return CODEC_ERROR; | 81 | return CODEC_ERROR; |
81 | } | 82 | } |
82 | 83 | ||
84 | /* check for a mid-track resume and force a seek time accordingly */ | ||
85 | if(resume_offset > rmctx.data_offset + DATA_HEADER_SIZE) { | ||
86 | resume_offset -= rmctx.data_offset + DATA_HEADER_SIZE; | ||
87 | num_units = (int)resume_offset / scrambling_unit_size; | ||
88 | /* put number of subpackets to skip in resume_offset */ | ||
89 | resume_offset /= (sps + PACKET_HEADER_SIZE); | ||
90 | ci->seek_time = (int)resume_offset * ((sps * 8 * 1000)/rmctx.bit_rate); | ||
91 | } | ||
92 | |||
83 | ci->set_elapsed(0); | 93 | ci->set_elapsed(0); |
84 | ci->advance_buffer(rmctx.data_offset + DATA_HEADER_SIZE); | 94 | ci->advance_buffer(rmctx.data_offset + DATA_HEADER_SIZE); |
85 | 95 | ||
@@ -98,7 +108,7 @@ seek_start : | |||
98 | else | 108 | else |
99 | goto done; | 109 | goto done; |
100 | } | 110 | } |
101 | 111 | ||
102 | for(i = 0; i < rmctx.audio_pkt_cnt*(fs/sps) ; i++) | 112 | for(i = 0; i < rmctx.audio_pkt_cnt*(fs/sps) ; i++) |
103 | { | 113 | { |
104 | ci->yield(); | 114 | ci->yield(); |