QAbstractVideoSurfaceclass is a base class for video presentation surfaces. 更多 …
def
error
()
def
isActive
()
def
nativeResolution
()
def
setError
(error)
def
setNativeResolution
(resolution)
def
surfaceFormat
()
def
isFormatSupported
(format)
def
nearestFormat
(format)
def
present
(frame)
def
start
(format)
def
stop
()
def
supportedPixelFormats
([type=QAbstractVideoBuffer.NoHandle])
def
activeChanged
(active)
def
nativeResolutionChanged
(resolution)
def
supportedFormatsChanged
()
def
surfaceFormatChanged
(format)
QAbstractVideoSurfaceclass defines the standard interface that video producers use to inter-operate with video presentation surfaces. You can subclass this interface to receive video frames from sources likedecoded mediaorcameras以履行你自己的处理。视频表面呈现连续流同等格式
QVideoFrame实例,每帧格式兼容流供给格式当开始呈现时。每帧可以拥有时间戳信息,可以用于表面以决定何时显示该帧。表面能呈现的像素列表格式,给出通过
supportedPixelFormats()function, and theisFormatSupported()function will test if a video surface format is supported. If a format is not supported thenearestFormat()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 thepresent()function. Surfaces may hold a reference to the buffer of a presented video frame until a new frame is presented or streaming is stopped. In addition, a video surface may hold a reference to a video frame until theend timestamp被传递。stop()function will disable a surface and release any video buffers it holds references to.
QAbstractVideoSurface
(
[
parent=None
]
)
¶
- param parent
QObject
构造视频表面采用给定
parent
.
PySide2.QtMultimedia.QAbstractVideoSurface.
Error
¶
此枚举描述可能的错误,错误返回通过
error()
函数。
|
常量 |
描述 |
|---|---|
|
QAbstractVideoSurface.NoError |
没有发生错误。 |
|
QAbstractVideoSurface.UnsupportedFormatError |
视频格式不被支持。 |
|
QAbstractVideoSurface.IncorrectFormatError |
视频帧不兼容表面格式。 |
|
QAbstractVideoSurface.StoppedError |
表面尚未开始。 |
|
QAbstractVideoSurface.ResourceError |
表面无法分配一些资源。 |
PySide2.QtMultimedia.QAbstractVideoSurface.
activeChanged
(
active
)
¶
active
–
bool
PySide2.QtMultimedia.QAbstractVideoSurface.
error
(
)
¶
返回上次发生的错误。
If a surface fails to
start()
, or stops unexpectedly this function can be called to discover what error occurred.
另请参阅
PySide2.QtMultimedia.QAbstractVideoSurface.
isActive
(
)
¶
bool
指示视频表面是否已启动。
返回 true 若表面已启动,否则返回 false。
PySide2.QtMultimedia.QAbstractVideoSurface.
isFormatSupported
(
format
)
¶
format
–
QVideoSurfaceFormat
bool
测试视频表面
format
以确定表面是否能接受它。
返回 true,若格式被表面支持,否则,返回 false。
PySide2.QtMultimedia.QAbstractVideoSurface.
nativeResolution
(
)
¶
QSize
PySide2.QtMultimedia.QAbstractVideoSurface.
nativeResolutionChanged
(
resolution
)
¶
resolution
–
QSize
PySide2.QtMultimedia.QAbstractVideoSurface.
nearestFormat
(
format
)
¶
format
–
QVideoSurfaceFormat
返回所支持的视频表面格式,类似于
format
.
A similar surface format is one that has the same
pixel
format
and
handle
type
but may differ 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
视口
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.
PySide2.QtMultimedia.QAbstractVideoSurface.
present
(
frame
)
¶
frame
–
QVideoFrame
bool
呈现视频
frame
.
返回 true,若帧被呈现;返回 false,若发生错误。
Not all surfaces will block until the presentation of a frame has completed. Calling 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 has had an opportunity to process events.
If fails for any other reason the surface should immediately enter the stopped state and an
error()
value will be set.
A video surface must be in the started state for to succeed, and the format of the video frame must be compatible with the current video surface format.
另请参阅
PySide2.QtMultimedia.QAbstractVideoSurface.
setError
(
error
)
¶
error
–
Error
设置值为
error()
to
error
.
此接口的实现者可以调用这,以传达最近错误是什么。
另请参阅
PySide2.QtMultimedia.QAbstractVideoSurface.
setNativeResolution
(
resolution
)
¶
resolution
–
QSize
设置视频表面的原始
resolution
.
This function can be called by implementors of this interface to specify to frame producers what the native resolution of this surface is.
另请参阅
PySide2.QtMultimedia.QAbstractVideoSurface.
start
(
format
)
¶
format
–
QVideoSurfaceFormat
bool
使视频表面开始呈现
format
帧。
返回 true,若表面已开始;返回 false,若发生错误。
注意
You must call the base class implementation of at the end of your implementation.
另请参阅
PySide2.QtMultimedia.QAbstractVideoSurface.
stop
(
)
¶
停止在视频表面呈现帧,并释放任何获得资源在
start()
.
注意
You must call the base class implementation of at the start of your implementation.
另请参阅
PySide2.QtMultimedia.QAbstractVideoSurface.
supportedFormatsChanged
(
)
¶
PySide2.QtMultimedia.QAbstractVideoSurface.
supportedPixelFormats
(
[
type=QAbstractVideoBuffer.NoHandle
]
)
¶
type
–
HandleType
返回视频表面能呈现的像素格式列表,针对给定句柄
type
.
返回像素格式为
NoHandle
类型是有效的,对于能以只读方式映射的任何缓冲。
可假定列表中的首个类型,渲染会更快。
PySide2.QtMultimedia.QAbstractVideoSurface.
surfaceFormat
(
)
¶
返回视频表面的格式。
PySide2.QtMultimedia.QAbstractVideoSurface.
surfaceFormatChanged
(
format
)
¶
format
–
QVideoSurfaceFormat