summaryrefslogtreecommitdiff
path: root/apps/codecs/libpcm/linear_pcm.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libpcm/linear_pcm.c')
-rw-r--r--apps/codecs/libpcm/linear_pcm.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/apps/codecs/libpcm/linear_pcm.c b/apps/codecs/libpcm/linear_pcm.c
index e58856efe8..5c3c140b8c 100644
--- a/apps/codecs/libpcm/linear_pcm.c
+++ b/apps/codecs/libpcm/linear_pcm.c
@@ -71,12 +71,14 @@ static bool set_format(struct pcm_format *format)
71 return true; 71 return true;
72} 72}
73 73
74static struct pcm_pos *get_seek_pos(long seek_time, 74static struct pcm_pos *get_seek_pos(uint32_t seek_val, int seek_mode,
75 uint8_t *(*read_buffer)(size_t *realsize)) 75 uint8_t *(*read_buffer)(size_t *realsize))
76{ 76{
77 static struct pcm_pos newpos; 77 static struct pcm_pos newpos;
78 uint32_t newblock = ((uint64_t)seek_time * ci->id3->frequency) 78 uint32_t newblock = (seek_mode == PCM_SEEK_TIME) ?
79 / (1000LL * fmt->samplesperblock); 79 ((uint64_t)seek_val * ci->id3->frequency / 1000LL)
80 / fmt->samplesperblock :
81 seek_val / fmt->blockalign;
80 82
81 (void)read_buffer; 83 (void)read_buffer;
82 newpos.pos = newblock * fmt->blockalign; 84 newpos.pos = newblock * fmt->blockalign;