mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-10 04:05:43 +01:00
aplay/arecord: filter direction for -L command
This commit is contained in:
parent
f6ed3aa3be
commit
0b70f2e606
1 changed files with 7 additions and 2 deletions
|
@ -280,18 +280,23 @@ static void device_list(void)
|
||||||
|
|
||||||
static void pcm_list(void)
|
static void pcm_list(void)
|
||||||
{
|
{
|
||||||
char **hints, **n, *delim;
|
char **hints, **n, *delim, *filter;
|
||||||
|
|
||||||
if (snd_device_name_hint(-1, SND_CTL_ELEM_IFACE_PCM, &hints) < 0)
|
if (snd_device_name_hint(-1, SND_CTL_ELEM_IFACE_PCM, &hints) < 0)
|
||||||
return;
|
return;
|
||||||
n = hints;
|
n = hints;
|
||||||
|
filter = stream == SND_PCM_STREAM_CAPTURE ? "{Playback}" : "{Capture}";
|
||||||
while (*n != NULL) {
|
while (*n != NULL) {
|
||||||
delim = strchr(*n, '|');
|
delim = strchr(*n, '|');
|
||||||
if (delim)
|
if (delim) {
|
||||||
*delim = '\0';
|
*delim = '\0';
|
||||||
|
if (strstr(delim + 1, filter) != NULL)
|
||||||
|
goto __end;
|
||||||
|
}
|
||||||
printf("%s\n", *n);
|
printf("%s\n", *n);
|
||||||
if (delim)
|
if (delim)
|
||||||
printf(" %s\n", delim + 1);
|
printf(" %s\n", delim + 1);
|
||||||
|
__end:
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
snd_device_name_free_hint(hints);
|
snd_device_name_free_hint(hints);
|
||||||
|
|
Loading…
Reference in a new issue