Lines 374-379
Link Here
|
374 |
++n; |
374 |
++n; |
375 |
} |
375 |
} |
376 |
snd_device_name_free_hint(hints); |
376 |
snd_device_name_free_hint(hints); |
|
|
377 |
|
378 |
// Now find aliases... |
379 |
int res; |
380 |
snd_config_iterator_t pos, next; |
381 |
snd_config_t *top, *node, *tp; |
382 |
snd_pcm_t *pcm; |
383 |
snd_pcm_stream_t st; |
384 |
const char *tps, *ids, **ig; |
385 |
static const char *ignore[] = {"hw", "plughw", "plug", "dsnoop", "tee", |
386 |
"file", "null", "shm", "cards", "rate_convert", NULL}; |
387 |
|
388 |
// Populate snd_config... |
389 |
if (snd_config == NULL) |
390 |
snd_config_update(); |
391 |
if (snd_config != NULL) { |
392 |
switch (mode) { |
393 |
case QAudio::AudioInput: |
394 |
st = SND_PCM_STREAM_CAPTURE; |
395 |
break; |
396 |
case QAudio::AudioOutput: |
397 |
st = SND_PCM_STREAM_PLAYBACK; |
398 |
break; |
399 |
default: |
400 |
goto bad_mode; |
401 |
} |
402 |
// Find "pcm" nodes... |
403 |
if ((res = snd_config_search(snd_config, "pcm", &top)) >= 0) { |
404 |
for (pos = snd_config_iterator_first(top), next = snd_config_iterator_next(pos); |
405 |
pos != snd_config_iterator_end(top); |
406 |
pos = next, next = snd_config_iterator_next(pos)) { |
407 |
node = snd_config_iterator_entry(pos); |
408 |
if (snd_config_search(node, "type", &tp) < 0) |
409 |
continue; |
410 |
snd_config_get_string(tp, &tps); |
411 |
snd_config_get_id(node, &ids); |
412 |
for (ig = ignore; *ig; ig++) { |
413 |
if (strcmp(*ig, ids) == 0) |
414 |
break; |
415 |
} |
416 |
if (*ig) |
417 |
continue; |
418 |
// Ensure it's available... |
419 |
if (snd_pcm_open(&pcm, ids, st, 0)) |
420 |
continue; |
421 |
snd_pcm_close(pcm); |
422 |
QString deviceName = QLatin1String(ids); |
423 |
devices.append(deviceName.toLocal8Bit().constData()); |
424 |
} |
425 |
} |
426 |
} |
427 |
bad_mode: |
377 |
#else |
428 |
#else |
378 |
int idx = 0; |
429 |
int idx = 0; |
379 |
char* name; |
430 |
char* name; |
Lines 384-390
Link Here
|
384 |
} |
435 |
} |
385 |
#endif |
436 |
#endif |
386 |
|
437 |
|
387 |
if (devices.size() > 0) |
438 |
if (devices.size() > 0 && !devices.contains("default")) |
388 |
devices.append("default"); |
439 |
devices.append("default"); |
389 |
|
440 |
|
390 |
return devices; |
441 |
return devices; |