diff options
author | Christian Stromme <christian.stromme@theqtcompany.com> | 2016-04-19 14:53:24 +0200 |
---|---|---|
committer | Christian Stromme <christian.stromme@qt.io> | 2016-05-20 10:54:32 +0000 |
commit | 3c5bbb0dac7bed3199ddddc88c0175d5a2ac1036 (patch) | |
tree | 51b9987225bf224637b87c3dd20558a3cca95811 /src/plugins/alsa/qalsaplugin.h | |
parent | 49461f9cffa5439e536a844ec3a0134c252141e6 (diff) | |
download | qtmultimedia-3c5bbb0dac7bed3199ddddc88c0175d5a2ac1036.tar.gz |
Improve QAudioDeviceInfo::defaultDevice().
The previous implementation of QAudioDeviceInfo::defaultXDevice() would
always report the first available device as the "default" one, making
the order, in which devices were listed, a hidden requirement when
implementing audio plugins. To make it easier and more reliable to
retrieve the default device, all new plugins should implement the new
QAudioSystemPluginExtension interface as well as the QAudioSystemPlugin.
Devices will be chosen in the following order (first match wins):
default plugin -> default device
-> first available device
plugins -> default device
-> first available device
Task-number: QTBUG-51292
Change-Id: I8ace78858976fe7c60a2c4a117ef15c4e1bb177f
Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
Diffstat (limited to 'src/plugins/alsa/qalsaplugin.h')
-rw-r--r-- | src/plugins/alsa/qalsaplugin.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/plugins/alsa/qalsaplugin.h b/src/plugins/alsa/qalsaplugin.h index 74e3475b7..b3c530f88 100644 --- a/src/plugins/alsa/qalsaplugin.h +++ b/src/plugins/alsa/qalsaplugin.h @@ -41,19 +41,22 @@ #define QALSAPLUGIN_H #include <QtMultimedia/qaudiosystemplugin.h> +#include <QtMultimedia/private/qaudiosystempluginext_p.h> QT_BEGIN_NAMESPACE -class QAlsaPlugin : public QAudioSystemPlugin +class QAlsaPlugin : public QAudioSystemPlugin, public QAudioSystemPluginExtension { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.qt.audiosystemfactory/5.0" FILE "alsa.json") + Q_INTERFACES(QAudioSystemPluginExtension) public: QAlsaPlugin(QObject *parent = 0); ~QAlsaPlugin() {} + QByteArray defaultDevice(QAudio::Mode mode) const Q_DECL_OVERRIDE; QList<QByteArray> availableDevices(QAudio::Mode mode) const Q_DECL_OVERRIDE; QAbstractAudioInput *createInput(const QByteArray &device) Q_DECL_OVERRIDE; QAbstractAudioOutput *createOutput(const QByteArray &device) Q_DECL_OVERRIDE; |