QAbstractVideoBuffer Class
The QAbstractVideoBuffer class is an abstraction for video data. More...
| Header: | #include <QAbstractVideoBuffer> |
| qmake: | QT += multimedia |
| Inherited By: |
Public Types
| enum | HandleType { NoHandle, GLTextureHandle, XvShmImageHandle, CoreImageHandle, QPixmapHandle, …, GLTextureRectangleHandle } |
| enum | MapMode { NotMapped, ReadOnly, WriteOnly, ReadWrite } |
Detailed Description
The QVideoFrame class makes use of a QAbstractVideoBuffer internally to reference a buffer of video data. Quite often video data buffers may reside in video memory rather than system memory, and this class provides an abstraction of the location.
In addition, creating a subclass of QAbstractVideoBuffer will allow you to construct video frames from preallocated or static buffers, in cases where the QVideoFrame constructors taking a QByteArray or a QImage do not suffice. This may be necessary when implementing a new hardware accelerated video system, for example.
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 video buffer. The memory returned by map() is released by calling the unmap() function.
The handle() of a buffer may also be used to manipulate its contents using type specific APIs. The type of a buffer's handle is given by the handleType() function.
See also QVideoFrame.
Member Type Documentation
enum QAbstractVideoBuffer::HandleType
Identifies the type of a video buffers handle.
| Constant | Value | Description |
|---|---|---|
QAbstractVideoBuffer::NoHandle | 0 | The buffer has no handle, its data can only be accessed by mapping the buffer. |
QAbstractVideoBuffer::GLTextureHandle | 1 | The handle of the buffer is an OpenGL texture ID of an undefined and platform dependent target type. |
QAbstractVideoBuffer::XvShmImageHandle | 2 | The handle contains pointer to shared memory XVideo image. |
QAbstractVideoBuffer::CoreImageHandle | 3 | The handle contains pointer to macOS CIImage. |
QAbstractVideoBuffer::QPixmapHandle | 4 | The handle of the buffer is a QPixmap. |
QAbstractVideoBuffer::EGLImageHandle | 5 | The handle of the buffer is an EGLImageKHR. |
QAbstractVideoBuffer::UserHandle | 1000 | Start value for user defined handle types. |
QAbstractVideoBuffer::GLTextureRectangleHandle | 6 | The handle of the buffer is an OpenGL texture ID of target type GL_TEXTURE_RECTANGLE. |
See also handleType().
enum QAbstractVideoBuffer::MapMode
Enumerates how a video buffer's data is mapped to system memory.
| Constant | Value | Description |
|---|---|---|
QAbstractVideoBuffer::NotMapped | 0x00 | The video buffer 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, but the possibly modified 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 when it is unmapped. |
See also mapMode() and map().