QAbstractVideoBuffer

The QAbstractVideoBuffer class is an abstraction for video data. More

Inheritance diagram of PySide2.QtMultimedia.QAbstractVideoBuffer

Synopsis

Functions

Virtual functions

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

class PySide2.QtMultimedia.QAbstractVideoBuffer(type)
param type

HandleType

Constructs an abstract video buffer of the given type .

PySide2.QtMultimedia.QAbstractVideoBuffer.HandleType

Identifies the type of a video buffers handle.

Constant

Description

QAbstractVideoBuffer.NoHandle

The buffer has no handle, its data can only be accessed by mapping the buffer.

QAbstractVideoBuffer.GLTextureHandle

The handle of the buffer is an OpenGL texture ID.

QAbstractVideoBuffer.XvShmImageHandle

The handle contains pointer to shared memory XVideo image.

QAbstractVideoBuffer.CoreImageHandle

The handle contains pointer to macOS CIImage.

QAbstractVideoBuffer.QPixmapHandle

The handle of the buffer is a QPixmap .

QAbstractVideoBuffer.EGLImageHandle

The handle of the buffer is an EGLImageKHR.

QAbstractVideoBuffer.UserHandle

Start value for user defined handle types.

See also

handleType()

PySide2.QtMultimedia.QAbstractVideoBuffer.MapMode

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

Constant

Description

QAbstractVideoBuffer.NotMapped

The video buffer is not mapped to memory.

QAbstractVideoBuffer.ReadOnly

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

The mapped memory is uninitialized when mapped, but the possibly modified content will be used to populate the video buffer when unmapped.

QAbstractVideoBuffer.ReadWrite

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() map()

PySide2.QtMultimedia.QAbstractVideoBuffer.m_type
PySide2.QtMultimedia.QAbstractVideoBuffer.handle()
Return type

object

Returns a type specific handle to the data buffer.

The type of the handle is given by handleType() function.

See also

handleType()

PySide2.QtMultimedia.QAbstractVideoBuffer.handleType()
Return type

HandleType

Returns the type of a video buffer’s handle.

See also

handle()

PySide2.QtMultimedia.QAbstractVideoBuffer.mapMode()
Return type

MapMode

Returns the mode a video buffer is mapped in.

See also

map()

PySide2.QtMultimedia.QAbstractVideoBuffer.release()

Releases the video buffer.

QVideoFrame calls when the buffer is not used any more and can be destroyed or returned to the buffer pool.

The default implementation deletes the buffer instance.

PySide2.QtMultimedia.QAbstractVideoBuffer.unmap()

Releases the memory mapped by the map() function.

If the MapMode included the QAbstractVideoBuffer::WriteOnly flag this will write the current content of the mapped memory back to the video frame.

See also

map()