QVideoSink Class

QVideoSink 类表示视频数据的通用汇。更多

头文件: #include <QVideoSink>
CMake: find_package(Qt6 REQUIRED COMPONENTS Multimedia)
target_link_libraries(mytarget PRIVATE Qt6::Multimedia)
qmake: QT += multimedia
继承: QObject

属性

公共功能

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 时,可使用 QVideoSink 中的 paint() 方法绘制QVideoFrame

QVideoFrame 这些对象可能会消耗大量内存或系统资源,因此保留时间不应超过应用程序所需的时间。

另请参阅 QMediaPlayerQMediaCaptureSession

属性文档

subtitleText : QString

返回当前字幕文本。

访问功能:

QString subtitleText() const
void setSubtitleText(const QString &subtitle)

通知信号

void subtitleTextChanged(const QString &subtitleText) const

[read-only] videoSize : const QSize

返回当前正在播放的视频的大小。如果没有视频正在播放,此方法返回的大小无效。

访问功能:

QSize videoSize() const

Notifier 信号:

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 发生变化时发出信号。

© 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.