diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2016-03-07 21:17:53 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2016-03-07 21:17:53 +0100 |
commit | 06a9505327f1c8aee70d701037b2cdcc4fc143f6 (patch) | |
tree | 242cec89d49078e912343afa8fc1ff92c7a8c2db /src/gsttools | |
parent | 9500aadc219481d89d32e5c2a2de10b0740c50de (diff) | |
parent | 3198bf4944edd8f25996c2b4c4516f606165af59 (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
src/plugins/avfoundation/mediaplayer/mediaplayer.pro
tests/auto/unit/qmediaserviceprovider/mockserviceplugin1/mockserviceplugin1.pro
tests/auto/unit/qmediaserviceprovider/mockserviceplugin2/mockserviceplugin2.pro
tests/auto/unit/qmediaserviceprovider/mockserviceplugin3/mockserviceplugin3.pro
tests/auto/unit/qmediaserviceprovider/mockserviceplugin4/mockserviceplugin4.pro
tests/auto/unit/qmediaserviceprovider/mockserviceplugin5/mockserviceplugin5.pro
Change-Id: I5742596230dc510ba2a09eba624429bb67179194
Diffstat (limited to 'src/gsttools')
-rw-r--r-- | src/gsttools/qgstreamerbushelper.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/gsttools/qgstreamerbushelper.cpp b/src/gsttools/qgstreamerbushelper.cpp index 95ba0c4eb..bd35d4b0a 100644 --- a/src/gsttools/qgstreamerbushelper.cpp +++ b/src/gsttools/qgstreamerbushelper.cpp @@ -41,6 +41,8 @@ #include <QtCore/qtimer.h> #include <QtCore/qmutex.h> #include <QtCore/qlist.h> +#include <QtCore/qabstracteventdispatcher.h> +#include <QtCore/qcoreapplication.h> #include "qgstreamerbushelper_p.h" @@ -53,31 +55,31 @@ class QGstreamerBusHelperPrivate : public QObject public: QGstreamerBusHelperPrivate(QGstreamerBusHelper *parent, GstBus* bus) : QObject(parent), + m_tag(0), m_bus(bus), - m_helper(parent) + m_helper(parent), + m_intervalTimer(nullptr) { -#ifdef QT_NO_GLIB - Q_UNUSED(bus); - - m_intervalTimer = new QTimer(this); - m_intervalTimer->setInterval(250); - - connect(m_intervalTimer, SIGNAL(timeout()), SLOT(interval())); - m_intervalTimer->start(); -#else - m_tag = gst_bus_add_watch_full(bus, 0, busCallback, this, NULL); -#endif - + // glib event loop can be disabled either by env variable or QT_NO_GLIB define, so check the dispacher + QAbstractEventDispatcher *dispatcher = QCoreApplication::eventDispatcher(); + const bool hasGlib = dispatcher && dispatcher->inherits("QEventDispatcherGlib"); + if (!hasGlib) { + m_intervalTimer = new QTimer(this); + m_intervalTimer->setInterval(250); + connect(m_intervalTimer, SIGNAL(timeout()), SLOT(interval())); + m_intervalTimer->start(); + } else { + m_tag = gst_bus_add_watch_full(bus, G_PRIORITY_DEFAULT, busCallback, this, NULL); + } } ~QGstreamerBusHelperPrivate() { m_helper = 0; -#ifdef QT_NO_GLIB - m_intervalTimer->stop(); -#else - g_source_remove(m_tag); -#endif + delete m_intervalTimer; + + if (m_tag) + g_source_remove(m_tag); } GstBus* bus() const { return m_bus; } @@ -116,9 +118,7 @@ private: guint m_tag; GstBus* m_bus; QGstreamerBusHelper* m_helper; -#ifdef QT_NO_GLIB QTimer* m_intervalTimer; -#endif private slots: void doProcessMessage(const QGstreamerMessage& msg) |