mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-31 22:25:35 -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
|
|
@ -191,14 +191,13 @@ int snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name, snd_pcm_t *slave, int
|
|||
}
|
||||
|
||||
int _snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode)
|
||||
snd_config_t *conf,
|
||||
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_config_for_each(i, next, conf) {
|
||||
snd_config_t *n = snd_config_iterator_entry(i);
|
||||
const char *id = snd_config_get_id(n);
|
||||
|
|
@ -217,15 +216,10 @@ int _snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name,
|
|||
SNDERR("slave is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_pcm_slave_conf(slave, &sname, 0);
|
||||
err = snd_pcm_slave_conf(slave, &sconf, 0);
|
||||
if (err < 0)
|
||||
return err;
|
||||
/* 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_copy_open(pcmp, name, spcm, 1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue