QAudioBufferOutput Class

The QAudioBufferOutput class is used for capturing audio data provided by QMediaPlayer. More...

Header: #include <QAudioBufferOutput>
CMake: find_package(Qt6 REQUIRED COMPONENTS Multimedia)
target_link_libraries(mytarget PRIVATE Qt6::Multimedia)
qmake: QT += multimedia
Since: Qt 6.8
Inherits: QObject

Public Functions

QAudioBufferOutput(QObject *parent = nullptr)
QAudioBufferOutput(const QAudioFormat &format, QObject *parent = nullptr)
virtual ~QAudioBufferOutput() override
QAudioFormat format() const

Signals

void audioBufferReceived(const QAudioBuffer &buffer)

Detailed Description

QAudioBufferOutput can be set to QMediaPlayer in order to receive audio buffers decoded by the media player. The received audio data can be used for any processing or visualization.

QAudioBufferOutput is only supported with the FFmpeg backend.

See also QMediaPlayer, QMediaPlayer::setAudioBufferOutput, and QAudioBuffer.

Member Function Documentation

[explicit] QAudioBufferOutput::QAudioBufferOutput(QObject *parent = nullptr)

Constructs a new QAudioBufferOutput object with parent.

The audio format of output audio buffers will depend on the source media file and the inner audio decoder in QMediaPlayer.

[explicit] QAudioBufferOutput::QAudioBufferOutput(const QAudioFormat &format, QObject *parent = nullptr)

Constructs a new QAudioBufferOutput object with audio format and parent.

If the specified format is valid, it will be the format of output audio buffers. Otherwise, the format of output audio buffers will depend on the source media file and the inner audio decoder in QMediaPlayer.

[override virtual noexcept] QAudioBufferOutput::~QAudioBufferOutput()

Destroys the audio buffer output object.

[signal] void QAudioBufferOutput::audioBufferReceived(const QAudioBuffer &buffer)

Signals that a new audio buffer has been received from QMediaPlayer.

QAudioFormat QAudioBufferOutput::format() const

Gets the audio format specified in the constructor.

If the format is valid, it specifies the format of output oudio buffers.