src/multimedia/audio/qaudiodevicefactory.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
child 7 f7bc934e204c
--- a/src/multimedia/audio/qaudiodevicefactory.cpp	Tue Jan 26 12:42:25 2010 +0200
+++ b/src/multimedia/audio/qaudiodevicefactory.cpp	Tue Feb 02 00:43:10 2010 +0200
@@ -45,6 +45,7 @@
 #include <private/qfactoryloader_p.h>
 #include "qaudiodevicefactory_p.h"
 
+#ifndef QT_NO_AUDIO_BACKEND
 #if defined(Q_OS_WIN)
 #include "qaudiodeviceinfo_win32_p.h"
 #include "qaudiooutput_win32_p.h"
@@ -58,6 +59,7 @@
 #include "qaudiooutput_alsa_p.h"
 #include "qaudioinput_alsa_p.h"
 #endif
+#endif
 
 QT_BEGIN_NAMESPACE
 
@@ -94,10 +96,10 @@
     int bufferSize() const  { return 0; }
     void setNotifyInterval(int ) {}
     int notifyInterval() const { return 0; }
-    qint64 totalTime() const { return 0; }
-    qint64 clock() const { return 0; }
+    qint64 processedUSecs() const { return 0; }
+    qint64 elapsedUSecs() const { return 0; }
     QAudio::Error error() const { return QAudio::OpenError; }
-    QAudio::State state() const { return QAudio::StopState; }
+    QAudio::State state() const { return QAudio::StoppedState; }
     QAudioFormat format() const { return QAudioFormat(); }
 };
 
@@ -115,26 +117,28 @@
     int bufferSize() const  { return 0; }
     void setNotifyInterval(int ) {}
     int notifyInterval() const { return 0; }
-    qint64 totalTime() const { return 0; }
-    qint64 clock() const { return 0; }
+    qint64 processedUSecs() const { return 0; }
+    qint64 elapsedUSecs() const { return 0; }
     QAudio::Error error() const { return QAudio::OpenError; }
-    QAudio::State state() const { return QAudio::StopState; }
+    QAudio::State state() const { return QAudio::StoppedState; }
     QAudioFormat format() const { return QAudioFormat(); }
 };
 
-QList<QAudioDeviceInfo> QAudioDeviceFactory::deviceList(QAudio::Mode mode)
+QList<QAudioDeviceInfo> QAudioDeviceFactory::availableDevices(QAudio::Mode mode)
 {
     QList<QAudioDeviceInfo> devices;
+#ifndef QT_NO_AUDIO_BACKEND
 #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
-    foreach (const QByteArray &handle, QAudioDeviceInfoInternal::deviceList(mode))
+    foreach (const QByteArray &handle, QAudioDeviceInfoInternal::availableDevices(mode))
         devices << QAudioDeviceInfo(QLatin1String("builtin"), handle, mode);
 #endif
+#endif
     QFactoryLoader* l = loader();
 
     foreach (QString const& key, l->keys()) {
         QAudioEngineFactoryInterface* plugin = qobject_cast<QAudioEngineFactoryInterface*>(l->instance(key));
         if (plugin) {
-            foreach (QByteArray const& handle, plugin->deviceList(mode))
+            foreach (QByteArray const& handle, plugin->availableDevices(mode))
                 devices << QAudioDeviceInfo(key, handle, mode);
         }
 
@@ -149,13 +153,15 @@
     QAudioEngineFactoryInterface* plugin = qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(QLatin1String("default")));
 
     if (plugin) {
-        QList<QByteArray> list = plugin->deviceList(QAudio::AudioInput);
+        QList<QByteArray> list = plugin->availableDevices(QAudio::AudioInput);
         if (list.size() > 0)
             return QAudioDeviceInfo(QLatin1String("default"), list.at(0), QAudio::AudioInput);
     }
+#ifndef QT_NO_AUDIO_BACKEND
 #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
     return QAudioDeviceInfo(QLatin1String("builtin"), QAudioDeviceInfoInternal::defaultInputDevice(), QAudio::AudioInput);
 #endif
+#endif
     return QAudioDeviceInfo();
 }
 
@@ -164,13 +170,15 @@
     QAudioEngineFactoryInterface* plugin = qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(QLatin1String("default")));
 
     if (plugin) {
-        QList<QByteArray> list = plugin->deviceList(QAudio::AudioOutput);
+        QList<QByteArray> list = plugin->availableDevices(QAudio::AudioOutput);
         if (list.size() > 0)
             return QAudioDeviceInfo(QLatin1String("default"), list.at(0), QAudio::AudioOutput);
     }
+#ifndef QT_NO_AUDIO_BACKEND
 #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
     return QAudioDeviceInfo(QLatin1String("builtin"), QAudioDeviceInfoInternal::defaultOutputDevice(), QAudio::AudioOutput);
 #endif
+#endif
     return QAudioDeviceInfo();
 }
 
@@ -178,10 +186,12 @@
 {
     QAbstractAudioDeviceInfo *rc = 0;
 
+#ifndef QT_NO_AUDIO_BACKEND
 #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
     if (realm == QLatin1String("builtin"))
         return new QAudioDeviceInfoInternal(handle, mode);
 #endif
+#endif
     QAudioEngineFactoryInterface* plugin =
         qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(realm));
 
@@ -205,10 +215,12 @@
 {
     if (deviceInfo.isNull())
         return new QNullInputDevice();
+#ifndef QT_NO_AUDIO_BACKEND
 #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
     if (deviceInfo.realm() == QLatin1String("builtin"))
         return new QAudioInputPrivate(deviceInfo.handle(), format);
 #endif
+#endif
     QAudioEngineFactoryInterface* plugin =
         qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(deviceInfo.realm()));
 
@@ -222,10 +234,12 @@
 {
     if (deviceInfo.isNull())
         return new QNullOutputDevice();
+#ifndef QT_NO_AUDIO_BACKEND
 #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
     if (deviceInfo.realm() == QLatin1String("builtin"))
         return new QAudioOutputPrivate(deviceInfo.handle(), format);
 #endif
+#endif
     QAudioEngineFactoryInterface* plugin =
         qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(deviceInfo.realm()));