diff options
author | Christian Strømme <christian.stromme@digia.com> | 2014-05-12 14:38:09 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-06-04 13:19:40 +0200 |
commit | b9b06defc76ae8c3bc6073cb81b4e31b94917a97 (patch) | |
tree | 8185b0790f1b06c22e6cc0b5ab82ee754d556c38 /src/plugins/android/src/common | |
parent | 1ef3ef6a30e6cb38e332da6cc62aea18248e9eae (diff) |
Android: Don't expose java calls in the control classes.
Makes the abstraction more clear.
Change-Id: Ia9a7b0b157e1182158cd26b62775d13f6c5e1727
Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
Diffstat (limited to 'src/plugins/android/src/common')
3 files changed, 7 insertions, 40 deletions
diff --git a/src/plugins/android/src/common/qandroidvideooutput.h b/src/plugins/android/src/common/qandroidvideooutput.h index 8bf6be6cb..e0335ec93 100644 --- a/src/plugins/android/src/common/qandroidvideooutput.h +++ b/src/plugins/android/src/common/qandroidvideooutput.h @@ -44,17 +44,17 @@ #include <qglobal.h> #include <qsize.h> -#include <jni.h> QT_BEGIN_NAMESPACE +class AndroidSurfaceTexture; + class QAndroidVideoOutput { public: virtual ~QAndroidVideoOutput() { } - virtual jobject surfaceHolder() = 0; - virtual jobject surfaceTexture() { return 0; } + virtual AndroidSurfaceTexture *surfaceTexture() { return 0; } virtual bool isReady() { return true; } diff --git a/src/plugins/android/src/common/qandroidvideorendercontrol.cpp b/src/plugins/android/src/common/qandroidvideorendercontrol.cpp index dfeea33c1..5532661db 100644 --- a/src/plugins/android/src/common/qandroidvideorendercontrol.cpp +++ b/src/plugins/android/src/common/qandroidvideorendercontrol.cpp @@ -109,9 +109,7 @@ private: QAndroidVideoRendererControl::QAndroidVideoRendererControl(QObject *parent) : QVideoRendererControl(parent) , m_surface(0) - , m_androidSurface(0) , m_surfaceTexture(0) - , m_surfaceHolder(0) , m_externalTex(0) , m_fbo(0) , m_program(0) @@ -176,7 +174,7 @@ bool QAndroidVideoRendererControl::initSurfaceTexture() m_surfaceTexture = new AndroidSurfaceTexture(m_externalTex); - if (m_surfaceTexture->object()) { + if (m_surfaceTexture->surfaceTexture() != 0) { connect(m_surfaceTexture, SIGNAL(frameAvailable()), this, SLOT(onFrameAvailable())); } else { delete m_surfaceTexture; @@ -195,42 +193,14 @@ void QAndroidVideoRendererControl::clearSurfaceTexture() delete m_surfaceTexture; m_surfaceTexture = 0; } - if (m_androidSurface) { - if (QtAndroidPrivate::androidSdkVersion() > 13) - m_androidSurface->callMethod<void>("release"); - delete m_androidSurface; - m_androidSurface = 0; - } - if (m_surfaceHolder) { - delete m_surfaceHolder; - m_surfaceHolder = 0; - } -} - -jobject QAndroidVideoRendererControl::surfaceHolder() -{ - if (!initSurfaceTexture()) - return 0; - - if (!m_surfaceHolder) { - m_androidSurface = new QJNIObjectPrivate("android/view/Surface", - "(Landroid/graphics/SurfaceTexture;)V", - m_surfaceTexture->object()); - - m_surfaceHolder = new QJNIObjectPrivate("org/qtproject/qt5/android/multimedia/QtSurfaceTextureHolder", - "(Landroid/view/Surface;)V", - m_androidSurface->object()); - } - - return m_surfaceHolder->object(); } -jobject QAndroidVideoRendererControl::surfaceTexture() +AndroidSurfaceTexture *QAndroidVideoRendererControl::surfaceTexture() { if (!initSurfaceTexture()) return 0; - return m_surfaceTexture->object(); + return m_surfaceTexture; } void QAndroidVideoRendererControl::setVideoSize(const QSize &size) diff --git a/src/plugins/android/src/common/qandroidvideorendercontrol.h b/src/plugins/android/src/common/qandroidvideorendercontrol.h index 83d57a437..6e70238c2 100644 --- a/src/plugins/android/src/common/qandroidvideorendercontrol.h +++ b/src/plugins/android/src/common/qandroidvideorendercontrol.h @@ -86,8 +86,7 @@ public: QAbstractVideoSurface *surface() const Q_DECL_OVERRIDE; void setSurface(QAbstractVideoSurface *surface) Q_DECL_OVERRIDE; - jobject surfaceHolder() Q_DECL_OVERRIDE; - jobject surfaceTexture() Q_DECL_OVERRIDE; + AndroidSurfaceTexture *surfaceTexture() Q_DECL_OVERRIDE; bool isReady() Q_DECL_OVERRIDE; void setVideoSize(const QSize &size) Q_DECL_OVERRIDE; void stop() Q_DECL_OVERRIDE; @@ -112,9 +111,7 @@ private: QAbstractVideoSurface *m_surface; QSize m_nativeSize; - QJNIObjectPrivate *m_androidSurface; AndroidSurfaceTexture *m_surfaceTexture; - QJNIObjectPrivate *m_surfaceHolder; quint32 m_externalTex; QOpenGLFramebufferObject *m_fbo; |