summaryrefslogtreecommitdiffstats
path: root/src/multimedia
diff options
context:
space:
mode:
authorMartin Banky <Martin.Banky@gmail.com>2009-10-05 22:26:00 (GMT)
committerKurt Korbatits <kurt.korbatits@nokia.com>2009-10-05 22:26:00 (GMT)
commitba11343826229e983cb1d38811c8363d355e2e01 (patch)
tree916182223f1f42a58fd6a565d86ab030f6a4e3be /src/multimedia
parentc7b091351d6fdf5fda5f38a94af24a395252249f (diff)
downloadQt-ba11343826229e983cb1d38811c8363d355e2e01.zip
Qt-ba11343826229e983cb1d38811c8363d355e2e01.tar.gz
Qt-ba11343826229e983cb1d38811c8363d355e2e01.tar.bz2
Fixed QAudioDeviceInfoInternal::deviceList(QAudio::Mode mode) filtering
If an audio device only supported Input or Output, it would not be added to the list of devices. Only devices that returned IOID == NULL would be added. Also, _m was not being used, and io was unneccessarily being cast to a QString. Merge-request: 1664 Reviewed-by: Kurt Korbatits <kurt.korbatits@nokia.com>
Diffstat (limited to 'src/multimedia')
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp26
1 files changed, 9 insertions, 17 deletions
diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp
index dc24875..55020a6 100644
--- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp
+++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp
@@ -360,33 +360,30 @@ void QAudioDeviceInfoInternal::updateLists()
QList<QByteArray> QAudioDeviceInfoInternal::deviceList(QAudio::Mode mode)
{
- QAudio::Mode _m;
QList<QByteArray> devices;
QByteArray filter;
- QString dir;
// Create a list of all current audio devices that support mode
void **hints, **n;
char *name, *descr, *io;
if(snd_device_name_hint(-1, "pcm", &hints) < 0) {
- qWarning()<<"no alsa devices available";
+ qWarning() << "no alsa devices available";
return devices;
}
n = hints;
+ if(mode == QAudio::AudioInput) {
+ filter = "Input";
+ } else {
+ filter = "Output";
+ }
+
while (*n != NULL) {
- _m = QAudio::AudioOutput;
name = snd_device_name_get_hint(*n, "NAME");
descr = snd_device_name_get_hint(*n, "DESC");
io = snd_device_name_get_hint(*n, "IOID");
- dir = QString::fromUtf8(io);
- if((name != NULL) && (descr != NULL) && ((io == NULL) || (dir.length() ==filter.length()))) {
- if(dir.length() == 5)
- _m = QAudio::AudioInput;
- if(io == NULL)
- _m = mode;
-
+ if((name != NULL) && (descr != NULL) && ((io == NULL) || (io == filter))) {
QString str = QLatin1String(name);
if(str.contains(QLatin1String("default"))) {
@@ -400,17 +397,12 @@ QList<QByteArray> QAudioDeviceInfoInternal::deviceList(QAudio::Mode mode)
free(descr);
if(io != NULL)
free(io);
- n++;
+ ++n;
}
snd_device_name_free_hint(hints);
if(devices.size() > 0) {
devices.append("default");
- if(mode == QAudio::AudioInput) {
- filter.append("Input");
- } else {
- filter.append("Output");
- }
}
return devices;