Qt 4.8
Public Functions | List of all members
QImageVideoBuffer Class Reference

#include <qimagevideobuffer_p.h>

Inheritance diagram for QImageVideoBuffer:
QAbstractVideoBuffer

Public Functions

ucharmap (MapMode mode, int *numBytes, int *bytesPerLine)
 Maps the contents of a video buffer to memory. More...
 
MapMode mapMode () const
 Returns the mode a video buffer is mapped in. More...
 
 QImageVideoBuffer (const QImage &image)
 
void unmap ()
 Releases the memory mapped by the map() function. More...
 
 ~QImageVideoBuffer ()
 
- Public Functions inherited from QAbstractVideoBuffer
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...
 
 QAbstractVideoBuffer (HandleType type)
 Constructs an abstract video buffer of the given type. More...
 
virtual ~QAbstractVideoBuffer ()
 Destroys an abstract video buffer. More...
 

Additional Inherited Members

- Public Types inherited from QAbstractVideoBuffer
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...
 
- Protected Functions inherited from QAbstractVideoBuffer
 QAbstractVideoBuffer (QAbstractVideoBufferPrivate &dd, HandleType type)
 
- Protected Variables inherited from QAbstractVideoBuffer
QAbstractVideoBufferPrivated_ptr
 

Detailed Description

Definition at line 64 of file qimagevideobuffer_p.h.

Constructors and Destructors

◆ QImageVideoBuffer()

QImageVideoBuffer::QImageVideoBuffer ( const QImage image)

Definition at line 63 of file qimagevideobuffer.cpp.

65 {
67 
68  d->image = image;
69 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
QAbstractVideoBuffer(HandleType type)
Constructs an abstract video buffer of the given type.

◆ ~QImageVideoBuffer()

QImageVideoBuffer::~QImageVideoBuffer ( )

Definition at line 71 of file qimagevideobuffer.cpp.

72 {
73 }

Functions

◆ map()

uchar * QImageVideoBuffer::map ( MapMode  mode,
int *  numBytes,
int *  bytesPerLine 
)
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()

Implements QAbstractVideoBuffer.

Definition at line 80 of file qimagevideobuffer.cpp.

81 {
83 
84  if (d->mapMode == NotMapped && d->image.bits() && mode != NotMapped) {
85  d->mapMode = mode;
86 
87  if (numBytes)
88  *numBytes = d->image.byteCount();
89 
90  if (bytesPerLine)
91  *bytesPerLine = d->image.bytesPerLine();
92 
93  return d->image.bits();
94  } else {
95  return 0;
96  }
97 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ mapMode()

QAbstractVideoBuffer::MapMode QImageVideoBuffer::mapMode ( ) const
virtual

Returns the mode a video buffer is mapped in.

See also
map()

Implements QAbstractVideoBuffer.

Definition at line 75 of file qimagevideobuffer.cpp.

76 {
77  return d_func()->mapMode;
78 }

◆ unmap()

void QImageVideoBuffer::unmap ( )
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()

Implements QAbstractVideoBuffer.

Definition at line 99 of file qimagevideobuffer.cpp.

100 {
102 
103  d->mapMode = NotMapped;
104 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

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