diff options
author | Andy Shaw <andy.shaw@qt.io> | 2019-02-19 12:07:47 +0100 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2019-02-19 11:33:45 +0000 |
commit | 6ece7be30accefcdebd6cb1cdfd51f0da83b627b (patch) | |
tree | 167447d01bf75d5256d1ffcc8a401009786eff36 /src | |
parent | 4379f999968a658b884237e17410a212f9be60aa (diff) |
Remove the mirclient code as this is no longer available
Fixes: QTBUG-73878
Change-Id: Ia178d41a3e152174865264c71a75e84cfc31462a
Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
Reviewed-by: Gerry Boland <gerry.boland@canonical.com>
Reviewed-by: VaL Doroshchuk <valentyn.doroshchuk@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/gsttools/gsttools.pro | 9 | ||||
-rw-r--r-- | src/gsttools/qgstreamermirtexturerenderer.cpp | 357 | ||||
-rw-r--r-- | src/gsttools/qgstreamermirtexturerenderer_p.h | 119 | ||||
-rw-r--r-- | src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp | 10 |
4 files changed, 0 insertions, 495 deletions
diff --git a/src/gsttools/gsttools.pro b/src/gsttools/gsttools.pro index b13479ce7..d161fff85 100644 --- a/src/gsttools/gsttools.pro +++ b/src/gsttools/gsttools.pro @@ -82,15 +82,6 @@ qtConfig(gstreamer_0_10) { qgstvideorenderersink.cpp } -qtConfig(mirclient): { - qtConfig(opengles2):qtHaveModule(widgets) { - PRIVATE_HEADERS += qgstreamermirtexturerenderer_p.h - SOURCES += qgstreamermirtexturerenderer.cpp - QT += opengl quick - LIBS += -lEGL - } -} - qtConfig(gstreamer_app) { QMAKE_USE += gstreamer_app PRIVATE_HEADERS += qgstappsrc_p.h diff --git a/src/gsttools/qgstreamermirtexturerenderer.cpp b/src/gsttools/qgstreamermirtexturerenderer.cpp deleted file mode 100644 index 35050db03..000000000 --- a/src/gsttools/qgstreamermirtexturerenderer.cpp +++ /dev/null @@ -1,357 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Canonical Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgstreamermirtexturerenderer_p.h" - -#include <qgstreamerplayersession.h> -#include <private/qvideosurfacegstsink_p.h> -#include <private/qgstutils_p.h> -#include <qabstractvideosurface.h> - -#include <QAbstractVideoBuffer> -#include <QGuiApplication> -#include <QDebug> -#include <QtQuick/QQuickWindow> -#include <QOpenGLContext> -#include <QGLContext> -#include <QGuiApplication> -#include <qgl.h> - -#include <gst/gst.h> - -static QGstreamerMirTextureRenderer *rendererInstance = NULL; - -class QGstreamerMirTextureBuffer : public QAbstractVideoBuffer -{ -public: - QGstreamerMirTextureBuffer(GLuint textureId) : - QAbstractVideoBuffer(QAbstractVideoBuffer::GLTextureHandle), - m_textureId(textureId) - { - } - - MapMode mapMode() const { return NotMapped; } - - uchar *map(MapMode mode, int *numBytes, int *bytesPerLine) - { - qDebug() << Q_FUNC_INFO; - Q_UNUSED(mode); - Q_UNUSED(numBytes); - Q_UNUSED(bytesPerLine); - - return NULL; - } - - void unmap() { qDebug() << Q_FUNC_INFO; } - - QVariant handle() const { return QVariant::fromValue<unsigned int>(m_textureId); } - - GLuint textureId() { return m_textureId; } - -private: - GLuint m_textureId; -}; - -QGstreamerMirTextureRenderer::QGstreamerMirTextureRenderer(QObject *parent - , const QGstreamerPlayerSession *playerSession) - : QVideoRendererControl(0), m_videoSink(0), m_surface(0), - m_glSurface(0), - m_context(0), - m_glContext(0), - m_textureId(0), - m_offscreenSurface(0), - m_textureBuffer(0) -{ - Q_UNUSED(parent); - setPlayerSession(playerSession); -} - -QGstreamerMirTextureRenderer::~QGstreamerMirTextureRenderer() -{ - if (m_videoSink) - gst_object_unref(GST_OBJECT(m_videoSink)); - - delete m_glContext; - delete m_offscreenSurface; -} - -GstElement *QGstreamerMirTextureRenderer::videoSink() -{ - qDebug() << Q_FUNC_INFO; - - // FIXME: Ugly hack until I figure out why passing this segfaults in the g_signal handler - rendererInstance = const_cast<QGstreamerMirTextureRenderer*>(this); - - if (!m_videoSink && m_surface) { - qDebug() << Q_FUNC_INFO << ": using mirsink, (this: " << this << ")"; - - m_videoSink = gst_element_factory_make("mirsink", "video-output"); - - connect(QGuiApplication::instance(), SIGNAL(focusWindowChanged(QWindow*)), - this, SLOT(handleFocusWindowChanged(QWindow*)), Qt::QueuedConnection); - - g_signal_connect(G_OBJECT(m_videoSink), "frame-ready", G_CALLBACK(handleFrameReady), - (gpointer)this); - } - - if (m_videoSink) { - gst_object_ref_sink(GST_OBJECT(m_videoSink)); - - GstPad *pad = gst_element_get_static_pad(m_videoSink, "sink"); - gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER, - padBufferProbe, this, NULL); - } - - return m_videoSink; -} - -QWindow *QGstreamerMirTextureRenderer::createOffscreenWindow(const QSurfaceFormat &format) -{ - QWindow *w = new QWindow(); - w->setSurfaceType(QWindow::OpenGLSurface); - w->setFormat(format); - w->setGeometry(0, 0, 1, 1); - w->setFlags(w->flags() | Qt::WindowTransparentForInput); - w->create(); - - return w; -} - -void QGstreamerMirTextureRenderer::handleFrameReady(gpointer userData) -{ - QGstreamerMirTextureRenderer *renderer = reinterpret_cast<QGstreamerMirTextureRenderer*>(userData); -#if 1 - QMutexLocker locker(&rendererInstance->m_mutex); - QMetaObject::invokeMethod(rendererInstance, "renderFrame", Qt::QueuedConnection); -#else - // FIXME! - //QMutexLocker locker(&renderer->m_mutex); - QMetaObject::invokeMethod(renderer, "renderFrame", Qt::QueuedConnection); -#endif -} - -void QGstreamerMirTextureRenderer::renderFrame() -{ - //qDebug() << Q_FUNC_INFO; - - if (m_context) - m_context->makeCurrent(); - - GstState pendingState = GST_STATE_NULL; - GstState newState = GST_STATE_NULL; - // Don't block and return immediately: - GstStateChangeReturn ret = gst_element_get_state(m_videoSink, &newState, - &pendingState, 0); - if (ret == GST_STATE_CHANGE_FAILURE || newState == GST_STATE_NULL|| - pendingState == GST_STATE_NULL) { - qWarning() << "Invalid state change for renderer, aborting"; - stopRenderer(); - return; - } - - if (!m_surface->isActive()) { - qDebug() << "m_surface is not active"; - GstPad *pad = gst_element_get_static_pad(m_videoSink, "sink"); - GstCaps *caps = gst_pad_get_current_caps(pad); - - if (caps) { - // Get the native video size from the video sink - QSize newNativeSize = QGstUtils::capsCorrectedResolution(caps); - if (m_nativeSize != newNativeSize) { - m_nativeSize = newNativeSize; - emit nativeSizeChanged(); - } - gst_caps_unref(caps); - } - - // Start the surface - QVideoSurfaceFormat format(m_nativeSize, QVideoFrame::Format_RGB32, QAbstractVideoBuffer::GLTextureHandle); - qDebug() << "m_nativeSize: " << m_nativeSize; - qDebug() << "format: " << format; - if (!m_surface->start(format)) { - qWarning() << Q_FUNC_INFO << ": failed to start the video surface " << format; - return; - } - } - - QGstreamerMirTextureBuffer *buffer = new QGstreamerMirTextureBuffer(m_textureId); - //qDebug() << "frameSize: " << m_surface->surfaceFormat().frameSize(); - QVideoFrame frame(buffer, m_surface->surfaceFormat().frameSize(), - m_surface->surfaceFormat().pixelFormat()); - - frame.setMetaData("TextureId", m_textureId); - - // Display the video frame on the surface: - m_surface->present(frame); -} - -GstPadProbeReturn QGstreamerMirTextureRenderer::padBufferProbe(GstPad *pad, GstPadProbeInfo *info, gpointer userData) -{ - Q_UNUSED(pad); - Q_UNUSED(info); - - QGstreamerMirTextureRenderer *control = reinterpret_cast<QGstreamerMirTextureRenderer*>(userData); - QMetaObject::invokeMethod(control, "updateNativeVideoSize", Qt::QueuedConnection); - - return GST_PAD_PROBE_REMOVE; -} - -void QGstreamerMirTextureRenderer::stopRenderer() -{ - if (m_surface) - m_surface->stop(); -} - -QAbstractVideoSurface *QGstreamerMirTextureRenderer::surface() const -{ - return m_surface; -} - -void QGstreamerMirTextureRenderer::setSurface(QAbstractVideoSurface *surface) -{ - qDebug() << Q_FUNC_INFO; - - if (m_surface != surface) { - qDebug() << "Saving current QGLContext"; - m_context = const_cast<QGLContext*>(QGLContext::currentContext()); - - if (m_videoSink) - gst_object_unref(GST_OBJECT(m_videoSink)); - - m_videoSink = 0; - - if (m_surface) { - disconnect(m_surface.data(), SIGNAL(supportedFormatsChanged()), - this, SLOT(handleFormatChange())); - } - - bool wasReady = isReady(); - - m_surface = surface; - - if (m_surface) { - connect(m_surface.data(), SIGNAL(supportedFormatsChanged()), - this, SLOT(handleFormatChange())); - } - - if (wasReady != isReady()) - emit readyChanged(isReady()); - - emit sinkChanged(); - } -} - -void QGstreamerMirTextureRenderer::setPlayerSession(const QGstreamerPlayerSession *playerSession) -{ - m_playerSession = const_cast<QGstreamerPlayerSession*>(playerSession); -} - -void QGstreamerMirTextureRenderer::handleFormatChange() -{ - qDebug() << "Supported formats list has changed, reload video output"; - - if (m_videoSink) - gst_object_unref(GST_OBJECT(m_videoSink)); - - m_videoSink = 0; - emit sinkChanged(); -} - -void QGstreamerMirTextureRenderer::updateNativeVideoSize() -{ - //qDebug() << Q_FUNC_INFO; - const QSize oldSize = m_nativeSize; - - if (m_videoSink) { - // Find video native size to update video widget size hint - GstPad *pad = gst_element_get_static_pad(m_videoSink,"sink"); - GstCaps *caps = gst_pad_get_current_caps(pad); - - if (caps) { - m_nativeSize = QGstUtils::capsCorrectedResolution(caps); - gst_caps_unref(caps); - } - } else { - m_nativeSize = QSize(); - } - qDebug() << Q_FUNC_INFO << oldSize << m_nativeSize << m_videoSink; - - if (m_nativeSize != oldSize) - emit nativeSizeChanged(); -} - -void QGstreamerMirTextureRenderer::handleFocusWindowChanged(QWindow *window) -{ - qDebug() << Q_FUNC_INFO; - - QOpenGLContext *currContext = QOpenGLContext::currentContext(); - - QQuickWindow *w = dynamic_cast<QQuickWindow*>(window); - // If we don't have a GL context in the current thread, create one and share it - // with the render thread GL context - if (!currContext && !m_glContext) { - // This emulates the new QOffscreenWindow class with Qt5.1 - m_offscreenSurface = createOffscreenWindow(w->openglContext()->surface()->format()); - m_offscreenSurface->setParent(window); - - QOpenGLContext *shareContext = 0; - if (m_surface) - shareContext = qobject_cast<QOpenGLContext*>(m_surface->property("GLContext").value<QObject*>()); - m_glContext = new QOpenGLContext; - m_glContext->setFormat(m_offscreenSurface->requestedFormat()); - - if (shareContext) - m_glContext->setShareContext(shareContext); - - if (!m_glContext->create()) - { - qWarning() << "Failed to create new shared context."; - return; - } - } - - if (m_glContext) - m_glContext->makeCurrent(m_offscreenSurface); - - if (m_textureId == 0) { - glGenTextures(1, &m_textureId); - qDebug() << "texture_id (handleFocusWindowChanged): " << m_textureId << endl; - g_object_set(G_OBJECT(m_videoSink), "texture-id", m_textureId, (char*)NULL); - } -} diff --git a/src/gsttools/qgstreamermirtexturerenderer_p.h b/src/gsttools/qgstreamermirtexturerenderer_p.h deleted file mode 100644 index 62150f7e1..000000000 --- a/src/gsttools/qgstreamermirtexturerenderer_p.h +++ /dev/null @@ -1,119 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Canonical Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGSTREAMERMIRTEXTURERENDERER_H -#define QGSTREAMERMIRTEXTURERENDERER_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <qmediaplayer.h> -#include <qvideorenderercontrol.h> -#include <private/qvideosurfacegstsink_p.h> -#include <qabstractvideosurface.h> - -#include "qgstreamervideorendererinterface_p.h" - -QT_BEGIN_NAMESPACE - -class QGstreamerMirTextureBuffer; -class QGstreamerPlayerSession; -class QGLContext; -class QOpenGLContext; -class QSurfaceFormat; - -class QGstreamerMirTextureRenderer : public QVideoRendererControl, public QGstreamerVideoRendererInterface -{ - Q_OBJECT - Q_INTERFACES(QGstreamerVideoRendererInterface) -public: - QGstreamerMirTextureRenderer(QObject *parent = 0, const QGstreamerPlayerSession *playerSession = 0); - virtual ~QGstreamerMirTextureRenderer(); - - QAbstractVideoSurface *surface() const; - void setSurface(QAbstractVideoSurface *surface); - - void setPlayerSession(const QGstreamerPlayerSession *playerSession); - - GstElement *videoSink(); - - void stopRenderer(); - bool isReady() const { return m_surface != 0; } - -signals: - void sinkChanged(); - void readyChanged(bool); - void nativeSizeChanged(); - -private slots: - void handleFormatChange(); - void updateNativeVideoSize(); - void handleFocusWindowChanged(QWindow *window); - void renderFrame(); - -private: - QWindow *createOffscreenWindow(const QSurfaceFormat &format); - static void handleFrameReady(gpointer userData); - static GstPadProbeReturn padBufferProbe(GstPad *pad, GstPadProbeInfo *info, gpointer userData); - - GstElement *m_videoSink; - QPointer<QAbstractVideoSurface> m_surface; - QPointer<QAbstractVideoSurface> m_glSurface; - QGLContext *m_context; - QOpenGLContext *m_glContext; - unsigned int m_textureId; - QWindow *m_offscreenSurface; - QGstreamerPlayerSession *m_playerSession; - QGstreamerMirTextureBuffer *m_textureBuffer; - QSize m_nativeSize; - - QMutex m_mutex; -}; - -QT_END_NAMESPACE - -#endif // QGSTREAMERMIRTEXTURERENDRER_H diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp index 0712f6e6c..a28968145 100644 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp @@ -55,10 +55,6 @@ #include <private/qgstreamervideowindow_p.h> #include <private/qgstreamervideorenderer_p.h> -#if QT_CONFIG(mirclient) && defined (__arm__) -#include "private/qgstreamermirtexturerenderer_p.h" -#endif - #include "qgstreamerstreamscontrol.h" #include <private/qgstreameraudioprobecontrol_p.h> #include <private/qgstreamervideoprobecontrol_p.h> @@ -88,13 +84,7 @@ QGstreamerPlayerService::QGstreamerPlayerService(QObject *parent): m_metaData = new QGstreamerMetaDataProvider(m_session, this); m_streamsControl = new QGstreamerStreamsControl(m_session,this); m_availabilityControl = new QGStreamerAvailabilityControl(m_control->resources(), this); - -#if QT_CONFIG(mirclient) && defined (__arm__) - m_videoRenderer = new QGstreamerMirTextureRenderer(this, m_session); -#else m_videoRenderer = new QGstreamerVideoRenderer(this); -#endif - m_videoWindow = new QGstreamerVideoWindow(this); // If the GStreamer video sink is not available, don't provide the video window control since // it won't work anyway. |