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.
此枚举描述的错误,返回可能是通过 error () 函数。
| 常量 | 值 | 描述 |
|---|---|---|
QAbstractVideoSurface::NoError
|
0
|
没有出现错误。 |
QAbstractVideoSurface::UnsupportedFormatError
|
1
|
视频格式不被支持。 |
QAbstractVideoSurface::IncorrectFormatError
|
2
|
视频帧不兼容表面格式。 |
QAbstractVideoSurface::StoppedError
|
3
|
表面尚未开始。 |
QAbstractVideoSurface::ResourceError
|
4
|
表面无法分配一些资源。 |
构造视频表面采用给定 parent .
销毁视频表面。
[signal]
void
QAbstractVideoSurface::
activeChanged
(
bool
active
)
发射信号,当 active 视频表面状态已改变。
另请参阅 isActive (), start (),和 stop ().
返回最后出现的错误。
若表面失败当 start (),或意外停止,可以调用此函数以探索出现了什么错误。
另请参阅 setError ().
指示视频表面是否已启动。
返回 true 若表面已启动,否则返回 false。
[虚拟]
bool
QAbstractVideoSurface::
isFormatSupported
(const
QVideoSurfaceFormat
&
format
) const
测试视频表面 format 以确定表面是否可以接受它。
返回 true,若格式被表面支持,否则,返回 false。
[虚拟]
QVideoSurfaceFormat
QAbstractVideoSurface::
nearestFormat
(const
QVideoSurfaceFormat
&
format
) const
返回所支持的视频表面格式,类似于 format .
类似的表面格式是拥有相同 像素格式 and 句柄类型 but differs in some of the other properties. For example if there are restrictions on the 帧大小 视频表面可以接受的可能建议格式具有更大的帧大小和 viewport 大小对于原始帧大小。
若格式已支持,将保持不变返回该格式,或者,若没有类似支持格式,将返回无效格式。
[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,若发生错误。
[虚拟]
void
QAbstractVideoSurface::
stop
()
使视频表面停止呈现帧,并释放任何获得资源在 start ().
[signal]
void
QAbstractVideoSurface::
supportedFormatsChanged
()
发射信号,当视频表面支持的格式集已改变。
另请参阅 supportedPixelFormats () 和 isFormatSupported ().
[pure virtual]
QList
<
QVideoFrame::PixelFormat
> QAbstractVideoSurface::
supportedPixelFormats
(
QAbstractVideoBuffer::HandleType
type
= QAbstractVideoBuffer::NoHandle) const
返回视频表面能呈现的像素格式列表,针对给定句柄 type .
返回像素格式为 QAbstractVideoBuffer::NoHandle 类型是有效的,对于能以只读方式映射的任何缓冲。
可假定列表中的首个类型,渲染会更快。
返回视频表面的格式。
[signal]
void
QAbstractVideoSurface::
surfaceFormatChanged
(const
QVideoSurfaceFormat
&
format
)
发射信号,当配置 format 对于视频表面已改变。
另请参阅 surfaceFormat () 和 start ().