mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2026-02-26 01:40:07 -05:00
control: remap - add no-op when the remapping is not active
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
5e7c507152
commit
d6f9e9f590
1 changed files with 12 additions and 4 deletions
|
|
@ -1170,6 +1170,13 @@ int snd_ctl_remap_open(snd_ctl_t **handlep, const char *name, snd_config_t *rema
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* no-op check, remove the plugin */
|
||||||
|
if (priv->map_items == 0 && priv->remap_items == 0) {
|
||||||
|
remap_free(priv);
|
||||||
|
*handlep = child;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
priv->map_read_queue = calloc(priv->map_items, sizeof(priv->map_read_queue[0]));
|
priv->map_read_queue = calloc(priv->map_items, sizeof(priv->map_read_queue[0]));
|
||||||
if (priv->map_read_queue == NULL) {
|
if (priv->map_read_queue == NULL) {
|
||||||
result = -ENOMEM;
|
result = -ENOMEM;
|
||||||
|
|
@ -1302,13 +1309,14 @@ int _snd_ctl_remap_open(snd_ctl_t **handlep, char *name, snd_config_t *root, snd
|
||||||
SNDERR("child is not defined");
|
SNDERR("child is not defined");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if (!remap && !map) {
|
|
||||||
SNDERR("remap or create section is not defined");
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
err = _snd_ctl_open_child(&cctl, root, child, mode, conf);
|
err = _snd_ctl_open_child(&cctl, root, child, mode, conf);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
/* no-op, remove the plugin */
|
||||||
|
if (!remap && !map) {
|
||||||
|
*handlep = cctl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
err = snd_ctl_remap_open(handlep, name, remap, map, cctl, mode);
|
err = snd_ctl_remap_open(handlep, name, remap, map, cctl, mode);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
snd_ctl_close(cctl);
|
snd_ctl_close(cctl);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue