mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2026-03-11 05:33:43 -04:00
namehint: Don't enumerate as duplex if only a single direction is defined
When a hint description has only either device_input or device_output, we shouldn't handle it as a full duplex but rather a single direction. In that way, we can avoid to list up a playback stream like dmix or surround51 as a capture stream in the namehint. Reported-by: Trent Reed <treed0803@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
5610b356b5
commit
8cdbdae731
1 changed files with 8 additions and 2 deletions
|
|
@ -28,6 +28,7 @@
|
||||||
#include "local.h"
|
#include "local.h"
|
||||||
|
|
||||||
#ifndef DOC_HIDDEN
|
#ifndef DOC_HIDDEN
|
||||||
|
#define DEV_SKIP 9999 /* some non-existing device number */
|
||||||
struct hint_list {
|
struct hint_list {
|
||||||
char **list;
|
char **list;
|
||||||
unsigned int count;
|
unsigned int count;
|
||||||
|
|
@ -90,7 +91,7 @@ static int get_dev_name1(struct hint_list *list, char **res, int device,
|
||||||
int stream)
|
int stream)
|
||||||
{
|
{
|
||||||
*res = NULL;
|
*res = NULL;
|
||||||
if (device < 0)
|
if (device < 0 || device == DEV_SKIP)
|
||||||
return 0;
|
return 0;
|
||||||
switch (list->iface) {
|
switch (list->iface) {
|
||||||
#ifdef BUILD_HWDEP
|
#ifdef BUILD_HWDEP
|
||||||
|
|
@ -317,7 +318,9 @@ static int try_config(snd_config_t *config,
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
goto __cleanup;
|
goto __cleanup;
|
||||||
}
|
}
|
||||||
list->device_output = -1;
|
/* skip the counterpart if only a single direction is defined */
|
||||||
|
if (list->device_output < 0)
|
||||||
|
list->device_output = DEV_SKIP;
|
||||||
}
|
}
|
||||||
if (snd_config_search(cfg, "device_output", &n) >= 0) {
|
if (snd_config_search(cfg, "device_output", &n) >= 0) {
|
||||||
if (snd_config_get_integer(n, &list->device_output) < 0) {
|
if (snd_config_get_integer(n, &list->device_output) < 0) {
|
||||||
|
|
@ -325,6 +328,9 @@ static int try_config(snd_config_t *config,
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
goto __cleanup;
|
goto __cleanup;
|
||||||
}
|
}
|
||||||
|
/* skip the counterpart if only a single direction is defined */
|
||||||
|
if (list->device_input < 0)
|
||||||
|
list->device_input = DEV_SKIP;
|
||||||
}
|
}
|
||||||
} else if (level == 1 && !list->show_all)
|
} else if (level == 1 && !list->show_all)
|
||||||
goto __skip_add;
|
goto __skip_add;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue