diff options
author | Kurt Korbatits <kurt.korbatits@nokia.com> | 2009-10-21 04:29:34 (GMT) |
---|---|---|
committer | Kurt Korbatits <kurt.korbatits@nokia.com> | 2009-10-21 04:29:34 (GMT) |
commit | 0cb251e67ae45d8ab5ad715a4bc6dcf89209d2ab (patch) | |
tree | 2a51c970bf8c82a25a0be4490eac58447b853ab7 /src/multimedia/audio/qaudioinput_alsa_p.cpp | |
parent | dfd6221d960ec8c563a687684000c3a9c4f58079 (diff) | |
download | Qt-0cb251e67ae45d8ab5ad715a4bc6dcf89209d2ab.zip Qt-0cb251e67ae45d8ab5ad715a4bc6dcf89209d2ab.tar.gz Qt-0cb251e67ae45d8ab5ad715a4bc6dcf89209d2ab.tar.bz2 |
Fixed compile issue with alsa < 1.0.14
Support pre 1.0.14 alsa version.
Reviewed-by:Justin McPherson
Diffstat (limited to 'src/multimedia/audio/qaudioinput_alsa_p.cpp')
-rw-r--r-- | src/multimedia/audio/qaudioinput_alsa_p.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/multimedia/audio/qaudioinput_alsa_p.cpp b/src/multimedia/audio/qaudioinput_alsa_p.cpp index 5e9aa81..6786657 100644 --- a/src/multimedia/audio/qaudioinput_alsa_p.cpp +++ b/src/multimedia/audio/qaudioinput_alsa_p.cpp @@ -249,6 +249,7 @@ bool QAudioInputPrivate::open() QTime now(QTime::currentTime()); qDebug()<<now.second()<<"s "<<now.msec()<<"ms :open()"; #endif + clockStamp.restart(); timeStamp.restart(); elapsedTimeOffset = 0; @@ -259,9 +260,21 @@ bool QAudioInputPrivate::open() QString dev = QString(QLatin1String(m_device.constData())); if(!dev.contains(QLatin1String("default"))) { +#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) dev = QString(QLatin1String("default:CARD=%1")).arg(QLatin1String(m_device.constData())); - } +#else + int idx = 0; + char *name; + while(snd_card_get_name(idx,&name) == 0) { + if(m_device.contains(name)) + break; + idx++; + } + dev = QString(QLatin1String("hw:%1,0")).arg(idx); +#endif + } + // Step 1: try and open the device while((count < 5) && (err < 0)) { err=snd_pcm_open(&handle,dev.toLocal8Bit().constData(),SND_PCM_STREAM_CAPTURE,0); @@ -601,6 +614,7 @@ qint64 QAudioInputPrivate::clock() const if (deviceState == QAudio::StopState) return 0; +#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) snd_pcm_status_t* status; snd_pcm_status_alloca(&status); @@ -619,6 +633,9 @@ qint64 QAudioInputPrivate::clock() const return ((t1.tv_sec * 1000)+l/1000); } else return 0; +#else + return clockStamp.elapsed()*1000; +#endif } void QAudioInputPrivate::reset() |