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)
创建一个新的 QAudioBufferOutput 对象,其音频format 和parent 。
如果指定的format 有效,则它将成为输出音频缓冲区的格式。否则,输出音频缓冲区的格式将取决于源媒体文件以及QMediaPlayer 中的内部音频解码器。
[override virtual noexcept] QAudioBufferOutput::~QAudioBufferOutput()
销毁音频缓冲区输出对象。
[signal] void QAudioBufferOutput::audioBufferReceived(const QAudioBuffer &buffer)
表示已从QMediaPlayer 接收到了新的音频buffer 。
QAudioFormat QAudioBufferOutput::format() const
获取构造函数中指定的音频格式。
如果该格式有效,则它指定了输出音频缓冲区的格式。
© 2026 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.