1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | |
41 | #include "qaudiosystemplugin.h" |
42 | #include "qaudiosystempluginext_p.h" |
43 | |
44 | QT_BEGIN_NAMESPACE |
45 | |
46 | QAudioSystemFactoryInterface::~QAudioSystemFactoryInterface() |
47 | { |
48 | } |
49 | |
50 | QAudioSystemPluginExtension::~QAudioSystemPluginExtension() |
51 | { |
52 | } |
53 | |
54 | /*! |
55 | \class QAudioSystemPlugin |
56 | \brief The QAudioSystemPlugin class provides an abstract base for audio plugins. |
57 | |
58 | \ingroup multimedia |
59 | \ingroup multimedia_audio |
60 | \inmodule QtMultimedia |
61 | |
62 | Writing a audio plugin is achieved by subclassing this base class, |
63 | reimplementing the pure virtual functions availableDevices(), |
64 | createInput(), createOutput() and createDeviceInfo() then exporting |
65 | the class with the Q_PLUGIN_METADATA() macro. |
66 | |
67 | The json file containing the meta data should contain a list of keys |
68 | matching the plugin. Add "default" to your list of keys available |
69 | to override the default audio device to be provided by your plugin. |
70 | |
71 | \code |
72 | { "Keys": [ "default" ] } |
73 | \endcode |
74 | |
75 | Unit tests are available to help in debugging new plugins. |
76 | |
77 | \sa QAbstractAudioDeviceInfo, QAbstractAudioOutput, QAbstractAudioInput |
78 | |
79 | Qt comes with plugins for Windows (WinMM and WASAPI), Linux (ALSA and PulseAudio), \macos / iOS |
80 | (CoreAudio), Android (OpenSL ES) and QNX. |
81 | |
82 | If no audio plugins are available, a fallback dummy backend will be used. |
83 | This should print out warnings if this is the case when you try and use QAudioInput |
84 | or QAudioOutput. To fix this problem, make sure the dependencies for the Qt plugins are |
85 | installed on the system and reconfigure Qt (e.g. alsa-devel package on Linux), or create your |
86 | own plugin with a default key to always override the dummy fallback. The easiest way to |
87 | determine if you have only a dummy backend is to get a list of available audio devices. |
88 | |
89 | QAudioDeviceInfo::availableDevices(QAudio::AudioOutput).size() = 0 (dummy backend) |
90 | */ |
91 | |
92 | /*! |
93 | \fn QAudioSystemPlugin::QAudioSystemPlugin(QObject* parent) |
94 | |
95 | Constructs a new audio plugin with \a parent. |
96 | This is invoked automatically by the Q_PLUGIN_METADATA() macro. |
97 | */ |
98 | |
99 | QAudioSystemPlugin::QAudioSystemPlugin(QObject* parent) : |
100 | QObject(parent) |
101 | {} |
102 | |
103 | /*! |
104 | \fn QAudioSystemPlugin::~QAudioSystemPlugin() |
105 | |
106 | Destroys the audio plugin. |
107 | You never have to call this explicitly. Qt destroys a plugin automatically when it is no longer used. |
108 | */ |
109 | |
110 | QAudioSystemPlugin::~QAudioSystemPlugin() |
111 | {} |
112 | |
113 | /*! |
114 | \fn QList<QByteArray> QAudioSystemPlugin::availableDevices(QAudio::Mode mode) const |
115 | Returns a list of available audio devices for \a mode |
116 | */ |
117 | |
118 | /*! |
119 | \fn QAbstractAudioInput* QAudioSystemPlugin::createInput(const QByteArray& device) |
120 | Returns a pointer to a QAbstractAudioInput created using \a device identifier |
121 | */ |
122 | |
123 | /*! |
124 | \fn QAbstractAudioOutput* QAudioSystemPlugin::createOutput(const QByteArray& device) |
125 | Returns a pointer to a QAbstractAudioOutput created using \a device identifier |
126 | |
127 | */ |
128 | |
129 | /*! |
130 | \fn QAbstractAudioDeviceInfo* QAudioSystemPlugin::createDeviceInfo(const QByteArray& device, QAudio::Mode mode) |
131 | Returns a pointer to a QAbstractAudioDeviceInfo created using \a device and \a mode |
132 | |
133 | */ |
134 | |
135 | |
136 | QT_END_NAMESPACE |
137 | |
138 | #include "moc_qaudiosystemplugin.cpp" |
139 | |