Qt 4.8
Public Types | Public Functions | Protected Functions | Protected Variables | List of all members
QAbstractVideoBuffer Class Referenceabstract

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

#include <qabstractvideobuffer.h>

Inheritance diagram for QAbstractVideoBuffer:
QImageVideoBuffer QMemoryVideoBuffer

Public Types

enum  HandleType {
  NoHandle, GLTextureHandle, XvShmImageHandle, CoreImageHandle,
  QPixmapHandle, UserHandle = 1000
}
 Identifies the type of a video buffers handle. More...
 
enum  MapMode { NotMapped = 0x00, ReadOnly = 0x01, WriteOnly = 0x02, ReadWrite = ReadOnly | WriteOnly }
 Enumerates how a video buffer's data is mapped to memory. More...
 

Public Functions

virtual QVariant handle () const
 Returns a type specific handle to the data buffer. More...
 
HandleType handleType () const
 Returns the type of a video buffer's handle. More...
 
virtual ucharmap (MapMode mode, int *numBytes, int *bytesPerLine)=0
 Maps the contents of a video buffer to memory. More...
 
virtual MapMode mapMode () const =0
 Returns the mode a video buffer is mapped in. More...
 
 QAbstractVideoBuffer (HandleType type)
 Constructs an abstract video buffer of the given type. More...
 
virtual void unmap ()=0
 Releases the memory mapped by the map() function. More...
 
virtual ~QAbstractVideoBuffer ()
 Destroys an abstract video buffer. More...
 

Protected Functions

 QAbstractVideoBuffer (QAbstractVideoBufferPrivate &dd, HandleType type)
 

Protected Variables

QAbstractVideoBufferPrivated_ptr
 

Detailed Description

The QAbstractVideoBuffer class is an abstraction for video data.

Since
4.6

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

Definition at line 57 of file qabstractvideobuffer.h.

Enumerations

◆ HandleType

Identifies the type of a video buffers handle.

  • NoHandle The buffer has no handle, its data can only be accessed by mapping the buffer.
  • GLTextureHandle The handle of the buffer is an OpenGL texture ID.
  • XvShmImageHandle The handle contains pointer to shared memory XVideo image.
  • CoreImageHandle The handle contains pointer to Mac OS X CIImage.
  • QPixmapHandle The handle of the buffer is a QPixmap.
  • UserHandle Start value for user defined handle types.
See also
handleType()
Enumerator
NoHandle 
GLTextureHandle 
XvShmImageHandle 
CoreImageHandle 
QPixmapHandle 
UserHandle 

Definition at line 60 of file qabstractvideobuffer.h.

◆ MapMode

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

  • NotMapped The video buffer has is not mapped to memory.
  • 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.
  • WriteOnly The mapped memory is uninitialized when mapped, and the content will be used to populate the video buffer when unmapped.
  • 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.
See also
mapMode(), map()
Enumerator
NotMapped 
ReadOnly 
WriteOnly 
ReadWrite 

Definition at line 70 of file qabstractvideobuffer.h.

Constructors and Destructors

◆ QAbstractVideoBuffer() [1/2]

QAbstractVideoBuffer::QAbstractVideoBuffer ( HandleType  type)

Constructs an abstract video buffer of the given type.

Definition at line 111 of file qabstractvideobuffer.cpp.

113 {
115 
116  d->handleType = type;
117 }
double d
Definition: qnumeric_p.h:62
int type
Definition: qmetatype.cpp:239
QAbstractVideoBufferPrivate * d_ptr
#define Q_D(Class)
Definition: qglobal.h:2482
The QAbstractVideoBuffer class is an abstraction for video data.

◆ ~QAbstractVideoBuffer()

QAbstractVideoBuffer::~QAbstractVideoBuffer ( )
virtual

Destroys an abstract video buffer.

Definition at line 135 of file qabstractvideobuffer.cpp.

136 {
137  delete d_ptr;
138 }
QAbstractVideoBufferPrivate * d_ptr

◆ QAbstractVideoBuffer() [2/2]

QAbstractVideoBuffer::QAbstractVideoBuffer ( QAbstractVideoBufferPrivate dd,
HandleType  type 
)
protected
Warning
This function is not part of the public interface.

Definition at line 123 of file qabstractvideobuffer.cpp.

124  : d_ptr(&dd)
125 {
127 
128  d->handleType = type;
129 }
double d
Definition: qnumeric_p.h:62
int type
Definition: qmetatype.cpp:239
QAbstractVideoBufferPrivate * d_ptr
#define Q_D(Class)
Definition: qglobal.h:2482
The QAbstractVideoBuffer class is an abstraction for video data.

Functions

◆ handle()

QVariant QAbstractVideoBuffer::handle ( ) const
virtual

Returns a type specific handle to the data buffer.

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

See also
handleType()

Definition at line 210 of file qabstractvideobuffer.cpp.

Referenced by QVideoFrame::handle().

211 {
212  return QVariant();
213 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92

◆ handleType()

QAbstractVideoBuffer::HandleType QAbstractVideoBuffer::handleType ( ) const

Returns the type of a video buffer's handle.

See also
handle()

Definition at line 146 of file qabstractvideobuffer.cpp.

Referenced by QVideoFrame::handleType().

147 {
148  return d_func()->handleType;
149 }

◆ map()

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.
See also
unmap(), mapMode()

Implemented in QMemoryVideoBuffer, and QImageVideoBuffer.

Referenced by QVideoFrame::map().

◆ mapMode()

QAbstractVideoBuffer::mapMode ( ) const
pure virtual

Returns the mode a video buffer is mapped in.

See also
map()

Implemented in QMemoryVideoBuffer, and QImageVideoBuffer.

Referenced by QVideoFrame::isMapped(), QVideoFrame::isReadable(), QVideoFrame::isWritable(), and QVideoFrame::mapMode().

◆ unmap()

QAbstractVideoBuffer::unmap ( )
pure virtual

Releases the memory mapped by the map() function.

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

See also
map()

Implemented in QMemoryVideoBuffer, and QImageVideoBuffer.

Referenced by QVideoFrame::unmap().

Properties

◆ d_ptr

QAbstractVideoBufferPrivate* QAbstractVideoBuffer::d_ptr
protected

Definition at line 93 of file qabstractvideobuffer.h.

Referenced by ~QAbstractVideoBuffer().


The documentation for this class was generated from the following files: