QtMobility Reference Documentation

QAbstractVideoBuffer Class Reference

The QAbstractVideoBuffer class is an abstraction for video data. More...

 #include <QAbstractVideoBuffer>

This class was introduced in Qt Mobility 1.0.

Public Types

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

Public Functions

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

Detailed Description

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() function.

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() function.

See also QVideoFrame.

Member Type Documentation

enum QAbstractVideoBuffer::HandleType

Identifies the type of a video buffers handle.

ConstantValueDescription
QAbstractVideoBuffer::NoHandle0The buffer has no handle, its data can only be accessed by mapping the buffer.
QAbstractVideoBuffer::GLTextureHandle1The handle of the buffer is an OpenGL texture ID.
QAbstractVideoBuffer::XvShmImageHandle2The handle contains pointer to shared memory XVideo image.
QAbstractVideoBuffer::CoreImageHandle3The handle contains pointer to Mac OS X CIImage.
QAbstractVideoBuffer::QPixmapHandle4The handle of the buffer is a QPixmap.
QAbstractVideoBuffer::UserHandle1000Start value for user defined handle types.

See also handleType().

enum QAbstractVideoBuffer::MapMode

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

ConstantValueDescription
QAbstractVideoBuffer::NotMapped0x00The video buffer has is not mapped to memory.
QAbstractVideoBuffer::ReadOnly0x01The 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::WriteOnly0x02The mapped memory is uninitialized when mapped, and the content will be used to populate the video buffer when unmapped.
QAbstractVideoBuffer::ReadWriteReadOnly | WriteOnlyThe mapped memory is populated with data from the video buffer, and the video buffer is repopulated with the content of the mapped memory.

See also mapMode() and map().

Member Function Documentation

QAbstractVideoBuffer::QAbstractVideoBuffer ( HandleType type )

Constructs an abstract video buffer of the given type.

QAbstractVideoBuffer::~QAbstractVideoBuffer () [virtual]

Destroys an abstract video buffer.

QVariant QAbstractVideoBuffer::handle () const [virtual]

Returns a type specific handle to the data buffer.

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

This function was introduced in Qt Mobility 1.0.

See also handleType().

HandleType QAbstractVideoBuffer::handleType () const

Returns the type of a video buffer's handle.

This function was introduced in Qt Mobility 1.0.

See also handle().

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

Maps the contents of a video buffer to memory.

The map 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.

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

This function was introduced in Qt Mobility 1.0.

See also unmap() and mapMode().

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

Returns the mode a video buffer is mapped in.

This function was introduced in Qt Mobility 1.0.

See also map().

void QAbstractVideoBuffer::unmap () [pure virtual]

Releases the memory mapped by the map() function

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

This function was introduced in Qt Mobility 1.0.

See also map().

X

Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.