• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/iserver/alsa-lib-1.0.26/src/control/

Lines Matching refs:list

32 	char **list;
49 static int hint_list_add(struct hint_list *list,
55 if (list->count == list->allocated) {
56 char **n = realloc(list->list, (list->allocated + 10) * sizeof(char *));
59 list->allocated += 10;
60 list->list = n;
75 list->list[list->count++] = x;
87 static int get_dev_name1(struct hint_list *list, char **res, int device,
93 switch (list->iface) {
100 if (snd_ctl_hwdep_info(list->ctl, info) < 0)
113 if (snd_ctl_pcm_info(list->ctl, info) < 0)
133 if (snd_ctl_rawmidi_info(list->ctl, info) < 0)
144 static char *get_dev_name(struct hint_list *list)
149 device = list->device_input >= 0 ? list->device_input : list->device;
150 if (get_dev_name1(list, &str1, device, 1) < 0)
152 device = list->device_output >= 0 ? list->device_output : list->device;
153 if (get_dev_name1(list, &str2, device, 0) < 0) {
161 res = malloc(strlen(list->cardname) + strlen(str2) + 3);
163 strcpy(res, list->cardname);
168 res = malloc(strlen(list->cardname) + strlen(str2) + strlen(str1) + 6);
170 strcpy(res, list->cardname);
187 res = malloc(strlen(list->cardname) + strlen(str1) + 19);
192 strcpy(res, list->cardname);
202 if (list->device >= 0 || list->device_input >= 0 || list->device_output >= 0)
204 return strdup(list->cardname);
211 static int try_config(struct hint_list *list,
221 long dev = list->device;
224 list->device_input = -1;
225 list->device_output = -1;
236 if (list->card >= 0 && list->device >= 0)
237 sprintf(buf, "%s:CARD=%s,DEV=%i", name, snd_ctl_card_info_get_id(list->info), list->device);
238 else if (list->card >= 0)
239 sprintf(buf, "%s:CARD=%s", name, snd_ctl_card_info_get_id(list->info));
274 list->device_input = -1;
275 list->device_output = -1;
310 list->device_input = dev;
311 list->device_output = dev;
314 if (snd_config_get_integer(n, &list->device_input) < 0) {
319 list->device_output = -1;
322 if (snd_config_get_integer(n, &list->device_output) < 0) {
328 } else if (level == 1 && !list->show_all)
359 list->device = dev;
360 str = list->card >= 0 ? get_dev_name(list) : NULL;
380 } else if (list->device >= 0)
382 err = hint_list_add(list, buf, buf1);
409 static int add_card(struct hint_list *list, int card)
420 list->info = info;
421 err = snd_config_search(snd_config, list->siface, &conf);
425 err = snd_ctl_open(&list->ctl, ctl_name, 0);
428 err = snd_ctl_card_info(list->ctl, info);
436 if (next_devices[list->iface] != NULL) {
437 list->card = card;
439 err = next_devices[list->iface](list->ctl, &device);
445 err = next_devices[list->iface](list->ctl, &device);
451 list->device = device;
452 err = try_config(list, list->siface, str);
465 list->card = card;
466 list->device = -1;
467 err = try_config(list, list->siface, str);
474 snd_ctl_close(list->ctl);
478 static int get_card_name(struct hint_list *list, int card)
483 free(list->cardname);
484 list->cardname = NULL;
485 err = snd_card_get_name(card, &list->cardname);
489 s = realloc(list->cardname, strlen(list->cardname) + strlen(scard) + 1);
492 list->cardname = s;
496 static int add_software_devices(struct hint_list *list)
503 err = snd_config_search(snd_config, list->siface, &conf);
510 list->card = -1;
511 list->device = -1;
512 err = try_config(list, list->siface, str);
547 struct hint_list list;
559 list.list = NULL;
560 list.count = list.allocated = 0;
561 list.siface = iface;
563 list.iface = SND_CTL_ELEM_IFACE_CARD;
565 list.iface = SND_CTL_ELEM_IFACE_PCM;
567 list.iface = SND_CTL_ELEM_IFACE_RAWMIDI;
569 list.iface = SND_CTL_ELEM_IFACE_TIMER;
571 list.iface = SND_CTL_ELEM_IFACE_SEQUENCER;
573 list.iface = SND_CTL_ELEM_IFACE_HWDEP;
575 list.iface = SND_CTL_ELEM_IFACE_MIXER;
578 list.show_all = 0;
579 list.cardname = NULL;
581 list.show_all = snd_config_get_bool(conf) > 0;
583 err = get_card_name(&list, card);
585 err = add_card(&list, card);
587 add_software_devices(&list);
592 err = get_card_name(&list, card);
595 err = add_card(&list, card);
603 sprintf(ehints, "namehint.%s", list.siface);
610 err = hint_list_add(&list, str, NULL);
618 snd_device_name_free_hint((void **)list.list);
619 if (list.cardname)
620 free(list.cardname);
623 err = hint_list_add(&list, NULL, NULL);
626 *hints = (void **)list.list;
627 if (list.cardname)
628 free(list.cardname);
634 * \brief Free a list of device name hints.