Split gstreamer plugin into smaller plugins providing fewer services

The gstreamer blob has been split into four plugins: audiodecoder,
camerabin, mediacapture, and mediaplayer.
Note: camerabin is still disabled because it is untested camerabin2
implementation.
A new qmake configuration use_gstreamer_camera has been introduced
and is needed for the mediacapture plugin to expose the camera
service. This configuration has been disabled by default.
Shared functionality has been moved to the internal gsttools library.

Change-Id: Ifb2604f440cfa97513d39f5d7978766c88eaec45
Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
This commit is contained in:
Jonas Rabbe
2012-03-22 11:04:03 +10:00
committed by Qt by Nokia
parent e44bcf0a38
commit a3b6eabd45
58 changed files with 923 additions and 322 deletions

View File

@@ -0,0 +1,87 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QGSTVIDEOCONNECTOR_H
#define QGSTVIDEOCONNECTOR_H
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_VIDEO_CONNECTOR \
(gst_video_connector_get_type())
#define GST_VIDEO_CONNECTOR(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VIDEO_CONNECTOR, GstVideoConnector))
#define GST_VIDEO_CONNECTOR_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VIDEO_CONNECTOR, GstVideoConnectorClass))
#define GST_IS_VIDEO_CONNECTOR(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VIDEO_CONNECTOR))
#define GST_IS_VIDEO_CONNECTOR_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VIDEO_CONNECTOR))
typedef struct _GstVideoConnector GstVideoConnector;
typedef struct _GstVideoConnectorClass GstVideoConnectorClass;
struct _GstVideoConnector {
GstElement element;
GstPad *srcpad;
GstPad *sinkpad;
gboolean relinked;
gboolean failedSignalEmited;
GstSegment segment;
GstBuffer *latest_buffer;
};
struct _GstVideoConnectorClass {
GstElementClass parent_class;
/* action signal to resend new segment */
void (*resend_new_segment) (GstElement * element, gboolean emitFailedSignal);
};
GType gst_video_connector_get_type (void);
G_END_DECLS
#endif

View File

@@ -0,0 +1,106 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QGSTAPPSRC_H
#define QGSTAPPSRC_H
#include <QtCore/qobject.h>
#include <QtCore/qiodevice.h>
#include <gst/gst.h>
#include <gst/app/gstappsrc.h>
#include <gst/app/gstappbuffer.h>
class QGstAppSrc : public QObject
{
Q_OBJECT
public:
QGstAppSrc(QObject *parent = 0);
~QGstAppSrc();
bool setup(GstElement *);
bool isReady() const { return m_setup; }
void setStream(QIODevice *);
QIODevice *stream() const;
GstAppSrc *element();
qint64 queueSize() const { return m_maxBytes; }
bool& enoughData() { return m_enoughData; }
bool& dataRequested() { return m_dataRequested; }
unsigned int& dataRequestSize() { return m_dataRequestSize; }
bool isStreamValid() const
{
return m_stream != 0 &&
m_stream->isOpen();
}
private slots:
void pushDataToAppSrc();
bool doSeek(qint64);
void onDataReady();
void streamDestroyed();
private:
static gboolean on_seek_data(GstAppSrc *element, guint64 arg0, gpointer userdata);
static void on_enough_data(GstAppSrc *element, gpointer userdata);
static void on_need_data(GstAppSrc *element, uint arg0, gpointer userdata);
static void destroy_notify(gpointer data);
void sendEOS();
QIODevice *m_stream;
GstAppSrc *m_appSrc;
bool m_sequential;
GstAppStreamType m_streamType;
GstAppSrcCallbacks m_callbacks;
qint64 m_maxBytes;
bool m_setup;
unsigned int m_dataRequestSize;
bool m_dataRequested;
bool m_enoughData;
bool m_forceData;
};
#endif

View File

@@ -0,0 +1,72 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QGSTCODECSINFO_H
#define QGSTCODECSINFO_H
#include <QtCore/qmap.h>
#include <QtCore/qstringlist.h>
#include <gst/gst.h>
class QGstCodecsInfo
{
public:
enum ElementType { AudioEncoder, VideoEncoder, Muxer };
QGstCodecsInfo(ElementType elementType);
QStringList supportedCodecs() const;
QString codecDescription(const QString &codec) const;
#if GST_CHECK_VERSION(0,10,31)
static GstCaps* supportedElementCaps(GstElementFactoryListType elementType,
GstRank minimumRank = GST_RANK_MARGINAL,
GstPadDirection padDirection = GST_PAD_SRC);
#endif
private:
QStringList m_codecs;
QMap<QString,QString> m_codecDescriptions;
};
#endif

View File

@@ -0,0 +1,78 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QGSTREAMERAUDIOINPUTENDPOINTSELECTOR_H
#define QGSTREAMERAUDIOINPUTENDPOINTSELECTOR_H
#include <qaudioendpointselector.h>
#include <QtCore/qstringlist.h>
QT_BEGIN_NAMESPACE
class QGstreamerAudioInputEndpointSelector : public QAudioEndpointSelector
{
Q_OBJECT
public:
QGstreamerAudioInputEndpointSelector(QObject *parent);
~QGstreamerAudioInputEndpointSelector();
QList<QString> availableEndpoints() const;
QString endpointDescription(const QString& name) const;
QString defaultEndpoint() const;
QString activeEndpoint() const;
public Q_SLOTS:
void setActiveEndpoint(const QString& name);
private:
void update();
void updateAlsaDevices();
void updateOssDevices();
void updatePulseDevices();
QString m_audioInput;
QList<QString> m_names;
QList<QString> m_descriptions;
};
QT_END_NAMESPACE
#endif // QGSTREAMERAUDIOINPUTENDPOINTSELECTOR_H

View File

@@ -0,0 +1,71 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QGSTREAMERAUDIOPROBECONTROL_H
#define QGSTREAMERAUDIOPROBECONTROL_H
#include <gst/gst.h>
#include <qmediaaudioprobecontrol.h>
#include <QtCore/qmutex.h>
#include <qaudiobuffer.h>
QT_BEGIN_NAMESPACE
class QGstreamerAudioProbeControl : public QMediaAudioProbeControl
{
Q_OBJECT
public:
explicit QGstreamerAudioProbeControl(QObject *parent);
virtual ~QGstreamerAudioProbeControl();
void bufferProbed(GstBuffer* buffer);
private slots:
void bufferProbed();
private:
QAudioBuffer m_pendingBuffer;
QMutex m_bufferMutex;
};
QT_END_NAMESPACE
#endif // QGSTREAMERAUDIOPROBECONTROL_H

View File

@@ -0,0 +1,132 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QGSTREAMERGLTEXTURERENDERER_H
#define QGSTREAMERGLTEXTURERENDERER_H
#include <qvideorenderercontrol.h>
#include <private/qvideosurfacegstsink_p.h>
#include <private/qgstreamerbushelper_p.h>
#include "qgstreamervideorendererinterface_p.h"
#include <QtGui/qcolor.h>
#include <X11/extensions/Xv.h>
QT_BEGIN_NAMESPACE
class QGLContext;
class QGstreamerGLTextureRenderer : public QVideoRendererControl,
public QGstreamerVideoRendererInterface,
public QGstreamerSyncMessageFilter,
public QGstreamerBusMessageFilter
{
Q_OBJECT
Q_INTERFACES(QGstreamerVideoRendererInterface QGstreamerSyncMessageFilter QGstreamerBusMessageFilter)
Q_PROPERTY(bool overlayEnabled READ overlayEnabled WRITE setOverlayEnabled)
Q_PROPERTY(qulonglong winId READ winId WRITE setWinId)
Q_PROPERTY(QRect overlayGeometry READ overlayGeometry WRITE setOverlayGeometry)
Q_PROPERTY(QColor colorKey READ colorKey)
Q_PROPERTY(QSize nativeSize READ nativeSize NOTIFY nativeSizeChanged)
public:
QGstreamerGLTextureRenderer(QObject *parent = 0);
virtual ~QGstreamerGLTextureRenderer();
QAbstractVideoSurface *surface() const;
void setSurface(QAbstractVideoSurface *surface);
GstElement *videoSink();
bool isReady() const;
bool processBusMessage(const QGstreamerMessage &message);
bool processSyncMessage(const QGstreamerMessage &message);
void stopRenderer();
int framebufferNumber() const;
bool overlayEnabled() const;
WId winId() const;
QRect overlayGeometry() const;
QColor colorKey() const;
QSize nativeSize() const;
public slots:
void renderGLFrame(int);
void setOverlayEnabled(bool);
void setWinId(WId id);
void setOverlayGeometry(const QRect &geometry);
void repaintOverlay();
signals:
void sinkChanged();
void readyChanged(bool);
void nativeSizeChanged();
private slots:
void handleFormatChange();
void updateNativeVideoSize();
private:
static void handleFrameReady(GstElement *sink, gint frame, gpointer data);
static gboolean padBufferProbe(GstPad *pad, GstBuffer *buffer, gpointer user_data);
GstElement *m_videoSink;
QAbstractVideoSurface *m_surface;
QGLContext *m_context;
QSize m_nativeSize;
WId m_winId;
QColor m_colorKey;
QRect m_displayRect;
bool m_overlayEnabled;
int m_bufferProbeId;
QMutex m_mutex;
QWaitCondition m_renderCondition;
};
QT_END_NAMESPACE
#endif // QGSTREAMERVIDEORENDRER_H

View File

@@ -0,0 +1,78 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QGSTREAMERVIDEOINPUTDEVICECONTROL_H
#define QGSTREAMERVIDEOINPUTDEVICECONTROL_H
#include <qvideodevicecontrol.h>
#include <QtCore/qstringlist.h>
QT_BEGIN_NAMESPACE
class QGstreamerVideoInputDeviceControl : public QVideoDeviceControl
{
Q_OBJECT
public:
QGstreamerVideoInputDeviceControl(QObject *parent);
~QGstreamerVideoInputDeviceControl();
int deviceCount() const;
QString deviceName(int index) const;
QString deviceDescription(int index) const;
int defaultDevice() const;
int selectedDevice() const;
public Q_SLOTS:
void setSelectedDevice(int index);
private:
void update();
int m_selectedDevice;
QStringList m_names;
QStringList m_descriptions;
};
QT_END_NAMESPACE
#endif // QGSTREAMERAUDIOINPUTDEVICECONTROL_H

View File

@@ -0,0 +1,117 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QGSTREAMERVIDEOOVERLAY_H
#define QGSTREAMERVIDEOOVERLAY_H
#include <qvideowindowcontrol.h>
#include "qgstreamervideorendererinterface_p.h"
QT_BEGIN_NAMESPACE
class QAbstractVideoSurface;
QT_END_NAMESPACE
class QX11VideoSurface;
QT_BEGIN_NAMESPACE
class QGstreamerVideoOverlay : public QVideoWindowControl, public QGstreamerVideoRendererInterface
{
Q_OBJECT
Q_INTERFACES(QGstreamerVideoRendererInterface)
public:
QGstreamerVideoOverlay(QObject *parent = 0);
~QGstreamerVideoOverlay();
WId winId() const;
void setWinId(WId id);
QRect displayRect() const;
void setDisplayRect(const QRect &rect);
bool isFullScreen() const;
void setFullScreen(bool fullScreen);
QSize nativeSize() const;
Qt::AspectRatioMode aspectRatioMode() const;
void setAspectRatioMode(Qt::AspectRatioMode mode);
void repaint();
int brightness() const;
void setBrightness(int brightness);
int contrast() const;
void setContrast(int contrast);
int hue() const;
void setHue(int hue);
int saturation() const;
void setSaturation(int saturation);
QAbstractVideoSurface *surface() const;
GstElement *videoSink();
bool isReady() const { return winId() != 0; }
signals:
void sinkChanged();
void readyChanged(bool);
private slots:
void surfaceFormatChanged();
private:
void setScaledDisplayRect();
QX11VideoSurface *m_surface;
GstElement *m_videoSink;
Qt::AspectRatioMode m_aspectRatioMode;
QRect m_displayRect;
bool m_fullScreen;
};
QT_END_NAMESPACE
#endif

View File

@@ -0,0 +1,75 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QGSTREAMERVIDEOPROBECONTROL_H
#define QGSTREAMERVIDEOPROBECONTROL_H
#include <gst/gst.h>
#include <qmediavideoprobecontrol.h>
#include <QtCore/qmutex.h>
#include <qvideoframe.h>
QT_BEGIN_NAMESPACE
class QGstreamerVideoProbeControl : public QMediaVideoProbeControl
{
Q_OBJECT
public:
explicit QGstreamerVideoProbeControl(QObject *parent);
virtual ~QGstreamerVideoProbeControl();
void bufferProbed(GstBuffer* buffer);
void startFlushing();
void stopFlushing();
private slots:
void frameProbed();
private:
bool m_flushing;
bool m_frameProbed; // true if at least one frame was probed
QVideoFrame m_pendingFrame;
QMutex m_frameMutex;
};
QT_END_NAMESPACE
#endif // QGSTREAMERVIDEOPROBECONTROL_H

View File

@@ -0,0 +1,81 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QGSTREAMERVIDEORENDERER_H
#define QGSTREAMERVIDEORENDERER_H
#include <qvideorenderercontrol.h>
#include <private/qvideosurfacegstsink_p.h>
#include "qgstreamervideorendererinterface_p.h"
QT_BEGIN_NAMESPACE
class QGstreamerVideoRenderer : public QVideoRendererControl, public QGstreamerVideoRendererInterface
{
Q_OBJECT
Q_INTERFACES(QGstreamerVideoRendererInterface)
public:
QGstreamerVideoRenderer(QObject *parent = 0);
virtual ~QGstreamerVideoRenderer();
QAbstractVideoSurface *surface() const;
void setSurface(QAbstractVideoSurface *surface);
GstElement *videoSink();
bool isReady() const { return m_surface != 0; }
signals:
void sinkChanged();
void readyChanged(bool);
private slots:
void handleFormatChange();
private:
QVideoSurfaceGstSink *m_videoSink;
QAbstractVideoSurface *m_surface;
};
QT_END_NAMESPACE
#endif // QGSTREAMERVIDEORENDRER_H

View File

@@ -0,0 +1,75 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QGSTREAMERVIDEOOUTPUTCONTROL_H
#define QGSTREAMERVIDEOOUTPUTCONTROL_H
#include <gst/gst.h>
#include <QtCore/qobject.h>
QT_BEGIN_NAMESPACE
class QGstreamerVideoRendererInterface
{
public:
virtual ~QGstreamerVideoRendererInterface();
virtual GstElement *videoSink() = 0;
//stopRenderer() is called when the renderer element is stopped.
//it can be reimplemented when video renderer can't detect
//changes to NULL state but has to free video resources.
virtual void stopRenderer() {}
//the video output is configured, usually after the first paint event
//(winId is known,
virtual bool isReady() const { return true; }
//signals:
//void sinkChanged();
//void readyChanged(bool);
};
#define QGstreamerVideoRendererInterface_iid "org.qt-project.qt.gstreamervideorenderer/5.0"
Q_DECLARE_INTERFACE(QGstreamerVideoRendererInterface, QGstreamerVideoRendererInterface_iid)
QT_END_NAMESPACE
#endif

View File

@@ -0,0 +1,114 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QGSTREAMERVIDEOWIDGET_H
#define QGSTREAMERVIDEOWIDGET_H
#include <qvideowidgetcontrol.h>
#include "qgstreamervideorendererinterface_p.h"
#include <private/qgstreamerbushelper_p.h>
QT_BEGIN_NAMESPACE
class QGstreamerVideoWidget;
class QGstreamerVideoWidgetControl
: public QVideoWidgetControl
, public QGstreamerVideoRendererInterface
, public QGstreamerSyncMessageFilter
, public QGstreamerBusMessageFilter
{
Q_OBJECT
Q_INTERFACES(QGstreamerVideoRendererInterface QGstreamerSyncMessageFilter QGstreamerBusMessageFilter)
public:
QGstreamerVideoWidgetControl(QObject *parent = 0);
virtual ~QGstreamerVideoWidgetControl();
GstElement *videoSink();
QWidget *videoWidget();
Qt::AspectRatioMode aspectRatioMode() const;
void setAspectRatioMode(Qt::AspectRatioMode mode);
bool isFullScreen() const;
void setFullScreen(bool fullScreen);
int brightness() const;
void setBrightness(int brightness);
int contrast() const;
void setContrast(int contrast);
int hue() const;
void setHue(int hue);
int saturation() const;
void setSaturation(int saturation);
void setOverlay();
bool eventFilter(QObject *object, QEvent *event);
bool processSyncMessage(const QGstreamerMessage &message);
bool processBusMessage(const QGstreamerMessage &message);
public slots:
void updateNativeVideoSize();
signals:
void sinkChanged();
void readyChanged(bool);
private:
void createVideoWidget();
void windowExposed();
GstElement *m_videoSink;
QGstreamerVideoWidget *m_widget;
WId m_windowId;
Qt::AspectRatioMode m_aspectRatioMode;
bool m_fullScreen;
};
QT_END_NAMESPACE
#endif // QGSTREAMERVIDEOWIDGET_H

View File

@@ -0,0 +1,133 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QGSTREAMERVIDEOWINDOW_H
#define QGSTREAMERVIDEOWINDOW_H
#include <qvideowindowcontrol.h>
#include "qgstreamervideorendererinterface_p.h"
#include <private/qgstreamerbushelper_p.h>
#include <QtGui/qcolor.h>
QT_BEGIN_NAMESPACE
class QAbstractVideoSurface;
QT_END_NAMESPACE
class QX11VideoSurface;
QT_BEGIN_NAMESPACE
class QGstreamerVideoWindow : public QVideoWindowControl,
public QGstreamerVideoRendererInterface,
public QGstreamerSyncMessageFilter
{
Q_OBJECT
Q_INTERFACES(QGstreamerVideoRendererInterface QGstreamerSyncMessageFilter)
Q_PROPERTY(QColor colorKey READ colorKey WRITE setColorKey)
Q_PROPERTY(bool autopaintColorKey READ autopaintColorKey WRITE setAutopaintColorKey)
public:
QGstreamerVideoWindow(QObject *parent = 0, const char *elementName = 0);
~QGstreamerVideoWindow();
WId winId() const;
void setWinId(WId id);
QRect displayRect() const;
void setDisplayRect(const QRect &rect);
bool isFullScreen() const;
void setFullScreen(bool fullScreen);
QSize nativeSize() const;
Qt::AspectRatioMode aspectRatioMode() const;
void setAspectRatioMode(Qt::AspectRatioMode mode);
QColor colorKey() const;
void setColorKey(const QColor &);
bool autopaintColorKey() const;
void setAutopaintColorKey(bool);
void repaint();
int brightness() const;
void setBrightness(int brightness);
int contrast() const;
void setContrast(int contrast);
int hue() const;
void setHue(int hue);
int saturation() const;
void setSaturation(int saturation);
QAbstractVideoSurface *surface() const;
GstElement *videoSink();
bool processSyncMessage(const QGstreamerMessage &message);
bool isReady() const { return m_windowId != 0; }
signals:
void sinkChanged();
void readyChanged(bool);
private slots:
void updateNativeVideoSize();
private:
static void padBufferProbe(GstPad *pad, GstBuffer *buffer, gpointer user_data);
GstElement *m_videoSink;
WId m_windowId;
Qt::AspectRatioMode m_aspectRatioMode;
QRect m_displayRect;
bool m_fullScreen;
QSize m_nativeSize;
mutable QColor m_colorKey;
int m_bufferProbeId;
};
QT_END_NAMESPACE
#endif

View File

@@ -54,6 +54,7 @@
//
#include <QtCore/qmap.h>
#include <QtCore/qset.h>
#include <gst/gst.h>
#include <qaudioformat.h>
@@ -71,6 +72,10 @@ namespace QGstUtils {
QAudioFormat audioFormatForCaps(const GstCaps *caps);
QAudioFormat audioFormatForBuffer(GstBuffer *buffer);
GstCaps *capsForAudioFormat(QAudioFormat format);
void initializeGst();
QtMultimedia::SupportEstimate hasSupport(const QString &mimeType,
const QStringList &codecs,
const QSet<QString> &supportedMimeTypeSet);
}
QT_END_NAMESPACE

View File

@@ -0,0 +1,117 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QX11VIDEOSURFACE_H
#define QX11VIDEOSURFACE_H
#include <QtWidgets/qwidget.h>
#include <qabstractvideosurface.h>
#include <X11/Xlib.h>
#include <X11/extensions/Xv.h>
#include <X11/extensions/Xvlib.h>
QT_BEGIN_NAMESPACE
class QX11VideoSurface : public QAbstractVideoSurface
{
Q_OBJECT
public:
QX11VideoSurface(QObject *parent = 0);
~QX11VideoSurface();
WId winId() const;
void setWinId(WId id);
QRect displayRect() const;
void setDisplayRect(const QRect &rect);
QRect viewport() const;
void setViewport(const QRect &rect);
int brightness() const;
void setBrightness(int brightness);
int contrast() const;
void setContrast(int contrast);
int hue() const;
void setHue(int hue);
int saturation() const;
void setSaturation(int saturation);
QList<QVideoFrame::PixelFormat> supportedPixelFormats(
QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const;
bool start(const QVideoSurfaceFormat &format);
void stop();
bool present(const QVideoFrame &frame);
private:
Display *display() const;
WId m_winId;
XvPortID m_portId;
GC m_gc;
XvImage *m_image;
QList<QVideoFrame::PixelFormat> m_supportedPixelFormats;
QVector<int> m_formatIds;
QRect m_viewport;
QRect m_displayRect;
QPair<int, int> m_brightnessRange;
QPair<int, int> m_contrastRange;
QPair<int, int> m_hueRange;
QPair<int, int> m_saturationRange;
bool findPort();
void querySupportedFormats();
int getAttribute(const char *attribute, int minimum, int maximum) const;
void setAttribute(const char *attribute, int value, int minimum, int maximum);
static int redistribute(int value, int fromLower, int fromUpper, int toLower, int toUpper);
};
QT_END_NAMESPACE
#endif