int snd_pcm_plugin_build_linear(int src_format, int dst_format, snd_pcm_plugin_t **r_plugin);
int snd_pcm_plugin_build_mulaw(int src_format, int dst_format, snd_pcm_plugin_t **r_plugin);
int snd_pcm_plugin_build_alaw(int src_format, int dst_format, snd_pcm_plugin_t **r_plugin);
+int snd_pcm_plugin_build_adpcm(int src_format, int dst_format, snd_pcm_plugin_t **r_plugin);
int snd_pcm_plugin_build_rate(int src_format, int src_rate, int src_voices,
int dst_format, int dst_rate, int dst_voices,
snd_pcm_plugin_t **r_plugin);
static unsigned int snd_pcm_plugin_formats(snd_pcm_t *pcm, unsigned int formats)
{
- formats |= SND_PCM_FMT_MU_LAW | SND_PCM_FMT_A_LAW;
+ formats |= SND_PCM_FMT_MU_LAW | SND_PCM_FMT_A_LAW | SND_PCM_FMT_IMA_ADPCM;
if (formats & (SND_PCM_FMT_U8|SND_PCM_FMT_S8|
SND_PCM_FMT_U16_LE|SND_PCM_FMT_S16_LE))
formats |= SND_PCM_FMT_U8|SND_PCM_FMT_S8|
} else {
return -EINVAL;
}
+ case SND_PCM_SFMT_IMA_ADPCM:
+ if (sinfo.formats & SND_PCM_FMT_S16_LE) {
+ sparams.format.format = SND_PCM_SFMT_S16_LE;
+ } else if (sinfo.formats & SND_PCM_FMT_U16_LE) {
+ sparams.format.format = SND_PCM_SFMT_U16_LE;
+ } else if (sinfo.formats & SND_PCM_FMT_S8) {
+ sparams.format.format = SND_PCM_SFMT_S8;
+ } else if (sinfo.formats & SND_PCM_FMT_U8) {
+ sparams.format.format = SND_PCM_SFMT_U8;
+ } else {
+ return -EINVAL;
+ }
break;
default:
return -EINVAL;
swap_formats(params->channel, &srcfmt, &dstfmt);
err = snd_pcm_plugin_build_alaw(srcfmt, dstfmt, &plugin);
break;
+ case SND_PCM_SFMT_IMA_ADPCM:
+ srcfmt = SND_PCM_SFMT_IMA_ADPCM;
+ dstfmt = sparams.format.format;
+ swap_formats(params->channel, &srcfmt, &dstfmt);
+ err = snd_pcm_plugin_build_adpcm(srcfmt, dstfmt, &plugin);
+ break;
default:
srcfmt = params->format.format;
dstfmt = sparams.format.format;
/*
* A-Law conversion Plug-In Interface
* Copyright (c) 1999 by Jaroslav Kysela <perex@suse.cz>
- * Portions (c) by Sun Microsystems, Inc.
+ * Uros Bizjak <uros@kss-loka.si>
*
+ * Based on reference implementation by Sun Microsystems, Inc.
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as