1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| static void mapping_paths_probe(pa_alsa_mapping *m, pa_alsa_profile *profile, pa_alsa_direction_t direction, pa_hashmap *used_paths) { pa_alsa_path *p; void *state; snd_pcm_t *pcm_handle; pa_alsa_path_set *ps; snd_mixer_t *mixer_handle;
if (direction == PA_ALSA_DIRECTION_OUTPUT) { if (m->output_path_set) return; m->output_path_set = ps = pa_alsa_path_set_new(m, direction, NULL); pcm_handle = m->output_pcm; } else { if (m->input_path_set) return; m->input_path_set = ps = pa_alsa_path_set_new(m, direction, NULL); pcm_handle = m->input_pcm; }
if (!ps) return;
pa_assert(pcm_handle);
mixer_handle = pa_alsa_open_mixer_for_pcm(pcm_handle, NULL); if (!mixer_handle) { pa_hashmap_remove_all(ps->paths); return; }
PA_HASHMAP_FOREACH(p, ps->paths, state) { if (p->autodetect_eld_device) p->eld_device = m->hw_device_index;
if (pa_alsa_path_probe(p, m, mixer_handle, m->profile_set->ignore_dB) < 0) pa_hashmap_remove(ps->paths, p); }
path_set_condense(ps, mixer_handle); path_set_make_path_descriptions_unique(ps);
if (mixer_handle) snd_mixer_close(mixer_handle);
PA_HASHMAP_FOREACH(p, ps->paths, state) pa_hashmap_put(used_paths, p, p);
pa_log_debug("Available mixer paths (after tidying):"); pa_alsa_path_set_dump(ps); }
|