Miam-Player  0.8.0
A nice music player
QtAV::VideoFrame Class Reference

#include <VideoFrame.h>

Inheritance diagram for QtAV::VideoFrame:
QtAV::Frame

Public Member Functions

 VideoFrame ()
 
 VideoFrame (int width, int height, const VideoFormat &format, const QByteArray &data=QByteArray())
 
 VideoFrame (const QImage &image)
 
 VideoFrame (const VideoFrame &other)
 
 ~VideoFrame ()
 
VideoFrameoperator= (const VideoFrame &other)
 
int channelCount () const Q_DECL_OVERRIDE
 channelCount for audio, channel count equals plane count for video, channels >= planes More...
 
VideoFrame clone () const
 Deep copy. More...
 
VideoFormat format () const
 
VideoFormat::PixelFormat pixelFormat () const
 
QImage::Format imageFormat () const
 
int pixelFormatFFmpeg () const
 
bool isValid () const
 
 operator bool () const
 
QSize size () const
 
int width () const
 
int height () const
 
int effectivePlaneWidth (int plane) const
 
int planeWidth (int plane) const
 
int planeHeight (int plane) const
 
float displayAspectRatio () const
 
void setDisplayAspectRatio (float displayAspectRatio)
 
ColorSpace colorSpace () const
 
void setColorSpace (ColorSpace value)
 
ColorRange colorRange () const
 
void setColorRange (ColorRange value)
 
int effectiveBytesPerLine (int plane) const
 effectiveBytesPerLine The plane bytes contains valid image data without padded data for alignment reason More...
 
QImage toImage (QImage::Format fmt=QImage::Format_ARGB32, const QSize &dstSize=QSize(), const QRectF &roi=QRect()) const
 toImage Return a QImage of current video frame, with given format, image size and region of interest. More...
 
VideoFrame to (VideoFormat::PixelFormat pixfmt, const QSize &dstSize=QSize(), const QRectF &roi=QRect()) const
 to The result frame data is always on host memory. More...
 
VideoFrame to (const VideoFormat &fmt, const QSize &dstSize=QSize(), const QRectF &roi=QRect()) const
 
bool to (VideoFormat::PixelFormat pixfmt, quint8 *const dst[], const int dstStride[], const QSize &dstSize=QSize(), const QRectF &roi=QRect()) const
 
bool to (const VideoFormat &fmt, quint8 *const dst[], const int dstStride[], const QSize &dstSize=QSize(), const QRectF &roi=QRect()) const
 
void * map (SurfaceType type, void *handle, int plane=0)
 map a gpu frame to opengl texture or d3d texture or other handle. More...
 
void * map (SurfaceType type, void *handle, const VideoFormat &fmt, int plane=0)
 
void unmap (void *handle)
 
void * createInteropHandle (void *handle, SurfaceType type, int plane)
 createInteropHandle More...
 
- Public Member Functions inherited from QtAV::Frame
 Frame (const Frame &other)
 
virtual ~Frame ()=0
 
Frameoperator= (const Frame &other)
 
int planeCount () const
 planeCount a decoded frame can be packed and planar. More...
 
int bytesPerLine (int plane=0) const
 bytesPerLine For video, it's size of each picture line. More...
 
QByteArray frameData () const
 
QByteArray data (int plane=0) const
 
uchar * bits (int plane=0)
 
const uchar * bits (int plane=0) const
 
const uchar * constBits (int plane=0) const
 
void setBits (uchar *b, int plane=0)
 setBits does nothing if plane is invalid. More...
 
void setBits (const QVector< uchar *> &b)
 
void setBits (quint8 *slice[])
 
void setBytesPerLine (int lineSize, int plane=0)
 setBytesPerLine does nothing if plane is invalid. More...
 
void setBytesPerLine (const QVector< int > &lineSize)
 
void setBytesPerLine (int stride[])
 
QVariantMap availableMetaData () const
 
QVariant metaData (const QString &key) const
 
void setMetaData (const QString &key, const QVariant &value)
 
void setTimestamp (qreal ts)
 
qreal timestamp () const
 
void swap (Frame &other)
 

Static Public Member Functions

static VideoFrame fromGPU (const VideoFormat &fmt, int width, int height, int surface_h, quint8 *src[], int pitch[], bool optimized=true, bool swapUV=false)
 fromGPU Make a VideoFrame with data on host memory from GPU resource More...
 
static void copyPlane (quint8 *dst, size_t dst_stride, const quint8 *src, size_t src_stride, unsigned byteWidth, unsigned height)
 

Additional Inherited Members

- Protected Member Functions inherited from QtAV::Frame
 Frame (FramePrivate *d)
 
- Protected Attributes inherited from QtAV::Frame
QExplicitlySharedDataPointer< FramePrivated_ptr
 

Constructor & Destructor Documentation

◆ VideoFrame() [1/4]

QtAV::VideoFrame::VideoFrame ( )

◆ VideoFrame() [2/4]

QtAV::VideoFrame::VideoFrame ( int  width,
int  height,
const VideoFormat format,
const QByteArray &  data = QByteArray() 
)

◆ VideoFrame() [3/4]

QtAV::VideoFrame::VideoFrame ( const QImage &  image)

◆ VideoFrame() [4/4]

QtAV::VideoFrame::VideoFrame ( const VideoFrame other)

◆ ~VideoFrame()

QtAV::VideoFrame::~VideoFrame ( )

Member Function Documentation

◆ channelCount()

int QtAV::VideoFrame::channelCount ( ) const
virtual

channelCount for audio, channel count equals plane count for video, channels >= planes

Returns

Reimplemented from QtAV::Frame.

◆ clone()

VideoFrame QtAV::VideoFrame::clone ( ) const

Deep copy.

Given the format, width and height, plane addresses and line sizes.

◆ colorRange()

ColorRange QtAV::VideoFrame::colorRange ( ) const

◆ colorSpace()

ColorSpace QtAV::VideoFrame::colorSpace ( ) const

◆ copyPlane()

static void QtAV::VideoFrame::copyPlane ( quint8 *  dst,
size_t  dst_stride,
const quint8 *  src,
size_t  src_stride,
unsigned  byteWidth,
unsigned  height 
)
static

◆ createInteropHandle()

void* QtAV::VideoFrame::createInteropHandle ( void *  handle,
SurfaceType  type,
int  plane 
)

createInteropHandle

Parameters
handleinput/output handle
Returns
null on error. otherwise return the input handle

◆ displayAspectRatio()

float QtAV::VideoFrame::displayAspectRatio ( ) const

◆ effectiveBytesPerLine()

int QtAV::VideoFrame::effectiveBytesPerLine ( int  plane) const

effectiveBytesPerLine The plane bytes contains valid image data without padded data for alignment reason

◆ effectivePlaneWidth()

int QtAV::VideoFrame::effectivePlaneWidth ( int  plane) const

◆ format()

VideoFormat QtAV::VideoFrame::format ( ) const

◆ fromGPU()

static VideoFrame QtAV::VideoFrame::fromGPU ( const VideoFormat fmt,
int  width,
int  height,
int  surface_h,
quint8 *  src[],
int  pitch[],
bool  optimized = true,
bool  swapUV = false 
)
static

fromGPU Make a VideoFrame with data on host memory from GPU resource

Parameters
fmtvideo format of GPU resource
widthframe width
heightframe height
surface_hsurface height. Can be greater than visual frame height because of alignment
srcCPU accessible address of frame planes on GPU. src[0] must be valid. src[i>0] will be filled depending on pixel format, pitch and surface_h if it's NULL.
pitchplane pitch on GPU. pitch[0] must be valid. pitch[i>0] will be filled depending on pixel format, pitch[0] and surface_h if it's NULL.
optimizedtry to use SIMD to copy from GPU. otherwise use memcpy
swapUVit's required if u/v src are null

◆ height()

int QtAV::VideoFrame::height ( ) const

◆ imageFormat()

QImage::Format QtAV::VideoFrame::imageFormat ( ) const

◆ isValid()

bool QtAV::VideoFrame::isValid ( ) const

◆ map() [1/2]

void* QtAV::VideoFrame::map ( SurfaceType  type,
void *  handle,
int  plane = 0 
)

map a gpu frame to opengl texture or d3d texture or other handle.

handle: given handle. can be gl texture (& GLuint), d3d texture, or 0 if create a new handle return the result handle or 0 if not supported

◆ map() [2/2]

void* QtAV::VideoFrame::map ( SurfaceType  type,
void *  handle,
const VideoFormat fmt,
int  plane = 0 
)

◆ operator bool()

QtAV::VideoFrame::operator bool ( ) const
inline

◆ operator=()

VideoFrame& QtAV::VideoFrame::operator= ( const VideoFrame other)

◆ pixelFormat()

VideoFormat::PixelFormat QtAV::VideoFrame::pixelFormat ( ) const

◆ pixelFormatFFmpeg()

int QtAV::VideoFrame::pixelFormatFFmpeg ( ) const

◆ planeHeight()

int QtAV::VideoFrame::planeHeight ( int  plane) const

◆ planeWidth()

int QtAV::VideoFrame::planeWidth ( int  plane) const

◆ setColorRange()

void QtAV::VideoFrame::setColorRange ( ColorRange  value)

◆ setColorSpace()

void QtAV::VideoFrame::setColorSpace ( ColorSpace  value)

◆ setDisplayAspectRatio()

void QtAV::VideoFrame::setDisplayAspectRatio ( float  displayAspectRatio)

◆ size()

QSize QtAV::VideoFrame::size ( ) const

◆ to() [1/4]

VideoFrame QtAV::VideoFrame::to ( VideoFormat::PixelFormat  pixfmt,
const QSize &  dstSize = QSize(),
const QRectF &  roi = QRect() 
) const

to The result frame data is always on host memory.

If video frame data is already in host memory, and the target parameters are the same, then return the current frame.

Parameters
pixfmttarget pixel format
dstSizetarget frame size
roiinterested region of source frame

◆ to() [2/4]

VideoFrame QtAV::VideoFrame::to ( const VideoFormat fmt,
const QSize &  dstSize = QSize(),
const QRectF &  roi = QRect() 
) const

◆ to() [3/4]

bool QtAV::VideoFrame::to ( VideoFormat::PixelFormat  pixfmt,
quint8 *const  dst[],
const int  dstStride[],
const QSize &  dstSize = QSize(),
const QRectF &  roi = QRect() 
) const

◆ to() [4/4]

bool QtAV::VideoFrame::to ( const VideoFormat fmt,
quint8 *const  dst[],
const int  dstStride[],
const QSize &  dstSize = QSize(),
const QRectF &  roi = QRect() 
) const

◆ toImage()

QImage QtAV::VideoFrame::toImage ( QImage::Format  fmt = QImage::Format_ARGB32,
const QSize &  dstSize = QSize(),
const QRectF &  roi = QRect() 
) const

toImage Return a QImage of current video frame, with given format, image size and region of interest.

If VideoFrame is constructed from an QImage, the target format, size and roi are the same, then no data copy.

Parameters
dstSizeresult image size
roiNOT implemented!

◆ unmap()

void QtAV::VideoFrame::unmap ( void *  handle)

◆ width()

int QtAV::VideoFrame::width ( ) const

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