W3cubDocs

/Qt

QVideoSink Class

The QVideoSink class represents a generic sink for video data. More...

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

Public Functions

QVideoSink(QObject *parent = nullptr)
virtual ~QVideoSink()
void setSubtitleText(const QString &subtitle)
void setVideoFrame(const QVideoFrame &frame)
QString subtitleText() const
QVideoFrame videoFrame() const
QSize videoSize() const

Detailed Description

The QVideoSink class can be used to retrieve video data on a frame by frame basis from Qt Multimedia.

QVideoSink can operate in two modes. In the first mode, it can render the video stream to a native window of the underlying windowing system. In the other mode, it will provide individual video frames to the application developer through the videoFrameChanged() signal.

The video frame can then be used to read out the data of those frames and handle them further. When using QPainter, the QVideoFrame can be drawing using the paint() method in QVideoSink.

QVideoFrame objects can consume a significant amount of memory or system resources and should thus not be held for longer than required by the application.

See also QMediaPlayer and QMediaCaptureSession.

Member Function Documentation

QVideoSink::QVideoSink(QObject *parent = nullptr)

Constructs a new QVideoSink object with parent.

[virtual] QVideoSink::~QVideoSink()

Destroys the object.

void QVideoSink::setSubtitleText(const QString &subtitle)

Sets the current subtitle text.

See also subtitleText().

void QVideoSink::setVideoFrame(const QVideoFrame &frame)

Sets the current video frame.

See also videoFrame().

QString QVideoSink::subtitleText() const

Returns the current subtitle text.

See also setSubtitleText().

QVideoFrame QVideoSink::videoFrame() const

Returns the current video frame.

See also setVideoFrame().

QSize QVideoSink::videoSize() const

Returns the size of the video currently being played back. If no video is being played, this method returns an invalid size.

© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-6.2/qvideosink.html