S60VideoOverlay::S60VideoOverlay(QObject *parent) : QVideoWindowControl(parent) , m_surface(new S60VideoSurface) , m_aspectRatioMode(Qt::KeepAspectRatio) , m_fullScreen(false) { connect(m_surface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)), this, SLOT(surfaceFormatChanged())); }
QGstreamerVideoOverlay::QGstreamerVideoOverlay(QObject *parent) : QVideoWindowControl(parent) , m_surface(new QX11VideoSurface) , m_videoSink(reinterpret_cast<GstElement*>(QVideoSurfaceGstSink::createSink(m_surface))) , m_aspectRatioMode(Qt::KeepAspectRatio) , m_fullScreen(false) { if (m_videoSink) { gst_object_ref(GST_OBJECT(m_videoSink)); //Take ownership gst_object_sink(GST_OBJECT(m_videoSink)); } connect(m_surface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)), this, SLOT(surfaceFormatChanged())); }
void QAbstractVideoSurface::stop() { if (property("_q_active").toBool()) { setProperty("_q_format", QVariant::fromValue(QVideoSurfaceFormat())); setProperty("_q_active", false); emit activeChanged(false); emit surfaceFormatChanged(surfaceFormat()); } }
/*! Stops a video surface presenting frames and releases any resources acquired in start(). \note You must call the base class implementation of stop() at the start of your implementation. \sa isActive(), start() */ void QAbstractVideoSurface::stop() { Q_D(QAbstractVideoSurface); if (d->active) { d->surfaceFormat = QVideoSurfaceFormat(); d->active = false; emit activeChanged(false); emit surfaceFormatChanged(surfaceFormat()); } }
/*! \since 1.2 */ bool QEglImageTextureSurface::start(const QVideoSurfaceFormat &format) { #ifdef DEBUG_OMAPFB_SURFACE qDebug() << Q_FUNC_INFO << format; #endif m_fallbackSurfaceActive = false; if (format.handleType() != EGLImageTextureHandle) { qWarning() << Q_FUNC_INFO << "Non EGLImageTextureHandle based format requested, fallback to QPainterVideoSurface"; connect(m_fallbackSurface, SIGNAL(activeChanged(bool)), this, SIGNAL(activeChanged(bool))); connect(m_fallbackSurface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)), this, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat))); connect(m_fallbackSurface, SIGNAL(supportedFormatsChanged()), this, SIGNAL(supportedFormatsChanged())); connect(m_fallbackSurface, SIGNAL(nativeResolutionChanged(QSize)), this, SIGNAL(nativeResolutionChanged(QSize))); connect(m_fallbackSurface, SIGNAL(frameChanged()), this, SIGNAL(frameChanged())); if (m_fallbackSurface->start(format)) { m_fallbackSurfaceActive = true; QAbstractVideoSurface::start(format); } else { qWarning() << Q_FUNC_INFO << "failed to start video surface:" << m_fallbackSurface->error(); setError(m_fallbackSurface->error()); disconnect(m_fallbackSurface, SIGNAL(activeChanged(bool)), this, SIGNAL(activeChanged(bool))); disconnect(m_fallbackSurface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)), this, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat))); disconnect(m_fallbackSurface, SIGNAL(supportedFormatsChanged()), this, SIGNAL(supportedFormatsChanged())); disconnect(m_fallbackSurface, SIGNAL(nativeResolutionChanged(QSize)), this, SIGNAL(nativeResolutionChanged(QSize))); disconnect(m_fallbackSurface, SIGNAL(frameChanged()), this, SIGNAL(frameChanged())); } return m_fallbackSurfaceActive; }
/* Constructs a graphics item that displays video. The \a parent is passed to QGraphicsItem. */ QGraphicsVideoItem::QGraphicsVideoItem(QGraphicsItem *parent) : QGraphicsObject(parent) , d_ptr(new QGraphicsVideoItemPrivate) { d_ptr->q_ptr = this; d_ptr->surface = new QEglImageTextureSurface(this); qRegisterMetaType<QVideoSurfaceFormat>(); connect(d_ptr->surface, SIGNAL(frameChanged()), this, SLOT(_q_present())); connect(d_ptr->surface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)), this, SLOT(_q_updateNativeSize()), Qt::QueuedConnection); }
bool QAbstractVideoSurface::start(const QVideoSurfaceFormat &format) { bool wasActive = property("_q_active").toBool(); setProperty("_q_active", true); setProperty("_q_format", QVariant::fromValue(format)); setProperty("_q_error", QVariant::fromValue(NoError)); emit surfaceFormatChanged(format); if (!wasActive) emit activeChanged(true); return true; }
/*! Starts a video surface presenting \a format frames. Returns true if the surface was started, and false if an error occurred. \note You must call the base class implementation of start() at the end of your implementation. \sa isActive(), stop() */ bool QAbstractVideoSurface::start(const QVideoSurfaceFormat &format) { Q_D(QAbstractVideoSurface); bool wasActive = d->active; d->active = true; d->surfaceFormat = format; d->error = NoError; emit surfaceFormatChanged(format); if (!wasActive) emit activeChanged(true); return true; }
QDeclarativeVideoRendererBackend::QDeclarativeVideoRendererBackend(QDeclarativeVideoOutput *parent) : QDeclarativeVideoBackend(parent), m_glContext(0), m_frameChanged(false) { m_surface = new QSGVideoItemSurface(this); QObject::connect(m_surface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)), q, SLOT(_q_updateNativeSize()), Qt::QueuedConnection); // Prioritize the plugin requested by the environment QString requestedVideoNode = QString::fromLatin1(qgetenv("QT_VIDEONODE")); foreach (const QString &key, videoNodeFactoryLoader()->keys()) { QObject *instance = videoNodeFactoryLoader()->instance(key); QSGVideoNodeFactoryInterface* plugin = qobject_cast<QSGVideoNodeFactoryInterface*>(instance); if (plugin) { if (key == requestedVideoNode) m_videoNodeFactories.prepend(plugin); else m_videoNodeFactories.append(plugin); qCDebug(qLcVideo) << "found videonode plugin" << key << plugin; } }