diff --git a/src/gsttools/gsttools.pro b/src/gsttools/gsttools.pro index a5c1d949..e1899f78 100644 --- a/src/gsttools/gsttools.pro +++ b/src/gsttools/gsttools.pro @@ -53,6 +53,8 @@ PRIVATE_HEADERS += \ qgstcodecsinfo_p.h \ qgstreamervideoprobecontrol_p.h \ qgstreameraudioprobecontrol_p.h \ + qgstreamervideosinkcontrol_p.h \ + qgstreamerelementcontrol_p.h \ qgstreamervideowindow_p.h \ qgstreamervideooverlay_p.h @@ -69,6 +71,8 @@ SOURCES += \ qgstcodecsinfo.cpp \ qgstreamervideoprobecontrol.cpp \ qgstreameraudioprobecontrol.cpp \ + qgstreamervideosinkcontrol.cpp \ + qgstreamerelementcontrol.cpp \ qgstreamervideowindow.cpp \ qgstreamervideooverlay.cpp diff --git a/src/gsttools/qgstreamerelementcontrol.cpp b/src/gsttools/qgstreamerelementcontrol.cpp new file mode 100644 index 00000000..a9edfb36 --- /dev/null +++ b/src/gsttools/qgstreamerelementcontrol.cpp @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Jolla Ltd. +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgstreamerelementcontrol_p.h" + + +QGStreamerElementControl::QGStreamerElementControl(QObject *parent) + : QMediaControl(parent) +{ +} + +QGStreamerElementControl::~QGStreamerElementControl() +{ +} diff --git a/src/gsttools/qgstreamervideosinkcontrol.cpp b/src/gsttools/qgstreamervideosinkcontrol.cpp new file mode 100644 index 00000000..3501b931 --- /dev/null +++ b/src/gsttools/qgstreamervideosinkcontrol.cpp @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Jolla Ltd. +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgstreamervideosinkcontrol_p.h" + +#include + +QGStreamerVideoSinkControl::QGStreamerVideoSinkControl(QObject *parent) + : QGStreamerElementControl(parent) + , m_videoSink(0) +{ +} + +QGStreamerVideoSinkControl::~QGStreamerVideoSinkControl() +{ + if (m_videoSink) + gst_object_unref(GST_OBJECT(m_videoSink)); +} + +GstElement *QGStreamerVideoSinkControl::videoSink() +{ + return m_videoSink; +} + +void QGStreamerVideoSinkControl::setElement(GstElement *element) +{ + if (m_videoSink != element) { + if (m_videoSink) + gst_object_unref(GST_OBJECT(m_videoSink)); + m_videoSink = element; + if (m_videoSink) + gst_object_ref(GST_OBJECT(element)); + emit sinkChanged(); + } +} diff --git a/src/multimedia/gsttools_headers/qgstreamerelementcontrol_p.h b/src/multimedia/gsttools_headers/qgstreamerelementcontrol_p.h new file mode 100644 index 00000000..69fd4a39 --- /dev/null +++ b/src/multimedia/gsttools_headers/qgstreamerelementcontrol_p.h @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Jolla Ltd. +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGSTREAMERELEMENTCONTROL_P_H +#define QGSTREAMERELEMENTCONTROL_P_H + +#include + +typedef struct _GstElement GstElement; + +class QGStreamerElementControl : public QMediaControl +{ + Q_OBJECT +public: + virtual ~QGStreamerElementControl(); + + virtual void setElement(GstElement *element) = 0; + +protected: + QGStreamerElementControl(QObject *parent = 0); +}; + +#define QGStreamerVideoSinkControl_iid "org.qt-project.qt.gstreamervideosinkcontrol/5.2" + +#endif diff --git a/src/multimedia/gsttools_headers/qgstreamervideosinkcontrol_p.h b/src/multimedia/gsttools_headers/qgstreamervideosinkcontrol_p.h new file mode 100644 index 00000000..c23d76ff --- /dev/null +++ b/src/multimedia/gsttools_headers/qgstreamervideosinkcontrol_p.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Jolla Ltd. +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGSTREAMERVIDEOSINKCONTROL_P_H +#define QGSTREAMERVIDEOSINKCONTROL_P_H + +#include +#include + +class QGStreamerVideoSinkControl + : public QGStreamerElementControl + , public QGstreamerVideoRendererInterface +{ + Q_OBJECT + Q_INTERFACES(QGstreamerVideoRendererInterface) +public: + QGStreamerVideoSinkControl(QObject *parent = 0); + ~QGStreamerVideoSinkControl(); + + GstElement *videoSink(); + void setElement(GstElement *element); + +Q_SIGNALS: + void sinkChanged(); + void readyChanged(bool); + +private: + GstElement *m_videoSink; +}; + +#endif diff --git a/src/plugins/gstreamer/camerabin/camerabinservice.cpp b/src/plugins/gstreamer/camerabin/camerabinservice.cpp index f0958bc5..f7b1ae12 100644 --- a/src/plugins/gstreamer/camerabin/camerabinservice.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinservice.cpp @@ -67,6 +67,7 @@ #endif #include #include +#include #if defined(Q_WS_MAEMO_6) && defined(__arm__) #include "qgstreamergltexturerenderer.h" @@ -170,6 +171,8 @@ QMediaControl *CameraBinService::requestControl(const char *name) m_videoOutput = m_videoRenderer; } else if (qstrcmp(name, QVideoWindowControl_iid) == 0) { m_videoOutput = m_videoWindow; + } else if (qstrcmp(name, QGStreamerVideoSinkControl_iid) == 0) { + m_videoOutput = new QGStreamerVideoSinkControl(this); } #if defined(HAVE_WIDGETS) else if (qstrcmp(name, QVideoWidgetControl_iid) == 0) { diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.cpp b/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.cpp index a29c1d26..9fb2d281 100644 --- a/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.cpp +++ b/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.cpp @@ -49,6 +49,7 @@ #include "qgstreamerimagecapturecontrol.h" #include #include +#include #include #include @@ -188,6 +189,8 @@ QMediaControl *QGstreamerCaptureService::requestControl(const char *name) m_videoOutput = m_videoRenderer; } else if (qstrcmp(name, QVideoWindowControl_iid) == 0) { m_videoOutput = m_videoWindow; + } else if (qstrcmp(name, QGStreamerVideoSinkControl_iid) == 0) { + m_videoOutput = new QGStreamerVideoSinkControl(this); } #if defined(HAVE_WIDGETS) else if (qstrcmp(name, QVideoWidgetControl_iid) == 0) { diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp index 69250c0b..51f840c1 100644 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp @@ -49,6 +49,7 @@ #endif #include #include +#include #if defined(Q_WS_MAEMO_6) && defined(__arm__) #include "private/qgstreamergltexturerenderer.h" @@ -161,6 +162,8 @@ QMediaControl *QGstreamerPlayerService::requestControl(const char *name) m_videoOutput = m_videoRenderer; else if (qstrcmp(name, QVideoWindowControl_iid) == 0) m_videoOutput = m_videoWindow; + else if (qstrcmp(name, QGStreamerVideoSinkControl_iid) == 0) + m_videoOutput = new QGStreamerVideoSinkControl(this); #if defined(HAVE_WIDGETS) else if (qstrcmp(name, QVideoWidgetControl_iid) == 0) m_videoOutput = m_videoWidget;