Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qaudiobufferoutput.cpp
Go to the documentation of this file.
1
// Copyright (C) 2024 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4
#
include
"qaudiobufferoutput_p.h"
5
#
include
"qmediaplayer.h"
6
#
include
"qaudiobuffer.h"
7
8
QT_BEGIN_NAMESPACE
9
10
/*!
11
\class QAudioBufferOutput
12
\inmodule QtMultimedia
13
\ingroup multimedia
14
\ingroup multimedia_audio
15
\since 6.8
16
17
\brief The QAudioBufferOutput class is used for capturing audio data provided by \l QMediaPlayer.
18
19
QAudioBufferOutput can be set to QMediaPlayer in order to receive audio buffers
20
decoded by the media player. The received audio data can be used for any
21
processing or visualization. An audio level meter implementation can be seen
22
in the widget based \l{Media Player Example}.
23
24
QAudioBufferOutput is only supported with the FFmpeg backend.
25
26
\sa QMediaPlayer, QMediaPlayer::setAudioBufferOutput, QAudioBuffer
27
*/
28
29
/*!
30
Constructs a new QAudioBufferOutput object with \a parent.
31
32
The audio format of output audio buffers will depend on
33
the source media file and the inner audio decoder in \l QMediaPlayer.
34
*/
35
QAudioBufferOutput::QAudioBufferOutput(QObject *parent)
36
: QObject(*
new
QAudioBufferOutputPrivate, parent)
37
{
38
}
39
40
/*!
41
Constructs a new QAudioBufferOutput object with audio \a format and \a parent.
42
43
If the specified \a format is valid, it will be the format of output
44
audio buffers. Otherwise, the format of output audio buffers
45
will depend on the source media file and the inner audio decoder in \l QMediaPlayer.
46
*/
47
QAudioBufferOutput::QAudioBufferOutput(
const
QAudioFormat &format, QObject *parent)
48
: QObject(*
new
QAudioBufferOutputPrivate(format), parent)
49
{
50
}
51
52
/*!
53
Destroys the audio buffer output object.
54
*/
55
QAudioBufferOutput::~QAudioBufferOutput()
56
{
57
Q_D(QAudioBufferOutput);
58
59
if
(d->mediaPlayer)
60
d->mediaPlayer->setAudioBufferOutput(
nullptr
);
61
}
62
63
/*!
64
Gets the audio format specified in the constructor.
65
66
If the format is valid, it specifies the format of output oudio buffers.
67
*/
68
QAudioFormat QAudioBufferOutput::format()
const
69
{
70
Q_D(
const
QAudioBufferOutput);
71
return
d->format;
72
}
73
74
/*!
75
\fn void QAudioBufferOutput::audioBufferReceived(const QAudioBuffer &buffer)
76
77
Signals that a new audio \a buffer has been received from \l QMediaPlayer.
78
*/
79
80
QT_END_NAMESPACE
81
82
#
include
"moc_qaudiobufferoutput.cpp"
QPlatformGraphicsBufferHelper
\inmodule QtGui
qtmultimedia
src
multimedia
audio
qaudiobufferoutput.cpp
Generated on
for Qt by
1.14.0