mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2026-02-26 01:40:07 -05:00
Cleaned all hw_info. Removed snd_pcm_hw_{info,params}_rules* and changed strategy to allow the same functionality. Cleaned names tables. Added informative failure
This commit is contained in:
parent
ae549cf739
commit
b9916fd7fe
15 changed files with 1098 additions and 2107 deletions
|
|
@ -352,12 +352,8 @@ static int snd_pcm_adpcm_hw_info(snd_pcm_t *pcm, snd_pcm_hw_info_t * info)
|
|||
info->format_mask = 1U << adpcm->sformat;
|
||||
info->access_mask = SND_PCM_ACCBIT_MMAP;
|
||||
err = snd_pcm_hw_info(adpcm->plug.slave, info);
|
||||
if (info->format_mask)
|
||||
info->format_mask = format_mask;
|
||||
if (info->access_mask) {
|
||||
adpcm->plug.saccess_mask = info->access_mask;
|
||||
info->access_mask = access_mask;
|
||||
}
|
||||
info->format_mask = format_mask;
|
||||
info->access_mask = access_mask;
|
||||
if (err < 0)
|
||||
return err;
|
||||
info->info &= ~(SND_PCM_INFO_MMAP | SND_PCM_INFO_MMAP_VALID);
|
||||
|
|
@ -369,25 +365,19 @@ static int snd_pcm_adpcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
|
|||
{
|
||||
snd_pcm_adpcm_t *adpcm = pcm->private;
|
||||
snd_pcm_t *slave = adpcm->plug.slave;
|
||||
unsigned int format, access;
|
||||
snd_pcm_hw_info_t sinfo;
|
||||
snd_pcm_hw_params_t sparams;
|
||||
int err;
|
||||
format = params->format;
|
||||
access = params->access;
|
||||
params->format = adpcm->sformat;
|
||||
if (adpcm->plug.saccess_mask & SND_PCM_ACCBIT_MMAP_INTERLEAVED)
|
||||
params->access = SND_PCM_ACCESS_MMAP_INTERLEAVED;
|
||||
else if (adpcm->plug.saccess_mask & SND_PCM_ACCBIT_MMAP_NONINTERLEAVED)
|
||||
params->access = SND_PCM_ACCESS_MMAP_NONINTERLEAVED;
|
||||
else
|
||||
assert(0);
|
||||
err = snd_pcm_hw_params(slave, params);
|
||||
params->format = format;
|
||||
params->access = access;
|
||||
snd_pcm_hw_params_to_info(params, &sinfo);
|
||||
sinfo.format_mask = 1 << adpcm->sformat;
|
||||
sinfo.access_mask = SND_PCM_ACCBIT_MMAP;
|
||||
err = snd_pcm_hw_params_info(slave, &sparams, &sinfo);
|
||||
params->fail_mask = sparams.fail_mask;
|
||||
if (err < 0)
|
||||
return err;
|
||||
if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
|
||||
if (adpcm->sformat == SND_PCM_FORMAT_IMA_ADPCM) {
|
||||
adpcm->getput_idx = get_index(format, SND_PCM_FORMAT_S16);
|
||||
adpcm->getput_idx = get_index(params->format, SND_PCM_FORMAT_S16);
|
||||
adpcm->func = adpcm_encode;
|
||||
} else {
|
||||
adpcm->getput_idx = put_index(SND_PCM_FORMAT_S16, adpcm->sformat);
|
||||
|
|
@ -395,7 +385,7 @@ static int snd_pcm_adpcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
|
|||
}
|
||||
} else {
|
||||
if (adpcm->sformat == SND_PCM_FORMAT_IMA_ADPCM) {
|
||||
adpcm->getput_idx = put_index(SND_PCM_FORMAT_S16, format);
|
||||
adpcm->getput_idx = put_index(SND_PCM_FORMAT_S16, params->format);
|
||||
adpcm->func = adpcm_decode;
|
||||
} else {
|
||||
adpcm->getput_idx = get_index(adpcm->sformat, SND_PCM_FORMAT_S16);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue