QAbstractVideoBuffer 类

The QAbstractVideoBuffer class is an abstraction for video data. 更多...

头: #include <QAbstractVideoBuffer>
Since: Qt 4.6

公共类型

enum HandleType { NoHandle, GLTextureHandle, XvShmImageHandle, CoreImageHandle, QPixmapHandle, UserHandle }
enum MapMode { NotMapped, ReadOnly, WriteOnly, ReadWrite }

公共函数

QAbstractVideoBuffer (HandleType type )
virtual ~QAbstractVideoBuffer ()
virtual QVariant handle () const
HandleType handleType () const
virtual uchar * map (MapMode mode , int * numBytes , int * bytesPerLine ) = 0
virtual MapMode mapMode () const = 0
virtual void unmap () = 0

详细描述

The QAbstractVideoBuffer class is an abstraction for video data.

The QVideoFrame class makes use of a QAbstractVideoBuffer internally to reference a buffer of video data. Creating a subclass of QAbstractVideoBuffer will allow you to construct video frames from preallocated or static buffers.

The contents of a buffer can be accessed by mapping the buffer to memory using the map () function which returns a pointer to memory containing the contents of the the video buffer. The memory returned by map () is released by calling the unmap () 函数。

The handle () of a buffer may also be used to manipulate it's contents using type specific APIs. The type of a buffer's handle is given by the handleType () 函数。

另请参阅 QVideoFrame .

成员类型文档编制

enum QAbstractVideoBuffer:: HandleType

标识视频缓冲句柄的类型。

常量 描述
QAbstractVideoBuffer::NoHandle 0 缓冲没有句柄,只能通过映射缓冲访问其数据。
QAbstractVideoBuffer::GLTextureHandle 1 The handle of the buffer is an OpenGL texture ID.
QAbstractVideoBuffer::XvShmImageHandle 2 句柄包含指向共享内存 XVideo 图像的指针。
QAbstractVideoBuffer::CoreImageHandle 3 The handle contains pointer to Mac OS X CIImage.
QAbstractVideoBuffer::QPixmapHandle 4 缓冲的句柄是 QPixmap .
QAbstractVideoBuffer::UserHandle 1000 用户定义句柄类型的起始值。

另请参阅 handleType ().

enum QAbstractVideoBuffer:: MapMode

Enumerates how a video buffer's data is mapped to memory.

常量 描述
QAbstractVideoBuffer::NotMapped 0x00 The video buffer has is not mapped to memory.
QAbstractVideoBuffer::ReadOnly 0x01 The mapped memory is populated with data from the video buffer when mapped, but the content of the mapped memory may be discarded when unmapped.
QAbstractVideoBuffer::WriteOnly 0x02 The mapped memory is uninitialized when mapped, and the content will be used to populate the video buffer when unmapped.
QAbstractVideoBuffer::ReadWrite ReadOnly | WriteOnly The mapped memory is populated with data from the video buffer, and the video buffer is repopulated with the content of the mapped memory.

另请参阅 mapMode () 和 map ().

成员函数文档编制

QAbstractVideoBuffer:: QAbstractVideoBuffer ( HandleType type )

构造抽象视频缓冲为给定 type .

[虚拟] QAbstractVideoBuffer:: ~QAbstractVideoBuffer ()

销毁抽象视频缓冲。

[虚拟] QVariant QAbstractVideoBuffer:: handle () const

返回数据缓冲的特定句柄类型。

句柄类型的给出,通过 handleType () 函数。

另请参阅 handleType ().

HandleType QAbstractVideoBuffer:: handleType () const

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

另请参阅 handle ().

[pure virtual] uchar * QAbstractVideoBuffer:: map ( MapMode mode , int * numBytes , int * bytesPerLine )

将视频缓冲内容映射到内存。

映射 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 QAbstractVideoBuffer::ReadOnly flag the mapped memory will be populated with the content of the video buffer when mapped. If the map mode includes the QAbstractVideoBuffer::WriteOnly flag the content of the mapped memory will be persisted in 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.

Returns a pointer to the mapped memory region, or a null pointer if the mapping failed. The size in bytes of the mapped memory region is returned in numBytes , and the line stride in bytesPerLine .

When access to the data is no longer needed be sure to unmap () the buffer.

注意: Writing to memory that is mapped as read-only is undefined, and may result in changes to shared data.

另请参阅 unmap () 和 mapMode ().

[pure virtual] MapMode QAbstractVideoBuffer:: mapMode () const

返回视频缓冲映射模式。

另请参阅 map ().

[pure virtual] void QAbstractVideoBuffer:: unmap ()

释放的内存映射通过 map () 函数

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

另请参阅 map ().