Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QAbstractVideoSurface Class Reference

The QAbstractVideoSurface class is a base class for video presentation surfaces. More...

 #include <QAbstractVideoSurface>

Inherits: QObject.

This class was introduced in Qt 4.6.

Public Types

enum Error { NoError, UnsupportedFormatError, IncorrectFormatError, StoppedError, ResourceError }

Public Functions

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
  • 29 public functions inherited from QObject

Signals

void activeChanged ( bool active )
void supportedFormatsChanged ()
void surfaceFormatChanged ( const QVideoSurfaceFormat & format )

Protected Functions

void setError ( Error error )
  • 7 protected functions inherited from QObject

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public slot inherited from QObject
  • 5 static public members inherited from QObject

Detailed Description

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.

A list of pixel formats a surface can present is given by the supportedPixelFormats() function, and the isFormatSupported() function will test if a video surface format is supported. If a format is not supported the 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() function takes a supported format and enables a video surface. Once started a surface will begin displaying the frames it receives in the 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.

Member Type Documentation

enum QAbstractVideoSurface::Error

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

ConstantValueDescription
QAbstractVideoSurface::NoError0No error occurred.
QAbstractVideoSurface::UnsupportedFormatError1A video format was not supported.
QAbstractVideoSurface::IncorrectFormatError2A video frame was not compatible with the format of the surface.
QAbstractVideoSurface::StoppedError3The surface has not been started.
QAbstractVideoSurface::ResourceError4The surface could not allocate some resource.

Member Function Documentation

QAbstractVideoSurface::QAbstractVideoSurface ( QObject * parent = 0 )

Constructs a video surface with the given parent.

QAbstractVideoSurface::~QAbstractVideoSurface ()

Destroys a video surface.

void QAbstractVideoSurface::activeChanged ( bool active ) [signal]

Signals that the active state of a video surface has changed.

See also isActive(), start(), and stop().

Error QAbstractVideoSurface::error () const

Returns the last error that occurred.

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

See also setError().

bool QAbstractVideoSurface::isActive () const

Indicates whether a video surface has been started.

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

bool QAbstractVideoSurface::isFormatSupported ( const QVideoSurfaceFormat & format ) const [virtual]

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.

QVideoSurfaceFormat QAbstractVideoSurface::nearestFormat ( const QVideoSurfaceFormat & format ) const [virtual]

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

bool QAbstractVideoSurface::present ( const QVideoFrame & frame ) [pure virtual]

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 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() value will be set.

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.

See also error().

void QAbstractVideoSurface::setError ( Error error ) [protected]

Sets the value of error() to error.

See also error().

bool QAbstractVideoSurface::start ( const QVideoSurfaceFormat & format ) [virtual]

Starts a video surface presenting format frames.

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

See also isActive() and stop().

void QAbstractVideoSurface::stop () [virtual]

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

See also isActive() and start().

void QAbstractVideoSurface::supportedFormatsChanged () [signal]

Signals that the set of formats supported by a video surface has changed.

See also supportedPixelFormats() and isFormatSupported().

QList<QVideoFrame::PixelFormat> QAbstractVideoSurface::supportedPixelFormats ( QAbstractVideoBuffer::HandleType type = QAbstractVideoBuffer::NoHandle ) const [pure virtual]

Returns a list of pixel formats a video surface can present for a given handle type.

The pixel formats returned for the QAbstractVideoBuffer::NoHandle type are valid for any buffer that can be mapped in read-only mode.

Types that are first in the list can be assumed to be faster to render.

QVideoSurfaceFormat QAbstractVideoSurface::surfaceFormat () const

Returns the format of a video surface.

void QAbstractVideoSurface::surfaceFormatChanged ( const QVideoSurfaceFormat & format ) [signal]

Signals that the configured format of a video surface has changed.

See also surfaceFormat() and start().

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année

Le Qt Developer Network au hasard

Logo

Utiliser QML et QtWebKit avec PySide

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 4.7-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web