Update ALSA device enumeration to return all devices
Previously, if a device was marked as "Default Audio Device" then only this device would be returned during device enumeration. Now it returns all devices, with the default device placed first. Task-number: QTBUG-22103 Change-Id: I1705415bf6b58ff046c4d2812107b46b76500001 Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
This commit is contained in:
committed by
Qt by Nokia
parent
53fdcca366
commit
8879945567
@@ -406,7 +406,6 @@ void QAudioDeviceInfoInternal::updateLists()
|
|||||||
|
|
||||||
QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode)
|
QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode)
|
||||||
{
|
{
|
||||||
QList<QByteArray> allDevices;
|
|
||||||
QList<QByteArray> devices;
|
QList<QByteArray> devices;
|
||||||
QByteArray filter;
|
QByteArray filter;
|
||||||
|
|
||||||
@@ -436,8 +435,9 @@ QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode)
|
|||||||
if ((descr != NULL) && ((io == NULL) || (io == filter))) {
|
if ((descr != NULL) && ((io == NULL) || (io == filter))) {
|
||||||
QString deviceName = QLatin1String(name);
|
QString deviceName = QLatin1String(name);
|
||||||
QString deviceDescription = QLatin1String(descr);
|
QString deviceDescription = QLatin1String(descr);
|
||||||
allDevices.append(deviceName.toLocal8Bit().constData());
|
|
||||||
if (deviceDescription.contains(QLatin1String("Default Audio Device")))
|
if (deviceDescription.contains(QLatin1String("Default Audio Device")))
|
||||||
|
devices.prepend(deviceName.toLocal8Bit().constData());
|
||||||
|
else
|
||||||
devices.append(deviceName.toLocal8Bit().constData());
|
devices.append(deviceName.toLocal8Bit().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -450,10 +450,6 @@ QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode)
|
|||||||
++n;
|
++n;
|
||||||
}
|
}
|
||||||
snd_device_name_free_hint(hints);
|
snd_device_name_free_hint(hints);
|
||||||
|
|
||||||
if(devices.size() > 0) {
|
|
||||||
devices.append("default");
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
char* name;
|
char* name;
|
||||||
@@ -462,13 +458,10 @@ QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode)
|
|||||||
devices.append(name);
|
devices.append(name);
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
if (idx > 0)
|
#endif
|
||||||
|
|
||||||
|
if (devices.size() > 0)
|
||||||
devices.append("default");
|
devices.append("default");
|
||||||
#endif
|
|
||||||
#if !defined(Q_WS_MAEMO_6)
|
|
||||||
if (devices.size() == 0 && allDevices.size() > 0)
|
|
||||||
return allDevices;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return devices;
|
return devices;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user