QVideoSurfaceFormat 类

QVideoSurfaceFormat 类指定视频呈现表面的流格式。 更多...

头: #include <QVideoSurfaceFormat>
qmake: QT += multimedia

公共类型

enum Direction { TopToBottom, BottomToTop }
enum YCbCrColorSpace { YCbCr_Undefined, YCbCr_BT601, YCbCr_BT709, YCbCr_xvYCC601, YCbCr_xvYCC709, YCbCr_JPEG }

公共函数

QVideoSurfaceFormat (const QVideoSurfaceFormat & other )
QVideoSurfaceFormat (const QSize & size , QVideoFrame::PixelFormat format , QAbstractVideoBuffer::HandleType type = QAbstractVideoBuffer::NoHandle)
QVideoSurfaceFormat ()
QVideoSurfaceFormat & operator= (const QVideoSurfaceFormat & other )
~QVideoSurfaceFormat ()
int frameHeight () const
qreal frameRate () const
QSize frameSize () const
int frameWidth () const
QAbstractVideoBuffer::HandleType handleType () const
bool isMirrored () const
bool isValid () const
QSize pixelAspectRatio () const
QVideoFrame::PixelFormat pixelFormat () const
QVariant property (const char * name ) const
QList<QByteArray> propertyNames () const
QVideoSurfaceFormat::Direction scanLineDirection () const
void setFrameRate (qreal rate )
void setFrameSize (const QSize & size )
void setFrameSize (int width , int height )
void setMirrored (bool mirrored )
void setPixelAspectRatio (const QSize & ratio )
void setPixelAspectRatio (int horizontal , int vertical )
void setProperty (const char * name , const QVariant & value )
void setScanLineDirection (QVideoSurfaceFormat::Direction direction )
void setViewport (const QRect & viewport )
void setYCbCrColorSpace (QVideoSurfaceFormat::YCbCrColorSpace space )
QSize sizeHint () const
QRect viewport () const
QVideoSurfaceFormat::YCbCrColorSpace yCbCrColorSpace () const
bool operator!= (const QVideoSurfaceFormat & other ) const
bool operator== (const QVideoSurfaceFormat & other ) const

详细描述

A video surface presents a stream of video frames. The surface's format describes the type of the frames and determines how they should be presented.

The core properties of a video stream required to setup a video surface are the pixel format given by pixelFormat (), and the frame dimensions given by frameSize ().

If the surface is to present frames using a frame's handle a surface format will also include a handle type which is given by the handleType () 函数。

The region of a frame that is actually displayed on a video surface is given by the viewport (). A stream may have a viewport less than the entire region of a frame to allow for videos smaller than the nearest optimal size of a video frame. For example the width of a frame may be extended so that the start of each scan line is eight byte aligned.

Other common properties are the pixelAspectRatio (), scanLineDirection (),和 frameRate (). Additionally a stream may have some additional type specific properties which are listed by the dynamicPropertyNames() function and can be accessed using the property (),和 setProperty () 函数。

成员类型文档编制

enum QVideoSurfaceFormat:: Direction

枚举视频扫描线的布局方向。

常量 描述
QVideoSurfaceFormat::TopToBottom 0 Scan lines are arranged from the top of the frame to the bottom.
QVideoSurfaceFormat::BottomToTop 1 Scan lines are arranged from the bottom of the frame to the top.

enum QVideoSurfaceFormat:: YCbCrColorSpace

枚举视频帧的 Y'CbCr 色彩空间。

常量 描述
QVideoSurfaceFormat::YCbCr_Undefined 0 No color space is specified.
QVideoSurfaceFormat::YCbCr_BT601 1 A Y'CbCr color space defined by ITU-R recommendation BT.601 with Y value range from 16 to 235, and Cb/Cr range from 16 to 240. Used in standard definition video.
QVideoSurfaceFormat::YCbCr_BT709 2 A Y'CbCr color space defined by ITU-R BT.709 with the same values range as YCbCr_BT601. Used for HDTV.
QVideoSurfaceFormat::YCbCr_xvYCC601 3 The BT.601 color space with the value range extended to 0 to 255. It is backward compatibile with BT.601 and uses values outside BT.601 range to represent a wider range of colors.
QVideoSurfaceFormat::YCbCr_xvYCC709 4 The BT.709 color space with the value range extended to 0 to 255.
QVideoSurfaceFormat::YCbCr_JPEG 5 The full range Y'CbCr color space used in JPEG files.

成员函数文档编制

QVideoSurfaceFormat:: QVideoSurfaceFormat (const QVideoSurfaceFormat & other )

构造副本为 other .

QVideoSurfaceFormat:: QVideoSurfaceFormat (const QSize & size , QVideoFrame::PixelFormat format , QAbstractVideoBuffer::HandleType type = QAbstractVideoBuffer::NoHandle)

Contructs a description of stream which receives stream of type buffers with given frame size and pixel format .

QVideoSurfaceFormat:: QVideoSurfaceFormat ()

Constructs a null video stream format.

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

Assigns the values of other 到此对象。

QVideoSurfaceFormat:: ~QVideoSurfaceFormat ()

Destroys a video stream description.

int QVideoSurfaceFormat:: frameHeight () const

Returns the height of frame in a video stream.

qreal QVideoSurfaceFormat:: frameRate () const

Returns the frame rate of a video stream in frames per second.

另请参阅 setFrameRate ().

QSize QVideoSurfaceFormat:: frameSize () const

返回视频流中帧的尺度。

另请参阅 setFrameSize (), frameWidth (),和 frameHeight ().

int QVideoSurfaceFormat:: frameWidth () const

返回视频流中帧的宽度。

另请参阅 frameSize () 和 frameHeight ().

QAbstractVideoBuffer::HandleType QVideoSurfaceFormat:: handleType () const

Returns the type of handle the surface uses to present the frame data.

If the handle type is QAbstractVideoBuffer::NoHandle , buffers with any handle type are valid provided they can be mapped 采用 QAbstractVideoBuffer::ReadOnly flag. If the handleType() is not QAbstractVideoBuffer::NoHandle then the handle type of the buffer must be the same as that of the surface format.

bool QVideoSurfaceFormat:: isMirrored () const

返回 true if the surface is mirrored around its vertical axis. This is typically needed for video frames coming from a front camera of a mobile device.

注意: The mirroring here differs from QImage::mirrored , as a vertically mirrored QImage will be mirrored around its x-axis.

该函数在 Qt 5.11 引入。

bool QVideoSurfaceFormat:: isValid () const

Identifies if a video surface format has a valid pixel format and frame size.

Returns true if the format is valid, and false otherwise.

QSize QVideoSurfaceFormat:: pixelAspectRatio () const

返回视频流的像素宽高比。

另请参阅 setPixelAspectRatio ().

QVideoFrame::PixelFormat QVideoSurfaceFormat:: pixelFormat () const

返回视频流中帧的像素格式。

QVariant QVideoSurfaceFormat:: property (const char * name ) const

Returns the value of the video format's name 特性。

另请参阅 setProperty ().

QList < QByteArray > QVideoSurfaceFormat:: propertyNames () const

Returns a list of video format dynamic property names.

QVideoSurfaceFormat::Direction QVideoSurfaceFormat:: scanLineDirection () const

Returns the direction of scan lines.

另请参阅 setScanLineDirection ().

void QVideoSurfaceFormat:: setFrameRate ( qreal rate )

Sets the frame rate of a video stream in frames per second.

另请参阅 frameRate ().

void QVideoSurfaceFormat:: setFrameSize (const QSize & size )

Sets the size of frames in a video stream to size .

This will reset the viewport () to fill the entire frame.

另请参阅 frameSize ().

void QVideoSurfaceFormat:: setFrameSize ( int width , int height )

这是重载函数。

设置 width and height of frames in a video stream.

This will reset the viewport () to fill the entire frame.

void QVideoSurfaceFormat:: setMirrored ( bool mirrored )

Sets if the surface is mirrored around its vertical axis. This is typically needed for video frames coming from a front camera of a mobile device. Default value is false.

注意: The mirroring here differs from QImage::mirrored , as a vertically mirrored QImage will be mirrored around its x-axis.

该函数在 Qt 5.11 引入。

另请参阅 isMirrored ().

void QVideoSurfaceFormat:: setPixelAspectRatio (const QSize & ratio )

Sets a video stream's pixel aspect ratio .

另请参阅 pixelAspectRatio ().

void QVideoSurfaceFormat:: setPixelAspectRatio ( int horizontal , int vertical )

这是重载函数。

设置 horizontal and vertical elements of a video stream's pixel aspect ratio.

void QVideoSurfaceFormat:: setProperty (const char * name , const QVariant & value )

Sets the video format's name 特性到 value .

Trying to set a read only property will be ignored.

另请参阅 property ().

void QVideoSurfaceFormat:: setScanLineDirection ( QVideoSurfaceFormat::Direction direction )

设置 direction of scan lines.

另请参阅 scanLineDirection ().

void QVideoSurfaceFormat:: setViewport (const QRect & viewport )

Sets the viewport of a video stream to viewport .

另请参阅 viewport ().

void QVideoSurfaceFormat:: setYCbCrColorSpace ( QVideoSurfaceFormat::YCbCrColorSpace space )

Sets the Y'CbCr color space of a video stream. It is only used with raw YUV frame types.

另请参阅 yCbCrColorSpace ().

QSize QVideoSurfaceFormat:: sizeHint () const

Returns a suggested size in pixels for the video stream.

This is the size of the viewport scaled according to the pixel aspect ratio.

QRect QVideoSurfaceFormat:: viewport () const

Returns the viewport of a video stream.

The viewport is the region of a video frame that is actually displayed.

By default the viewport covers an entire frame.

另请参阅 setViewport ().

QVideoSurfaceFormat::YCbCrColorSpace QVideoSurfaceFormat:: yCbCrColorSpace () const

Returns the Y'CbCr color space of a video stream.

另请参阅 setYCbCrColorSpace ().

bool QVideoSurfaceFormat:: operator!= (const QVideoSurfaceFormat & other ) const

返回 true 若 other is different to this video format, and false if they are the same.

bool QVideoSurfaceFormat:: operator== (const QVideoSurfaceFormat & other ) const

返回 true 若 other is the same as this video format, and false if they are different.