18#include "graphicsvideosurface_p.h"
19#include "../elementfactory.h"
20#include "../../QGlib/connect.h"
22#ifndef QTGSTREAMER_UI_NO_OPENGL
23# include <QtOpenGL/QGLWidget>
29GraphicsVideoSurface::GraphicsVideoSurface(QGraphicsView *parent)
30 : QObject(parent), d(new GraphicsVideoSurfacePrivate)
35GraphicsVideoSurface::~GraphicsVideoSurface()
37 if (!d->videoSink.isNull()) {
38 d->videoSink->setState(QGst::StateNull);
46 if (d->videoSink.isNull()) {
47#ifndef QTGSTREAMER_UI_NO_OPENGL
49 QGLWidget *glw = qobject_cast<QGLWidget*>(d->view->viewport());
51 d->videoSink = QGst::ElementFactory::make(QTGLVIDEOSINK_NAME);
53 if (!d->videoSink.isNull()) {
55 d->videoSink->setProperty(
"glcontext", (
void*) QGLContext::currentContext());
58 if (d->videoSink->setState(QGst::StateReady) != QGst::StateChangeSuccess) {
65 if (d->videoSink.isNull()) {
66 d->videoSink = QGst::ElementFactory::make(QTVIDEOSINK_NAME);
68 if (d->videoSink.isNull()) {
69 qCritical(
"Failed to create qtvideosink. Make sure it is installed correctly");
76 &GraphicsVideoSurface::onUpdate);
82void GraphicsVideoSurface::onUpdate()
85 item->update(item->rect());
Helper class for painting video on a QGraphicsView.
bool connect(void *instance, const char *detailedSignal, T *receiver, R(T::*slot)(Args...), ConnectFlags flags=0)
Wrappers for GStreamer classes.