summaryrefslogtreecommitdiffstats
path: root/src/gsttools
diff options
context:
space:
mode:
authorJonas Rabbe <jonas.rabbe@nokia.com>2011-12-09 11:45:11 +1000
committerQt by Nokia <qt-info@nokia.com>2011-12-13 01:22:28 +0100
commit4f3294930af1ea4350bc8dd5225afd17591f16cd (patch)
tree9d941147930f09cf568884030783a0a4dbaff11e /src/gsttools
parent9d526fca670ba90c8ad433f60bd94f9b9975e18d (diff)
Fix X11 and QPA compilation problems
The X11 buffer pool was using outdated APIs, and as the 'qpa' configuration value is being removed, it caused the X11 code to be pulled in, and therefore cause compilation failures. Change-Id: I5fdaed854c6525716fccca44b5fbd0b850880cb9 Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
Diffstat (limited to 'src/gsttools')
-rw-r--r--src/gsttools/gsttools.pro6
-rw-r--r--src/gsttools/qgstxvimagebuffer.cpp41
-rw-r--r--src/gsttools/qvideosurfacegstsink.cpp5
3 files changed, 31 insertions, 21 deletions
diff --git a/src/gsttools/gsttools.pro b/src/gsttools/gsttools.pro
index c972058ba..fef65aebf 100644
--- a/src/gsttools/gsttools.pro
+++ b/src/gsttools/gsttools.pro
@@ -43,7 +43,6 @@ PRIVATE_HEADERS += \
qgstvideobuffer_p.h \
qvideosurfacegstsink_p.h \
-
SOURCES += \
qgstbufferpoolinterface.cpp \
qgstreamerbushelper.cpp \
@@ -52,13 +51,14 @@ SOURCES += \
qgstvideobuffer.cpp \
qvideosurfacegstsink.cpp \
-!win32:!contains(QT_CONFIG,embedded):!mac:!simulator:!contains(QT_CONFIG, qpa) {
+contains(config_test_xvideo, yes) {
+ DEFINES += HAVE_XVIDEO
+
LIBS += -lXv -lX11 -lXext
PRIVATE_HEADERS += \
qgstxvimagebuffer_p.h \
-
SOURCES += \
qgstxvimagebuffer.cpp \
}
diff --git a/src/gsttools/qgstxvimagebuffer.cpp b/src/gsttools/qgstxvimagebuffer.cpp
index eb28999fc..82217d397 100644
--- a/src/gsttools/qgstxvimagebuffer.cpp
+++ b/src/gsttools/qgstxvimagebuffer.cpp
@@ -42,14 +42,14 @@
#include <QtCore/qdebug.h>
#include <QtCore/qthread.h>
#include <QtCore/qvariant.h>
-#include <QtWidgets/qx11info_x11.h>
+#include <QtGui/qguiapplication.h>
+#include <QtGui/qwindow.h>
+#include <QtGui/qplatformnativeinterface_qpa.h>
#include "qgstxvimagebuffer_p.h"
#include "qvideosurfacegstsink_p.h"
#include "qgstvideobuffer_p.h"
-#ifndef QT_NO_XVIDEO
-
QT_BEGIN_NAMESPACE
GstBufferClass *QGstXvImageBuffer::parent_class = NULL;
@@ -182,6 +182,11 @@ QAbstractVideoBuffer *QGstXvImageBufferPool::prepareVideoBuffer(GstBuffer *buffe
return new QGstVideoBuffer(buffer, bytesPerLine, QAbstractVideoBuffer::XvShmImageHandle, handle);
}
+QStringList QGstXvImageBufferPool::keys() const
+{
+ return QStringList() << QGstBufferPoolPluginKey;
+}
+
void QGstXvImageBufferPool::queuedAlloc()
{
QMutexLocker lock(&m_poolMutex);
@@ -194,7 +199,7 @@ void QGstXvImageBufferPool::doAlloc()
//should be always called from the main thread with m_poolMutex locked
//Q_ASSERT(QThread::currentThread() == thread());
- XSync(QX11Info::display(), false);
+ XSync(display(), false);
QGstXvImageBuffer *xvBuffer = (QGstXvImageBuffer *)gst_mini_object_new(QGstXvImageBuffer::get_type());
@@ -202,7 +207,7 @@ void QGstXvImageBufferPool::doAlloc()
int xvFormatId = m_format.property("xvFormatId").toInt();
xvBuffer->xvImage = XvShmCreateImage(
- QX11Info::display(),
+ display(),
portId,
xvFormatId,
0,
@@ -216,18 +221,18 @@ void QGstXvImageBufferPool::doAlloc()
return;
}
- XSync(QX11Info::display(), false);
+ XSync(display(), false);
xvBuffer->shmInfo.shmid = shmget(IPC_PRIVATE, xvBuffer->xvImage->data_size, IPC_CREAT | 0777);
xvBuffer->shmInfo.shmaddr = xvBuffer->xvImage->data = (char*)shmat(xvBuffer->shmInfo.shmid, 0, 0);
xvBuffer->shmInfo.readOnly = False;
- if (!XShmAttach(QX11Info::display(), &xvBuffer->shmInfo)) {
+ if (!XShmAttach(display(), &xvBuffer->shmInfo)) {
qWarning() << "QGstXvImageBufferPool: XShmAttach failed";
return;
}
- XSync(QX11Info::display(), false);
+ XSync(display(), false);
shmctl (xvBuffer->shmInfo.shmid, IPC_RMID, NULL);
@@ -240,7 +245,7 @@ void QGstXvImageBufferPool::doAlloc()
m_allBuffers.append(xvBuffer);
m_pool.append(xvBuffer);
- XSync(QX11Info::display(), false);
+ XSync(display(), false);
}
@@ -269,12 +274,12 @@ void QGstXvImageBufferPool::queuedDestroy()
{
QMutexLocker lock(&m_destroyMutex);
- XSync(QX11Info::display(), false);
+ XSync(display(), false);
foreach(XvShmImage xvImage, m_imagesToDestroy) {
if (xvImage.shmInfo.shmaddr != ((void *) -1)) {
- XShmDetach(QX11Info::display(), &xvImage.shmInfo);
- XSync(QX11Info::display(), false);
+ XShmDetach(display(), &xvImage.shmInfo);
+ XSync(display(), false);
shmdt(xvImage.shmInfo.shmaddr);
}
@@ -285,7 +290,7 @@ void QGstXvImageBufferPool::queuedDestroy()
m_imagesToDestroy.clear();
- XSync(QX11Info::display(), false);
+ XSync(display(), false);
}
void QGstXvImageBufferPool::recycleBuffer(QGstXvImageBuffer *xvBuffer)
@@ -309,7 +314,13 @@ void QGstXvImageBufferPool::destroyBuffer(QGstXvImageBuffer *xvBuffer)
QMetaObject::invokeMethod(this, "queuedDestroy", Qt::QueuedConnection);
}
-QT_END_NAMESPACE
+Display *QGstXvImageBufferPool::display() const
+{
+ QWindow *window = QGuiApplication::topLevelWindows().first();
+ Display *display = static_cast<Display *>(QGuiApplication::platformNativeInterface()->nativeResourceForWindow("Display", window));
+
+ return display;
+}
-#endif //QT_NO_XVIDEO
+QT_END_NAMESPACE
diff --git a/src/gsttools/qvideosurfacegstsink.cpp b/src/gsttools/qvideosurfacegstsink.cpp
index 545c37ead..ce69d78b3 100644
--- a/src/gsttools/qvideosurfacegstsink.cpp
+++ b/src/gsttools/qvideosurfacegstsink.cpp
@@ -49,8 +49,7 @@
#include <private/qmediapluginloader_p.h>
#include "qgstvideobuffer_p.h"
-#if defined(Q_WS_X11) && !defined(QT_NO_XVIDEO)
-#include <QtWidgets/qx11info_x11.h>
+#if defined(HAVE_XVIDEO)
#include "qgstxvimagebuffer_p.h"
#endif
@@ -77,7 +76,7 @@ QVideoSurfaceGstDelegate::QVideoSurfaceGstDelegate(
m_pools.append(plugin);
}
}
-#if defined(Q_WS_X11) && !defined(QT_NO_XVIDEO)
+#ifdef HAVE_XVIDEO
m_pools.append(new QGstXvImageBufferPool());
#endif
updateSupportedFormats();