mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-28 05:40:23 -04:00
Added embedded/anonymous slave PCM definition
This commit is contained in:
parent
00c749f080
commit
6cb24e0186
15 changed files with 197 additions and 204 deletions
|
|
@ -552,10 +552,9 @@ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
|
|||
snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_config_iterator_t i, next;
|
||||
const char *sname = NULL;
|
||||
int err;
|
||||
snd_pcm_t *spcm;
|
||||
snd_config_t *slave = NULL;
|
||||
snd_config_t *slave = NULL, *sconf;
|
||||
snd_pcm_format_t sformat;
|
||||
snd_config_for_each(i, next, conf) {
|
||||
snd_config_t *n = snd_config_iterator_entry(i);
|
||||
|
|
@ -575,7 +574,7 @@ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
|
|||
SNDERR("slave is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_pcm_slave_conf(slave, &sname, 1,
|
||||
err = snd_pcm_slave_conf(slave, &sconf, 1,
|
||||
SND_PCM_HW_PARAM_FORMAT, 1, &sformat);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
|
@ -584,12 +583,7 @@ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
|
|||
SNDERR("invalid slave format");
|
||||
return -EINVAL;
|
||||
}
|
||||
/* This is needed cause snd_config_update may destroy config */
|
||||
sname = strdup(sname);
|
||||
if (!sname)
|
||||
return -ENOMEM;
|
||||
err = snd_pcm_open(&spcm, sname, stream, mode);
|
||||
free((void *) sname);
|
||||
err = snd_pcm_open_slave(&spcm, sconf, stream, mode);
|
||||
if (err < 0)
|
||||
return err;
|
||||
err = snd_pcm_adpcm_open(pcmp, name, sformat, spcm, 1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue