diff options
| author | Yoshihisa Uchida <uchida@rockbox.org> | 2010-02-20 02:04:56 +0000 |
|---|---|---|
| committer | Yoshihisa Uchida <uchida@rockbox.org> | 2010-02-20 02:04:56 +0000 |
| commit | 3716abba9274f544dd31cdf4e6c83a845bf2a801 (patch) | |
| tree | 07bca7cdd3e40bb176e938fcb5ea8eb2f7c3e9cb /apps/codecs/libpcm/ieee_float.c | |
| parent | 93caf52db5e0afe826278c148936bdfa563724f1 (diff) | |
| download | rockbox-3716abba9274f544dd31cdf4e6c83a845bf2a801.zip rockbox-3716abba9274f544dd31cdf4e6c83a845bf2a801.tar.gz rockbox-3716abba9274f544dd31cdf4e6c83a845bf2a801.tar.bz2 rockbox-3716abba9274f544dd31cdf4e6c83a845bf2a801.tar.xz | |
commit FS#10424 and FS#10425
- wav(RIFF) supports Microsoft ADPCM, Dialogic OKI ADPCM, YAMAHA ADPCM, Adobe SWF ADPCM.
- AIFF supports QuickTime IMA ADPCM.
- DVI ADPCM(IMA ADPCM) reworks.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24782 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libpcm/ieee_float.c')
| -rw-r--r-- | apps/codecs/libpcm/ieee_float.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/apps/codecs/libpcm/ieee_float.c b/apps/codecs/libpcm/ieee_float.c index c0e91a4..0530993 100644 --- a/apps/codecs/libpcm/ieee_float.c +++ b/apps/codecs/libpcm/ieee_float.c @@ -28,33 +28,38 @@ static struct pcm_format *fmt; -static bool set_format(struct pcm_format *format, const unsigned char *fmtpos) +static bool set_format(struct pcm_format *format) { fmt = format; - (void)fmtpos; - if (fmt->bitspersample != 32 && fmt->bitspersample != 64) { - DEBUGF("CODEC_ERROR: ieee float must be 32 or 64 bitspersample %d\n", fmt->bitspersample); + DEBUGF("CODEC_ERROR: ieee float must be 32 or 64 bitspersample: %d\n", + fmt->bitspersample); return false; } fmt->bytespersample = fmt->bitspersample >> 3; - fmt->blockalign = fmt->bytespersample; + fmt->samplesperblock = fmt->blockalign / (fmt->bytespersample * fmt->channels); - /* chunksize is computed so that one chunk is about 1/50s. */ - fmt->chunksize = (ci->id3->frequency * fmt->channels / 50) * fmt->blockalign; + /* chunksize = about 1/50[sec] data */ + fmt->chunksize = (ci->id3->frequency / (50 * fmt->samplesperblock)) + * fmt->blockalign; return true; } -static uint32_t get_seek_pos(long seek_time) +static struct pcm_pos *get_seek_pos(long seek_time, + uint8_t *(*read_buffer)(size_t *realsize)) { - uint32_t newpos; - - newpos = ((uint64_t)(seek_time * ci->id3->frequency * fmt->channels / 1000LL))*fmt->blockalign; - return newpos; + static struct pcm_pos newpos; + uint32_t newblock = ((uint64_t)seek_time * ci->id3->frequency) + / (1000LL * fmt->samplesperblock); + + (void)read_buffer; + newpos.pos = newblock * fmt->blockalign; + newpos.samples = newblock * fmt->samplesperblock; + return &newpos; } static int decode(const uint8_t *inbuf, size_t inbufsize, |