diff options
| author | Steve Kondik <steve@cyngn.com> | 2014-12-17 11:48:06 -0800 |
|---|---|---|
| committer | Steve Kondik <steve@cyngn.com> | 2014-12-17 11:48:06 -0800 |
| commit | 82637341b77a175882e43af8c1d942cca4e07bbc (patch) | |
| tree | 85f468696c8f45a1b50b22dfbc80fb062254d680 | |
| parent | ed9d96857868c2b8a8d0e371dab395f1949e148d (diff) | |
| download | android_frameworks_wilhelm-stable/cm-12.0-YNG1I.tar.gz android_frameworks_wilhelm-stable/cm-12.0-YNG1I.tar.bz2 android_frameworks_wilhelm-stable/cm-12.0-YNG1I.zip | |
Beef up the test cases for different formatsstable/cm-12.0-YNG4Nstable/cm-12.0-YNG3Cstable/cm-12.0-YNG1TAstable/cm-12.0-YNG1Tstable/cm-12.0-YNG1Icm-12.0
* Allow WAV files, more sample rates, and more channel masks in the
OpenSLES test player.
Change-Id: I6a5b582f41c229b07f44da9dcaee6f997acb6650
| -rw-r--r-- | tests/sandbox/playbq.c | 54 |
1 files changed, 33 insertions, 21 deletions
diff --git a/tests/sandbox/playbq.c b/tests/sandbox/playbq.c index cb94444..2641891 100644 --- a/tests/sandbox/playbq.c +++ b/tests/sandbox/playbq.c @@ -281,27 +281,12 @@ int main(int argc, char **argv) } // verify the file format - switch (sfinfo.channels) { - case 1: - case 2: - break; - default: + if (sfinfo.channels < 1 || sfinfo.channels > 12) { fprintf(stderr, "unsupported channel count %d\n", sfinfo.channels); goto close_sndfile; } - switch (sfinfo.samplerate) { - case 8000: - case 11025: - case 12000: - case 16000: - case 22050: - case 24000: - case 32000: - case 44100: - case 48000: - break; - default: + if (sfinfo.samplerate < 8000 || sfinfo.samplerate > 192000) { fprintf(stderr, "unsupported sample rate %d\n", sfinfo.samplerate); goto close_sndfile; } @@ -321,8 +306,10 @@ int main(int argc, char **argv) case SF_FORMAT_PCM_U8: break; default: - fprintf(stderr, "unsupported sub-format 0x%x\n", sfinfo.format & SF_FORMAT_SUBMASK); - goto close_sndfile; + if (sfinfo.format != SF_FORMAT_WAV) { + fprintf(stderr, "unsupported sub-format 0x%x (0x%x)\n", sfinfo.format & SF_FORMAT_SUBMASK, sfinfo.format); + goto close_sndfile; + } } SLuint32 bitsPerSample; @@ -399,8 +386,33 @@ int main(int argc, char **argv) format_pcm.sampleRate = sfinfo.samplerate * 1000; format_pcm.bitsPerSample = bitsPerSample; format_pcm.containerSize = format_pcm.bitsPerSample; - format_pcm.channelMask = 1 == format_pcm.numChannels ? SL_SPEAKER_FRONT_CENTER : - SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT; + + switch (format_pcm.numChannels) { + case 1: + format_pcm.channelMask = SL_SPEAKER_FRONT_CENTER; + break; + case 2: + format_pcm.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT; + break; + case 4: + format_pcm.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT + | SL_SPEAKER_BACK_LEFT | SL_SPEAKER_BACK_RIGHT; + break; + case 6: + format_pcm.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT + | SL_SPEAKER_FRONT_CENTER | SL_SPEAKER_LOW_FREQUENCY + | SL_SPEAKER_BACK_LEFT | SL_SPEAKER_BACK_RIGHT; + break; + case 8: + format_pcm.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT + | SL_SPEAKER_FRONT_CENTER | SL_SPEAKER_LOW_FREQUENCY + | SL_SPEAKER_BACK_LEFT | SL_SPEAKER_BACK_RIGHT + | SL_SPEAKER_SIDE_LEFT | SL_SPEAKER_SIDE_RIGHT; + break; + default: + format_pcm.channelMask = 0; + } + format_pcm.endianness = byteOrder; format_pcm.representation = transferFormat == AUDIO_FORMAT_PCM_FLOAT ? SL_ANDROID_PCM_REPRESENTATION_FLOAT : transferFormat == AUDIO_FORMAT_PCM_8_BIT |
