summaryrefslogtreecommitdiff
path: root/apps/codecs/libpcm/linear_pcm.c
diff options
context:
space:
mode:
authorYoshihisa Uchida <uchida@rockbox.org>2010-03-13 05:19:40 +0000
committerYoshihisa Uchida <uchida@rockbox.org>2010-03-13 05:19:40 +0000
commit4446d1bc857b41e491d04b05eeccc873a206fd18 (patch)
tree47a50663e5680e115e32bed19b1f76e073b81c05 /apps/codecs/libpcm/linear_pcm.c
parent131bb698ada664a49e0a548b515b14733914654e (diff)
downloadrockbox-4446d1bc857b41e491d04b05eeccc873a206fd18.zip
rockbox-4446d1bc857b41e491d04b05eeccc873a206fd18.tar.gz
rockbox-4446d1bc857b41e491d04b05eeccc873a206fd18.tar.bz2
rockbox-4446d1bc857b41e491d04b05eeccc873a206fd18.tar.xz
reduce firmware and sun audio codec.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25140 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libpcm/linear_pcm.c')
-rw-r--r--apps/codecs/libpcm/linear_pcm.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/apps/codecs/libpcm/linear_pcm.c b/apps/codecs/libpcm/linear_pcm.c
index 82c70eb..e58856e 100644
--- a/apps/codecs/libpcm/linear_pcm.c
+++ b/apps/codecs/libpcm/linear_pcm.c
@@ -38,6 +38,18 @@ static bool set_format(struct pcm_format *format)
{
fmt = format;
+ if (fmt->channels == 0)
+ {
+ DEBUGF("CODEC_ERROR: channels is 0\n");
+ return false;
+ }
+
+ if (fmt->bitspersample == 0)
+ {
+ DEBUGF("CODEC_ERROR: bitspersample is 0\n");
+ return false;
+ }
+
if (fmt->bitspersample > 32)
{
DEBUGF("CODEC_ERROR: pcm with more than 32 bitspersample "
@@ -47,8 +59,8 @@ static bool set_format(struct pcm_format *format)
fmt->bytespersample = fmt->bitspersample >> 3;
- if (fmt->totalsamples == 0)
- fmt->totalsamples = fmt->numbytes/fmt->bytespersample;
+ if (fmt->blockalign == 0)
+ fmt->blockalign = fmt->bytespersample * fmt->channels;
fmt->samplesperblock = fmt->blockalign / (fmt->bytespersample * fmt->channels);