Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QVideoFrame Class Reference

The QVideoFrame class represents a frame of video data. More...

#include <qvideoframe.h>

+ Collaboration diagram for QVideoFrame:

Classes

struct  PaintOptions
 

Public Types

enum  HandleType { NoHandle , RhiTextureHandle }
 Identifies the type of a video buffers handle. More...
 
enum  MapMode { Q_DECL_ENUMERATOR_DEPRECATED_X , Q_DECL_ENUMERATOR_DEPRECATED_X , Q_DECL_ENUMERATOR_DEPRECATED_X , Q_DECL_ENUMERATOR_DEPRECATED_X }
 

Public Member Functions

 QVideoFrame ()
 Constructs a null video frame.
 
 QVideoFrame (const QVideoFrameFormat &format)
 Constructs a video frame of the given pixel format.
 
 QVideoFrame (const QImage &image)
 Constructs a QVideoFrame from a QImage.
 
 QVideoFrame (std::unique_ptr< QAbstractVideoBuffer > videoBuffer)
 Constructs a QVideoFrame from a \l QAbstractVideoBuffer.
 
 QVideoFrame (const QVideoFrame &other)
 Constructs a shallow copy of other.
 
 ~QVideoFrame ()
 Destroys a video frame.
 
 QVideoFrame (QVideoFrame &&other) noexcept=default
 Constructs a QVideoFrame by moving from other.
 
void swap (QVideoFrame &other) noexcept
 Swaps the current video frame with other.
 
QVideoFrameoperator= (const QVideoFrame &other)
 Moves other into this QVideoFrame.
 
bool operator== (const QVideoFrame &other) const
 
bool operator!= (const QVideoFrame &other) const
 
bool isValid () const
 Identifies whether a video frame is valid.
 
QVideoFrameFormat::PixelFormat pixelFormat () const
 Returns the pixel format of this video frame.
 
QVideoFrameFormat surfaceFormat () const
 Returns the surface format of this video frame.
 
QVideoFrame::HandleType handleType () const
 Returns the type of a video frame's handle.
 
QSize size () const
 Returns the dimensions of a video frame.
 
int width () const
 Returns the width of a video frame.
 
int height () const
 Returns the height of a video frame.
 
bool isMapped () const
 Identifies if a video frame's contents are currently mapped to system memory.
 
bool isReadable () const
 Identifies if the mapped contents of a video frame were read from the frame when it was mapped.
 
bool isWritable () const
 Identifies if the mapped contents of a video frame will be persisted when the frame is unmapped.
 
QVideoFrame::MapMode mapMode () const
 Returns the mode a video frame was mapped to system memory in.
 
bool map (QtVideo::MapMode mode)
 Maps the contents of a video frame to system (CPU addressable) memory.
 
void unmap ()
 Releases the memory mapped by the map() function.
 
int bytesPerLine (int plane) const
 Returns the number of bytes in a scan line of a plane.
 
ucharbits (int plane)
 Returns a pointer to the start of the frame data buffer for a plane.
 
const ucharbits (int plane) const
 Returns a pointer to the start of the frame data buffer for a plane.
 
int mappedBytes (int plane) const
 Returns the number of bytes occupied by plane plane of the mapped frame data.
 
int planeCount () const
 Returns the number of planes in the video frame.
 
qint64 startTime () const
 Returns the presentation time (in microseconds) when the frame should be displayed.
 
void setStartTime (qint64 time)
 Sets the presentation time (in microseconds) when the frame should initially be displayed.
 
qint64 endTime () const
 Returns the presentation time (in microseconds) when a frame should stop being displayed.
 
void setEndTime (qint64 time)
 Sets the presentation time (in microseconds) when a frame should stop being displayed.
 
void setRotation (QtVideo::Rotation angle)
 Sets the angle the frame should be rotated clockwise before displaying.
 
QtVideo::Rotation rotation () const
 Returns the angle the frame should be rotated clockwise before displaying.
 
void setMirrored (bool)
 Sets the mirrored flag for the frame and sets the flag to the underlying \l surfaceFormat.
 
bool mirrored () const
 Returns whether the frame should be mirrored before displaying.
 
void setStreamFrameRate (qreal rate)
 Sets the frame rate of a video stream in frames per second.
 
qreal streamFrameRate () const
 Returns the frame rate of a video stream in frames per second.
 
QImage toImage () const
 Based on the pixel format converts current video frame to image.
 
QString subtitleText () const
 Returns the subtitle text that should be rendered together with this video frame.
 
void setSubtitleText (const QString &text)
 Sets the subtitle text that should be rendered together with this video frame to text.
 
void paint (QPainter *painter, const QRectF &rect, const PaintOptions &options)
 Uses a QPainter, {painter}, to render this QVideoFrame to rect.
 

Friends

class QVideoFramePrivate
 

Detailed Description

The QVideoFrame class represents a frame of video data.

\inmodule QtMultimedia

A QVideoFrame encapsulates the pixel data of a video frame, and information about the frame.

Video frames can come from several places - decoded \l {QMediaPlayer}{media}, a \l {QCamera}{camera}, or generated programmatically. The way pixels are described in these frames can vary greatly, and some pixel formats offer greater compression opportunities at the expense of ease of use.

The pixel contents of a video frame can be mapped to memory using the map() function. After a successful call to map(), the video data can be accessed through various functions. Some of the YUV pixel formats provide the data in several planes. The planeCount() method will return the amount of planes that being used.

While mapped, the video data of each plane can accessed using the bits() function, which returns a pointer to a buffer. The size of this buffer is given by the mappedBytes() function, and the size of each line is given by bytesPerLine(). The return value of the handle() function may also be used to access frame data using the internal buffer's native APIs (for example - an OpenGL texture handle).

A video frame can also have timestamp information associated with it. These timestamps can be used to determine when to start and stop displaying the frame.

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

Note
Since video frames can be expensive to copy, QVideoFrame is explicitly shared, so any change made to a video frame will also apply to any copies.
See also
QAbstractVideoBuffer, QVideoFrameFormat, QtVideo::MapMode

Definition at line 26 of file qvideoframe.h.

Member Enumeration Documentation

◆ HandleType

Identifies the type of a video buffers handle.

\value NoHandle The buffer has no handle, its data can only be accessed by mapping the buffer. \value RhiTextureHandle The handle of the buffer is defined by The Qt Rendering Hardware Interface (RHI). RHI is Qt's internal graphics abstraction for 3D APIs, such as OpenGL, Vulkan, Metal, and Direct 3D.

See also
handleType()
Enumerator
NoHandle 
RhiTextureHandle 

Definition at line 30 of file qvideoframe.h.

◆ MapMode

Enumerator
Q_DECL_ENUMERATOR_DEPRECATED_X 
Q_DECL_ENUMERATOR_DEPRECATED_X 
Q_DECL_ENUMERATOR_DEPRECATED_X 
Q_DECL_ENUMERATOR_DEPRECATED_X 

Definition at line 36 of file qvideoframe.h.

Constructor & Destructor Documentation

◆ QVideoFrame() [1/6]

QVideoFrame::QVideoFrame ( )

Constructs a null video frame.

Definition at line 84 of file qvideoframe.cpp.

◆ QVideoFrame() [2/6]

QVideoFrame::QVideoFrame ( const QVideoFrameFormat & format)

Constructs a video frame of the given pixel format.

Definition at line 115 of file qvideoframe.cpp.

References QVideoTextureHelper::TextureDescription::bytesForSize(), QByteArray::resize(), QVideoTextureHelper::TextureDescription::strideForWidth(), QVideoTextureHelper::textureDescription(), and QVideoFramePrivate::videoBuffer.

+ Here is the call graph for this function:

◆ QVideoFrame() [3/6]

QVideoFrame::QVideoFrame ( const QImage & image)
explicit

Constructs a QVideoFrame from a QImage.

Since
6.8

If the QImage::Format matches one of the formats in QVideoFrameFormat::PixelFormat, the QVideoFrame will hold an instance of the image and use that format without any pixel format conversion. In this case, pixel data will be copied only if you call \l{QVideoFrame::map} with WriteOnly flag while keeping the original image.

Otherwise, if the QImage::Format matches none of video formats, the image is first converted to a supported (A)RGB format using QImage::convertedTo() with the Qt::AutoColor flag. This may incur a performance penalty.

If QImage::isNull() evaluates to true for the input QImage, the QVideoFrame will be invalid and QVideoFrameFormat::isValid() will return false.

See also
QVideoFrameFormat::pixelFormatFromImageFormat()
QImage::convertedTo()
QImage::isNull()

Definition at line 154 of file qvideoframe.cpp.

References QVideoFrameFormat::pixelFormatFromImageFormat(), and Q_ASSERT.

+ Here is the call graph for this function:

◆ QVideoFrame() [4/6]

QVideoFrame::QVideoFrame ( std::unique_ptr< QAbstractVideoBuffer > videoBuffer)
explicit

Constructs a QVideoFrame from a \l QAbstractVideoBuffer.

Since
6.8

The specified videoBuffer refers to an instance a reimplemented \l QAbstractVideoBuffer. The instance is expected to contain a preallocated custom video buffer and must implement \l QAbstractVideoBuffer::format, \l QAbstractVideoBuffer::map, and \l QAbstractVideoBuffer::unmap for GPU content.

If videoBuffer is null or gets an invalid \l QVideoFrameFormat, the constructors creates an invalid video frame.

The created frame will hold ownership of the specified video buffer for its lifetime. Considering that QVideoFrame is implemented via a shared private object, the specified video buffer will be destroyed upon destruction of the last copy of the created video frame.

Note, if a video frame has been passed to \l QMediaRecorder or a rendering pipeline, the lifetime of the frame is undefined, and the media recorder can destroy it in a different thread.

QVideoFrame will contain own instance of QVideoFrameFormat. Upon invoking \l setStreamFrameRate, \l setMirrored, or \l setRotation, the inner format can be modified, and \l surfaceFormat will return a detached instance.

See also
QAbstractVideoBuffer, QVideoFrameFormat

Definition at line 205 of file qvideoframe.cpp.

◆ QVideoFrame() [5/6]

QVideoFrame::QVideoFrame ( const QVideoFrame & other)
default

Constructs a shallow copy of other.

Since QVideoFrame is explicitly shared, these two instances will reflect the same frame.

◆ ~QVideoFrame()

QVideoFrame::~QVideoFrame ( )
default

Destroys a video frame.

◆ QVideoFrame() [6/6]

QVideoFrame::QVideoFrame ( QVideoFrame && other)
defaultnoexcept

Constructs a QVideoFrame by moving from other.

Member Function Documentation

◆ bits() [1/2]

uchar * QVideoFrame::bits ( int plane)

Returns a pointer to the start of the frame data buffer for a plane.

This value is only valid while the frame data is \l {map()}{mapped}.

Changes made to data accessed via this pointer (when mapped with write access) are only guaranteed to have been persisted when unmap() is called and when the buffer has been mapped for writing.

See also
map(), mappedBytes(), bytesPerLine(), planeCount()
Since
5.4

Definition at line 672 of file qvideoframe.cpp.

References QAbstractVideoBuffer::MapData::data, QVideoFramePrivate::mapData, and QAbstractVideoBuffer::MapData::planeCount.

Referenced by QSGVivanteVideoMaterial::vivanteMapping().

+ Here is the caller graph for this function:

◆ bits() [2/2]

const uchar * QVideoFrame::bits ( int plane) const

Returns a pointer to the start of the frame data buffer for a plane.

This value is only valid while the frame data is \l {map()}{mapped}.

If the buffer was not mapped with read access, the contents of this buffer will initially be uninitialized.

See also
map(), mappedBytes(), bytesPerLine(), planeCount()
Since
5.4

Definition at line 690 of file qvideoframe.cpp.

References QAbstractVideoBuffer::MapData::data, QVideoFramePrivate::mapData, and QAbstractVideoBuffer::MapData::planeCount.

◆ bytesPerLine()

int QVideoFrame::bytesPerLine ( int plane) const

Returns the number of bytes in a scan line of a plane.

This value is only valid while the frame data is \l {map()}{mapped}.

See also
bits(), map(), mappedBytes(), planeCount()
Since
5.4

Definition at line 653 of file qvideoframe.cpp.

References QAbstractVideoBuffer::MapData::bytesPerLine, QVideoFramePrivate::mapData, and QAbstractVideoBuffer::MapData::planeCount.

Referenced by QSGVivanteVideoMaterial::vivanteMapping().

+ Here is the caller graph for this function:

◆ endTime()

qint64 QVideoFrame::endTime ( ) const

Returns the presentation time (in microseconds) when a frame should stop being displayed.

An invalid time is represented as -1.

Definition at line 757 of file qvideoframe.cpp.

References QVideoFramePrivate::endTime.

◆ handleType()

QVideoFrame::HandleType QVideoFrame::handleType ( ) const

Returns the type of a video frame's handle.

The handle type could either be NoHandle, meaning that the frame is memory based, or a RHI texture.

Definition at line 305 of file qvideoframe.cpp.

References QHwVideoBuffer::handleType(), QVideoFramePrivate::hwVideoBuffer, and NoHandle.

Referenced by QQuickVideoOutput::updatePaintNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ height()

int QVideoFrame::height ( ) const

Returns the height of a video frame.

Definition at line 329 of file qvideoframe.cpp.

References QSize::height(), and size().

Referenced by map(), and QSGVivanteVideoMaterial::vivanteMapping().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isMapped()

bool QVideoFrame::isMapped ( ) const

Identifies if a video frame's contents are currently mapped to system memory.

This is a convenience function which checks that the \l {QtVideo::MapMode}{MapMode} of the frame is not equal to QtVideo::MapMode::NotMapped.

Returns true if the contents of the video frame are mapped to system memory, and false otherwise.

See also
mapMode(), QtVideo::MapMode

Definition at line 346 of file qvideoframe.cpp.

References QVideoFramePrivate::mapMode, and QtVideo::NotMapped.

◆ isReadable()

bool QVideoFrame::isReadable ( ) const

Identifies if the mapped contents of a video frame were read from the frame when it was mapped.

This is a convenience function which checks if the \l {QtVideo::MapMode}{MapMode} contains the QtVideo::MapMode::WriteOnly flag.

Returns true if the contents of the mapped memory were read from the video frame, and false otherwise.

See also
mapMode(), QtVideo::MapMode

Definition at line 381 of file qvideoframe.cpp.

References QVideoFramePrivate::mapMode, QtVideo::NotMapped, and QtVideo::ReadOnly.

◆ isValid()

bool QVideoFrame::isValid ( ) const

Identifies whether a video frame is valid.

An invalid frame has no video buffer associated with it.

Returns true if the frame is valid, and false if it is not.

Definition at line 278 of file qvideoframe.cpp.

References QVideoFramePrivate::format, QVideoFrameFormat::Format_Invalid, QVideoFrameFormat::pixelFormat(), and QVideoFramePrivate::videoBuffer.

Referenced by QSGVivanteVideoMaterial::bind(), paint(), AVFCameraRenderer::syncHandleViewfinderFrame(), toImage(), QQuickVideoOutput::updatePaintNode(), and QVideoWindowPrivate::updateTextures().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isWritable()

bool QVideoFrame::isWritable ( ) const

Identifies if the mapped contents of a video frame will be persisted when the frame is unmapped.

This is a convenience function which checks if the \l {QtVideo::MapMode}{MapMode} contains the QtVideo::MapMode::WriteOnly flag.

Returns true if the video frame will be updated when unmapped, and false otherwise.

Note
The result of altering the data of a frame that is mapped in read-only mode is undefined. Depending on the buffer implementation the changes may be persisted, or worse alter a shared buffer.
See also
mapMode(), QtVideo::MapMode

Definition at line 365 of file qvideoframe.cpp.

References QVideoFramePrivate::mapMode, QtVideo::NotMapped, and QtVideo::WriteOnly.

◆ map()

bool QVideoFrame::map ( QtVideo::MapMode mode)

Maps the contents of a video frame to system (CPU addressable) memory.

In some cases the video frame data might be stored in video memory or otherwise inaccessible memory, so it is necessary to map a frame before accessing the pixel data. This may involve copying the contents around, so avoid mapping and unmapping unless required.

The map mode indicates whether the contents of the mapped memory should be read from and/or written to the frame. If the map mode includes the QtVideo::MapMode::ReadOnly flag the mapped memory will be populated with the content of the video frame when initially mapped. If the map mode includes the QtVideo::MapMode::WriteOnly flag the content of the possibly modified mapped memory will be written back to the frame when unmapped.

While mapped the contents of a video frame can be accessed directly through the pointer returned by the bits() function.

When access to the data is no longer needed, be sure to call the unmap() function to release the mapped memory and possibly update the video frame contents.

If the video frame has been mapped in read only mode, it is permissible to map it multiple times in read only mode (and unmap it a corresponding number of times). In all other cases it is necessary to unmap the frame first before mapping a second time.

Note
Writing to memory that is mapped as read-only is undefined, and may result in changes to shared data or crashes.

Returns true if the frame was mapped to memory in the given mode and false otherwise.

See also
unmap(), mapMode(), bits()

Definition at line 426 of file qvideoframe.cpp.

References QAbstractVideoBuffer::MapData::bytesPerLine, QAbstractVideoBuffer::MapData::data, QAbstractVideoBuffer::MapData::dataSize, QVideoFramePrivate::format, QVideoFrameFormat::Format_ABGR8888, QVideoFrameFormat::Format_ARGB8888, QVideoFrameFormat::Format_ARGB8888_Premultiplied, QVideoFrameFormat::Format_AYUV, QVideoFrameFormat::Format_AYUV_Premultiplied, QVideoFrameFormat::Format_BGRA8888, QVideoFrameFormat::Format_BGRA8888_Premultiplied, QVideoFrameFormat::Format_BGRX8888, QVideoFrameFormat::Format_IMC1, QVideoFrameFormat::Format_IMC2, QVideoFrameFormat::Format_IMC3, QVideoFrameFormat::Format_IMC4, QVideoFrameFormat::Format_Invalid, QVideoFrameFormat::Format_Jpeg, QVideoFrameFormat::Format_NV12, QVideoFrameFormat::Format_NV21, QVideoFrameFormat::Format_P010, QVideoFrameFormat::Format_P016, QVideoFrameFormat::Format_RGBA8888, QVideoFrameFormat::Format_RGBX8888, QVideoFrameFormat::Format_SamplerExternalOES, QVideoFrameFormat::Format_SamplerRect, QVideoFrameFormat::Format_UYVY, QVideoFrameFormat::Format_XBGR8888, QVideoFrameFormat::Format_XRGB8888, QVideoFrameFormat::Format_Y16, QVideoFrameFormat::Format_Y8, QVideoFrameFormat::Format_YUV420P, QVideoFrameFormat::Format_YUV420P10, QVideoFrameFormat::Format_YUV422P, QVideoFrameFormat::Format_YUYV, QVideoFrameFormat::Format_YV12, height(), QVideoFramePrivate::image, QVideoFramePrivate::imageMutex, lock, QVideoFramePrivate::mapData, QVideoFramePrivate::mapMode, QVideoFramePrivate::mapMutex, QVideoFramePrivate::mappedCount, QtVideo::NotMapped, QVideoFrameFormat::pixelFormat(), QAbstractVideoBuffer::MapData::planeCount, Q_ASSERT, QtVideo::ReadOnly, QVideoFramePrivate::videoBuffer, and QtVideo::WriteOnly.

+ Here is the call graph for this function:

◆ mapMode()

QVideoFrame::MapMode QVideoFrame::mapMode ( ) const

Returns the mode a video frame was mapped to system memory in.

See also
map(), QtVideo::MapMode

Definition at line 391 of file qvideoframe.cpp.

References QVideoFramePrivate::mapMode, and QtVideo::NotMapped.

◆ mappedBytes()

int QVideoFrame::mappedBytes ( int plane) const

Returns the number of bytes occupied by plane plane of the mapped frame data.

This value is only valid while the frame data is \l {map()}{mapped}.

See also
map()

Definition at line 704 of file qvideoframe.cpp.

References QAbstractVideoBuffer::MapData::dataSize, QVideoFramePrivate::mapData, and QAbstractVideoBuffer::MapData::planeCount.

◆ mirrored()

bool QVideoFrame::mirrored ( ) const

Returns whether the frame should be mirrored before displaying.

Definition at line 838 of file qvideoframe.cpp.

References QVideoFramePrivate::format, and QVideoFrameFormat::isMirrored().

Referenced by QVideoWindowPrivate::render(), setMirrored(), QSGVideoNode::setTexturedRectGeometry(), and toImage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator!=()

bool QVideoFrame::operator!= ( const QVideoFrame & other) const
Returns
true if this QVideoFrame and other do not reflect the same frame.

Definition at line 261 of file qvideoframe.cpp.

References other().

+ Here is the call graph for this function:

◆ operator=()

QVideoFrame & QVideoFrame::operator= ( const QVideoFrame & other)
default

Moves other into this QVideoFrame.

Assigns the contents of other to this video frame.

Since QVideoFrame is explicitly shared, these two instances will reflect the same frame.

◆ operator==()

bool QVideoFrame::operator== ( const QVideoFrame & other) const
Returns
true if this QVideoFrame and other reflect the same frame.

Definition at line 252 of file qvideoframe.cpp.

References other().

+ Here is the call graph for this function:

◆ paint()

void QVideoFrame::paint ( QPainter * painter,
const QRectF & rect,
const PaintOptions & options )

Uses a QPainter, {painter}, to render this QVideoFrame to rect.

The PaintOptions options can be used to specify a background color and how rect should be filled with the video.

Note
that rendering will usually happen without hardware acceleration when using this method.

Definition at line 905 of file qvideoframe.cpp.

References QVideoFrame::PaintOptions::aspectRatioMode, QVideoFrame::PaintOptions::backgroundColor, Qt::black, QVideoFrame::PaintOptions::DontDrawSubtitles, QPainter::drawImage(), QPainter::fillRect(), QString::isEmpty(), isValid(), Qt::KeepAspectRatio, layout, map, painter, QVideoFrame::PaintOptions::paintFlags, qRotatedFrameSize(), QtVideo::ReadOnly, rect, QString::replace(), QPainter::setTransform(), QVideoFramePrivate::subtitleText, text, this, toImage(), QPainter::transform(), QTransform::translate(), Qt::transparent, unmap(), and QLayout::update().

Referenced by QVideoWindowPrivate::render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pixelFormat()

QVideoFrameFormat::PixelFormat QVideoFrame::pixelFormat ( ) const

Returns the pixel format of this video frame.

Definition at line 286 of file qvideoframe.cpp.

References QVideoFramePrivate::format, QVideoFrameFormat::Format_Invalid, and QVideoFrameFormat::pixelFormat().

Referenced by QQuickVideoOutput::updatePaintNode(), and QSGVivanteVideoMaterial::vivanteMapping().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ planeCount()

int QVideoFrame::planeCount ( ) const

Returns the number of planes in the video frame.

See also
map()
Since
5.4

Definition at line 718 of file qvideoframe.cpp.

References QVideoFramePrivate::format, and QVideoFrameFormat::planeCount().

+ Here is the call graph for this function:

◆ rotation()

QtVideo::Rotation QVideoFrame::rotation ( ) const

Returns the angle the frame should be rotated clockwise before displaying.

Definition at line 820 of file qvideoframe.cpp.

References QVideoFramePrivate::format, QtVideo::None, and QVideoFrameFormat::rotation().

Referenced by QVideoWindowPrivate::render(), QSGVideoNode::setTexturedRectGeometry(), and toImage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setEndTime()

void QVideoFrame::setEndTime ( qint64 time)

Sets the presentation time (in microseconds) when a frame should stop being displayed.

An invalid time is represented as -1.

Definition at line 770 of file qvideoframe.cpp.

References QVideoFramePrivate::endTime, and time.

Referenced by QAndroidCamera::frameAvailable(), and QFFmpeg::VideoRenderer::renderInternal().

+ Here is the caller graph for this function:

◆ setMirrored()

void QVideoFrame::setMirrored ( bool mirrored)

Sets the mirrored flag for the frame and sets the flag to the underlying \l surfaceFormat.

Definition at line 829 of file qvideoframe.cpp.

References QVideoFramePrivate::format, mirrored(), and QVideoFrameFormat::setMirrored().

Referenced by QAndroidCamera::frameAvailable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setRotation()

void QVideoFrame::setRotation ( QtVideo::Rotation angle)

Sets the angle the frame should be rotated clockwise before displaying.

Definition at line 811 of file qvideoframe.cpp.

References QVideoFramePrivate::format, and QVideoFrameFormat::setRotation().

Referenced by QAndroidCamera::frameAvailable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setStartTime()

void QVideoFrame::setStartTime ( qint64 time)

Sets the presentation time (in microseconds) when the frame should initially be displayed.

An invalid time is represented as -1.

Definition at line 744 of file qvideoframe.cpp.

References QVideoFramePrivate::startTime, and time.

Referenced by QAndroidCamera::frameAvailable(), and QFFmpeg::VideoRenderer::renderInternal().

+ Here is the caller graph for this function:

◆ setStreamFrameRate()

void QVideoFrame::setStreamFrameRate ( qreal rate)

Sets the frame rate of a video stream in frames per second.

Definition at line 846 of file qvideoframe.cpp.

References QVideoFramePrivate::format, and QVideoFrameFormat::setStreamFrameRate().

+ Here is the call graph for this function:

◆ setSubtitleText()

void QVideoFrame::setSubtitleText ( const QString & text)

Sets the subtitle text that should be rendered together with this video frame to text.

Definition at line 890 of file qvideoframe.cpp.

References QVideoFramePrivate::subtitleText, and text.

Referenced by QPlatformVideoSink::setVideoFrame().

+ Here is the caller graph for this function:

◆ size()

QSize QVideoFrame::size ( ) const

Returns the dimensions of a video frame.

Definition at line 313 of file qvideoframe.cpp.

References QVideoFramePrivate::format, and QVideoFrameFormat::frameSize().

Referenced by height(), QVideoWindowPrivate::render(), and width().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ startTime()

qint64 QVideoFrame::startTime ( ) const

Returns the presentation time (in microseconds) when the frame should be displayed.

An invalid time is represented as -1.

Definition at line 731 of file qvideoframe.cpp.

References QVideoFramePrivate::startTime.

◆ streamFrameRate()

qreal QVideoFrame::streamFrameRate ( ) const

Returns the frame rate of a video stream in frames per second.

Definition at line 855 of file qvideoframe.cpp.

References QVideoFramePrivate::format, and QVideoFrameFormat::streamFrameRate().

+ Here is the call graph for this function:

◆ subtitleText()

QString QVideoFrame::subtitleText ( ) const

Returns the subtitle text that should be rendered together with this video frame.

Definition at line 882 of file qvideoframe.cpp.

References QVideoFramePrivate::subtitleText.

Referenced by QVideoWindowPrivate::updateSubtitle().

+ Here is the caller graph for this function:

◆ surfaceFormat()

QVideoFrameFormat QVideoFrame::surfaceFormat ( ) const

Returns the surface format of this video frame.

Definition at line 294 of file qvideoframe.cpp.

References QVideoFramePrivate::format.

Referenced by QVideoWindowPrivate::render(), toImage(), and QVideoWindowPrivate::updateTextures().

+ Here is the caller graph for this function:

◆ swap()

void QVideoFrame::swap ( QVideoFrame & other)
inlinenoexcept

Swaps the current video frame with other.

Definition at line 67 of file qvideoframe.h.

References d, and other().

+ Here is the call graph for this function:

◆ toImage()

QImage QVideoFrame::toImage ( ) const

Based on the pixel format converts current video frame to image.

Since
5.15

Definition at line 864 of file qvideoframe.cpp.

References QVideoFramePrivate::image, QVideoFramePrivate::imageMutex, QImage::isNull(), isValid(), lock, mirrored(), qImageFromVideoFrame(), rotation(), QVideoFrameFormat::scanLineDirection(), surfaceFormat(), and QVideoFrameFormat::TopToBottom.

Referenced by paint().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unmap()

void QVideoFrame::unmap ( )

Releases the memory mapped by the map() function.

If the \l {QtVideo::MapMode}{MapMode} included the QtVideo::MapMode::WriteOnly flag this will persist the current content of the mapped memory to the video frame.

unmap() should not be called if map() function failed.

See also
map()

Definition at line 623 of file qvideoframe.cpp.

References lock, QVideoFramePrivate::mapData, QVideoFramePrivate::mapMode, QVideoFramePrivate::mapMutex, QVideoFramePrivate::mappedCount, QtVideo::NotMapped, qWarning, and QVideoFramePrivate::videoBuffer.

Referenced by QVideoTextureHelper::QVideoFrameTexturesArray::~QVideoFrameTexturesArray(), and paint().

+ Here is the caller graph for this function:

◆ width()

int QVideoFrame::width ( ) const

Returns the width of a video frame.

Definition at line 321 of file qvideoframe.cpp.

References size(), and QSize::width().

Referenced by QSGVivanteVideoMaterial::vivanteMapping().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ QVideoFramePrivate

friend class QVideoFramePrivate
friend

Definition at line 154 of file qvideoframe.h.


The documentation for this class was generated from the following files: