QVideoFrame

QVideoFrame 

#include <QVideoFrame>

 

 

Public Types

enum FieldType { ProgressiveFrame, TopField, BottomField, InterlacedFrame }
enum PixelFormat { Format_Invalid, Format_ARGB32, Format_ARGB32_Premultiplied, Format_RGB32, ..., Format_User }

Public Functions

  QVideoFrame()
  QVideoFrame(QAbstractVideoBuffer *buffer, const QSize &size, QVideoFrame::PixelFormat format)
  QVideoFrame(int bytes, const QSize &size, int bytesPerLine, QVideoFrame::PixelFormat format)
  QVideoFrame(const QImage &image)
  QVideoFrame(const QVideoFrame &other)
  ~QVideoFrame()
QVariantMap availableMetaData() const
uchar * bits()
uchar * bits(int plane)
const uchar * bits() const
const uchar * bits(int plane) const
int bytesPerLine() const
int bytesPerLine(int plane) const
qint64 endTime() const
QVideoFrame::FieldType fieldType() const
QVariant handle() const
QAbstractVideoBuffer::HandleType handleType() const
int height() const
bool isMapped() const
bool isReadable() const
bool isValid() const
bool isWritable() const
bool map(QAbstractVideoBuffer::MapMode mode)
QAbstractVideoBuffer::MapMode mapMode() const
int mappedBytes() const
QVariant metaData(const QString &key) const
QVideoFrame::PixelFormat pixelFormat() const
int planeCount() const
void setEndTime(qint64 time)
void setFieldType(QVideoFrame::FieldType field)
void setMetaData(const QString &key, const QVariant &value)
void setStartTime(qint64 time)
QSize size() const
qint64 startTime() const
void unmap()
int width() const
bool operator!=(const QVideoFrame &other) const
QVideoFrame & operator=(const QVideoFrame &other)
bool operator==(const QVideoFrame &other) const

Static Public Members

QImage::Format imageFormatFromPixelFormat(QVideoFrame::PixelFormat format)
QVideoFrame::PixelFormat pixelFormatFromImageFormat(QImage::Format format)

 

 

 

详细说明

QVideoFrame类表示一帧视频数据。

 

QVideoFrame封装视频帧的像素数据以及关于该帧的信息。

 

视频帧可以来自多个地方——解码媒体、相机或程序生成。在这些帧中描述像素的方式可能会有很大的变化,一些像素格式以牺牲易用性为代价提供了更大的压缩机会。

 

视频帧的像素内容可以使用map()函数映射到内存。映射时,可以使用bits()函数访问视频数据,该函数返回一个指向缓冲区的指针。这个缓冲区的总大小由mappedBytes()函数给定,每行的大小由bytesPerLine()函数给出。handle()函数的返回值也可以用于使用内部缓冲区的本地API(例如OpenGL纹理句柄)访问帧数据。

 

视频帧也可以具有与其相关联的时间戳信息。QAbstractVideoSurface的实现可以使用这些时间戳来确定何时开始和停止显示帧,但并非所有曲面都会遵守此设置。

 

QVideoFrame中的视频像素数据被封装在QAbstractVideoBuffer中。通过对QAbstractVideoBuffer类进行子类化,可以从任何缓冲区类型构造QVideoFrame。

 

注意:由于视频帧的复制成本可能很高,QVideoFrame是明确共享的,因此对视频帧所做的任何更改也将适用于任何副本。

 

指定隔行扫描视频帧所属的字段。

 

ConstantValueDescription
QVideoFrame::ProgressiveFrame 0 The frame is not interlaced.
QVideoFrame::TopField 1 The frame contains a top field.
QVideoFrame::BottomField 2 The frame contains a bottom field.
QVideoFrame::InterlacedFrame 3 The frame contains a merged top and bottom field.

enum QVideoFrame::PixelFormat

Enumerates video data types.

ConstantValueDescription
QVideoFrame::Format_Invalid 0 The frame is invalid.
QVideoFrame::Format_ARGB32 1 The frame is stored using a 32-bit ARGB format (0xAARRGGBB). This is equivalent to QImage::Format_ARGB32.
QVideoFrame::Format_ARGB32_Premultiplied 2 The frame stored using a premultiplied 32-bit ARGB format (0xAARRGGBB). This is equivalent to QImage::Format_ARGB32_Premultiplied.
QVideoFrame::Format_RGB32 3 The frame stored using a 32-bit RGB format (0xffRRGGBB). This is equivalent to QImage::Format_RGB32
QVideoFrame::Format_RGB24 4 The frame is stored using a 24-bit RGB format (8-8-8). This is equivalent to QImage::Format_RGB888
QVideoFrame::Format_RGB565 5 The frame is stored using a 16-bit RGB format (5-6-5). This is equivalent to QImage::Format_RGB16.
QVideoFrame::Format_RGB555 6 The frame is stored using a 16-bit RGB format (5-5-5). This is equivalent to QImage::Format_RGB555.
QVideoFrame::Format_ARGB8565_Premultiplied 7 The frame is stored using a 24-bit premultiplied ARGB format (8-5-6-5).
QVideoFrame::Format_BGRA32 8 The frame is stored using a 32-bit BGRA format (0xBBGGRRAA).
QVideoFrame::Format_BGRA32_Premultiplied 9 The frame is stored using a premultiplied 32bit BGRA format.
QVideoFrame::Format_BGR32 10 The frame is stored using a 32-bit BGR format (0xBBGGRRff).
QVideoFrame::Format_BGR24 11 The frame is stored using a 24-bit BGR format (0xBBGGRR).
QVideoFrame::Format_BGR565 12 The frame is stored using a 16-bit BGR format (5-6-5).
QVideoFrame::Format_BGR555 13 The frame is stored using a 16-bit BGR format (5-5-5).
QVideoFrame::Format_BGRA5658_Premultiplied 14 The frame is stored using a 24-bit premultiplied BGRA format (5-6-5-8).
QVideoFrame::Format_AYUV444 15 The frame is stored using a packed 32-bit AYUV format (0xAAYYUUVV).
QVideoFrame::Format_AYUV444_Premultiplied 16 The frame is stored using a packed premultiplied 32-bit AYUV format (0xAAYYUUVV).
QVideoFrame::Format_YUV444 17 The frame is stored using a 24-bit packed YUV format (8-8-8).
QVideoFrame::Format_YUV420P 18 The frame is stored using an 8-bit per component planar YUV format with the U and V planes horizontally and vertically sub-sampled, i.e. the height and width of the U and V planes are half that of the Y plane.
QVideoFrame::Format_YV12 19 The frame is stored using an 8-bit per component planar YVU format with the V and U planes horizontally and vertically sub-sampled, i.e. the height and width of the V and U planes are half that of the Y plane.
QVideoFrame::Format_UYVY 20 The frame is stored using an 8-bit per component packed YUV format with the U and V planes horizontally sub-sampled (U-Y-V-Y), i.e. two horizontally adjacent pixels are stored as a 32-bit macropixel which has a Y value for each pixel and common U and V values.
QVideoFrame::Format_YUYV 21 The frame is stored using an 8-bit per component packed YUV format with the U and V planes horizontally sub-sampled (Y-U-Y-V), i.e. two horizontally adjacent pixels are stored as a 32-bit macropixel which has a Y value for each pixel and common U and V values.
QVideoFrame::Format_NV12 22 The frame is stored using an 8-bit per component semi-planar YUV format with a Y plane (Y) followed by a horizontally and vertically sub-sampled, packed UV plane (U-V).
QVideoFrame::Format_NV21 23 The frame is stored using an 8-bit per component semi-planar YUV format with a Y plane (Y) followed by a horizontally and vertically sub-sampled, packed VU plane (V-U).
QVideoFrame::Format_IMC1 24 The frame is stored using an 8-bit per component planar YUV format with the U and V planes horizontally and vertically sub-sampled. This is similar to the Format_YUV420P type, except that the bytes per line of the U and V planes are padded out to the same stride as the Y plane.
QVideoFrame::Format_IMC2 25 The frame is stored using an 8-bit per component planar YUV format with the U and V planes horizontally and vertically sub-sampled. This is similar to the Format_YUV420P type, except that the lines of the U and V planes are interleaved, i.e. each line of U data is followed by a line of V data creating a single line of the same stride as the Y data.
QVideoFrame::Format_IMC3 26 The frame is stored using an 8-bit per component planar YVU format with the V and U planes horizontally and vertically sub-sampled. This is similar to the Format_YV12 type, except that the bytes per line of the V and U planes are padded out to the same stride as the Y plane.
QVideoFrame::Format_IMC4 27 The frame is stored using an 8-bit per component planar YVU format with the V and U planes horizontally and vertically sub-sampled. This is similar to the Format_YV12 type, except that the lines of the V and U planes are interleaved, i.e. each line of V data is followed by a line of U data creating a single line of the same stride as the Y data.
QVideoFrame::Format_Y8 28 The frame is stored using an 8-bit greyscale format.
QVideoFrame::Format_Y16 29 The frame is stored using a 16-bit linear greyscale format. Little endian.
QVideoFrame::Format_Jpeg 30 The frame is stored in compressed Jpeg format.
QVideoFrame::Format_CameraRaw 31 The frame is stored using a device specific camera raw format.
QVideoFrame::Format_AdobeDng 32 The frame is stored using raw Adobe Digital Negative (DNG) format.
QVideoFrame::Format_User 1000 Start value for user defined pixel formats.

 

 

 

##############################

posted @ 2023-06-29 20:55  西北逍遥  阅读(441)  评论(0编辑  收藏  举报