From 3716abba9274f544dd31cdf4e6c83a845bf2a801 Mon Sep 17 00:00:00 2001 From: Yoshihisa Uchida Date: Sat, 20 Feb 2010 02:04:56 +0000 Subject: 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 --- apps/codecs/libpcm/ieee_float.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'apps/codecs/libpcm/ieee_float.c') 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, -- cgit v1.1