QAudioBufferOutput Class
QAudioBufferOutput 类用于捕获QMediaPlayer 提供的音频数据。更多
头文件: | #include <QAudioBufferOutput> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Multimedia) target_link_libraries(mytarget PRIVATE Qt6::Multimedia) |
qmake: | QT += multimedia |
自 | Qt 6.8 |
继承: | QObject |
公共函数
QAudioBufferOutput(QObject *parent = nullptr) | |
QAudioBufferOutput(const QAudioFormat &format, QObject *parent = nullptr) | |
virtual | ~QAudioBufferOutput() override |
QAudioFormat | format() const |
信号
void | audioBufferReceived(const QAudioBuffer &buffer) |
详细说明
QAudioBufferOutput 可设置为QMediaPlayer ,以便接收由媒体播放器解码的音频缓冲区。接收到的音频数据可用于任何处理或可视化。音频电平表的实现可参见基于小部件的媒体播放器示例。
QAudioBufferOutput 仅支持 FFmpeg 后端。
另请参见 QMediaPlayer,QMediaPlayer::setAudioBufferOutput, 和QAudioBuffer 。
成员函数文档
[explicit]
QAudioBufferOutput::QAudioBufferOutput(QObject *parent = nullptr)
用parent 构建一个新的 QAudioBufferOutput 对象。
输出音频缓冲区的音频格式取决于源媒体文件和QMediaPlayer 中的内部音频解码器。
[explicit]
QAudioBufferOutput::QAudioBufferOutput(const QAudioFormat &format, QObject *parent = nullptr)
使用音频format 和parent 构建一个新的 QAudioBufferOutput 对象。
如果指定的format 有效,它将成为输出音频缓冲区的格式。否则,输出音频缓冲区的格式将取决于源媒体文件和QMediaPlayer 中的内部音频解码器。
[override virtual noexcept]
QAudioBufferOutput::~QAudioBufferOutput()
销毁音频缓冲输出对象。
[signal]
void QAudioBufferOutput::audioBufferReceived(const QAudioBuffer &buffer)
QMediaPlayer 接收到新音频buffer 的信号。
QAudioFormat QAudioBufferOutput::format() const
获取构造函数中指定的音频格式。
如果格式有效,它将指定输出 oudio 缓冲区的格式。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.