summaryrefslogtreecommitdiff
path: root/apps/codecs/libpcm/swf_adpcm.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libpcm/swf_adpcm.c')
-rw-r--r--apps/codecs/libpcm/swf_adpcm.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/apps/codecs/libpcm/swf_adpcm.c b/apps/codecs/libpcm/swf_adpcm.c
index ebc4328c59..c440fd1303 100644
--- a/apps/codecs/libpcm/swf_adpcm.c
+++ b/apps/codecs/libpcm/swf_adpcm.c
@@ -81,20 +81,21 @@ static bool set_format(struct pcm_format *format)
81 return true; 81 return true;
82} 82}
83 83
84static struct pcm_pos *get_seek_pos(long seek_time, 84static struct pcm_pos *get_seek_pos(uint32_t seek_val, int seek_mode,
85 uint8_t *(*read_buffer)(size_t *realsize)) 85 uint8_t *(*read_buffer)(size_t *realsize))
86{ 86{
87 static struct pcm_pos newpos; 87 static struct pcm_pos newpos;
88 uint32_t chunkbits = blockbits; 88 uint32_t chunkbits = blockbits;
89 uint32_t seekbits = (((uint64_t)seek_time * ci->id3->frequency) 89 uint32_t seekblocks = (seek_mode == PCM_SEEK_TIME)?
90 / (1000LL * fmt->samplesperblock)) * blockbits + 2; 90 ((uint64_t)seek_val * ci->id3->frequency)
91 / (1000LL * fmt->samplesperblock) :
92 ((seek_val << 3) - 2) / blockbits;
93 uint32_t seekbits = seekblocks * blockbits + 2;
91 94
92 (void)read_buffer; 95 (void)read_buffer;
93 96
94 newpos.pos = seekbits >> 3; 97 newpos.pos = seekbits >> 3;
95 newpos.samples = (((uint64_t)seek_time * ci->id3->frequency) 98 newpos.samples = seekblocks * fmt->samplesperblock;
96 / (1000LL * fmt->samplesperblock))
97 * fmt->samplesperblock;
98 99
99 if (newpos.pos == 0) 100 if (newpos.pos == 0)
100 { 101 {