summaryrefslogtreecommitdiffstats
path: root/src/multimedia
diff options
context:
space:
mode:
authorJonas Rabbe <jonas.rabbe@nokia.com>2011-11-08 12:38:02 +1000
committerQt by Nokia <qt-info@nokia.com>2011-11-14 07:59:19 +0100
commit956526a9fb769acc66b376be0b051c0108a06f21 (patch)
treeaf4fd6da5f8d54483c1d944fa15c5bb366fbd7a8 /src/multimedia
parent34cdc41a935766a7d773cb7e2bdb7ce27711dd9d (diff)
Changed QVideoSurfaceGstSink to take pools from plugins
Change-Id: Iec743efc52513e2000276b9a18d1d9639c270699 Reviewed-by: Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com>
Diffstat (limited to 'src/multimedia')
-rw-r--r--src/multimedia/gsttools_headers/qgstbufferpoolinterface_p.h (renamed from src/multimedia/gsttools_headers/qabstractgstbufferpool_p.h)45
-rw-r--r--src/multimedia/gsttools_headers/qgstxvimagebuffer_p.h4
-rw-r--r--src/multimedia/gsttools_headers/qvideosurfacegstsink_p.h8
3 files changed, 46 insertions, 11 deletions
diff --git a/src/multimedia/gsttools_headers/qabstractgstbufferpool_p.h b/src/multimedia/gsttools_headers/qgstbufferpoolinterface_p.h
index 40c75ad32..7dbccfdbc 100644
--- a/src/multimedia/gsttools_headers/qabstractgstbufferpool_p.h
+++ b/src/multimedia/gsttools_headers/qgstbufferpoolinterface_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QGSTBUFFERPOOL_P_H
-#define QGSTBUFFERPOOL_P_H
+#ifndef QGSTBUFFERPOOLINTERFACE_P_H
+#define QGSTBUFFERPOOLINTERFACE_P_H
//
// W A R N I N G
@@ -55,16 +55,21 @@
#include <qabstractvideobuffer.h>
#include <qvideosurfaceformat.h>
+#include <QtCore/qobject.h>
+#include <QtCore/qplugin.h>
+#include <QtCore/qfactoryinterface.h>
#include <gst/gst.h>
+const QLatin1String QGstBufferPoolPluginKey("bufferpool");
+
/*!
Abstract interface for video buffers allocation.
*/
-class QAbstractGstBufferPool
+class QGstBufferPoolInterface : public QFactoryInterface
{
public:
- virtual ~QAbstractGstBufferPool() {}
+ virtual ~QGstBufferPoolInterface() {}
virtual bool isFormatSupported(const QVideoSurfaceFormat &format) const = 0;
@@ -83,4 +88,34 @@ public:
virtual QAbstractVideoBuffer *prepareVideoBuffer(GstBuffer *buffer, int bytesPerLine) = 0;
};
+#define QGstBufferPoolInterface_iid "com.nokia.Qt.QGstBufferPoolInterface"
+Q_DECLARE_INTERFACE(QGstBufferPoolInterface, QGstBufferPoolInterface_iid)
+
+class QGstBufferPoolPlugin : public QObject, public QGstBufferPoolInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(QGstBufferPoolInterface:QFactoryInterface)
+public:
+ explicit QGstBufferPoolPlugin(QObject *parent = 0);
+ virtual ~QGstBufferPoolPlugin() {}
+
+ virtual bool isFormatSupported(const QVideoSurfaceFormat &format) const = 0;
+
+ virtual GType bufferType() const = 0;
+ virtual GstBuffer *takeBuffer(const QVideoSurfaceFormat &format, GstCaps *caps) = 0;
+ virtual void clear() = 0;
+
+ virtual QAbstractVideoBuffer::HandleType handleType() const = 0;
+
+ /*!
+ Build an QAbstractVideoBuffer instance from compatible (mathcing gst buffer type)
+ GstBuffer.
+
+ This method is called from gstreamer video sink thread.
+ */
+ virtual QAbstractVideoBuffer *prepareVideoBuffer(GstBuffer *buffer, int bytesPerLine) = 0;
+
+ virtual QStringList keys() const = 0;
+};
+
#endif
diff --git a/src/multimedia/gsttools_headers/qgstxvimagebuffer_p.h b/src/multimedia/gsttools_headers/qgstxvimagebuffer_p.h
index c6f74373e..6fd7eb769 100644
--- a/src/multimedia/gsttools_headers/qgstxvimagebuffer_p.h
+++ b/src/multimedia/gsttools_headers/qgstxvimagebuffer_p.h
@@ -71,7 +71,7 @@
#include <gst/gst.h>
-#include "qabstractgstbufferpool_p.h"
+#include "qgstbufferpoolinterface_p.h"
class QGstXvImageBufferPool;
@@ -91,7 +91,7 @@ struct QGstXvImageBuffer {
Q_DECLARE_METATYPE(XvImage*)
-class QGstXvImageBufferPool : public QObject, public QAbstractGstBufferPool {
+class QGstXvImageBufferPool : public QObject, public QGstBufferPoolInterface {
Q_OBJECT
friend class QGstXvImageBuffer;
public:
diff --git a/src/multimedia/gsttools_headers/qvideosurfacegstsink_p.h b/src/multimedia/gsttools_headers/qvideosurfacegstsink_p.h
index 438b796cf..55147ef38 100644
--- a/src/multimedia/gsttools_headers/qvideosurfacegstsink_p.h
+++ b/src/multimedia/gsttools_headers/qvideosurfacegstsink_p.h
@@ -64,7 +64,7 @@
#include <qvideoframe.h>
#include <qabstractvideobuffer.h>
-#include "qabstractgstbufferpool_p.h"
+#include "qgstbufferpoolinterface_p.h"
QT_BEGIN_NAMESPACE
class QAbstractVideoSurface;
@@ -92,7 +92,7 @@ public:
bool isActive();
- QAbstractGstBufferPool *pool() { return m_pool; }
+ QGstBufferPoolInterface *pool() { return m_pool; }
QMutex *poolMutex() { return &m_poolMutex; }
GstFlowReturn render(GstBuffer *buffer);
@@ -109,8 +109,8 @@ private:
QList<QVideoFrame::PixelFormat> m_supportedPixelFormats;
//pixel formats of buffers pool native type
QList<QVideoFrame::PixelFormat> m_supportedPoolPixelFormats;
- QAbstractGstBufferPool *m_pool;
- QList<QAbstractGstBufferPool *> m_pools;
+ QGstBufferPoolInterface *m_pool;
+ QList<QGstBufferPoolInterface *> m_pools;
QMutex m_poolMutex;
QMutex m_mutex;
QWaitCondition m_setupCondition;