View | Details | Raw Unified | Return to bug 208570 | Differences between
and this patch

Collapse All | Expand All

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

Return to bug 208570