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#include "qmediacontrol_p.h"
41#include "qaudiodecodercontrol.h"
42
43QT_BEGIN_NAMESPACE
44
45
46/*!
47 \class QAudioDecoderControl
48 \obsolete
49 \inmodule QtMultimedia
50
51
52 \ingroup multimedia_control
53
54 \brief The QAudioDecoderControl class provides access to the audio decoding
55 functionality of a QMediaService.
56
57 \preliminary
58
59 The functionality provided by this control is exposed to application
60 code through the QAudioDecoder class.
61
62 The interface name of QAudioDecoderControl is \c org.qt-project.qt.audiodecodercontrol/5.0 as
63 defined in QAudioDecoderControl_iid.
64
65 \sa QMediaService::requestControl(), QAudioDecoder
66*/
67
68/*!
69 \macro QAudioDecoderControl_iid
70
71 \c org.qt-project.qt.audiodecodercontrol/5.0
72
73 Defines the interface name of the QAudioDecoderControl class.
74
75 \relates QAudioDecoderControl
76*/
77
78/*!
79 Destroys an audio decoder control.
80*/
81QAudioDecoderControl::~QAudioDecoderControl()
82{
83}
84
85/*!
86 Constructs a new audio decoder control with the given \a parent.
87*/
88QAudioDecoderControl::QAudioDecoderControl(QObject *parent):
89 QMediaControl(*new QMediaControlPrivate, parent)
90{
91}
92
93/*!
94 \fn QAudioDecoderControl::state() const
95
96 Returns the state of a player control.
97*/
98
99/*!
100 \fn QAudioDecoderControl::stateChanged(QAudioDecoder::State newState)
101
102 Signals that the state of a player control has changed to \a newState.
103
104 \sa state()
105*/
106
107/*!
108 \fn QAudioDecoderControl::sourceFilename() const
109
110 Returns the current media source filename, or a null QString if none (or a device)
111*/
112
113/*!
114 \fn QAudioDecoderControl::setSourceFilename(const QString &fileName)
115
116 Sets the current source to \a fileName. Changing the source will
117 stop any current decoding and discard any buffers.
118
119 Sources are exclusive, so only one can be set.
120*/
121
122/*!
123 \fn QAudioDecoderControl::sourceDevice() const
124
125 Returns the current media source QIODevice, or 0 if none (or a file).
126*/
127
128/*!
129 \fn QAudioDecoderControl::setSourceDevice(QIODevice *device)
130
131 Sets the current source to \a device. Changing the source will
132 stop any current decoding and discard any buffers.
133
134 Sources are exclusive, so only one can be set.
135*/
136
137/*!
138 \fn QAudioDecoderControl::start()
139
140 Starts decoding the current media.
141
142 If successful the player control will immediately enter the \l {QAudioDecoder::DecodingState}
143 {decoding} state.
144
145 \sa state(), read()
146*/
147
148/*!
149 \fn QAudioDecoderControl::stop()
150
151 Stops playback of the current media and discards any buffers.
152
153 If successful the player control will immediately enter the \l {QAudioDecoder::StoppedState}
154 {stopped} state.
155*/
156
157/*!
158 \fn QAudioDecoderControl::error(int error, const QString &errorString)
159
160 Signals that an \a error has occurred. The \a errorString provides a more detailed explanation.
161*/
162
163/*!
164 \fn QAudioDecoderControl::bufferAvailableChanged(bool available)
165
166 Signals that the bufferAvailable property has changed to \a available.
167*/
168
169/*!
170 \fn QAudioDecoderControl::bufferReady()
171
172 Signals that a new buffer is ready for reading.
173*/
174
175/*!
176 \fn QAudioDecoderControl::bufferAvailable() const
177
178 Returns true if a buffer is available to be read,
179 and false otherwise.
180*/
181
182/*!
183 \fn QAudioDecoderControl::sourceChanged()
184
185 Signals that the current source of the decoder has changed.
186
187 \sa sourceFilename(), sourceDevice()
188*/
189
190/*!
191 \fn QAudioDecoderControl::formatChanged(const QAudioFormat &format)
192
193 Signals that the current audio format of the decoder has changed to \a format.
194
195 \sa audioFormat(), setAudioFormat()
196*/
197
198/*!
199 \fn void QAudioDecoderControl::finished()
200
201 Signals that the decoding has finished successfully.
202 If decoding fails, error signal is emitted instead.
203
204 \sa start(), stop(), error()
205*/
206
207/*!
208 \fn void QAudioDecoderControl::positionChanged(qint64 position)
209
210 Signals that the current \a position of the decoder has changed.
211
212 \sa durationChanged()
213*/
214
215/*!
216 \fn void QAudioDecoderControl::durationChanged(qint64 duration)
217
218 Signals that the estimated \a duration of the decoded data has changed.
219
220 \sa positionChanged()
221*/
222
223/*!
224 \fn QAudioDecoderControl::audioFormat() const
225 Returns the current audio format of the decoded stream.
226
227 Any buffers returned should have this format.
228
229 \sa setAudioFormat(), formatChanged()
230*/
231
232/*!
233 \fn QAudioDecoderControl::setAudioFormat(const QAudioFormat &format)
234 Set the desired audio format for decoded samples to \a format.
235
236 If the decoder does not support this format, \l error() will
237 be set to \c FormatError.
238
239 If you do not specify a format, the format of the decoded
240 audio itself will be used. Otherwise, some format conversion
241 will be applied.
242
243 If you wish to reset the decoded format to that of the original
244 audio file, you can specify an invalid \a format.
245*/
246
247/*!
248 \fn QAudioDecoderControl::read()
249 Attempts to read a buffer from the decoder, without blocking. Returns invalid buffer if there are
250 no decoded buffers available, or on error.
251*/
252
253/*!
254 \fn QAudioDecoderControl::position() const
255 Returns position (in milliseconds) of the last buffer read from
256 the decoder or -1 if no buffers have been read.
257*/
258
259/*!
260 \fn QAudioDecoderControl::duration() const
261 Returns total duration (in milliseconds) of the audio stream
262 or -1 if not available.
263*/
264
265QT_END_NAMESPACE
266
267#include "moc_qaudiodecodercontrol.cpp"
268

source code of qtmultimedia/src/multimedia/controls/qaudiodecodercontrol.cpp