summaryrefslogtreecommitdiffstats
path: root/src/plugins/android/src/common
diff options
context:
space:
mode:
authorChristian Strømme <christian.stromme@digia.com>2014-03-19 13:48:19 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-27 16:44:06 +0100
commitcc41c7df3ca3daf3fe7e9ef3e1d74ca96724d821 (patch)
tree61d08693c8053364cfc121217c3f930384a2273e /src/plugins/android/src/common
parent3c3e2c324b9030570588b29f962a3e34bc48be1c (diff)
Android: Fix QtSurfaceTexture
Don't extend SurfaceTexture as this causes ART to fail when it doesn't find the postEventFromNative() function. The postEventFromNative() function was implemented sometime after API 11, so to avoid this situation we can use composition instead. Task-number: QTBUG-37605 Change-Id: Ie1013d218291ba0035f1bb18a0c0655fd2170bfd Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
Diffstat (limited to 'src/plugins/android/src/common')
-rw-r--r--src/plugins/android/src/common/qandroidvideorendercontrol.cpp16
-rw-r--r--src/plugins/android/src/common/qandroidvideorendercontrol.h3
2 files changed, 10 insertions, 9 deletions
diff --git a/src/plugins/android/src/common/qandroidvideorendercontrol.cpp b/src/plugins/android/src/common/qandroidvideorendercontrol.cpp
index b737e8a42..5f14a4691 100644
--- a/src/plugins/android/src/common/qandroidvideorendercontrol.cpp
+++ b/src/plugins/android/src/common/qandroidvideorendercontrol.cpp
@@ -42,7 +42,6 @@
#include "qandroidvideorendercontrol.h"
#include <QtCore/private/qjni_p.h>
-#include "jsurfacetextureholder.h"
#include <QAbstractVideoSurface>
#include <QVideoSurfaceFormat>
#include <qevent.h>
@@ -51,6 +50,7 @@
#include <qopenglfunctions.h>
#include <qopenglshaderprogram.h>
#include <qopenglframebufferobject.h>
+#include <QtCore/private/qjnihelpers_p.h>
QT_BEGIN_NAMESPACE
@@ -177,7 +177,7 @@ bool QAndroidVideoRendererControl::initSurfaceTexture()
m_surfaceTexture = new JSurfaceTexture(m_externalTex);
- if (m_surfaceTexture->isValid()) {
+ if (m_surfaceTexture->object()) {
connect(m_surfaceTexture, SIGNAL(frameAvailable()), this, SLOT(onFrameAvailable()));
} else {
delete m_surfaceTexture;
@@ -193,12 +193,12 @@ bool QAndroidVideoRendererControl::initSurfaceTexture()
void QAndroidVideoRendererControl::clearSurfaceTexture()
{
if (m_surfaceTexture) {
- m_surfaceTexture->callMethod<void>("release");
delete m_surfaceTexture;
m_surfaceTexture = 0;
}
if (m_androidSurface) {
- m_androidSurface->callMethod<void>("release");
+ if (QtAndroidPrivate::androidSdkVersion() > 13)
+ m_androidSurface->callMethod<void>("release");
delete m_androidSurface;
m_androidSurface = 0;
}
@@ -215,10 +215,12 @@ jobject QAndroidVideoRendererControl::surfaceHolder()
if (!m_surfaceHolder) {
m_androidSurface = new QJNIObjectPrivate("android/view/Surface",
- "(Landroid/graphics/SurfaceTexture;)V",
- m_surfaceTexture->object());
+ "(Landroid/graphics/SurfaceTexture;)V",
+ m_surfaceTexture->object());
- m_surfaceHolder = new JSurfaceTextureHolder(m_androidSurface->object());
+ m_surfaceHolder = new QJNIObjectPrivate("org/qtproject/qt5/android/multimedia/QtSurfaceTextureHolder",
+ "(Landroid/view/Surface;)V",
+ m_androidSurface->object());
}
return m_surfaceHolder->object();
diff --git a/src/plugins/android/src/common/qandroidvideorendercontrol.h b/src/plugins/android/src/common/qandroidvideorendercontrol.h
index 56407d5de..75fd7ef12 100644
--- a/src/plugins/android/src/common/qandroidvideorendercontrol.h
+++ b/src/plugins/android/src/common/qandroidvideorendercontrol.h
@@ -49,7 +49,6 @@
QT_BEGIN_NAMESPACE
-class JSurfaceTextureHolder;
class QOpenGLTexture;
class QOpenGLFramebufferObject;
class QOpenGLShaderProgram;
@@ -115,7 +114,7 @@ private:
QJNIObjectPrivate *m_androidSurface;
JSurfaceTexture *m_surfaceTexture;
- JSurfaceTextureHolder *m_surfaceHolder;
+ QJNIObjectPrivate *m_surfaceHolder;
quint32 m_externalTex;
QOpenGLFramebufferObject *m_fbo;