<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html><head><title>QAbstractVideoSurface Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } td.postheader { font-family: sans-serif } tr.address { font-family: sans-serif } body { background: #ffffff; color: black; } </style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QAbstractVideoSurface Class Reference<br /><sup><sup>[<a href="qtmultimedia.html">QtMultimedia</a> module]</sup></sup></h1><p>The QAbstractVideoSurface class is a base class for video presentation surfaces. <a href="#details">More...</a></p> <p>Inherits <a href="qobject.html">QObject</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qabstractvideosurface.html#Error-enum">Error</a></b> { NoError, UnsupportedFormatError, IncorrectFormatError, StoppedError, ResourceError }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qabstractvideosurface.html#QAbstractVideoSurface">__init__</a></b> (<i>self</i>, QObject <i>parent</i> = None)</li><li><div class="fn" />Error <b><a href="qabstractvideosurface.html#error">error</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qabstractvideosurface.html#isActive">isActive</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qabstractvideosurface.html#isFormatSupported">isFormatSupported</a></b> (<i>self</i>, QVideoSurfaceFormat <i>format</i>)</li><li><div class="fn" />QVideoSurfaceFormat <b><a href="qabstractvideosurface.html#nearestFormat">nearestFormat</a></b> (<i>self</i>, QVideoSurfaceFormat <i>format</i>)</li><li><div class="fn" />bool <b><a href="qabstractvideosurface.html#present">present</a></b> (<i>self</i>, QVideoFrame <i>frame</i>)</li><li><div class="fn" /><b><a href="qabstractvideosurface.html#setError">setError</a></b> (<i>self</i>, Error <i>error</i>)</li><li><div class="fn" />bool <b><a href="qabstractvideosurface.html#start">start</a></b> (<i>self</i>, QVideoSurfaceFormat <i>format</i>)</li><li><div class="fn" /><b><a href="qabstractvideosurface.html#stop">stop</a></b> (<i>self</i>)</li><li><div class="fn" />list-of-QVideoFrame.PixelFormat <b><a href="qabstractvideosurface.html#supportedPixelFormats">supportedPixelFormats</a></b> (<i>self</i>, QAbstractVideoBuffer.HandleType <i>type</i> = QAbstractVideoBuffer.NoHandle)</li><li><div class="fn" />QVideoSurfaceFormat <b><a href="qabstractvideosurface.html#surfaceFormat">surfaceFormat</a></b> (<i>self</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qabstractvideosurface.html#activeChanged">activeChanged</a></b> (bool)</li><li><div class="fn" />void <b><a href="qabstractvideosurface.html#supportedFormatsChanged">supportedFormatsChanged</a></b> ()</li><li><div class="fn" />void <b><a href="qabstractvideosurface.html#surfaceFormatChanged">surfaceFormatChanged</a></b> (const QVideoSurfaceFormat&)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QAbstractVideoSurface class is a base class for video presentation surfaces.</p> <p>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.</p> <p>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.</p> <p>A list of pixel formats a surface can present is given by the <a href="qabstractvideosurface.html#supportedPixelFormats">supportedPixelFormats</a>() function, and the <a href="qabstractvideosurface.html#isFormatSupported">isFormatSupported</a>() function will test if a video surface format is supported. If a format is not supported the <a href="qabstractvideosurface.html#nearestFormat">nearestFormat</a>() 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.</p> <p>The <a href="qabstractvideosurface.html#start">start</a>() function takes a supported format and enables a video surface. Once started a surface will begin displaying the frames it receives in the <a href="qabstractvideosurface.html#present">present</a>() 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 <a href="qabstractvideosurface.html#stop">stop</a>() function will disable a surface and a release any video buffers it holds references to.</p> <hr /><h2>Type Documentation</h2><h3 class="fn"><a name="Error-enum" />QAbstractVideoSurface.Error</h3><p>This enum describes the errors that may be returned by the <a href="qabstractvideosurface.html#error">error</a>() function.</p> <table class="valuelist"> <tr class="odd" valign="top"> <th class="tblConst">Constant</th> <th class="tblval">Value</th> <th class="tbldscr">Description</th> </tr> <tr> <td class="topAlign"><tt>QAbstractVideoSurface.NoError</tt></td> <td class="topAlign"><tt>0</tt></td> <td class="topAlign">No error occurred.</td> </tr> <tr> <td class="topAlign"> <tt>QAbstractVideoSurface.UnsupportedFormatError</tt></td> <td class="topAlign"><tt>1</tt></td> <td class="topAlign">A video format was not supported.</td> </tr> <tr> <td class="topAlign"> <tt>QAbstractVideoSurface.IncorrectFormatError</tt></td> <td class="topAlign"><tt>2</tt></td> <td class="topAlign">A video frame was not compatible with the format of the surface.</td> </tr> <tr> <td class="topAlign"> <tt>QAbstractVideoSurface.StoppedError</tt></td> <td class="topAlign"><tt>3</tt></td> <td class="topAlign">The surface has not been started.</td> </tr> <tr> <td class="topAlign"> <tt>QAbstractVideoSurface.ResourceError</tt></td> <td class="topAlign"><tt>4</tt></td> <td class="topAlign">The surface could not allocate some resource.</td> </tr> </table> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QAbstractVideoSurface" />QAbstractVideoSurface.__init__ (<i>self</i>, <a href="qobject.html">QObject</a> <i>parent</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a video surface with the given <i>parent</i>.</p> <h3 class="fn"><a name="error" /><a href="qabstractvideosurface.html#Error-enum">Error</a> QAbstractVideoSurface.error (<i>self</i>)</h3><p>Returns the last error that occurred.</p> <p>If a surface fails to <a href="qabstractvideosurface.html#start">start</a>(), or stops unexpectedly this function can be called to discover what error occurred.</p> <p><b>See also</b> <a href="qabstractvideosurface.html#setError">setError</a>().</p> <h3 class="fn"><a name="isActive" />bool QAbstractVideoSurface.isActive (<i>self</i>)</h3><p>Indicates whether a video surface has been started.</p> <p>Returns true if the surface has been started, and false otherwise.</p> <h3 class="fn"><a name="isFormatSupported" />bool QAbstractVideoSurface.isFormatSupported (<i>self</i>, <a href="qvideosurfaceformat.html">QVideoSurfaceFormat</a> <i>format</i>)</h3><p>Tests a video surface <i>format</i> to determine if a surface can accept it.</p> <p>Returns true if the format is supported by the surface, and false otherwise.</p> <h3 class="fn"><a name="nearestFormat" /><a href="qvideosurfaceformat.html">QVideoSurfaceFormat</a> QAbstractVideoSurface.nearestFormat (<i>self</i>, <a href="qvideosurfaceformat.html">QVideoSurfaceFormat</a> <i>format</i>)</h3><p>Returns a supported video surface format that is similar to <i>format</i>.</p> <p>A similar surface format is one that has the same <a href="qvideosurfaceformat.html#pixelFormat">pixel format</a> and <a href="qvideosurfaceformat.html#handleType">handle type</a> but differs in some of the other properties. For example if there are restrictions on the <a href="qvideosurfaceformat.html#frameSize">frame sizes</a> a video surface can accept it may suggest a format with a larger frame size and a <a href="qvideosurfaceformat.html#viewport">viewport</a> the size of the original frame size.</p> <p>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.</p> <h3 class="fn"><a name="present" />bool QAbstractVideoSurface.present (<i>self</i>, <a href="qvideoframe.html">QVideoFrame</a> <i>frame</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Presents a video <i>frame</i>.</p> <p>Returns true if the frame was presented, and false if an error occurred.</p> <p>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.</p> <p>If present() fails for any other reason the surface will immediately enter the stopped state and an <a href="qabstractvideosurface.html#error">error</a>() value will be set.</p> <p>A video surface must be in the started state for present() to succeed, and the format of the video frame must be compatible with the current video surface format.</p> <p><b>See also</b> <a href="qabstractvideosurface.html#error">error</a>().</p> <h3 class="fn"><a name="setError" />QAbstractVideoSurface.setError (<i>self</i>, <a href="qabstractvideosurface.html#Error-enum">Error</a> <i>error</i>)</h3><p>Sets the value of <a href="qabstractvideosurface.html#error">error</a>() to <i>error</i>.</p> <p><b>See also</b> <a href="qabstractvideosurface.html#error">error</a>().</p> <h3 class="fn"><a name="start" />bool QAbstractVideoSurface.start (<i>self</i>, <a href="qvideosurfaceformat.html">QVideoSurfaceFormat</a> <i>format</i>)</h3><p>Starts a video surface presenting <i>format</i> frames.</p> <p>Returns true if the surface was started, and false if an error occurred.</p> <p><b>See also</b> <a href="qabstractvideosurface.html#isActive">isActive</a>() and <a href="qabstractvideosurface.html#stop">stop</a>().</p> <h3 class="fn"><a name="stop" />QAbstractVideoSurface.stop (<i>self</i>)</h3><p>Stops a video surface presenting frames and releases any resources acquired in <a href="qabstractvideosurface.html#start">start</a>().</p> <p><b>See also</b> <a href="qabstractvideosurface.html#isActive">isActive</a>() and <a href="qabstractvideosurface.html#start">start</a>().</p> <h3 class="fn"><a name="supportedPixelFormats" />list-of-QVideoFrame.PixelFormat QAbstractVideoSurface.supportedPixelFormats (<i>self</i>, <a href="qabstractvideobuffer.html#HandleType-enum">QAbstractVideoBuffer.HandleType</a> <i>type</i> = QAbstractVideoBuffer.NoHandle)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns a list of pixel formats a video surface can present for a given handle <i>type</i>.</p> <p>The pixel formats returned for the <a href="qabstractvideobuffer.html#HandleType-enum">QAbstractVideoBuffer.NoHandle</a> type are valid for any buffer that can be mapped in read-only mode.</p> <p>Types that are first in the list can be assumed to be faster to render.</p> <h3 class="fn"><a name="surfaceFormat" /><a href="qvideosurfaceformat.html">QVideoSurfaceFormat</a> QAbstractVideoSurface.surfaceFormat (<i>self</i>)</h3><p>Returns the format of a video surface.</p> <hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="activeChanged" />void activeChanged (bool)</h3><p>This is the default overload of this signal.</p><p>Signals that the <i>active</i> state of a video surface has changed.</p> <p><b>See also</b> <a href="qabstractvideosurface.html#isActive">isActive</a>(), <a href="qabstractvideosurface.html#start">start</a>(), and <a href="qabstractvideosurface.html#stop">stop</a>().</p> <h3 class="fn"><a name="supportedFormatsChanged" />void supportedFormatsChanged ()</h3><p>This is the default overload of this signal.</p><p>Signals that the set of formats supported by a video surface has changed.</p> <p><b>See also</b> <a href="qabstractvideosurface.html#supportedPixelFormats">supportedPixelFormats</a>() and <a href="qabstractvideosurface.html#isFormatSupported">isFormatSupported</a>().</p> <h3 class="fn"><a name="surfaceFormatChanged" />void surfaceFormatChanged (const QVideoSurfaceFormat&)</h3><p>This is the default overload of this signal.</p><p>Signals that the configured <i>format</i> of a video surface has changed.</p> <p><b>See also</b> <a href="qabstractvideosurface.html#surfaceFormat">surfaceFormat</a>() and <a href="qabstractvideosurface.html#start">start</a>().</p> <address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.10.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt 4.8.5</td></tr></table></div></address></body></html>