From ab6ebd360eb27a0d502839fca07ae0e6e107cec6 Mon Sep 17 00:00:00 2001
From: Jochen Seemann <seemann.jochen@gmail.com>
Date: Tue, 6 Sep 2016 00:24:05 +0200
Subject: [PATCH] turn QGstTools into a proper private module

This patch moves the QGstTools lib to a private Qt module and marks
the needed classes and functions with Q_DECL*, to improve
cross-platform abilities. It's the first step to use the GStreamer
backend on macOS and Windows platform.

Change-Id: Idc23c72bcccb52dd501e169e9dfdc227856787fa
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
---
 src/gsttools/gsttools.pro                     | 15 ++--
 .../gsttools_headers/gstvideoconnector_p.h    |  8 +-
 .../gsttools_headers/qgstappsrc_p.h           |  3 +-
 .../qgstbufferpoolinterface_p.h               |  3 +-
 .../gsttools_headers/qgstcodecsinfo_p.h       |  3 +-
 .../qgstreameraudioinputselector_p.h          |  3 +-
 .../qgstreameraudioprobecontrol_p.h           |  3 +-
 .../qgstreamerbufferprobe_p.h                 |  4 +-
 .../gsttools_headers/qgstreamerbushelper_p.h  |  4 +-
 .../gsttools_headers/qgstreamermessage_p.h    |  3 +-
 .../qgstreamervideoinputdevicecontrol_p.h     |  3 +-
 .../qgstreamervideoprobecontrol_p.h           |  3 +-
 .../qgstreamervideorenderer_p.h               |  3 +-
 .../qgstreamervideowidget_p.h                 |  5 +-
 .../qgstreamervideowindow_p.h                 |  3 +-
 .../gsttools_headers/qgsttools_global_p.h     | 70 +++++++++++++++
 src/multimedia/gsttools_headers/qgstutils_p.h | 87 ++++++++++---------
 .../gsttools_headers/qgstvideobuffer_p.h      |  5 +-
 .../qgstvideorendererplugin_p.h               |  7 +-
 src/plugins/gstreamer/common.pri              |  4 +-
 sync.profile                                  |  1 +
 21 files changed, 163 insertions(+), 77 deletions(-)
 create mode 100644 src/multimedia/gsttools_headers/qgsttools_global_p.h

diff --git a/src/gsttools/gsttools.pro b/src/gsttools/gsttools.pro
index edbf603e3..f5e3fd96f 100644
--- a/src/gsttools/gsttools.pro
+++ b/src/gsttools/gsttools.pro
@@ -1,7 +1,6 @@
-TEMPLATE = lib
-
-TARGET = qgsttools_p
-QPRO_PWD = $$PWD
+TARGET = QtMultimediaGstTools
+MODULE = multimediagsttools
+CONFIG += internal_module
 
 QT = core-private multimedia-private gui-private
 
@@ -36,7 +35,8 @@ PRIVATE_HEADERS += \
     qgstreamervideoprobecontrol_p.h \
     qgstreameraudioprobecontrol_p.h \
     qgstreamervideowindow_p.h \
-    qgstreamervideooverlay_p.h
+    qgstreamervideooverlay_p.h \
+    qgsttools_global_p.h
 
 SOURCES += \
     qgstreamerbushelper.cpp \
@@ -101,7 +101,4 @@ qtConfig(gstreamer_app) {
 
 HEADERS += $$PRIVATE_HEADERS
 
-DESTDIR = $$QT.multimedia.libs
-target.path = $$[QT_INSTALL_LIBS]
-
-INSTALLS += target
+load(qt_module)
diff --git a/src/multimedia/gsttools_headers/gstvideoconnector_p.h b/src/multimedia/gsttools_headers/gstvideoconnector_p.h
index 4fa1456c8..a38ca2e65 100644
--- a/src/multimedia/gsttools_headers/gstvideoconnector_p.h
+++ b/src/multimedia/gsttools_headers/gstvideoconnector_p.h
@@ -51,6 +51,8 @@
 // We mean it.
 //
 
+#include <private/qgsttools_global_p.h>
+
 #include <gst/gst.h>
 
 G_BEGIN_DECLS
@@ -69,7 +71,7 @@ G_BEGIN_DECLS
 typedef struct _GstVideoConnector GstVideoConnector;
 typedef struct _GstVideoConnectorClass GstVideoConnectorClass;
 
-struct _GstVideoConnector {
+struct Q_GSTTOOLS_EXPORT _GstVideoConnector {
   GstElement element;
 
   GstPad *srcpad;
@@ -81,14 +83,14 @@ struct _GstVideoConnector {
   GstBuffer *latest_buffer;
 };
 
-struct _GstVideoConnectorClass {
+struct Q_GSTTOOLS_EXPORT _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);
+GType Q_GSTTOOLS_EXPORT gst_video_connector_get_type (void);
 
 G_END_DECLS
 
diff --git a/src/multimedia/gsttools_headers/qgstappsrc_p.h b/src/multimedia/gsttools_headers/qgstappsrc_p.h
index e50915231..c7e87037d 100644
--- a/src/multimedia/gsttools_headers/qgstappsrc_p.h
+++ b/src/multimedia/gsttools_headers/qgstappsrc_p.h
@@ -51,6 +51,7 @@
 // We mean it.
 //
 
+#include <private/qgsttools_global_p.h>
 #include <QtCore/qobject.h>
 #include <QtCore/qiodevice.h>
 
@@ -63,7 +64,7 @@
 
 QT_BEGIN_NAMESPACE
 
-class QGstAppSrc  : public QObject
+class Q_GSTTOOLS_EXPORT QGstAppSrc  : public QObject
 {
     Q_OBJECT
 public:
diff --git a/src/multimedia/gsttools_headers/qgstbufferpoolinterface_p.h b/src/multimedia/gsttools_headers/qgstbufferpoolinterface_p.h
index e03da1ab5..45e573262 100644
--- a/src/multimedia/gsttools_headers/qgstbufferpoolinterface_p.h
+++ b/src/multimedia/gsttools_headers/qgstbufferpoolinterface_p.h
@@ -51,6 +51,7 @@
 // We mean it.
 //
 
+#include <private/qgsttools_global_p.h>
 #include <qabstractvideobuffer.h>
 #include <qvideosurfaceformat.h>
 #include <QtCore/qobject.h>
@@ -65,7 +66,7 @@ const QLatin1String QGstBufferPoolPluginKey("bufferpool");
 /*!
     Abstract interface for video buffers allocation.
 */
-class QGstBufferPoolInterface
+class Q_GSTTOOLS_EXPORT QGstBufferPoolInterface
 {
 public:
     virtual ~QGstBufferPoolInterface() {}
diff --git a/src/multimedia/gsttools_headers/qgstcodecsinfo_p.h b/src/multimedia/gsttools_headers/qgstcodecsinfo_p.h
index af1a4486f..33ab3de4b 100644
--- a/src/multimedia/gsttools_headers/qgstcodecsinfo_p.h
+++ b/src/multimedia/gsttools_headers/qgstcodecsinfo_p.h
@@ -51,6 +51,7 @@
 // We mean it.
 //
 
+#include <private/qgsttools_global_p.h>
 #include <QtCore/qmap.h>
 #include <QtCore/qstringlist.h>
 
@@ -58,7 +59,7 @@
 
 QT_BEGIN_NAMESPACE
 
-class QGstCodecsInfo
+class Q_GSTTOOLS_EXPORT QGstCodecsInfo
 {
 public:
     enum ElementType { AudioEncoder, VideoEncoder, Muxer };
diff --git a/src/multimedia/gsttools_headers/qgstreameraudioinputselector_p.h b/src/multimedia/gsttools_headers/qgstreameraudioinputselector_p.h
index 1a961c6d9..0c193fda9 100644
--- a/src/multimedia/gsttools_headers/qgstreameraudioinputselector_p.h
+++ b/src/multimedia/gsttools_headers/qgstreameraudioinputselector_p.h
@@ -51,12 +51,13 @@
 // We mean it.
 //
 
+#include <private/qgsttools_global_p.h>
 #include <qaudioinputselectorcontrol.h>
 #include <QtCore/qstringlist.h>
 
 QT_BEGIN_NAMESPACE
 
-class QGstreamerAudioInputSelector : public QAudioInputSelectorControl
+class Q_GSTTOOLS_EXPORT QGstreamerAudioInputSelector : public QAudioInputSelectorControl
 {
 Q_OBJECT
 public:
diff --git a/src/multimedia/gsttools_headers/qgstreameraudioprobecontrol_p.h b/src/multimedia/gsttools_headers/qgstreameraudioprobecontrol_p.h
index bacf8c71d..4fc5c7704 100644
--- a/src/multimedia/gsttools_headers/qgstreameraudioprobecontrol_p.h
+++ b/src/multimedia/gsttools_headers/qgstreameraudioprobecontrol_p.h
@@ -51,6 +51,7 @@
 // We mean it.
 //
 
+#include <private/qgsttools_global_p.h>
 #include <gst/gst.h>
 #include <qmediaaudioprobecontrol.h>
 #include <QtCore/qmutex.h>
@@ -61,7 +62,7 @@
 
 QT_BEGIN_NAMESPACE
 
-class QGstreamerAudioProbeControl
+class Q_GSTTOOLS_EXPORT QGstreamerAudioProbeControl
     : public QMediaAudioProbeControl
     , public QGstreamerBufferProbe
     , public QSharedData
diff --git a/src/multimedia/gsttools_headers/qgstreamerbufferprobe_p.h b/src/multimedia/gsttools_headers/qgstreamerbufferprobe_p.h
index f7ba2bbd9..35644f934 100644
--- a/src/multimedia/gsttools_headers/qgstreamerbufferprobe_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamerbufferprobe_p.h
@@ -51,13 +51,15 @@
 // We mean it.
 //
 
+#include <private/qgsttools_global_p.h>
 #include <gst/gst.h>
 
 #include <QtCore/qglobal.h>
 
+
 QT_BEGIN_NAMESPACE
 
-class QGstreamerBufferProbe
+class Q_GSTTOOLS_EXPORT QGstreamerBufferProbe
 {
 public:
     enum Flags
diff --git a/src/multimedia/gsttools_headers/qgstreamerbushelper_p.h b/src/multimedia/gsttools_headers/qgstreamerbushelper_p.h
index 3216c07da..c7d06faf8 100644
--- a/src/multimedia/gsttools_headers/qgstreamerbushelper_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamerbushelper_p.h
@@ -51,9 +51,11 @@
 // We mean it.
 //
 
+#include <private/qgsttools_global_p.h>
 #include <QObject>
 
 #include "qgstreamermessage_p.h"
+
 #include <gst/gst.h>
 
 QT_BEGIN_NAMESPACE
@@ -78,7 +80,7 @@ Q_DECLARE_INTERFACE(QGstreamerBusMessageFilter, QGstreamerBusMessageFilter_iid)
 
 class QGstreamerBusHelperPrivate;
 
-class QGstreamerBusHelper : public QObject
+class Q_GSTTOOLS_EXPORT QGstreamerBusHelper : public QObject
 {
     Q_OBJECT
     friend class QGstreamerBusHelperPrivate;
diff --git a/src/multimedia/gsttools_headers/qgstreamermessage_p.h b/src/multimedia/gsttools_headers/qgstreamermessage_p.h
index 5d832ccfa..2f9d1745c 100644
--- a/src/multimedia/gsttools_headers/qgstreamermessage_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamermessage_p.h
@@ -51,6 +51,7 @@
 // We mean it.
 //
 
+#include <private/qgsttools_global_p.h>
 #include <QMetaType>
 
 #include <gst/gst.h>
@@ -60,7 +61,7 @@ QT_BEGIN_NAMESPACE
 // Required for QDoc workaround
 class QString;
 
-class QGstreamerMessage
+class Q_GSTTOOLS_EXPORT QGstreamerMessage
 {
 public:
     QGstreamerMessage();
diff --git a/src/multimedia/gsttools_headers/qgstreamervideoinputdevicecontrol_p.h b/src/multimedia/gsttools_headers/qgstreamervideoinputdevicecontrol_p.h
index e1ac453c7..b660cc7b3 100644
--- a/src/multimedia/gsttools_headers/qgstreamervideoinputdevicecontrol_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamervideoinputdevicecontrol_p.h
@@ -51,6 +51,7 @@
 // We mean it.
 //
 
+#include <private/qgsttools_global_p.h>
 #include <qvideodeviceselectorcontrol.h>
 #include <QtCore/qstringlist.h>
 
@@ -59,7 +60,7 @@
 
 QT_BEGIN_NAMESPACE
 
-class QGstreamerVideoInputDeviceControl : public QVideoDeviceSelectorControl
+class Q_GSTTOOLS_EXPORT QGstreamerVideoInputDeviceControl : public QVideoDeviceSelectorControl
 {
 Q_OBJECT
 public:
diff --git a/src/multimedia/gsttools_headers/qgstreamervideoprobecontrol_p.h b/src/multimedia/gsttools_headers/qgstreamervideoprobecontrol_p.h
index b599b0e78..b15b6099c 100644
--- a/src/multimedia/gsttools_headers/qgstreamervideoprobecontrol_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamervideoprobecontrol_p.h
@@ -51,6 +51,7 @@
 // We mean it.
 //
 
+#include <private/qgsttools_global_p.h>
 #include <gst/gst.h>
 #include <gst/video/video.h>
 #include <qmediavideoprobecontrol.h>
@@ -62,7 +63,7 @@
 
 QT_BEGIN_NAMESPACE
 
-class QGstreamerVideoProbeControl
+class Q_GSTTOOLS_EXPORT QGstreamerVideoProbeControl
     : public QMediaVideoProbeControl
     , public QGstreamerBufferProbe
     , public QSharedData
diff --git a/src/multimedia/gsttools_headers/qgstreamervideorenderer_p.h b/src/multimedia/gsttools_headers/qgstreamervideorenderer_p.h
index 1d22e1125..2f0b80d45 100644
--- a/src/multimedia/gsttools_headers/qgstreamervideorenderer_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamervideorenderer_p.h
@@ -51,6 +51,7 @@
 // We mean it.
 //
 
+#include <private/qgsttools_global_p.h>
 #include <qvideorenderercontrol.h>
 #include <private/qvideosurfacegstsink_p.h>
 #include <qabstractvideosurface.h>
@@ -59,7 +60,7 @@
 
 QT_BEGIN_NAMESPACE
 
-class QGstreamerVideoRenderer : public QVideoRendererControl, public QGstreamerVideoRendererInterface
+class Q_GSTTOOLS_EXPORT QGstreamerVideoRenderer : public QVideoRendererControl, public QGstreamerVideoRendererInterface
 {
     Q_OBJECT
     Q_INTERFACES(QGstreamerVideoRendererInterface)
diff --git a/src/multimedia/gsttools_headers/qgstreamervideowidget_p.h b/src/multimedia/gsttools_headers/qgstreamervideowidget_p.h
index b2dfece60..3e3240725 100644
--- a/src/multimedia/gsttools_headers/qgstreamervideowidget_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamervideowidget_p.h
@@ -51,6 +51,7 @@
 // We mean it.
 //
 
+#include <private/qgsttools_global_p.h>
 #include <qvideowidgetcontrol.h>
 
 #include "qgstreamervideorendererinterface_p.h"
@@ -59,9 +60,9 @@
 
 QT_BEGIN_NAMESPACE
 
-class QGstreamerVideoWidget;
+class Q_GSTTOOLS_EXPORT QGstreamerVideoWidget;
 
-class QGstreamerVideoWidgetControl
+class Q_GSTTOOLS_EXPORT QGstreamerVideoWidgetControl
         : public QVideoWidgetControl
         , public QGstreamerVideoRendererInterface
         , public QGstreamerSyncMessageFilter
diff --git a/src/multimedia/gsttools_headers/qgstreamervideowindow_p.h b/src/multimedia/gsttools_headers/qgstreamervideowindow_p.h
index b489650f9..5f893f10e 100644
--- a/src/multimedia/gsttools_headers/qgstreamervideowindow_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamervideowindow_p.h
@@ -51,6 +51,7 @@
 // We mean it.
 //
 
+#include <private/qgsttools_global_p.h>
 #include <qvideowindowcontrol.h>
 
 #include "qgstreamervideorendererinterface_p.h"
@@ -61,7 +62,7 @@
 QT_BEGIN_NAMESPACE
 class QAbstractVideoSurface;
 
-class QGstreamerVideoWindow :
+class Q_GSTTOOLS_EXPORT QGstreamerVideoWindow :
         public QVideoWindowControl,
         public QGstreamerVideoRendererInterface,
         public QGstreamerSyncMessageFilter,
diff --git a/src/multimedia/gsttools_headers/qgsttools_global_p.h b/src/multimedia/gsttools_headers/qgsttools_global_p.h
new file mode 100644
index 000000000..babcd3aaf
--- /dev/null
+++ b/src/multimedia/gsttools_headers/qgsttools_global_p.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company 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 QGSTTOOLS_GLOBAL_H
+#define QGSTTOOLS_GLOBAL_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 <QtCore/qglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+#ifndef QT_STATIC
+# if defined(QT_BUILD_MULTIMEDIAGSTTOOLS_LIB)
+#  define Q_GSTTOOLS_EXPORT Q_DECL_EXPORT
+# else
+#  define Q_GSTTOOLS_EXPORT Q_DECL_IMPORT
+# endif
+#else
+# define Q_GSTTOOLS_EXPORT
+#endif
+
+QT_END_NAMESPACE
+
+#endif // QGSTTOOLS_GLOBAL_H
diff --git a/src/multimedia/gsttools_headers/qgstutils_p.h b/src/multimedia/gsttools_headers/qgstutils_p.h
index 8b7de3661..24d3e889d 100644
--- a/src/multimedia/gsttools_headers/qgstutils_p.h
+++ b/src/multimedia/gsttools_headers/qgstutils_p.h
@@ -51,6 +51,7 @@
 // We mean it.
 //
 
+#include <private/qgsttools_global_p.h>
 #include <QtCore/qmap.h>
 #include <QtCore/qset.h>
 #include <QtCore/qvector.h>
@@ -85,7 +86,7 @@ class QImage;
 class QVideoSurfaceFormat;
 
 namespace QGstUtils {
-    struct CameraInfo
+    struct Q_GSTTOOLS_EXPORT CameraInfo
     {
         QString name;
         QString description;
@@ -94,74 +95,74 @@ namespace QGstUtils {
         QByteArray driver;
     };
 
-    QMap<QByteArray, QVariant> gstTagListToMap(const GstTagList *list);
+    Q_GSTTOOLS_EXPORT QMap<QByteArray, QVariant> gstTagListToMap(const GstTagList *list);
 
-    QSize capsResolution(const GstCaps *caps);
-    QSize capsCorrectedResolution(const GstCaps *caps);
-    QAudioFormat audioFormatForCaps(const GstCaps *caps);
+    Q_GSTTOOLS_EXPORT QSize capsResolution(const GstCaps *caps);
+    Q_GSTTOOLS_EXPORT QSize capsCorrectedResolution(const GstCaps *caps);
+    Q_GSTTOOLS_EXPORT QAudioFormat audioFormatForCaps(const GstCaps *caps);
 #if GST_CHECK_VERSION(1,0,0)
-    QAudioFormat audioFormatForSample(GstSample *sample);
+    Q_GSTTOOLS_EXPORT QAudioFormat audioFormatForSample(GstSample *sample);
 #else
-    QAudioFormat audioFormatForBuffer(GstBuffer *buffer);
+    Q_GSTTOOLS_EXPORT QAudioFormat audioFormatForBuffer(GstBuffer *buffer);
 #endif
-    GstCaps *capsForAudioFormat(const QAudioFormat &format);
-    void initializeGst();
-    QMultimedia::SupportEstimate hasSupport(const QString &mimeType,
+    Q_GSTTOOLS_EXPORT GstCaps *capsForAudioFormat(const QAudioFormat &format);
+    Q_GSTTOOLS_EXPORT void initializeGst();
+    Q_GSTTOOLS_EXPORT QMultimedia::SupportEstimate hasSupport(const QString &mimeType,
                                              const QStringList &codecs,
                                              const QSet<QString> &supportedMimeTypeSet);
 
-    QVector<CameraInfo> enumerateCameras(GstElementFactory *factory = 0);
-    QList<QByteArray> cameraDevices(GstElementFactory * factory = 0);
-    QString cameraDescription(const QString &device, GstElementFactory * factory = 0);
-    QCamera::Position cameraPosition(const QString &device, GstElementFactory * factory = 0);
-    int cameraOrientation(const QString &device, GstElementFactory * factory = 0);
-    QByteArray cameraDriver(const QString &device, GstElementFactory * factory = 0);
+    Q_GSTTOOLS_EXPORT QVector<CameraInfo> enumerateCameras(GstElementFactory *factory = 0);
+    Q_GSTTOOLS_EXPORT QList<QByteArray> cameraDevices(GstElementFactory * factory = 0);
+    Q_GSTTOOLS_EXPORT QString cameraDescription(const QString &device, GstElementFactory * factory = 0);
+    Q_GSTTOOLS_EXPORT QCamera::Position cameraPosition(const QString &device, GstElementFactory * factory = 0);
+    Q_GSTTOOLS_EXPORT int cameraOrientation(const QString &device, GstElementFactory * factory = 0);
+    Q_GSTTOOLS_EXPORT QByteArray cameraDriver(const QString &device, GstElementFactory * factory = 0);
 
-    QSet<QString> supportedMimeTypes(bool (*isValidFactory)(GstElementFactory *factory));
+    Q_GSTTOOLS_EXPORT QSet<QString> supportedMimeTypes(bool (*isValidFactory)(GstElementFactory *factory));
 
 #if GST_CHECK_VERSION(1,0,0)
-    QImage bufferToImage(GstBuffer *buffer, const GstVideoInfo &info);
-    QVideoSurfaceFormat formatForCaps(
+    Q_GSTTOOLS_EXPORT QImage bufferToImage(GstBuffer *buffer, const GstVideoInfo &info);
+    Q_GSTTOOLS_EXPORT QVideoSurfaceFormat formatForCaps(
             GstCaps *caps,
             GstVideoInfo *info = 0,
             QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle);
 #else
-    QImage bufferToImage(GstBuffer *buffer);
-    QVideoSurfaceFormat formatForCaps(
+    Q_GSTTOOLS_EXPORT QImage bufferToImage(GstBuffer *buffer);
+    Q_GSTTOOLS_EXPORT QVideoSurfaceFormat formatForCaps(
             GstCaps *caps,
             int *bytesPerLine = 0,
             QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle);
 #endif
 
-    GstCaps *capsForFormats(const QList<QVideoFrame::PixelFormat> &formats);
+    Q_GSTTOOLS_EXPORT GstCaps *capsForFormats(const QList<QVideoFrame::PixelFormat> &formats);
     void setFrameTimeStamps(QVideoFrame *frame, GstBuffer *buffer);
 
-    void setMetaData(GstElement *element, const QMap<QByteArray, QVariant> &data);
-    void setMetaData(GstBin *bin, const QMap<QByteArray, QVariant> &data);
+    Q_GSTTOOLS_EXPORT void setMetaData(GstElement *element, const QMap<QByteArray, QVariant> &data);
+    Q_GSTTOOLS_EXPORT void setMetaData(GstBin *bin, const QMap<QByteArray, QVariant> &data);
 
-    GstCaps *videoFilterCaps();
+    Q_GSTTOOLS_EXPORT GstCaps *videoFilterCaps();
 
-    QSize structureResolution(const GstStructure *s);
-    QVideoFrame::PixelFormat structurePixelFormat(const GstStructure *s, int *bpp = 0);
-    QSize structurePixelAspectRatio(const GstStructure *s);
-    QPair<qreal, qreal> structureFrameRateRange(const GstStructure *s);
+    Q_GSTTOOLS_EXPORT QSize structureResolution(const GstStructure *s);
+    Q_GSTTOOLS_EXPORT QVideoFrame::PixelFormat structurePixelFormat(const GstStructure *s, int *bpp = 0);
+    Q_GSTTOOLS_EXPORT QSize structurePixelAspectRatio(const GstStructure *s);
+    Q_GSTTOOLS_EXPORT QPair<qreal, qreal> structureFrameRateRange(const GstStructure *s);
 
-    QString fileExtensionForMimeType(const QString &mimeType);
+    Q_GSTTOOLS_EXPORT QString fileExtensionForMimeType(const QString &mimeType);
 }
 
-void qt_gst_object_ref_sink(gpointer object);
-GstCaps *qt_gst_pad_get_current_caps(GstPad *pad);
-GstCaps *qt_gst_pad_get_caps(GstPad *pad);
-GstStructure *qt_gst_structure_new_empty(const char *name);
-gboolean qt_gst_element_query_position(GstElement *element, GstFormat format, gint64 *cur);
-gboolean qt_gst_element_query_duration(GstElement *element, GstFormat format, gint64 *cur);
-GstCaps *qt_gst_caps_normalize(GstCaps *caps);
-const gchar *qt_gst_element_get_factory_name(GstElement *element);
-gboolean qt_gst_caps_can_intersect(const GstCaps * caps1, const GstCaps * caps2);
-GList *qt_gst_video_sinks();
-void qt_gst_util_double_to_fraction(gdouble src, gint *dest_n, gint *dest_d);
-
-QDebug operator <<(QDebug debug, GstCaps *caps);
+Q_GSTTOOLS_EXPORT void qt_gst_object_ref_sink(gpointer object);
+Q_GSTTOOLS_EXPORT GstCaps *qt_gst_pad_get_current_caps(GstPad *pad);
+Q_GSTTOOLS_EXPORT GstCaps *qt_gst_pad_get_caps(GstPad *pad);
+Q_GSTTOOLS_EXPORT GstStructure *qt_gst_structure_new_empty(const char *name);
+Q_GSTTOOLS_EXPORT gboolean qt_gst_element_query_position(GstElement *element, GstFormat format, gint64 *cur);
+Q_GSTTOOLS_EXPORT gboolean qt_gst_element_query_duration(GstElement *element, GstFormat format, gint64 *cur);
+Q_GSTTOOLS_EXPORT GstCaps *qt_gst_caps_normalize(GstCaps *caps);
+Q_GSTTOOLS_EXPORT const gchar *qt_gst_element_get_factory_name(GstElement *element);
+Q_GSTTOOLS_EXPORT gboolean qt_gst_caps_can_intersect(const GstCaps * caps1, const GstCaps * caps2);
+Q_GSTTOOLS_EXPORT GList *qt_gst_video_sinks();
+Q_GSTTOOLS_EXPORT void qt_gst_util_double_to_fraction(gdouble src, gint *dest_n, gint *dest_d);
+
+Q_GSTTOOLS_EXPORT QDebug operator <<(QDebug debug, GstCaps *caps);
 
 QT_END_NAMESPACE
 
diff --git a/src/multimedia/gsttools_headers/qgstvideobuffer_p.h b/src/multimedia/gsttools_headers/qgstvideobuffer_p.h
index d2802d9a2..c67c57021 100644
--- a/src/multimedia/gsttools_headers/qgstvideobuffer_p.h
+++ b/src/multimedia/gsttools_headers/qgstvideobuffer_p.h
@@ -51,6 +51,7 @@
 // We mean it.
 //
 
+#include <private/qgsttools_global_p.h>
 #include <qabstractvideobuffer.h>
 #include <QtCore/qvariant.h>
 
@@ -60,14 +61,14 @@
 QT_BEGIN_NAMESPACE
 
 #if GST_CHECK_VERSION(1,0,0)
-class QGstVideoBuffer : public QAbstractPlanarVideoBuffer
+class Q_GSTTOOLS_EXPORT QGstVideoBuffer : public QAbstractPlanarVideoBuffer
 {
 public:
     QGstVideoBuffer(GstBuffer *buffer, const GstVideoInfo &info);
     QGstVideoBuffer(GstBuffer *buffer, const GstVideoInfo &info,
                     HandleType handleType, const QVariant &handle);
 #else
-class QGstVideoBuffer : public QAbstractVideoBuffer
+class Q_GSTTOOLS_EXPORT QGstVideoBuffer : public QAbstractVideoBuffer
 {
 public:
     QGstVideoBuffer(GstBuffer *buffer, int bytesPerLine);
diff --git a/src/multimedia/gsttools_headers/qgstvideorendererplugin_p.h b/src/multimedia/gsttools_headers/qgstvideorendererplugin_p.h
index 6a0c4c6bd..df36dbe09 100644
--- a/src/multimedia/gsttools_headers/qgstvideorendererplugin_p.h
+++ b/src/multimedia/gsttools_headers/qgstvideorendererplugin_p.h
@@ -51,6 +51,7 @@
 // We mean it.
 //
 
+#include <private/qgsttools_global_p.h>
 #include <qabstractvideobuffer.h>
 #include <qvideosurfaceformat.h>
 #include <QtCore/qobject.h>
@@ -64,7 +65,7 @@ class QAbstractVideoSurface;
 
 const QLatin1String QGstVideoRendererPluginKey("gstvideorenderer");
 
-class QGstVideoRenderer
+class Q_GSTTOOLS_EXPORT QGstVideoRenderer
 {
 public:
     virtual ~QGstVideoRenderer() {}
@@ -81,7 +82,7 @@ public:
 /*
     Abstract interface for video buffers allocation.
 */
-class QGstVideoRendererInterface
+class Q_GSTTOOLS_EXPORT QGstVideoRendererInterface
 {
 public:
     virtual ~QGstVideoRendererInterface() {}
@@ -92,7 +93,7 @@ public:
 #define QGstVideoRendererInterface_iid "org.qt-project.qt.gstvideorenderer/5.4"
 Q_DECLARE_INTERFACE(QGstVideoRendererInterface, QGstVideoRendererInterface_iid)
 
-class QGstVideoRendererPlugin : public QObject, public QGstVideoRendererInterface
+class Q_GSTTOOLS_EXPORT QGstVideoRendererPlugin : public QObject, public QGstVideoRendererInterface
 {
     Q_OBJECT
     Q_INTERFACES(QGstVideoRendererInterface)
diff --git a/src/plugins/gstreamer/common.pri b/src/plugins/gstreamer/common.pri
index cbe87be4f..d0c5c7bdd 100644
--- a/src/plugins/gstreamer/common.pri
+++ b/src/plugins/gstreamer/common.pri
@@ -1,12 +1,10 @@
-QT += core-private multimedia-private network
+QT += core-private multimedia-private multimediagsttools-private network
 
 qtHaveModule(widgets) {
     QT += widgets multimediawidgets-private
     DEFINES += HAVE_WIDGETS
 }
 
-LIBS += -lqgsttools_p
-
 QMAKE_USE += gstreamer
 
 qtConfig(resourcepolicy): \
diff --git a/sync.profile b/sync.profile
index 16c2b00ec..2ac22b5bd 100644
--- a/sync.profile
+++ b/sync.profile
@@ -2,6 +2,7 @@
     "QtMultimedia" => "$basedir/src/multimedia",
     "QtMultimediaWidgets" => "$basedir/src/multimediawidgets",
     "QtMultimediaQuick" => "$basedir/src/qtmultimediaquicktools",
+    "QtMultimediaGstTools" => "$basedir/src/gsttools",
 );
 
 %moduleheaders = ( # restrict the module headers to those found in relative path
-- 
GitLab