QAbstractVideoSurface 类

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

头: #include <QAbstractVideoSurface>
Since: Qt 4.6
继承: QObject

公共类型

enum Error { NoError, UnsupportedFormatError, IncorrectFormatError, StoppedError, ResourceError }

公共函数

QAbstractVideoSurface (QObject * parent = 0)
~QAbstractVideoSurface ()
Error error () const
bool isActive () const
virtual bool isFormatSupported (const QVideoSurfaceFormat & format ) const
virtual QVideoSurfaceFormat nearestFormat (const QVideoSurfaceFormat & format ) const
virtual bool present (const QVideoFrame & frame ) = 0
virtual bool start (const QVideoSurfaceFormat & format )
virtual void stop ()
virtual QList<QVideoFrame::PixelFormat> supportedPixelFormats (QAbstractVideoBuffer::HandleType type = QAbstractVideoBuffer::NoHandle) const = 0
QVideoSurfaceFormat surfaceFormat () const

信号

void activeChanged (bool active )
void supportedFormatsChanged ()
void surfaceFormatChanged (const QVideoSurfaceFormat & format )

保护函数

void setError (Error error )

额外继承成员

详细描述

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 () 函数,和 isFormatSupported () 函数将测试是否支持视频表面格式。若格式不支持 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.

The start () 函数接受支持格式并启用视频表面。一旦启动,表面将开始显示它收到的帧在 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.

成员类型文档编制

enum QAbstractVideoSurface:: Error

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

常量 描述
QAbstractVideoSurface::NoError 0 没有出现错误。
QAbstractVideoSurface::UnsupportedFormatError 1 视频格式不被支持。
QAbstractVideoSurface::IncorrectFormatError 2 视频帧不兼容表面格式。
QAbstractVideoSurface::StoppedError 3 表面尚未开始。
QAbstractVideoSurface::ResourceError 4 表面无法分配一些资源。

成员函数文档编制

QAbstractVideoSurface:: QAbstractVideoSurface ( QObject * parent = 0)

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

QAbstractVideoSurface:: ~QAbstractVideoSurface ()

销毁视频表面。

[signal] void QAbstractVideoSurface:: activeChanged ( bool active )

信号 active 视频表面状态已改变。

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

Error QAbstractVideoSurface:: error () const

返回最后出现的错误。

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

另请参阅 setError ().

bool QAbstractVideoSurface:: isActive () const

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

返回 true 若表面已启动,否则返回 false。

[虚拟] bool QAbstractVideoSurface:: isFormatSupported (const QVideoSurfaceFormat & format ) const

测试视频表面 format 以确定表面是否能接受它。

返回 true,若格式被表面支持,否则,返回 false。

[虚拟] QVideoSurfaceFormat QAbstractVideoSurface:: nearestFormat (const QVideoSurfaceFormat & format ) const

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

A similar surface format is one that has the same 像素格式 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 and a viewport 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.

[pure virtual] bool QAbstractVideoSurface:: present (const QVideoFrame & frame )

呈现视频 frame .

返回 true,若帧被呈现;返回 false,若发生错误。

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 () 值将被设置。

视频表面必须处于启动状态为 present() 成功,且视频帧格式必须兼容当前视频表面格式。

另请参阅 error ().

[protected] void QAbstractVideoSurface:: setError ( Error error )

设置值为 error () 到 error .

另请参阅 error ().

[虚拟] bool QAbstractVideoSurface:: start (const QVideoSurfaceFormat & format )

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

返回 true,若表面已开始;返回 false,若发生错误。

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

[虚拟] void QAbstractVideoSurface:: stop ()

停止在视频表面呈现帧,并释放任何获得资源在 start ().

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

[signal] void QAbstractVideoSurface:: supportedFormatsChanged ()

Signals that the set of formats supported by a video surface has changed.

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

[pure virtual] QList < QVideoFrame::PixelFormat > QAbstractVideoSurface:: supportedPixelFormats ( QAbstractVideoBuffer::HandleType type = QAbstractVideoBuffer::NoHandle) const

返回视频表面能呈现的像素格式列表,针对给定句柄 type .

返回像素格式为 QAbstractVideoBuffer::NoHandle 类型是有效的,对于能以只读方式映射的任何缓冲。

可假定列表中的首个类型,渲染会更快。

QVideoSurfaceFormat QAbstractVideoSurface:: surfaceFormat () const

返回视频表面的格式。

[signal] void QAbstractVideoSurface:: surfaceFormatChanged (const QVideoSurfaceFormat & format )

信号配置 format of a video surface has changed.

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