Qt 4.8
Public Types | Public Functions | Static Public Functions | Properties | List of all members
QVideoFrame Class Reference

The QVideoFrame class provides a representation of a frame of video data. More...

#include <qvideoframe.h>

Public Types

enum  FieldType { ProgressiveFrame, TopField, BottomField, InterlacedFrame }
 Specifies the field an interlaced video frame belongs to. More...
 
enum  PixelFormat {
  Format_Invalid, Format_ARGB32, Format_ARGB32_Premultiplied, Format_RGB32,
  Format_RGB24, Format_RGB565, Format_RGB555, Format_ARGB8565_Premultiplied,
  Format_BGRA32, Format_BGRA32_Premultiplied, Format_BGR32, Format_BGR24,
  Format_BGR565, Format_BGR555, Format_BGRA5658_Premultiplied, Format_AYUV444,
  Format_AYUV444_Premultiplied, Format_YUV444, Format_YUV420P, Format_YV12,
  Format_UYVY, Format_YUYV, Format_NV12, Format_NV21,
  Format_IMC1, Format_IMC2, Format_IMC3, Format_IMC4,
  Format_Y8, Format_Y16, Format_User = 1000
}
 Enumerates video data types. More...
 

Public Functions

ucharbits ()
 Returns a pointer to the start of the frame data buffer. More...
 
const ucharbits () const
 Returns a pointer to the start of the frame data buffer. More...
 
int bytesPerLine () const
 Returns the number of bytes in a scan line. More...
 
qint64 endTime () const
 Returns the presentation time when a frame should stop being displayed. More...
 
FieldType fieldType () const
 Returns the field an interlaced video frame belongs to. More...
 
QVariant handle () const
 Returns a type specific handle to a video frame's buffer. More...
 
QAbstractVideoBuffer::HandleType handleType () const
 Returns the type of a video frame's handle. More...
 
int height () const
 Returns the height of a video frame. More...
 
bool isMapped () const
 Identifies if a video frame's contents are currently mapped to system memory. More...
 
bool isReadable () const
 Identifies if the mapped contents of a video frame were read from the frame when it was mapped. More...
 
bool isValid () const
 Identifies whether a video frame is valid. More...
 
bool isWritable () const
 Identifies if the mapped contents of a video frame will be persisted when the frame is unmapped. More...
 
bool map (QAbstractVideoBuffer::MapMode mode)
 Maps the contents of a video frame to memory. More...
 
QAbstractVideoBuffer::MapMode mapMode () const
 Returns the mode a video frame was mapped to system memory in. More...
 
int mappedBytes () const
 Returns the number of bytes occupied by the mapped frame data. More...
 
QVideoFrameoperator= (const QVideoFrame &other)
 Assigns the contents of other to a video frame. More...
 
PixelFormat pixelFormat () const
 Returns the color format of a video frame. More...
 
 QVideoFrame ()
 Constructs a null video frame. More...
 
 QVideoFrame (QAbstractVideoBuffer *buffer, const QSize &size, PixelFormat format)
 Constructs a video frame from a buffer of the given pixel format and size in pixels. More...
 
 QVideoFrame (int bytes, const QSize &size, int bytesPerLine, PixelFormat format)
 Constructs a video frame of the given pixel format and size in pixels. More...
 
 QVideoFrame (const QImage &image)
 Constructs a video frame from an image. More...
 
 QVideoFrame (const QVideoFrame &other)
 Constructs a copy of other. More...
 
void setEndTime (qint64 time)
 Sets the presentation time when a frame should stop being displayed. More...
 
void setFieldType (FieldType)
 Sets the field an interlaced video frame belongs to. More...
 
void setStartTime (qint64 time)
 Sets the presentation time when the frame should be displayed. More...
 
QSize size () const
 Returns the size of a video frame. More...
 
qint64 startTime () const
 Returns the presentation time when the frame should be displayed. More...
 
void unmap ()
 Releases the memory mapped by the map() function. More...
 
int width () const
 Returns the width of a video frame. More...
 
 ~QVideoFrame ()
 Destroys a video frame. More...
 

Static Public Functions

static QImage::Format imageFormatFromPixelFormat (PixelFormat format)
 Returns an image format equivalent to a video frame pixel format. More...
 
static PixelFormat pixelFormatFromImageFormat (QImage::Format format)
 Returns an video pixel format equivalent to an image format. More...
 

Properties

QExplicitlySharedDataPointer< QVideoFramePrivated
 

Detailed Description

The QVideoFrame class provides a representation of a frame of video data.

Since
4.6

A QVideoFrame encapsulates the data of a video frame, and information about the frame.

The contents of a video frame can be mapped to memory using the map() function. While mapped the video data can accessed using the bits() function which returns a pointer to a buffer, the total size of which is given by the mappedBytes(), and the size of each line is given by bytesPerLine(). The return value of the handle() function may be used to access frame data using the internal buffer's native APIs.

The video data in a QVideoFrame is encapsulated in a QAbstractVideoBuffer. A QVideoFrame may be constructed from any buffer type by subclassing the QAbstractVideoBuffer class.

Note
QVideoFrame is explicitly shared, any change made to video frame will also apply to any copies.

Definition at line 61 of file qvideoframe.h.

Enumerations

◆ FieldType

Specifies the field an interlaced video frame belongs to.

  • ProgressiveFrame The frame is not interlaced.
  • TopField The frame contains a top field.
  • BottomField The frame contains a bottom field.
  • InterlacedFrame The frame contains a merged top and bottom field.
Enumerator
ProgressiveFrame 
TopField 
BottomField 
InterlacedFrame 

Definition at line 64 of file qvideoframe.h.

◆ PixelFormat

Enumerates video data types.

  • Format_Invalid The frame is invalid.
  • Format_ARGB32 The frame is stored using a 32-bit ARGB format (0xAARRGGBB). This is equivalent to QImage::Format_ARGB32.
  • Format_RGB32 The frame stored using a 32-bit RGB format (0xffRRGGBB). This is equivalent to QImage::Format_RGB32
  • Format_RGB24 The frame is stored using a 24-bit RGB format (8-8-8). This is equivalent to QImage::Format_RGB888
  • Format_RGB565 The frame is stored using a 16-bit RGB format (5-6-5). This is equivalent to QImage::Format_RGB16.
  • Format_RGB555 The frame is stored using a 16-bit RGB format (5-5-5). This is equivalent to QImage::Format_RGB555.
  • Format_ARGB8565_Premultiplied The frame is stored using a 24-bit premultiplied ARGB format (8-6-6-5).
  • Format_BGRA32 The frame is stored using a 32-bit ARGB format (0xBBGGRRAA).
  • Format_BGRA32_Premultiplied The frame is stored using a premultiplied 32bit BGRA format.
  • Format_BGR32 The frame is stored using a 32-bit BGR format (0xBBGGRRff).
  • Format_BGR24 The frame is stored using a 24-bit BGR format (0xBBGGRR).
  • Format_BGR565 The frame is stored using a 16-bit BGR format (5-6-5).
  • Format_BGR555 The frame is stored using a 16-bit BGR format (5-5-5).
  • Format_BGRA5658_Premultiplied The frame is stored using a 24-bit premultiplied BGRA format (5-6-5-8).
  • Format_AYUV444 The frame is stored using a packed 32-bit AYUV format (0xAAYYUUVV).
  • Format_AYUV444_Premultiplied The frame is stored using a packed premultiplied 32-bit AYUV format (0xAAYYUUVV).
  • Format_YUV444 The frame is stored using a 24-bit packed YUV format (8-8-8).
  • Format_YUV420P The frame is stored using an 8-bit per component planar YUV format with the U and V planes horizontally and vertically sub-sampled, i.e. the height and width of the U and V planes are half that of the Y plane.
  • Format_YV12 The frame is stored using an 8-bit per component planar YVU format with the V and U planes horizontally and vertically sub-sampled, i.e. the height and width of the V and U planes are half that of the Y plane.
  • Format_UYVY The frame is stored using an 8-bit per component packed YUV format with the U and V planes horizontally sub-sampled (U-Y-V-Y), i.e. two horizontally adjacent pixels are stored as a 32-bit macropixel which has a Y value for each pixel and common U and V values.
  • Format_YUYV The frame is stored using an 8-bit per component packed YUV format with the U and V planes horizontally sub-sampled (Y-U-Y-V), i.e. two horizontally adjacent pixels are stored as a 32-bit macropixel which has a Y value for each pixel and common U and V values.
  • Format_NV12 The frame is stored using an 8-bit per component semi-planar YUV format with a Y plane (Y) followed by a horizontally and vertically sub-sampled, packed UV plane (U-V).
  • Format_NV21 The frame is stored using an 8-bit per component semi-planar YUV format with a Y plane (Y) followed by a horizontally and vertically sub-sampled, packed VU plane (V-U).
  • Format_IMC1 The frame is stored using an 8-bit per component planar YUV format with the U and V planes horizontally and vertically sub-sampled. This is similar to the Format_YUV420P type, except that the bytes per line of the U and V planes are padded out to the same stride as the Y plane.
  • Format_IMC2 The frame is stored using an 8-bit per component planar YUV format with the U and V planes horizontally and vertically sub-sampled. This is similar to the Format_YUV420P type, except that the lines of the U and V planes are interleaved, i.e. each line of U data is followed by a line of V data creating a single line of the same stride as the Y data.
  • Format_IMC3 The frame is stored using an 8-bit per component planar YVU format with the V and U planes horizontally and vertically sub-sampled. This is similar to the Format_YV12 type, except that the bytes per line of the V and U planes are padded out to the same stride as the Y plane.
  • Format_IMC4 The frame is stored using an 8-bit per component planar YVU format with the V and U planes horizontally and vertically sub-sampled. This is similar to the Format_YV12 type, except that the lines of the V and U planes are interleaved, i.e. each line of V data is followed by a line of U data creating a single line of the same stride as the Y data.
  • Format_Y8 The frame is stored using an 8-bit greyscale format.
  • Format_Y16 The frame is stored using a 16-bit linear greyscale format. Little endian.
  • Format_User Start value for user defined pixel formats.
Enumerator
Format_Invalid 
Format_ARGB32 
Format_ARGB32_Premultiplied 
Format_RGB32 
Format_RGB24 
Format_RGB565 
Format_RGB555 
Format_ARGB8565_Premultiplied 
Format_BGRA32 
Format_BGRA32_Premultiplied 
Format_BGR32 
Format_BGR24 
Format_BGR565 
Format_BGR555 
Format_BGRA5658_Premultiplied 
Format_AYUV444 
Format_AYUV444_Premultiplied 
Format_YUV444 
Format_YUV420P 
Format_YV12 
Format_UYVY 
Format_YUYV 
Format_NV12 
Format_NV21 
Format_IMC1 
Format_IMC2 
Format_IMC3 
Format_IMC4 
Format_Y8 
Format_Y16 
Format_User 

Definition at line 72 of file qvideoframe.h.

73  {
89 
100  Format_IMC2,
101  Format_IMC3,
102  Format_IMC4,
103  Format_Y8,
104  Format_Y16,
105 
106  Format_User = 1000
107  };

Constructors and Destructors

◆ QVideoFrame() [1/5]

QVideoFrame::QVideoFrame ( )

Constructs a null video frame.

Definition at line 271 of file qvideoframe.cpp.

272  : d(new QVideoFramePrivate)
273 {
274 }
QExplicitlySharedDataPointer< QVideoFramePrivate > d
Definition: qvideoframe.h:158

◆ QVideoFrame() [2/5]

QVideoFrame::QVideoFrame ( QAbstractVideoBuffer buffer,
const QSize size,
PixelFormat  format 
)

Constructs a video frame from a buffer of the given pixel format and size in pixels.

Note
This doesn't increment the reference count of the video buffer.

Definition at line 282 of file qvideoframe.cpp.

284  : d(new QVideoFramePrivate(size, format))
285 {
286  d->buffer = buffer;
287 }
QAbstractVideoBuffer * buffer
Definition: qvideoframe.cpp:96
QExplicitlySharedDataPointer< QVideoFramePrivate > d
Definition: qvideoframe.h:158

◆ QVideoFrame() [3/5]

QVideoFrame::QVideoFrame ( int  bytes,
const QSize size,
int  bytesPerLine,
PixelFormat  format 
)

Constructs a video frame of the given pixel format and size in pixels.

The bytesPerLine (stride) is the length of each scan line in bytes, and bytes is the total number of bytes that must be allocated for the frame.

Definition at line 296 of file qvideoframe.cpp.

297  : d(new QVideoFramePrivate(size, format))
298 {
299  if (bytes > 0) {
301  data.resize(bytes);
302 
303  // Check the memory was successfully allocated.
304  if (!data.isEmpty())
305  d->buffer = new QMemoryVideoBuffer(data, bytesPerLine);
306  }
307 }
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
int bytesPerLine() const
Returns the number of bytes in a scan line.
QAbstractVideoBuffer * buffer
Definition: qvideoframe.cpp:96
static const char * data(const QByteArray &arr)
The QMemoryVideoBuffer class provides a system memory allocated video data buffer.
void resize(int size)
Sets the size of the byte array to size bytes.
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
Definition: qbytearray.h:421
QExplicitlySharedDataPointer< QVideoFramePrivate > d
Definition: qvideoframe.h:158

◆ QVideoFrame() [4/5]

QVideoFrame::QVideoFrame ( const QImage image)

Constructs a video frame from an image.

Note
This will construct an invalid video frame if there is no frame type equivalent to the image format.
See also
pixelFormatFromImageFormat()

Definition at line 318 of file qvideoframe.cpp.

319  : d(new QVideoFramePrivate(
320  image.size(), pixelFormatFromImageFormat(image.format())))
321 {
322  if (d->pixelFormat != Format_Invalid)
323  d->buffer = new QImageVideoBuffer(image);
324 }
static PixelFormat pixelFormatFromImageFormat(QImage::Format format)
Returns an video pixel format equivalent to an image format.
Format format() const
Returns the format of the image.
Definition: qimage.cpp:2305
QAbstractVideoBuffer * buffer
Definition: qvideoframe.cpp:96
QSize size() const
Returns the size of the image, i.
Definition: qimage.cpp:1587
QVideoFrame::PixelFormat pixelFormat
Definition: qvideoframe.cpp:94
QExplicitlySharedDataPointer< QVideoFramePrivate > d
Definition: qvideoframe.h:158

◆ QVideoFrame() [5/5]

QVideoFrame::QVideoFrame ( const QVideoFrame other)

Constructs a copy of other.

Definition at line 330 of file qvideoframe.cpp.

331  : d(other.d)
332 {
333 }
QExplicitlySharedDataPointer< QVideoFramePrivate > d
Definition: qvideoframe.h:158

◆ ~QVideoFrame()

QVideoFrame::~QVideoFrame ( )

Destroys a video frame.

Definition at line 350 of file qvideoframe.cpp.

351 {
352 }

Functions

◆ bits() [1/2]

uchar * QVideoFrame::bits ( )

Returns a pointer to the start of the frame data buffer.

This value is only valid while the frame data is map(){mapped}.

See also
map(), mappedBytes(), bytesPerLine()

Definition at line 575 of file qvideoframe.cpp.

576 {
577  return d->data;
578 }
QExplicitlySharedDataPointer< QVideoFramePrivate > d
Definition: qvideoframe.h:158

◆ bits() [2/2]

const uchar * QVideoFrame::bits ( ) const

Returns a pointer to the start of the frame data buffer.

This value is only valid while the frame data is map(){mapped}.

See also
map(), mappedBytes(), bytesPerLine()

Definition at line 588 of file qvideoframe.cpp.

589 {
590  return d->data;
591 }
QExplicitlySharedDataPointer< QVideoFramePrivate > d
Definition: qvideoframe.h:158

◆ bytesPerLine()

int QVideoFrame::bytesPerLine ( ) const

Returns the number of bytes in a scan line.

Note
This is the bytes per line of the first plane only. The bytes per line of subsequent planes should be calculated as per the frame type.

This value is only valid while the frame data is map(){mapped}.

See also
bits(), map(), mappedBytes()

Definition at line 562 of file qvideoframe.cpp.

563 {
564  return d->bytesPerLine;
565 }
QExplicitlySharedDataPointer< QVideoFramePrivate > d
Definition: qvideoframe.h:158

◆ endTime()

qint64 QVideoFrame::endTime ( ) const

Returns the presentation time when a frame should stop being displayed.

Definition at line 641 of file qvideoframe.cpp.

642 {
643  return d->endTime;
644 }
QExplicitlySharedDataPointer< QVideoFramePrivate > d
Definition: qvideoframe.h:158

◆ fieldType()

QVideoFrame::FieldType QVideoFrame::fieldType ( ) const

Returns the field an interlaced video frame belongs to.

If the video is not interlaced this will return WholeFrame.

Definition at line 418 of file qvideoframe.cpp.

419 {
420  return d->fieldType;
421 }
QVideoFrame::FieldType fieldType
Definition: qvideoframe.cpp:95
QExplicitlySharedDataPointer< QVideoFramePrivate > d
Definition: qvideoframe.h:158

◆ handle()

QVariant QVideoFrame::handle ( ) const

Returns a type specific handle to a video frame's buffer.

For an OpenGL texture this would be the texture ID.

See also
QAbstractVideoBuffer::handle()

Definition at line 614 of file qvideoframe.cpp.

615 {
616  return d->buffer != 0 ? d->buffer->handle() : QVariant();
617 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
QAbstractVideoBuffer * buffer
Definition: qvideoframe.cpp:96
virtual QVariant handle() const
Returns a type specific handle to the data buffer.
QExplicitlySharedDataPointer< QVideoFramePrivate > d
Definition: qvideoframe.h:158

◆ handleType()

QAbstractVideoBuffer::HandleType QVideoFrame::handleType ( ) const

Returns the type of a video frame's handle.

Definition at line 380 of file qvideoframe.cpp.

381 {
383 }
QAbstractVideoBuffer * buffer
Definition: qvideoframe.cpp:96
QExplicitlySharedDataPointer< QVideoFramePrivate > d
Definition: qvideoframe.h:158
HandleType handleType() const
Returns the type of a video buffer&#39;s handle.

◆ height()

int QVideoFrame::height ( ) const

Returns the height of a video frame.

Definition at line 407 of file qvideoframe.cpp.

408 {
409  return d->size.height();
410 }
int height() const
Returns the height.
Definition: qsize.h:129
QExplicitlySharedDataPointer< QVideoFramePrivate > d
Definition: qvideoframe.h:158

◆ imageFormatFromPixelFormat()

QImage::Format QVideoFrame::imageFormatFromPixelFormat ( PixelFormat  format)
static

Returns an image format equivalent to a video frame pixel format.

If there is no equivalent format QImage::Format_Invalid is returned instead.

Definition at line 701 of file qvideoframe.cpp.

702 {
703  switch (format) {
704  case Format_Invalid:
705  return QImage::Format_Invalid;
706  case Format_ARGB32:
707  return QImage::Format_ARGB32;
710  case Format_RGB32:
711  return QImage::Format_RGB32;
712  case Format_RGB24:
713  return QImage::Format_RGB888;
714  case Format_RGB565:
715  return QImage::Format_RGB16;
716  case Format_RGB555:
717  return QImage::Format_RGB555;
720  case Format_BGRA32:
722  case Format_BGR32:
723  case Format_BGR24:
724  return QImage::Format_Invalid;
725  case Format_BGR565:
726  case Format_BGR555:
728  case Format_AYUV444:
730  case Format_YUV444:
731  case Format_YUV420P:
732  case Format_YV12:
733  case Format_UYVY:
734  case Format_YUYV:
735  case Format_NV12:
736  case Format_NV21:
737  case Format_IMC1:
738  case Format_IMC2:
739  case Format_IMC3:
740  case Format_IMC4:
741  case Format_Y8:
742  case Format_Y16:
743  return QImage::Format_Invalid;
744  case Format_User:
745  return QImage::Format_Invalid;
746  }
747  return QImage::Format_Invalid;
748 }

◆ isMapped()

bool QVideoFrame::isMapped ( ) const

Identifies if a video frame's contents are currently mapped to system memory.

This is a convenience function which checks that the QAbstractVideoBuffer::MapMode{MapMode} of the frame is not equal to QAbstractVideoBuffer::NotMapped.

Returns true if the contents of the video frame are mapped to system memory, and false otherwise.

See also
mapMode() QAbstractVideoBuffer::MapMode

Definition at line 444 of file qvideoframe.cpp.

445 {
446  return d->buffer != 0 && d->buffer->mapMode() != QAbstractVideoBuffer::NotMapped;
447 }
QAbstractVideoBuffer * buffer
Definition: qvideoframe.cpp:96
virtual MapMode mapMode() const =0
Returns the mode a video buffer is mapped in.
QExplicitlySharedDataPointer< QVideoFramePrivate > d
Definition: qvideoframe.h:158

◆ isReadable()

bool QVideoFrame::isReadable ( ) const

Identifies if the mapped contents of a video frame were read from the frame when it was mapped.

This is a convenience function which checks if the QAbstractVideoBuffer::MapMode{MapMode} contains the QAbstractVideoBuffer::WriteOnly flag.

Returns true if the contents of the mapped memory were read from the video frame, and false otherwise.

See also
mapMode(), QAbstractVideoBuffer::MapMode

Definition at line 481 of file qvideoframe.cpp.

482 {
483  return d->buffer != 0 && (d->buffer->mapMode() & QAbstractVideoBuffer::ReadOnly);
484 }
QAbstractVideoBuffer * buffer
Definition: qvideoframe.cpp:96
virtual MapMode mapMode() const =0
Returns the mode a video buffer is mapped in.
QExplicitlySharedDataPointer< QVideoFramePrivate > d
Definition: qvideoframe.h:158

◆ isValid()

bool QVideoFrame::isValid ( ) const

Identifies whether a video frame is valid.

An invalid frame has no video buffer associated with it.

Returns true if the frame is valid, and false if it is not.

Definition at line 362 of file qvideoframe.cpp.

363 {
364  return d->buffer != 0;
365 }
QAbstractVideoBuffer * buffer
Definition: qvideoframe.cpp:96
QExplicitlySharedDataPointer< QVideoFramePrivate > d
Definition: qvideoframe.h:158

◆ isWritable()

bool QVideoFrame::isWritable ( ) const

Identifies if the mapped contents of a video frame will be persisted when the frame is unmapped.

This is a convenience function which checks if the QAbstractVideoBuffer::MapMode{MapMode} contains the QAbstractVideoBuffer::WriteOnly flag.

Returns true if the video frame will be updated when unmapped, and false otherwise.

Note
The result of altering the data of a frame that is mapped in read-only mode is undefined. Depending on the buffer implementation the changes may be persisted, or worse alter a shared buffer.
See also
mapMode(), QAbstractVideoBuffer::MapMode

Definition at line 464 of file qvideoframe.cpp.

465 {
466  return d->buffer != 0 && (d->buffer->mapMode() & QAbstractVideoBuffer::WriteOnly);
467 }
QAbstractVideoBuffer * buffer
Definition: qvideoframe.cpp:96
virtual MapMode mapMode() const =0
Returns the mode a video buffer is mapped in.
QExplicitlySharedDataPointer< QVideoFramePrivate > d
Definition: qvideoframe.h:158

◆ map()

bool QVideoFrame::map ( QAbstractVideoBuffer::MapMode  mode)

Maps the contents of a video frame to memory.

The map mode indicates whether the contents of the mapped memory should be read from and/or written to the frame. If the map mode includes the QAbstractVideoBuffer::ReadOnly flag the mapped memory will be populated with the content of the video frame when mapped. If the map mode inclues the QAbstractVideoBuffer::WriteOnly flag the content of the mapped memory will be persisted in the frame when unmapped.

While mapped the contents of a video frame can be accessed directly through the pointer returned by the bits() function.

When access to the data is no longer needed be sure to call the unmap() function to release the mapped memory.

Returns true if the buffer was mapped to memory in the given mode and false otherwise.

See also
unmap(), mapMode(), bits()

Definition at line 517 of file qvideoframe.cpp.

518 {
519  if (d->buffer != 0 && d->data == 0) {
520  Q_ASSERT(d->bytesPerLine == 0);
521  Q_ASSERT(d->mappedBytes == 0);
522 
523  d->data = d->buffer->map(mode, &d->mappedBytes, &d->bytesPerLine);
524 
525  return d->data != 0;
526  }
527 
528  return false;
529 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QAbstractVideoBuffer * buffer
Definition: qvideoframe.cpp:96
virtual uchar * map(MapMode mode, int *numBytes, int *bytesPerLine)=0
Maps the contents of a video buffer to memory.
QExplicitlySharedDataPointer< QVideoFramePrivate > d
Definition: qvideoframe.h:158

◆ mapMode()

QAbstractVideoBuffer::MapMode QVideoFrame::mapMode ( ) const

Returns the mode a video frame was mapped to system memory in.

See also
map(), QAbstractVideoBuffer::MapMode

Definition at line 492 of file qvideoframe.cpp.

493 {
495 }
QAbstractVideoBuffer * buffer
Definition: qvideoframe.cpp:96
virtual MapMode mapMode() const =0
Returns the mode a video buffer is mapped in.
QExplicitlySharedDataPointer< QVideoFramePrivate > d
Definition: qvideoframe.h:158

◆ mappedBytes()

int QVideoFrame::mappedBytes ( ) const

Returns the number of bytes occupied by the mapped frame data.

This value is only valid while the frame data is map(){mapped}.

See also
map()

Definition at line 601 of file qvideoframe.cpp.

602 {
603  return d->mappedBytes;
604 }
QExplicitlySharedDataPointer< QVideoFramePrivate > d
Definition: qvideoframe.h:158

◆ operator=()

QVideoFrame & QVideoFrame::operator= ( const QVideoFrame other)

Assigns the contents of other to a video frame.

Definition at line 339 of file qvideoframe.cpp.

340 {
341  d = other.d;
342 
343  return *this;
344 }
QExplicitlySharedDataPointer< QVideoFramePrivate > d
Definition: qvideoframe.h:158

◆ pixelFormat()

QVideoFrame::PixelFormat QVideoFrame::pixelFormat ( ) const

Returns the color format of a video frame.

Definition at line 371 of file qvideoframe.cpp.

372 {
373  return d->pixelFormat;
374 }
QVideoFrame::PixelFormat pixelFormat
Definition: qvideoframe.cpp:94
QExplicitlySharedDataPointer< QVideoFramePrivate > d
Definition: qvideoframe.h:158

◆ pixelFormatFromImageFormat()

QVideoFrame::PixelFormat QVideoFrame::pixelFormatFromImageFormat ( QImage::Format  format)
static

Returns an video pixel format equivalent to an image format.

If there is no equivalent format QVideoFrame::InvalidType is returned instead.

Definition at line 660 of file qvideoframe.cpp.

661 {
662  switch (format) {
664  case QImage::Format_Mono:
667  return Format_Invalid;
669  return Format_RGB32;
671  return Format_ARGB32;
675  return Format_RGB565;
680  return Format_Invalid;
682  return Format_RGB555;
684  return Format_Invalid;
686  return Format_RGB24;
689  return Format_Invalid;
690  case QImage::NImageFormats:
691  return Format_Invalid;
692  }
693  return Format_Invalid;
694 }

◆ setEndTime()

void QVideoFrame::setEndTime ( qint64  time)

Sets the presentation time when a frame should stop being displayed.

Definition at line 650 of file qvideoframe.cpp.

651 {
652  d->endTime = time;
653 }
QExplicitlySharedDataPointer< QVideoFramePrivate > d
Definition: qvideoframe.h:158

◆ setFieldType()

void QVideoFrame::setFieldType ( QVideoFrame::FieldType  field)

Sets the field an interlaced video frame belongs to.

Definition at line 427 of file qvideoframe.cpp.

428 {
429  d->fieldType = field;
430 }
QVideoFrame::FieldType fieldType
Definition: qvideoframe.cpp:95
QExplicitlySharedDataPointer< QVideoFramePrivate > d
Definition: qvideoframe.h:158

◆ setStartTime()

void QVideoFrame::setStartTime ( qint64  time)

Sets the presentation time when the frame should be displayed.

Definition at line 632 of file qvideoframe.cpp.

633 {
634  d->startTime = time;
635 }
QExplicitlySharedDataPointer< QVideoFramePrivate > d
Definition: qvideoframe.h:158

◆ size()

QSize QVideoFrame::size ( ) const

Returns the size of a video frame.

Definition at line 389 of file qvideoframe.cpp.

390 {
391  return d->size;
392 }
QExplicitlySharedDataPointer< QVideoFramePrivate > d
Definition: qvideoframe.h:158

◆ startTime()

qint64 QVideoFrame::startTime ( ) const

Returns the presentation time when the frame should be displayed.

Definition at line 623 of file qvideoframe.cpp.

624 {
625  return d->startTime;
626 }
QExplicitlySharedDataPointer< QVideoFramePrivate > d
Definition: qvideoframe.h:158

◆ unmap()

void QVideoFrame::unmap ( )

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

Definition at line 540 of file qvideoframe.cpp.

541 {
542  if (d->data != 0) {
543  d->mappedBytes = 0;
544  d->bytesPerLine = 0;
545  d->data = 0;
546 
547  d->buffer->unmap();
548  }
549 }
virtual void unmap()=0
Releases the memory mapped by the map() function.
QAbstractVideoBuffer * buffer
Definition: qvideoframe.cpp:96
QExplicitlySharedDataPointer< QVideoFramePrivate > d
Definition: qvideoframe.h:158

◆ width()

int QVideoFrame::width ( ) const

Returns the width of a video frame.

Definition at line 398 of file qvideoframe.cpp.

399 {
400  return d->size.width();
401 }
int width() const
Returns the width.
Definition: qsize.h:126
QExplicitlySharedDataPointer< QVideoFramePrivate > d
Definition: qvideoframe.h:158

Properties

◆ d


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