From: Jaroslav Kysela Date: Thu, 30 Nov 2006 12:42:33 +0000 (+0100) Subject: fix for recent namehint API (use get_hint function) X-Git-Tag: v1.0.14rc1~3 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=a6f9df06afbe7e5e15006b2dd36f8a83c736bd8b;p=alsa-utils.git fix for recent namehint API (use get_hint function) --- diff --git a/aplay/aplay.c b/aplay/aplay.c index 3b0bf9e..e9e0df2 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -262,32 +262,39 @@ static void device_list(void) static void pcm_list(void) { - char **hints, **n, *delim, *filter; + void **hints, **n; + char *name, *descr, *descr1, *io; + const char *filter; if (snd_device_name_hint(-1, "pcm", &hints) < 0) return; n = hints; - filter = stream == SND_PCM_STREAM_CAPTURE ? "{Playback}" : "{Capture}"; + filter = stream == SND_PCM_STREAM_CAPTURE ? "Input" : "Output"; while (*n != NULL) { - delim = strchr(*n, '|'); - if (delim) { - *delim = '\0'; - if (strstr(delim + 1, filter) != NULL) - goto __end; - } - printf("%s\n", *n); - if (delim++) { + name = snd_device_name_get_hint(*n, "NAME"); + descr = snd_device_name_get_hint(*n, "DESC"); + io = snd_device_name_get_hint(*n, "IOID"); + printf("%s\n", name); + if (io != NULL && strcmp(io, filter) == 0) + goto __end; + if ((descr1 = descr) != NULL) { printf(" "); - while (*delim) { - if (*delim == '\n') + while (*descr1) { + if (*descr1 == '\n') printf("\n "); else - putchar(*delim); - delim++; + putchar(*descr1); + descr1++; } putchar('\n'); } __end: + if (name != NULL) + free(name); + if (descr != NULL) + free(descr); + if (io != NULL) + free(io); n++; } snd_device_name_free_hint(hints);