• PySide 模块
  • PySide.QtMultimedia
  • 内容表

    上一话题

    QAudioFormat

    下一话题

    QAbstractVideoBuffer

    QVideoFrame

    概要

    函数

    详细描述

    PySide.QtMultimedia.QVideoFrame class provides a representation of a frame of video data.

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

    The contents of a video frame can be mapped to memory using the PySide.QtMultimedia.QVideoFrame.map() function. While mapped the video data can accessed using the PySide.QtMultimedia.QVideoFrame.bits() function which returns a pointer to a buffer, the total size of which is given by the PySide.QtMultimedia.QVideoFrame.mappedBytes() , and the size of each line is given by PySide.QtMultimedia.QVideoFrame.bytesPerLine() . The return value of the PySide.QtMultimedia.QVideoFrame.handle() function may be used to access frame data using the internal buffer's native APIs.

    The video data in a PySide.QtMultimedia.QVideoFrame is encapsulated in a PySide.QtMultimedia.QAbstractVideoBuffer . A PySide.QtMultimedia.QVideoFrame may be constructed from any buffer type by subclassing the PySide.QtMultimedia.QAbstractVideoBuffer 类。

    注意

    PySide.QtMultimedia.QVideoFrame is explicitly shared, any change made to video frame will also apply to any copies.

    class PySide.QtMultimedia. QVideoFrame
    class PySide.QtMultimedia. QVideoFrame ( buffer , size , format )
    class PySide.QtMultimedia. QVideoFrame ( image )
    class PySide.QtMultimedia. QVideoFrame ( other )
    class PySide.QtMultimedia. QVideoFrame ( bytes , size , bytesPerLine , format )
    参数:

    构造 null 视频帧。

    Constructs a video frame from a buffer of the given pixel format and size in pixels.

    注意

    This doesn't increment the reference count of the video buffer.

    Constructs a video frame from an image .

    注意

    This will construct an invalid video frame if there is no frame type equivalent to the image format.

    构造副本为 other .

    Constructs a video frame of the given pixel format and size in pixels.

    bytesPerLine (stride) is the length of each scan line in bytes, and bytes is the total number of bytes that must be allocated for the frame.

    PySide.QtMultimedia.QVideoFrame. FieldType

    Specifies the field an interlaced video frame belongs to.

    常量 描述
    QVideoFrame.ProgressiveFrame The frame is not interlaced.
    QVideoFrame.TopField The frame contains a top field.
    QVideoFrame.BottomField The frame contains a bottom field.
    QVideoFrame.InterlacedFrame The frame contains a merged top and bottom field.
    PySide.QtMultimedia.QVideoFrame. PixelFormat

    枚举视频数据类型。

    常量 描述
    QVideoFrame.Format_Invalid 帧是无效的。
    QVideoFrame.Format_ARGB32 The frame is stored using a 32-bit ARGB format (0xAARRGGBB). This is equivalent to QImage.Format_ARGB32 .
    QVideoFrame.Format_ARGB32_Premultiplied The frame stored using a premultiplied 32-bit ARGB format (0xAARRGGBB). This is equivalent to QImage.Format_ARGB32_Premultiplied .
    QVideoFrame.Format_RGB32 The frame stored using a 32-bit RGB format (0xffRRGGBB). This is equivalent to QImage.Format_RGB32
    QVideoFrame.Format_RGB24 The frame is stored using a 24-bit RGB format (8-8-8). This is equivalent to QImage.Format_RGB888
    QVideoFrame.Format_RGB565 The frame is stored using a 16-bit RGB format (5-6-5). This is equivalent to QImage.Format_RGB16 .
    QVideoFrame.Format_RGB555 The frame is stored using a 16-bit RGB format (5-5-5). This is equivalent to QImage.Format_RGB555 .
    QVideoFrame.Format_ARGB8565_Premultiplied The frame is stored using a 24-bit premultiplied ARGB format (8-6-6-5).
    QVideoFrame.Format_BGRA32 The frame is stored using a 32-bit ARGB format (0xBBGGRRAA).
    QVideoFrame.Format_BGRA32_Premultiplied The frame is stored using a premultiplied 32bit BGRA format.
    QVideoFrame.Format_BGR32 The frame is stored using a 32-bit BGR format (0xBBGGRRff).
    QVideoFrame.Format_BGR24 The frame is stored using a 24-bit BGR format (0xBBGGRR).
    QVideoFrame.Format_BGR565 帧使用 16 位 BGR 格式 (5-6-5) 存储。
    QVideoFrame.Format_BGR555 帧使用 16 位 BGR 格式 (5-5-5) 存储。
    QVideoFrame.Format_BGRA5658_Premultiplied The frame is stored using a 24-bit premultiplied BGRA format (5-6-5-8).
    QVideoFrame.Format_AYUV444 The frame is stored using a packed 32-bit AYUV format (0xAAYYUUVV).
    QVideoFrame.Format_AYUV444_Premultiplied The frame is stored using a packed premultiplied 32-bit AYUV format (0xAAYYUUVV).
    QVideoFrame.Format_YUV444 The frame is stored using a 24-bit packed YUV format (8-8-8).
    QVideoFrame.Format_YUV420P 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 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 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 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 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 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 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 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 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 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 The frame is stored using an 8-bit greyscale format.
    QVideoFrame.Format_Y16 The frame is stored using a 16-bit linear greyscale format. Little endian.
    QVideoFrame.Format_User 用户定义像素格式的起始值。
    PySide.QtMultimedia.QVideoFrame. bits ( )
    返回类型: PySide.QtCore.uchar

    返回指向帧数据缓冲起始的指针。

    此值才有效当帧数据为 mapped .

    PySide.QtMultimedia.QVideoFrame. bytesPerLine ( )
    返回类型: PySide.QtCore.int

    返回扫描行字节数。

    注意

    This is the bytes per line of the first plane only. The bytes per line of subsequent planes should be calculated as per the frame type.

    此值才有效当帧数据为 mapped .

    PySide.QtMultimedia.QVideoFrame. endTime ( )
    返回类型: PySide.QtCore.qint64

    Returns the presentation time when a frame should stop being displayed.

    PySide.QtMultimedia.QVideoFrame. fieldType ( )
    返回类型: PySide.QtMultimedia.QVideoFrame.FieldType

    Returns the field an interlaced video frame belongs to.

    If the video is not interlaced this will return WholeFrame.

    PySide.QtMultimedia.QVideoFrame. handle ( )
    返回类型: object

    返回视频帧缓冲的特定类型句柄。

    对于 OpenGL 纹理,这将是纹理 ID。

    PySide.QtMultimedia.QVideoFrame. handleType ( )
    返回类型: PySide.QtMultimedia.QAbstractVideoBuffer.HandleType

    返回视频帧的句柄类型。

    PySide.QtMultimedia.QVideoFrame. height ( )
    返回类型: PySide.QtCore.int

    返回视频帧的高度。

    static PySide.QtMultimedia.QVideoFrame. imageFormatFromPixelFormat ( format )
    参数: format PySide.QtMultimedia.QVideoFrame.PixelFormat
    返回类型: PySide.QtGui.QImage.Format

    返回图像格式等效视频帧像素 format 。若没有等效格式 QImage.Format_Invalid 被返回取而代之。

    PySide.QtMultimedia.QVideoFrame. isMapped ( )
    返回类型: PySide.QtCore.bool

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

    This is a convenience function which checks that the QAbstractVideoBuffer.MapMode of the frame is not equal to QAbstractVideoBuffer.NotMapped .

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

    另请参阅

    PySide.QtMultimedia.QVideoFrame.mapMode() QAbstractVideoBuffer.MapMode

    PySide.QtMultimedia.QVideoFrame. isReadable ( )
    返回类型: PySide.QtCore.bool

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

    这是方便的校验函数若 QAbstractVideoBuffer.MapMode contains the QAbstractVideoBuffer.WriteOnly 标志。

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

    另请参阅

    PySide.QtMultimedia.QVideoFrame.mapMode() QAbstractVideoBuffer.MapMode

    PySide.QtMultimedia.QVideoFrame. isValid ( )
    返回类型: PySide.QtCore.bool

    标识视频帧是否有效。

    无效帧没有关联它的视频缓冲。

    返回 true 若帧有效,和 false 若帧无效。

    PySide.QtMultimedia.QVideoFrame. isWritable ( )
    返回类型: PySide.QtCore.bool

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

    这是方便的校验函数若 QAbstractVideoBuffer.MapMode contains the QAbstractVideoBuffer.WriteOnly 标志。

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

    注意

    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.

    另请参阅

    PySide.QtMultimedia.QVideoFrame.mapMode() QAbstractVideoBuffer.MapMode

    PySide.QtMultimedia.QVideoFrame. map ( mode )
    参数: mode PySide.QtMultimedia.QAbstractVideoBuffer.MapMode
    返回类型: PySide.QtCore.bool
    PySide.QtMultimedia.QVideoFrame. mapMode ( )
    返回类型: PySide.QtMultimedia.QAbstractVideoBuffer.MapMode

    返回将视频帧映射到系统内存中的模式。

    另请参阅

    PySide.QtMultimedia.QVideoFrame.map() QAbstractVideoBuffer.MapMode

    PySide.QtMultimedia.QVideoFrame. mappedBytes ( )
    返回类型: PySide.QtCore.int

    返回由映射帧数据所占据的字节数。

    此值才有效当帧数据为 mapped .

    PySide.QtMultimedia.QVideoFrame. pixelFormat ( )
    返回类型: PySide.QtMultimedia.QVideoFrame.PixelFormat

    返回视频帧的颜色格式。

    static PySide.QtMultimedia.QVideoFrame. pixelFormatFromImageFormat ( format )
    参数: format PySide.QtGui.QImage.Format
    返回类型: PySide.QtMultimedia.QVideoFrame.PixelFormat
    PySide.QtMultimedia.QVideoFrame. setEndTime ( time )
    参数: time PySide.QtCore.qint64

    设置呈现 time when a frame should stop being displayed.

    PySide.QtMultimedia.QVideoFrame. setFieldType ( arg__1 )
    参数: arg__1 PySide.QtMultimedia.QVideoFrame.FieldType

    设置 field 属于隔行扫描视频帧。

    PySide.QtMultimedia.QVideoFrame. setStartTime ( time )
    参数: time PySide.QtCore.qint64

    设置呈现 time when the frame should be displayed.

    PySide.QtMultimedia.QVideoFrame. size ( )
    返回类型: PySide.QtCore.QSize

    Returns the size of a video frame.

    PySide.QtMultimedia.QVideoFrame. startTime ( )
    返回类型: PySide.QtCore.qint64

    Returns the presentation time when the frame should be displayed.

    PySide.QtMultimedia.QVideoFrame. unmap ( )

    释放映射内存,映射通过 PySide.QtMultimedia.QVideoFrame.map() 函数。

    QAbstractVideoBuffer.MapMode 包括 QAbstractVideoBuffer.WriteOnly 标志,则这会把映射内存当前内容坚持到视频帧。

    PySide.QtMultimedia.QVideoFrame. width ( )
    返回类型: PySide.QtCore.int

    返回视频帧的宽度。