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>.
|
#include <qffmpegvideobuffer_p.h>
Public Types | |
using | AVFrameUPtr = QFFmpeg::AVFrameUPtr |
Public Member Functions | |
QFFmpegVideoBuffer (AVFrameUPtr frame, AVRational pixelAspectRatio={ 1, 1 }) | |
~QFFmpegVideoBuffer () override | |
QVideoFrame::MapMode | mapMode () const override |
MapData | map (QVideoFrame::MapMode mode) override |
Independently maps the planes of a video buffer to memory. | |
void | unmap () override |
Releases the memory mapped by the map() function. | |
virtual std::unique_ptr< QVideoFrameTextures > | mapTextures (QRhi *) override |
virtual quint64 | textureHandle (QRhi *rhi, int plane) const override |
Returns a texture handle to the data buffer. | |
QVideoFrameFormat::PixelFormat | pixelFormat () const |
QSize | size () const |
void | convertSWFrame () |
AVFrame * | getHWFrame () const |
void | setTextureConverter (const QFFmpeg::TextureConverter &converter) |
QVideoFrameFormat::ColorSpace | colorSpace () const |
QVideoFrameFormat::ColorTransfer | colorTransfer () const |
QVideoFrameFormat::ColorRange | colorRange () const |
float | maxNits () |
Public Member Functions inherited from QAbstractVideoBuffer | |
QAbstractVideoBuffer (QVideoFrame::HandleType type, QRhi *rhi=nullptr) | |
Constructs an abstract video buffer of the given type. | |
virtual | ~QAbstractVideoBuffer () |
Destroys an abstract video buffer. | |
QVideoFrame::HandleType | handleType () const |
Returns the type of a video buffer's handle. | |
QRhi * | rhi () const |
Returns the QRhi instance. | |
virtual QMatrix4x4 | externalTextureMatrix () const |
virtual QByteArray | underlyingByteArray (int) const |
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 QAbstractVideoBuffer | |
QVideoFrame::HandleType | m_type |
QRhi * | m_rhi = nullptr |
Definition at line 28 of file qffmpegvideobuffer_p.h.
Definition at line 31 of file qffmpegvideobuffer_p.h.
QFFmpegVideoBuffer::QFFmpegVideoBuffer | ( | AVFrameUPtr | frame, |
AVRational | pixelAspectRatio = { 1, 1 } ) |
Definition at line 29 of file qffmpegvideobuffer.cpp.
References frame, QWidget::height, and QWidget::width.
|
overridedefault |
QVideoFrameFormat::ColorRange QFFmpegVideoBuffer::colorRange | ( | ) | const |
Definition at line 143 of file qffmpegvideobuffer.cpp.
References QVideoFrameFormat::ColorRange_Full, QVideoFrameFormat::ColorRange_Unknown, and QVideoFrameFormat::ColorRange_Video.
QVideoFrameFormat::ColorSpace QFFmpegVideoBuffer::colorSpace | ( | ) | const |
Definition at line 85 of file qffmpegvideobuffer.cpp.
References QVideoFrameFormat::ColorSpace_AdobeRgb, QVideoFrameFormat::ColorSpace_BT2020, QVideoFrameFormat::ColorSpace_BT601, QVideoFrameFormat::ColorSpace_BT709, and QVideoFrameFormat::ColorSpace_Undefined.
QVideoFrameFormat::ColorTransfer QFFmpegVideoBuffer::colorTransfer | ( | ) | const |
Definition at line 112 of file qffmpegvideobuffer.cpp.
References QVideoFrameFormat::ColorTransfer_BT601, QVideoFrameFormat::ColorTransfer_BT709, QVideoFrameFormat::ColorTransfer_Gamma22, QVideoFrameFormat::ColorTransfer_Gamma28, QVideoFrameFormat::ColorTransfer_Linear, QVideoFrameFormat::ColorTransfer_ST2084, QVideoFrameFormat::ColorTransfer_STD_B67, and QVideoFrameFormat::ColorTransfer_Unknown.
void QFFmpegVideoBuffer::convertSWFrame | ( | ) |
Definition at line 49 of file qffmpegvideobuffer.cpp.
References QSize::height(), isFrameFlipped(), QFFmpeg::makeAVFrame(), Q_ASSERT, toAVPixelFormat(), toQtPixelFormat(), and QSize::width().
Referenced by map().
|
inline |
Definition at line 51 of file qffmpegvideobuffer_p.h.
Referenced by QFFmpeg::VideoEncoder::processOne().
|
overridevirtual |
Independently maps the planes of a video buffer to memory.
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 be sure to call the unmap() function to release the mapped memory and possibly update the buffer contents.
Returns the number of planes in the mapped video data. For each plane the line stride of that plane will be returned in bytesPerLine, and a pointer to the plane data will be returned in data. The accumulative size of the mapped data is returned in numBytes.
Not all buffer implementations will map more than the first plane, if this returns a single plane for a planar format the additional planes will have to be calculated from the line stride of the first plane and the frame height. Mapping a buffer with QVideoFrame will do this for you.
To implement this function create a derivative of QAbstractPlanarVideoBuffer and implement its map function instance instead.
Implements QAbstractVideoBuffer.
Definition at line 176 of file qffmpegvideobuffer.cpp.
References convertSWFrame(), i, QAbstractVideoBuffer::m_type, QFFmpeg::makeAVFrame(), mapData(), QVideoFrame::NoHandle, pixelFormat(), Q_ASSERT, qCDebug, qWarning, ret, QVideoTextureHelper::textureDescription(), and QVideoFrame::WriteOnly.
|
overridevirtual |
Implements QAbstractVideoBuffer.
Definition at line 171 of file qffmpegvideobuffer.cpp.
|
overridevirtual |
Reimplemented from QAbstractVideoBuffer.
Definition at line 225 of file qffmpegvideobuffer.cpp.
References QFFmpeg::TextureConverter::getTextures(), QFFmpeg::TextureConverter::isNull(), and qWarning.
float QFFmpegVideoBuffer::maxNits | ( | ) |
Definition at line 155 of file qffmpegvideobuffer.cpp.
References i, maxNits(), and QFFmpeg::mul().
Referenced by maxNits().
QVideoFrameFormat::PixelFormat QFFmpegVideoBuffer::pixelFormat | ( | ) | const |
Definition at line 250 of file qffmpegvideobuffer.cpp.
Referenced by map(), and toAVPixelFormat().
void QFFmpegVideoBuffer::setTextureConverter | ( | const QFFmpeg::TextureConverter & | converter | ) |
Definition at line 78 of file qffmpegvideobuffer.cpp.
References QFFmpeg::TextureConverter::init(), QFFmpeg::TextureConverter::isNull(), QAbstractVideoBuffer::m_type, QVideoFrame::NoHandle, and QVideoFrame::RhiTextureHandle.
Referenced by QFFmpegVideoSink::setVideoFrame().
QSize QFFmpegVideoBuffer::size | ( | ) | const |
Definition at line 255 of file qffmpegvideobuffer.cpp.
Returns a texture handle to the data buffer.
Reimplemented from QAbstractVideoBuffer.
Definition at line 245 of file qffmpegvideobuffer.cpp.
References QAbstractVideoBuffer::rhi().
|
static |
Definition at line 328 of file qffmpegvideobuffer.cpp.
References 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_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, and pixelFormat().
Referenced by QFFmpeg::VideoEncoder::VideoEncoder(), convertSWFrame(), QAndroidCamera::ffmpegHWPixelFormat(), and QAndroidCamera::frameAvailable().
|
static |
Definition at line 260 of file qffmpegvideobuffer.cpp.
References QVideoFrameFormat::Format_ABGR8888, QVideoFrameFormat::Format_ARGB8888, QVideoFrameFormat::Format_BGRA8888, QVideoFrameFormat::Format_BGRX8888, QVideoFrameFormat::Format_Invalid, QVideoFrameFormat::Format_NV12, QVideoFrameFormat::Format_NV21, QVideoFrameFormat::Format_P010, QVideoFrameFormat::Format_P016, QVideoFrameFormat::Format_RGBA8888, QVideoFrameFormat::Format_RGBX8888, QVideoFrameFormat::Format_SamplerExternalOES, 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, and Q_ASSERT.
Referenced by convertSWFrame(), QFFmpeg::isNoConversionFormat(), and Q_LOGGING_CATEGORY().
|
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.
Implements QAbstractVideoBuffer.
Definition at line 218 of file qffmpegvideobuffer.cpp.
References QVideoFrame::NotMapped.