Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QFFmpegVideoBuffer Class Reference

#include <qffmpegvideobuffer_p.h>

Inheritance diagram for QFFmpegVideoBuffer:
Collaboration diagram for QFFmpegVideoBuffer:

Public Types

using AVFrameUPtr = QFFmpeg::AVFrameUPtr

Public Member Functions

 QFFmpegVideoBuffer (AVFrameUPtr frame, AVRational pixelAspectRatio={ 1, 1 })
 ~QFFmpegVideoBuffer () override
MapData map (QVideoFrame::MapMode mode) override
 Maps the planes of a video buffer to memory.
void unmap () override
 Releases the memory mapped by the map() function.
QVideoFrameTexturesUPtr mapTextures (QRhi &, QVideoFrameTexturesUPtr &oldTextures) override
QVideoFrameFormat::PixelFormat pixelFormat () const
QSize size () const
void convertSWFrame ()
AVFrame * getHWFrame () const
void initTextureConverter (QRhi &rhi) override
QRhirhi () const override
QVideoFrameFormat::ColorSpace colorSpace () const
QVideoFrameFormat::ColorTransfer colorTransfer () const
QVideoFrameFormat::ColorRange colorRange () const
float maxNits ()
Public Member Functions inherited from QHwVideoBuffer
 QHwVideoBuffer (QVideoFrame::HandleType type, QRhi *rhi=nullptr)
 ~QHwVideoBuffer () override
QVideoFrame::HandleType handleType () const
QVideoFrameFormat format () const override
 Gets \l QVideoFrameFormat of the underlying video buffer.
virtual QMatrix4x4 externalTextureMatrix () const
virtual bool isDmaBuf () const
Public Member Functions inherited from QAbstractVideoBuffer
virtual ~QAbstractVideoBuffer ()
 \variable QAbstractVideoBuffer::MapData::planeCount
Public Member Functions inherited from QVideoFrameTexturesHandles
virtual ~QVideoFrameTexturesHandles ()
virtual quint64 textureHandle (QRhi &, int)

Static Public Member Functions

static QVideoFrameFormat::PixelFormat toQtPixelFormat (AVPixelFormat avPixelFormat, bool *needsConversion=nullptr)
static AVPixelFormat toAVPixelFormat (QVideoFrameFormat::PixelFormat pixelFormat)

Additional Inherited Members

Protected Attributes inherited from QHwVideoBuffer
QVideoFrame::HandleType m_type
QRhim_rhi = nullptr

Detailed Description

Definition at line 26 of file qffmpegvideobuffer_p.h.

Member Typedef Documentation

◆ AVFrameUPtr

Constructor & Destructor Documentation

◆ QFFmpegVideoBuffer()

QFFmpegVideoBuffer::QFFmpegVideoBuffer ( AVFrameUPtr frame,
AVRational pixelAspectRatio = { 1, 1 } )

Definition at line 30 of file qffmpegvideobuffer.cpp.

References QFFmpegVideoBuffer().

Referenced by QFFmpegVideoBuffer().

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

◆ ~QFFmpegVideoBuffer()

QFFmpegVideoBuffer::~QFFmpegVideoBuffer ( )
overridedefault

Member Function Documentation

◆ colorRange()

QVideoFrameFormat::ColorRange QFFmpegVideoBuffer::colorRange ( ) const

Definition at line 132 of file qffmpegvideobuffer.cpp.

◆ colorSpace()

QVideoFrameFormat::ColorSpace QFFmpegVideoBuffer::colorSpace ( ) const

Definition at line 122 of file qffmpegvideobuffer.cpp.

◆ colorTransfer()

QVideoFrameFormat::ColorTransfer QFFmpegVideoBuffer::colorTransfer ( ) const

Definition at line 127 of file qffmpegvideobuffer.cpp.

◆ convertSWFrame()

void QFFmpegVideoBuffer::convertSWFrame ( )

Definition at line 50 of file qffmpegvideobuffer.cpp.

Referenced by map().

Here is the caller graph for this function:

◆ getHWFrame()

AVFrame * QFFmpegVideoBuffer::getHWFrame ( ) const
inline

Definition at line 47 of file qffmpegvideobuffer_p.h.

◆ initTextureConverter()

void QFFmpegVideoBuffer::initTextureConverter ( QRhi & rhi)
overridevirtual

Reimplemented from QHwVideoBuffer.

Definition at line 79 of file qffmpegvideobuffer.cpp.

◆ map()

QAbstractVideoBuffer::MapData QFFmpegVideoBuffer::map ( QVideoFrame::MapMode mode)
overridevirtual

Maps the planes of a video buffer to memory.

Returns a \l MapData structure that contains information about the plane layout of the mapped current video data. If the mapping fails, the method returns the default structure. For CPU memory buffers, the data is considered as already mapped, so the function just returns the plane layout of the preallocated underlying data.

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

When access to the data is no longer needed, the \l unmap function is called to release the mapped memory and possibly update the buffer contents.

If the format of the video data is multiplanar, the method may map the whole pixel data as a single plane. In this case, mapping a buffer with \l QVideoFrame will calculate additional planes from the specified line stride of the first plane, the frame height, and the data size.

Implements QAbstractVideoBuffer.

Definition at line 153 of file qffmpegvideobuffer.cpp.

References convertSWFrame().

Here is the call graph for this function:

◆ mapTextures()

QVideoFrameTexturesUPtr QFFmpegVideoBuffer::mapTextures ( QRhi & rhi,
QVideoFrameTexturesUPtr & oldTextures )
overridevirtual

Reimplemented from QHwVideoBuffer.

Definition at line 195 of file qffmpegvideobuffer.cpp.

◆ maxNits()

float QFFmpegVideoBuffer::maxNits ( )

Definition at line 137 of file qffmpegvideobuffer.cpp.

◆ pixelFormat()

QVideoFrameFormat::PixelFormat QFFmpegVideoBuffer::pixelFormat ( ) const

Definition at line 254 of file qffmpegvideobuffer.cpp.

◆ rhi()

QRhi * QFFmpegVideoBuffer::rhi ( ) const
overridevirtual

Reimplemented from QHwVideoBuffer.

Definition at line 112 of file qffmpegvideobuffer.cpp.

◆ size()

QSize QFFmpegVideoBuffer::size ( ) const

Definition at line 259 of file qffmpegvideobuffer.cpp.

◆ toAVPixelFormat()

AVPixelFormat QFFmpegVideoBuffer::toAVPixelFormat ( QVideoFrameFormat::PixelFormat pixelFormat)
static

Definition at line 332 of file qffmpegvideobuffer.cpp.

◆ toQtPixelFormat()

QVideoFrameFormat::PixelFormat QFFmpegVideoBuffer::toQtPixelFormat ( AVPixelFormat avPixelFormat,
bool * needsConversion = nullptr )
static

Definition at line 264 of file qffmpegvideobuffer.cpp.

◆ unmap()

void QFFmpegVideoBuffer::unmap ( )
overridevirtual

Releases the memory mapped by the map() function.

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

For CPU video buffers, the function may be not overridden. The default implementation of unmap does nothing.

See also
map()

Reimplemented from QAbstractVideoBuffer.

Definition at line 188 of file qffmpegvideobuffer.cpp.


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