QtGStreamer  0.10.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
Public Member Functions
QGst::Ui::GraphicsVideoSurface Class Reference

#include <QGst/Ui/GraphicsVideoSurface>

List of all members.

Public Member Functions

 GraphicsVideoSurface (QGraphicsView *parent)
ElementPtr videoSink () const

Detailed Description

Helper class for painting video on a QGraphicsView.

This is a helper class that represents a video surface on a QGraphicsView. This is not a QGraphicsItem, though, it is just a helper class to bind the video sink to a specific view. To use it, create a GraphicsVideoWidget, add it to your scene and connect it with this surface.

Example

 QGraphicsView *view = new QGraphicsView;
 view->setViewport(new QGLWidget); //recommended
 QGst::Ui::GraphicsVideoSurface *surface = new QGst::Ui::GraphicsVideoSurface(view);
 ...
 QGst::Ui::GraphicsVideoWidget *widget = new QGst::Ui::GraphicsVideoWidget;
 widget->setSurface(surface);
 view->addItem(widget);

This class internally creates and uses either a "qtglvideosink" or a "qtvideosink" element. This element is created the first time it is requested and a reference is kept internally.

To make use of OpenGL hardware acceleration (using qtglvideosink), you need to set a QGLWidget as the viewport of the QGraphicsView. Note that you must do this before the video sink element is requested for the first time using the videoSink() method, as this method needs to find a GL context to be able to construct qtglvideosink and query the hardware about supported features. Using OpenGL acceleration is recommended. If you don't use it, painting will be done in software with QImage and QPainter (using qtvideosink).

This class can also be used to paint video on QML.

Example:

 // in your C++ code
 QDeclarativeView *view = new QDeclarativeView;
 view->setViewport(new QGLWidget); //recommended
 QGst::Ui::GraphicsVideoSurface *surface = new QGst::Ui::GraphicsVideoSurface(view);
 view->rootContext()->setContextProperty(QLatin1String("videoSurface"), surface);
 ...
 // and in your qml file:
 import QtGStreamer 0.10
 ...
 VideoItem {
      id: video
      width: 320
      height: 240
      surface: videoSurface
 }
See also:
GraphicsVideoWidget
Examples:
examples/qmlplayer/main.cpp.

Definition at line 85 of file graphicsvideosurface.h.


Member Function Documentation

Returns the video sink element that provides this surface's image. The element will be constructed the first time that this function is called. The surface will always keep a reference to this element.

Examples:
examples/qmlplayer/main.cpp.

Definition at line 44 of file graphicsvideosurface.cpp.


The documentation for this class was generated from the following files: