QVideoSink Class
QVideoSink 类表示一个通用的视频数据接收器。更多内容...
| 头文件: | #include <QVideoSink> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Multimedia) target_link_libraries(mytarget PRIVATE Qt6::Multimedia) |
| qmake: | QT += multimedia |
| 继承自: | QObject |
属性
- subtitleText : QString
- videoSize : QSize
公共函数
| QVideoSink(QObject *parent = nullptr) | |
| virtual | ~QVideoSink() override |
| QRhi * | rhi() const |
| void | setSubtitleText(const QString &subtitle) |
| void | setVideoFrame(const QVideoFrame &frame) |
| QString | subtitleText() const |
| QVideoFrame | videoFrame() const |
| QSize | videoSize() const |
信号
| void | subtitleTextChanged(const QString &subtitleText) const |
| void | videoFrameChanged(const QVideoFrame &frame) const |
| void | videoSizeChanged() |
详细说明
QVideoSink 类可用于从Qt Multimedia 逐帧地获取视频数据。
QVideoSink 将通过videoFrameChanged() 信号向应用程序开发人员提供单个视频帧。
然后,视频帧可用于读取这些帧的数据并进行进一步处理。使用QPainter 时,QVideoFrame 可以使用paint()方法进行绘制。
QVideoFrame 这些对象可能会消耗大量内存或系统资源,因此不应保留的时间超过应用程序所需。
另请参阅 QMediaPlayer 和QMediaCaptureSession 。
属性文档
subtitleText : QString
返回当前的字幕文本。
访问函数:
| QString | subtitleText() const |
| void | setSubtitleText(const QString &subtitle) |
通知信号:
| void | subtitleTextChanged(const QString &subtitleText) const |
[read-only] videoSize : QSize
返回当前正在播放的视频的大小。如果没有视频正在播放,则此方法将返回一个无效的大小。
访问函数:
| QSize | videoSize() const |
通知信号:
| void | videoSizeChanged() |
成员函数文档
QVideoSink::QVideoSink(QObject *parent = nullptr)
使用parent 创建一个新的QVideoSink对象。
[override virtual noexcept] QVideoSink::~QVideoSink()
销毁该对象。
QRhi *QVideoSink::rhi() const
返回用于在视频帧中创建纹理数据的QRhi 实例。
void QVideoSink::setSubtitleText(const QString &subtitle)
设置当前subtitle 的文本。
注意: 这是属性subtitleText 的设置 函数。
另请参阅 subtitleText()。
void QVideoSink::setVideoFrame(const QVideoFrame &frame)
设置当前视频的frame 。
注意:此函数是线程安全的。
另请参阅 videoFrame()。
QVideoFrame QVideoSink::videoFrame() const
返回当前视频帧。
注意:此函数是线程安全的。
另请参阅 setVideoFrame()。
[signal] void QVideoSink::videoFrameChanged(const QVideoFrame &frame) const
当视频frame 发生变化时发出信号。
© 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.