summaryrefslogtreecommitdiffstats
path: root/src/gsttools
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@theqtcompany.com>2015-03-11 14:32:17 +0100
committerYoann Lopes <yoann.lopes@theqtcompany.com>2015-03-11 14:17:14 +0000
commite1d76e2df53b766f418e15282a2b908e91108b66 (patch)
tree68a7c0ad2971ba9fa6a83456e96e55f5b6c0208b /src/gsttools
parent95e9155b7f290d438dfd986fca7f9a26698cf691 (diff)
Revert "Alsa: fix crash when detecting devices."
This reverts commit 0ab81ef59f35d103ec8174834c4fc2a4dcced453. The workaround causes software devices not to appear in the list of available devices. Besides, since the crash is caused by a bug in older versions of Alsa, the workaround was probably a bad idea in the first place. People should update Alsa instead. Task-number: QTBUG-42326 Change-Id: I37923a87180d1c5abc18d52d84f633e14ba46860 Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
Diffstat (limited to 'src/gsttools')
-rw-r--r--src/gsttools/qgstreameraudioinputselector.cpp49
1 files changed, 23 insertions, 26 deletions
diff --git a/src/gsttools/qgstreameraudioinputselector.cpp b/src/gsttools/qgstreameraudioinputselector.cpp
index 31634f024..a0ced3367 100644
--- a/src/gsttools/qgstreameraudioinputselector.cpp
+++ b/src/gsttools/qgstreameraudioinputselector.cpp
@@ -111,36 +111,33 @@ void QGstreamerAudioInputSelector::updateAlsaDevices()
{
#ifdef HAVE_ALSA
void **hints, **n;
- int card = -1;
-
- while (snd_card_next(&card) == 0 && card >= 0) {
- if (snd_device_name_hint(card, "pcm", &hints) < 0)
- continue;
-
- n = hints;
- while (*n != NULL) {
- char *name = snd_device_name_get_hint(*n, "NAME");
- char *descr = snd_device_name_get_hint(*n, "DESC");
- char *io = snd_device_name_get_hint(*n, "IOID");
-
- if ((name != NULL) && (descr != NULL)) {
- if ( io == NULL || qstrcmp(io,"Input") == 0 ) {
- m_names.append(QLatin1String("alsa:")+QString::fromUtf8(name));
- m_descriptions.append(QString::fromUtf8(descr));
- }
- }
+ if (snd_device_name_hint(-1, "pcm", &hints) < 0) {
+ qWarning()<<"no alsa devices available";
+ return;
+ }
+ n = hints;
- if (name != NULL)
- free(name);
- if (descr != NULL)
- free(descr);
- if (io != NULL)
- free(io);
- ++n;
+ while (*n != NULL) {
+ char *name = snd_device_name_get_hint(*n, "NAME");
+ char *descr = snd_device_name_get_hint(*n, "DESC");
+ char *io = snd_device_name_get_hint(*n, "IOID");
+
+ if ((name != NULL) && (descr != NULL)) {
+ if ( io == NULL || qstrcmp(io,"Input") == 0 ) {
+ m_names.append(QLatin1String("alsa:")+QString::fromUtf8(name));
+ m_descriptions.append(QString::fromUtf8(descr));
+ }
}
- snd_device_name_free_hint(hints);
+ if (name != NULL)
+ free(name);
+ if (descr != NULL)
+ free(descr);
+ if (io != NULL)
+ free(io);
+ n++;
}
+ snd_device_name_free_hint(hints);
#endif
}