Virtual functions


Detailed Description

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

The PySide.QtMultimedia.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.

A list of pixel formats a surface can present is given by the PySide.QtMultimedia.QAbstractVideoSurface.supportedPixelFormats() function, and the PySide.QtMultimedia.QAbstractVideoSurface.isFormatSupported() function will test if a video surface format is supported. If a format is not supported the PySide.QtMultimedia.QAbstractVideoSurface.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 PySide.QtMultimedia.QAbstractVideoSurface.start() function takes a supported format and enables a video surface. Once started a surface will begin displaying the frames it receives in the PySide.QtMultimedia.QAbstractVideoSurface.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 PySide.QtMultimedia.QAbstractVideoSurface.stop() function will disable a surface and a release any video buffers it holds references to.

class PySide.QtMultimedia.QAbstractVideoSurface([parent=None])

Constructs a video surface with the given parent .


This enum describes the errors that may be returned by the PySide.QtMultimedia.QAbstractVideoSurface.error() function.

Constant Description
QAbstractVideoSurface.NoError No error occurred.
QAbstractVideoSurface.UnsupportedFormatError A video format was not supported.
QAbstractVideoSurface.IncorrectFormatError A video frame was not compatible with the format of the surface.
QAbstractVideoSurface.StoppedError The surface has not been started.
QAbstractVideoSurface.ResourceError The surface could not allocate some resource.
Return type:PySide.QtMultimedia.QAbstractVideoSurface.Error

Returns the last error that occurred.

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

Return type:PySide.QtCore.bool

Indicates whether a video surface has been started.

Returns true if the surface has been started, and false otherwise.

Return type:PySide.QtCore.bool

Tests a video surface format to determine if a surface can accept it.

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

Return type:PySide.QtMultimedia.QVideoSurfaceFormat

Returns a supported video surface format that is similar to 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 and a PySide.QtMultimedia.QVideoSurfaceFormat.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.

Return type:PySide.QtCore.bool

Presents a video 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 PySide.QtMultimedia.QAbstractVideoSurface.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 PySide.QtMultimedia.QAbstractVideoSurface.present() fails for any other reason the surface will immediately enter the stopped state and an PySide.QtMultimedia.QAbstractVideoSurface.error() value will be set.

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


Sets the value of PySide.QtMultimedia.QAbstractVideoSurface.error() to error .

Return type:PySide.QtCore.bool

Starts a video surface presenting format frames.

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


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

Return type:
Return type:PySide.QtMultimedia.QVideoSurfaceFormat

Returns the format of a video surface.