QAbstractVideoSurface Class Reference

[ QtMultimedia module]

The QAbstractVideoSurface class is a base class for video presentation surfaces. 更多...

继承 QObject .

类型

方法

Qt Signals


详细描述

The QAbstractVideoSurface class is a base class for video presentation surfaces.

The QAbstractVideoSurface class defines the standard interface that video producers use to inter-operate with video presentation surfaces. It is not supposed to be instantiated directly. Instead, you should subclass it to create new video surfaces.

A video surface presents a continuous stream of identically formatted frames, where the format of each frame is compatible with a stream format supplied when starting a presentation.

表面能呈现的像素列表格式,给出通过 supportedPixelFormats () function, and the isFormatSupported () function will test if a video surface format is supported. If a format is not supported the nearestFormat () function may be able to suggest a similar format. For example if a surface supports fixed set of resolutions it may suggest the smallest supported resolution that contains the proposed resolution.

start () function takes a supported format and enables a video surface. Once started a surface will begin displaying the frames it receives in the present () function. Surfaces may hold a reference to the buffer of a presented video frame until a new frame is presented or streaming is stopped. The stop () function will disable a surface and a release any video buffers it holds references to.


类型文档编制

QAbstractVideoSurface.Error

此枚举描述可能的错误,错误返回通过 error () 函数。

常量 描述
QAbstractVideoSurface.NoError 0 没有发生错误。
QAbstractVideoSurface.UnsupportedFormatError 1 视频格式不被支持。
QAbstractVideoSurface.IncorrectFormatError 2 A video frame was not compatible with the format of the surface.
QAbstractVideoSurface.StoppedError 3 表面尚未开始。
QAbstractVideoSurface.ResourceError 4 The surface could not allocate some resource.

方法文档编制

QAbstractVideoSurface.__init__ ( self , QObject   parent  = None)

parent argument, if not None, causes self to be owned by Qt instead of PyQt.

构造视频表面采用给定 parent .

Error QAbstractVideoSurface.error ( self )

返回上次发生的错误。

If a surface fails to start (), or stops unexpectedly this function can be called to discover what error occurred.

另请参阅 setError ().

bool QAbstractVideoSurface.isActive ( self )

指示视频表面是否已启动。

Returns true if the surface has been started, and false 否则。

bool QAbstractVideoSurface.isFormatSupported ( self , QVideoSurfaceFormat   format )

测试视频表面 format to determine if a surface can accept it.

Returns true if the format is supported by the surface, and false otherwise.

QVideoSurfaceFormat QAbstractVideoSurface.nearestFormat ( self , QVideoSurfaceFormat   format )

返回所支持的视频表面格式,类似于 format .

A similar surface format is one that has the same pixel format and handle type but differs in some of the other properties. For example if there are restrictions on the frame sizes a video surface can accept it may suggest a format with a larger frame size 和 视口 the size of the original frame size.

If the format is already supported it will be returned unchanged, or if there is no similar supported format an invalid format will be returned.

bool QAbstractVideoSurface.present ( self , QVideoFrame   frame )

This method is abstract and should be reimplemented in any sub-class.

呈现视频 frame .

Returns true if the frame was presented, and false if an error occurred.

Not all surfaces will block until the presentation of a frame has completed. Calling present() on a non-blocking surface may fail if called before the presentation of a previous frame has completed. In such cases the surface may not return to a ready state until it's had an opportunity to process events.

If present() fails for any other reason the surface will immediately enter the stopped state and an error () value will be set.

A video surface must be in the started state for present() to succeed, and the format of the video frame must be compatible with the current video surface format.

另请参阅 error ().

QAbstractVideoSurface.setError ( self , Error   error )

设置值为 error () 到 error .

另请参阅 error ().

bool QAbstractVideoSurface.start ( self , QVideoSurfaceFormat   format )

使视频表面开始呈现 format 帧。

Returns true if the surface was started, and false if an error occurred.

另请参阅 isActive () 和 stop ().

QAbstractVideoSurface.stop ( self )

Stops a video surface presenting frames and releases any resources acquired in start ().

另请参阅 isActive () 和 start ().

list-of-QVideoFrame.PixelFormat QAbstractVideoSurface.supportedPixelFormats ( self , QAbstractVideoBuffer.HandleType   type  = QAbstractVideoBuffer.NoHandle)

This method is abstract and should be reimplemented in any sub-class.

Returns a list of pixel formats a video surface can present for a given handle type .

返回像素格式为 QAbstractVideoBuffer.NoHandle type are valid for any buffer that can be mapped in read-only 模式。

Types that are first in the list can be assumed to be faster to render.

QVideoSurfaceFormat QAbstractVideoSurface.surfaceFormat ( self )

返回视频表面的格式。


Qt Signal Documentation

void activeChanged (bool)

This is the default overload of this signal.

信号 active state of a video surface has 改变。

另请参阅 isActive (), start (),和 stop ().

void supportedFormatsChanged ()

This is the default overload of this signal.

Signals that the set of formats supported by a video surface has 改变。

另请参阅 supportedPixelFormats () and isFormatSupported ().

void surfaceFormatChanged (const QVideoSurfaceFormat&)

This is the default overload of this signal.

信号配置 format of a video surface has 改变。

另请参阅 surfaceFormat () 和 start ().