diff options
author | Thomas Zander <t.zander@nokia.com> | 2010-10-06 12:32:43 (GMT) |
---|---|---|
committer | Thomas Zander <t.zander@nokia.com> | 2010-10-06 12:32:43 (GMT) |
commit | e3724aeab93a2ab3cc5b1d78c42f9a4e2f60628d (patch) | |
tree | 08fa39a9605ec38a45247baea0e2053179f5970f /src/multimedia/audio/qaudiooutput_alsa_p.cpp | |
parent | 838ed9c68aef4d5a4f0b4d4dbbc1c1f7797cde91 (diff) | |
parent | 901ea45ca02dc8fbbf3f6112240c4e468c240b73 (diff) | |
download | Qt-e3724aeab93a2ab3cc5b1d78c42f9a4e2f60628d.zip Qt-e3724aeab93a2ab3cc5b1d78c42f9a4e2f60628d.tar.gz Qt-e3724aeab93a2ab3cc5b1d78c42f9a4e2f60628d.tar.bz2 |
Merge commit 'origin/master' into fileEngines
Conflicts:
src/s60installs/bwins/QtCoreu.def
Diffstat (limited to 'src/multimedia/audio/qaudiooutput_alsa_p.cpp')
-rw-r--r-- | src/multimedia/audio/qaudiooutput_alsa_p.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.cpp b/src/multimedia/audio/qaudiooutput_alsa_p.cpp index 49b32c0..ecf3215 100644 --- a/src/multimedia/audio/qaudiooutput_alsa_p.cpp +++ b/src/multimedia/audio/qaudiooutput_alsa_p.cpp @@ -155,7 +155,7 @@ int QAudioOutputPrivate::xrun_recovery(int err) int QAudioOutputPrivate::setFormat() { - snd_pcm_format_t pcmformat = SND_PCM_FORMAT_S16; + snd_pcm_format_t pcmformat = SND_PCM_FORMAT_UNKNOWN; if(settings.sampleSize() == 8) { pcmformat = SND_PCM_FORMAT_U8; @@ -208,7 +208,9 @@ int QAudioOutputPrivate::setFormat() pcmformat = SND_PCM_FORMAT_FLOAT64_BE; } - return snd_pcm_hw_params_set_format( handle, hwparams, pcmformat); + return pcmformat != SND_PCM_FORMAT_UNKNOWN + ? snd_pcm_hw_params_set_format( handle, hwparams, pcmformat) + : -1; } QIODevice* QAudioOutputPrivate::start(QIODevice* device) @@ -275,10 +277,25 @@ bool QAudioOutputPrivate::open() elapsedTimeOffset = 0; int dir; - int err=-1; + int err = 0; int count=0; unsigned int freakuency=settings.frequency(); + if (!settings.isValid()) { + qWarning("QAudioOutput: open error, invalid format."); + } else if (settings.frequency() <= 0) { + qWarning("QAudioOutput: open error, invalid sample rate (%d).", + settings.frequency()); + } else { + err = -1; + } + + if (err == 0) { + errorState = QAudio::OpenError; + deviceState = QAudio::StoppedState; + return false; + } + QString dev = QString(QLatin1String(m_device.constData())); QList<QByteArray> devices = QAudioDeviceInfoInternal::availableDevices(QAudio::AudioOutput); if(dev.compare(QLatin1String("default")) == 0) { |