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 ().