summaryrefslogtreecommitdiff
path: root/src/plugins/android
diff options
context:
space:
mode:
authorChristian Strømme <christian.stromme@digia.com>2013-09-12 13:14:56 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-20 10:11:50 +0200
commitac029c65f273ce5dd20da8e84d1bcff2fd6749d4 (patch)
tree17299491d3020145ad7273cdb50372a1c03d4765 /src/plugins/android
parent17480111ed3e98c3d10c2fb9590c3c487e3e952c (diff)
downloadqtmultimedia-ac029c65f273ce5dd20da8e84d1bcff2fd6749d4.tar.gz
Android: Adapt the multimedia plugin to new QJNI API
Change-Id: Id87f5518724eed6c9de6d5d3b8141860bd511643 Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
Diffstat (limited to 'src/plugins/android')
-rw-r--r--src/plugins/android/src/common/qandroidvideorendercontrol.cpp4
-rw-r--r--src/plugins/android/src/common/qandroidvideorendercontrol.h2
-rw-r--r--src/plugins/android/src/mediacapture/qandroidcapturesession.cpp16
-rw-r--r--src/plugins/android/src/mediacapture/qandroidvideodeviceselectorcontrol.cpp7
-rw-r--r--src/plugins/android/src/src.pro2
-rw-r--r--src/plugins/android/src/wrappers/jcamera.cpp302
-rw-r--r--src/plugins/android/src/wrappers/jcamera.h8
-rw-r--r--src/plugins/android/src/wrappers/jmediametadataretriever.cpp43
-rw-r--r--src/plugins/android/src/wrappers/jmediametadataretriever.h4
-rw-r--r--src/plugins/android/src/wrappers/jmediaplayer.cpp16
-rw-r--r--src/plugins/android/src/wrappers/jmediaplayer.h4
-rw-r--r--src/plugins/android/src/wrappers/jmediarecorder.cpp34
-rw-r--r--src/plugins/android/src/wrappers/jmediarecorder.h4
-rw-r--r--src/plugins/android/src/wrappers/jmultimediautils.cpp16
-rw-r--r--src/plugins/android/src/wrappers/jmultimediautils.h4
-rw-r--r--src/plugins/android/src/wrappers/jsurfacetexture.cpp6
-rw-r--r--src/plugins/android/src/wrappers/jsurfacetexture.h4
-rw-r--r--src/plugins/android/src/wrappers/jsurfacetextureholder.cpp2
-rw-r--r--src/plugins/android/src/wrappers/jsurfacetextureholder.h4
19 files changed, 229 insertions, 253 deletions
diff --git a/src/plugins/android/src/common/qandroidvideorendercontrol.cpp b/src/plugins/android/src/common/qandroidvideorendercontrol.cpp
index c5d38aebe..0eb8d172f 100644
--- a/src/plugins/android/src/common/qandroidvideorendercontrol.cpp
+++ b/src/plugins/android/src/common/qandroidvideorendercontrol.cpp
@@ -41,7 +41,7 @@
#include "qandroidvideorendercontrol.h"
-#include <QtPlatformSupport/private/qjnihelpers_p.h>
+#include <QtCore/private/qjni_p.h>
#include "jsurfacetextureholder.h"
#include <QAbstractVideoSurface>
#include <QOpenGLContext>
@@ -268,7 +268,7 @@ jobject QAndroidVideoRendererControl::surfaceHolder()
return 0;
if (!m_surfaceHolder) {
- m_androidSurface = new QJNIObject("android/view/Surface",
+ m_androidSurface = new QJNIObjectPrivate("android/view/Surface",
"(Landroid/graphics/SurfaceTexture;)V",
m_surfaceTexture->object());
diff --git a/src/plugins/android/src/common/qandroidvideorendercontrol.h b/src/plugins/android/src/common/qandroidvideorendercontrol.h
index d8078f075..25220310e 100644
--- a/src/plugins/android/src/common/qandroidvideorendercontrol.h
+++ b/src/plugins/android/src/common/qandroidvideorendercontrol.h
@@ -90,7 +90,7 @@ private:
bool m_useImage;
QSize m_nativeSize;
- QJNIObject *m_androidSurface;
+ QJNIObjectPrivate *m_androidSurface;
JSurfaceTexture *m_surfaceTexture;
JSurfaceTextureHolder *m_surfaceHolder;
uint m_externalTex;
diff --git a/src/plugins/android/src/mediacapture/qandroidcapturesession.cpp b/src/plugins/android/src/mediacapture/qandroidcapturesession.cpp
index 1927aeb8e..ec458eddb 100644
--- a/src/plugins/android/src/mediacapture/qandroidcapturesession.cpp
+++ b/src/plugins/android/src/mediacapture/qandroidcapturesession.cpp
@@ -45,7 +45,7 @@
#include "qandroidcamerasession.h"
#include "jmultimediautils.h"
#include "qandroidmultimediautils.h"
-#include <QtPlatformSupport/private/qjnihelpers_p.h>
+#include <QtCore/private/qjni_p.h>
QT_BEGIN_NAMESPACE
@@ -466,22 +466,20 @@ void QAndroidCaptureSession::onCameraOpened()
QAndroidCaptureSession::CaptureProfile QAndroidCaptureSession::getProfile(int id)
{
CaptureProfile profile;
- bool hasProfile = QJNIObject::callStaticMethod<jboolean>("android/media/CamcorderProfile",
+ bool hasProfile = QJNIObjectPrivate::callStaticMethod<jboolean>("android/media/CamcorderProfile",
"hasProfile",
"(II)Z",
m_cameraSession->camera()->cameraId(),
id);
if (hasProfile) {
- QJNILocalRef<jobject> ref = QJNIObject::callStaticObjectMethod<jobject>("android/media/CamcorderProfile",
- "get",
- "(II)Landroid/media/CamcorderProfile;",
- m_cameraSession->camera()->cameraId(),
- id);
+ QJNIObjectPrivate obj = QJNIObjectPrivate::callStaticObjectMethod("android/media/CamcorderProfile",
+ "get",
+ "(II)Landroid/media/CamcorderProfile;",
+ m_cameraSession->camera()->cameraId(),
+ id);
- QJNIObject obj(ref.object());
-
profile.outputFormat = JMediaRecorder::OutputFormat(obj.getField<jint>("fileFormat"));
profile.audioEncoder = JMediaRecorder::AudioEncoder(obj.getField<jint>("audioCodec"));
profile.audioBitRate = obj.getField<jint>("audioBitRate");
diff --git a/src/plugins/android/src/mediacapture/qandroidvideodeviceselectorcontrol.cpp b/src/plugins/android/src/mediacapture/qandroidvideodeviceselectorcontrol.cpp
index 26dce565e..04af61085 100644
--- a/src/plugins/android/src/mediacapture/qandroidvideodeviceselectorcontrol.cpp
+++ b/src/plugins/android/src/mediacapture/qandroidvideodeviceselectorcontrol.cpp
@@ -43,7 +43,6 @@
#include "qandroidcamerasession.h"
#include "jcamera.h"
-#include <QtPlatformSupport/private/qjnihelpers_p.h>
QT_BEGIN_NAMESPACE
@@ -103,12 +102,12 @@ void QAndroidVideoDeviceSelectorControl::update()
m_names.clear();
m_descriptions.clear();
- QJNIObject cameraInfo("android/hardware/Camera$CameraInfo");
- int numCameras = QJNIObject::callStaticMethod<jint>("android/hardware/Camera",
+ QJNIObjectPrivate cameraInfo("android/hardware/Camera$CameraInfo");
+ int numCameras = QJNIObjectPrivate::callStaticMethod<jint>("android/hardware/Camera",
"getNumberOfCameras");
for (int i = 0; i < numCameras; ++i) {
- QJNIObject::callStaticMethod<void>("android/hardware/Camera",
+ QJNIObjectPrivate::callStaticMethod<void>("android/hardware/Camera",
"getCameraInfo",
"(ILandroid/hardware/Camera$CameraInfo;)V",
i, cameraInfo.object());
diff --git a/src/plugins/android/src/src.pro b/src/plugins/android/src/src.pro
index e99fd30f5..d071f6fcd 100644
--- a/src/plugins/android/src/src.pro
+++ b/src/plugins/android/src/src.pro
@@ -1,5 +1,5 @@
TARGET = qtmedia_android
-QT += multimedia-private gui-private platformsupport-private network
+QT += multimedia-private core-private network
PLUGIN_TYPE = mediaservice
PLUGIN_CLASS_NAME = QAndroidMediaServicePlugin
diff --git a/src/plugins/android/src/wrappers/jcamera.cpp b/src/plugins/android/src/wrappers/jcamera.cpp
index 9005ac6e0..f53fa4936 100644
--- a/src/plugins/android/src/wrappers/jcamera.cpp
+++ b/src/plugins/android/src/wrappers/jcamera.cpp
@@ -41,7 +41,7 @@
#include "jcamera.h"
-#include <QtPlatformSupport/private/qjnihelpers_p.h>
+#include <QtCore/private/qjni_p.h>
#include <qstringlist.h>
#include <qdebug.h>
#include "qandroidmultimediautils.h"
@@ -53,9 +53,8 @@ static QMap<int, JCamera*> g_objectMap;
static QRect areaToRect(jobject areaObj)
{
- QJNIObject area(areaObj);
- QJNILocalRef<jobject> rectRef = area.getObjectField<jobject>("rect", "android/graphics/Rect");
- QJNIObject rect(rectRef.object());
+ QJNIObjectPrivate area(areaObj);
+ QJNIObjectPrivate rect = area.getObjectField("rect", "android/graphics/Rect");
return QRect(rect.getField<jint>("left"),
rect.getField<jint>("top"),
@@ -63,17 +62,17 @@ static QRect areaToRect(jobject areaObj)
rect.callMethod<jint>("height"));
}
-static QJNILocalRef<jobject> rectToArea(const QRect &rect)
+static QJNIObjectPrivate rectToArea(const QRect &rect)
{
- QJNIObject jrect("android/graphics/Rect",
+ QJNIObjectPrivate jrect("android/graphics/Rect",
"(IIII)V",
rect.left(), rect.top(), rect.right(), rect.bottom());
- QJNIObject area("android/hardware/Camera$Area",
+ QJNIObjectPrivate area("android/hardware/Camera$Area",
"(Landroid/graphics/Rect;I)V",
jrect.object(), 500);
- return QJNILocalRef<jobject>(QAttachedJNIEnv()->NewLocalRef(area.object()));
+ return area;
}
// native method for QtCamera.java
@@ -105,27 +104,25 @@ static void notifyPictureCaptured(JNIEnv *env, jobject, int id, jbyteArray data)
JCamera::JCamera(int cameraId, jobject cam)
: QObject()
- , QJNIObject(cam)
+ , QJNIObjectPrivate(cam)
, m_cameraId(cameraId)
- , m_info(0)
- , m_parameters(0)
, m_hasAPI14(false)
{
if (isValid()) {
g_objectMap.insert(cameraId, this);
- m_info = new QJNIObject("android/hardware/Camera$CameraInfo");
+ m_info = QJNIObjectPrivate("android/hardware/Camera$CameraInfo");
callStaticMethod<void>("android/hardware/Camera",
"getCameraInfo",
"(ILandroid/hardware/Camera$CameraInfo;)V",
- cameraId, m_info->object());
+ cameraId, m_info.object());
- QJNILocalRef<jobject> params = callObjectMethod<jobject>("getParameters",
- "()Landroid/hardware/Camera$Parameters;");
- m_parameters = new QJNIObject(params.object());
+ QJNIObjectPrivate params = callObjectMethod("getParameters",
+ "()Landroid/hardware/Camera$Parameters;");
+ m_parameters = QJNIObjectPrivate(params);
// Check if API 14 is available
- QAttachedJNIEnv env;
+ QJNIEnvironmentPrivate env;
jclass clazz = env->FindClass("android/hardware/Camera");
if (env->ExceptionCheck()) {
clazz = 0;
@@ -147,20 +144,18 @@ JCamera::~JCamera()
{
if (isValid())
g_objectMap.remove(m_cameraId);
- delete m_parameters;
- delete m_info;
}
JCamera *JCamera::open(int cameraId)
{
- QAttachedJNIEnv env;
+ QJNIEnvironmentPrivate env;
- QJNILocalRef<jobject> camera = callStaticObjectMethod<jobject>(g_qtCameraClass,
- "open",
- "(I)Lorg/qtproject/qt5/android/multimedia/QtCamera;",
- cameraId);
+ QJNIObjectPrivate camera = callStaticObjectMethod(g_qtCameraClass,
+ "open",
+ "(I)Lorg/qtproject/qt5/android/multimedia/QtCamera;",
+ cameraId);
- if (camera.isNull())
+ if (!camera.isValid())
return 0;
else
return new JCamera(cameraId, camera.object());
@@ -184,30 +179,28 @@ void JCamera::reconnect()
void JCamera::release()
{
m_previewSize = QSize();
- delete m_parameters;
- m_parameters = 0;
+ m_parameters = QJNIObjectPrivate();
callMethod<void>("release");
}
JCamera::CameraFacing JCamera::getFacing()
{
- return CameraFacing(m_info->getField<jint>("facing"));
+ return CameraFacing(m_info.getField<jint>("facing"));
}
int JCamera::getNativeOrientation()
{
- return m_info->getField<jint>("orientation");
+ return m_info.getField<jint>("orientation");
}
QSize JCamera::getPreferredPreviewSizeForVideo()
{
- if (!m_parameters || !m_parameters->isValid())
+ if (!m_parameters.isValid())
return QSize();
- QJNILocalRef<jobject> sizeRef = m_parameters->callObjectMethod<jobject>("getPreferredPreviewSizeForVideo",
- "()Landroid/hardware/Camera$Size;");
+ QJNIObjectPrivate size = m_parameters.callObjectMethod("getPreferredPreviewSizeForVideo",
+ "()Landroid/hardware/Camera$Size;");
- QJNIObject size(sizeRef.object());
return QSize(size.getField<jint>("width"), size.getField<jint>("height"));
}
@@ -215,16 +208,14 @@ QList<QSize> JCamera::getSupportedPreviewSizes()
{
QList<QSize> list;
- if (m_parameters && m_parameters->isValid()) {
- QJNILocalRef<jobject> sizeListRef = m_parameters->callObjectMethod<jobject>("getSupportedPreviewSizes",
- "()Ljava/util/List;");
- QJNIObject sizeList(sizeListRef.object());
+ if (m_parameters.isValid()) {
+ QJNIObjectPrivate sizeList = m_parameters.callObjectMethod("getSupportedPreviewSizes",
+ "()Ljava/util/List;");
int count = sizeList.callMethod<jint>("size");
for (int i = 0; i < count; ++i) {
- QJNILocalRef<jobject> sizeRef = sizeList.callObjectMethod<jobject>("get",
- "(I)Ljava/lang/Object;",
- i);
- QJNIObject size(sizeRef.object());
+ QJNIObjectPrivate size = sizeList.callObjectMethod("get",
+ "(I)Ljava/lang/Object;",
+ i);
list.append(QSize(size.getField<jint>("width"), size.getField<jint>("height")));
}
@@ -236,12 +227,12 @@ QList<QSize> JCamera::getSupportedPreviewSizes()
void JCamera::setPreviewSize(const QSize &size)
{
- if (!m_parameters || !m_parameters->isValid())
+ if (!m_parameters.isValid())
return;
m_previewSize = size;
- m_parameters->callMethod<void>("setPreviewSize", "(II)V", size.width(), size.height());
+ m_parameters.callMethod<void>("setPreviewSize", "(II)V", size.width(), size.height());
applyParameters();
emit previewSizeChanged();
@@ -254,35 +245,33 @@ void JCamera::setPreviewTexture(jobject surfaceTexture)
bool JCamera::isZoomSupported()
{
- if (!m_parameters || !m_parameters->isValid())
+ if (!m_parameters.isValid())
return false;
- return m_parameters->callMethod<jboolean>("isZoomSupported");
+ return m_parameters.callMethod<jboolean>("isZoomSupported");
}
int JCamera::getMaxZoom()
{
- if (!m_parameters || !m_parameters->isValid())
+ if (!m_parameters.isValid())
return 0;
- return m_parameters->callMethod<jint>("getMaxZoom");
+ return m_parameters.callMethod<jint>("getMaxZoom");
}
QList<int> JCamera::getZoomRatios()
{
QList<int> ratios;
- if (m_parameters && m_parameters->isValid()) {
- QJNILocalRef<jobject> ratioListRef = m_parameters->callObjectMethod<jobject>("getZoomRatios",
- "()Ljava/util/List;");
- QJNIObject ratioList(ratioListRef.object());
+ if (m_parameters.isValid()) {
+ QJNIObjectPrivate ratioList = m_parameters.callObjectMethod("getZoomRatios",
+ "()Ljava/util/List;");
int count = ratioList.callMethod<jint>("size");
for (int i = 0; i < count; ++i) {
- QJNILocalRef<jobject> zoomRatioRef = ratioList.callObjectMethod<jobject>("get",
- "(I)Ljava/lang/Object;",
- i);
+ QJNIObjectPrivate zoomRatio = ratioList.callObjectMethod("get",
+ "(I)Ljava/lang/Object;",
+ i);
- QJNIObject zoomRatio(zoomRatioRef.object());
ratios.append(zoomRatio.callMethod<jint>("intValue"));
}
}
@@ -292,18 +281,18 @@ QList<int> JCamera::getZoomRatios()
int JCamera::getZoom()
{
- if (!m_parameters || !m_parameters->isValid())
+ if (!m_parameters.isValid())
return 0;
- return m_parameters->callMethod<jint>("getZoom");
+ return m_parameters.callMethod<jint>("getZoom");
}
void JCamera::setZoom(int value)
{
- if (!m_parameters || !m_parameters->isValid())
+ if (!m_parameters.isValid())
return;
- m_parameters->callMethod<void>("setZoom", "(I)V", value);
+ m_parameters.callMethod<void>("setZoom", "(I)V", value);
applyParameters();
}
@@ -316,11 +305,11 @@ QString JCamera::getFlashMode()
{
QString value;
- if (m_parameters && m_parameters->isValid()) {
- QJNILocalRef<jstring> flashMode = m_parameters->callObjectMethod<jstring>("getFlashMode",
- "()Ljava/lang/String;");
- if (!flashMode.isNull())
- value = qt_convertJString(flashMode.object());
+ if (m_parameters.isValid()) {
+ QJNIObjectPrivate flashMode = m_parameters.callObjectMethod("getFlashMode",
+ "()Ljava/lang/String;");
+ if (flashMode.isValid())
+ value = flashMode.toString();
}
return value;
@@ -328,12 +317,12 @@ QString JCamera::getFlashMode()
void JCamera::setFlashMode(const QString &value)
{
- if (!m_parameters || !m_parameters->isValid())
+ if (!m_parameters.isValid())
return;
- m_parameters->callMethod<void>("setFlashMode",
- "(Ljava/lang/String;)V",
- qt_toJString(value).object());
+ m_parameters.callMethod<void>("setFlashMode",
+ "(Ljava/lang/String;)V",
+ QJNIObjectPrivate::fromString(value).object());
applyParameters();
}
@@ -346,11 +335,11 @@ QString JCamera::getFocusMode()
{
QString value;
- if (m_parameters && m_parameters->isValid()) {
- QJNILocalRef<jstring> focusMode = m_parameters->callObjectMethod<jstring>("getFocusMode",
- "()Ljava/lang/String;");
- if (!focusMode.isNull())
- value = qt_convertJString(focusMode.object());
+ if (m_parameters.isValid()) {
+ QJNIObjectPrivate focusMode = m_parameters.callObjectMethod("getFocusMode",
+ "()Ljava/lang/String;");
+ if (focusMode.isValid())
+ value = focusMode.toString();
}
return value;
@@ -358,40 +347,39 @@ QString JCamera::getFocusMode()
void JCamera::setFocusMode(const QString &value)
{
- if (!m_parameters || !m_parameters->isValid())
+ if (!m_parameters.isValid())
return;
- m_parameters->callMethod<void>("setFocusMode",
- "(Ljava/lang/String;)V",
- qt_toJString(value).object());
+ m_parameters.callMethod<void>("setFocusMode",
+ "(Ljava/lang/String;)V",
+ QJNIObjectPrivate::fromString(value).object());
applyParameters();
}
int JCamera::getMaxNumFocusAreas()
{
- if (!m_hasAPI14 || !m_parameters || !m_parameters->isValid())
+ if (!m_hasAPI14 || !m_parameters.isValid())
return 0;
- return m_parameters->callMethod<jint>("getMaxNumFocusAreas");
+ return m_parameters.callMethod<jint>("getMaxNumFocusAreas");
}
QList<QRect> JCamera::getFocusAreas()
{
QList<QRect> areas;
- if (m_hasAPI14 && m_parameters && m_parameters->isValid()) {
- QJNILocalRef<jobject> listRef = m_parameters->callObjectMethod<jobject>("getFocusAreas",
- "()Ljava/util/List;");
+ if (m_hasAPI14 && m_parameters.isValid()) {
+ QJNIObjectPrivate list = m_parameters.callObjectMethod("getFocusAreas",
+ "()Ljava/util/List;");
- if (!listRef.isNull()) {
- QJNIObject list(listRef.object());
+ if (list.isValid()) {
int count = list.callMethod<jint>("size");
for (int i = 0; i < count; ++i) {
- QJNILocalRef<jobject> areaRef = list.callObjectMethod<jobject>("get",
- "(I)Ljava/lang/Object;",
- i);
+ QJNIObjectPrivate area = list.callObjectMethod("get",
+ "(I)Ljava/lang/Object;",
+ i);
- areas.append(areaToRect(areaRef.object()));
+ areas.append(areaToRect(area.object()));
}
}
}
@@ -401,14 +389,14 @@ QList<QRect> JCamera::getFocusAreas()
void JCamera::setFocusAreas(const QList<QRect> &areas)
{
- if (!m_hasAPI14 || !m_parameters || !m_parameters->isValid())
+ if (!m_hasAPI14 || !m_parameters.isValid())
return;
- QJNILocalRef<jobject> list(0);
+ QJNIObjectPrivate list;
if (!areas.isEmpty()) {
- QAttachedJNIEnv env;
- QJNIObject arrayList("java/util/ArrayList", "(I)V", areas.size());
+ QJNIEnvironmentPrivate env;
+ QJNIObjectPrivate arrayList("java/util/ArrayList", "(I)V", areas.size());
for (int i = 0; i < areas.size(); ++i) {
arrayList.callMethod<jboolean>("add",
"(Ljava/lang/Object;)Z",
@@ -416,10 +404,10 @@ void JCamera::setFocusAreas(const QList<QRect> &areas)
if (env->ExceptionCheck())
env->ExceptionClear();
}
- list = env->NewLocalRef(arrayList.object());
+ list = arrayList;
}
- m_parameters->callMethod<void>("setFocusAreas", "(Ljava/util/List;)V", list.object());
+ m_parameters.callMethod<void>("setFocusAreas", "(Ljava/util/List;)V", list.object());
applyParameters();
}
@@ -437,93 +425,93 @@ void JCamera::cancelAutoFocus()
bool JCamera::isAutoExposureLockSupported()
{
- if (!m_hasAPI14 || !m_parameters || !m_parameters->isValid())
+ if (!m_hasAPI14 || !m_parameters.isValid())
return false;
- return m_parameters->callMethod<jboolean>("isAutoExposureLockSupported");
+ return m_parameters.callMethod<jboolean>("isAutoExposureLockSupported");
}
bool JCamera::getAutoExposureLock()
{
- if (!m_hasAPI14 || !m_parameters || !m_parameters->isValid())
+ if (!m_hasAPI14 || !m_parameters.isValid())
return false;
- return m_parameters->callMethod<jboolean>("getAutoExposureLock");
+ return m_parameters.callMethod<jboolean>("getAutoExposureLock");
}
void JCamera::setAutoExposureLock(bool toggle)
{
- if (!m_hasAPI14 || !m_parameters || !m_parameters->isValid())
+ if (!m_hasAPI14 || !m_parameters.isValid())
return;
- m_parameters->callMethod<void>("setAutoExposureLock", "(Z)V", toggle);
+ m_parameters.callMethod<void>("setAutoExposureLock", "(Z)V", toggle);
applyParameters();
}
bool JCamera::isAutoWhiteBalanceLockSupported()
{
- if (!m_hasAPI14 || !m_parameters || !m_parameters->isValid())
+ if (!m_hasAPI14 || !m_parameters.isValid())
return false;
- return m_parameters->callMethod<jboolean>("isAutoWhiteBalanceLockSupported");
+ return m_parameters.callMethod<jboolean>("isAutoWhiteBalanceLockSupported");
}
bool JCamera::getAutoWhiteBalanceLock()
{
- if (!m_hasAPI14 || !m_parameters || !m_parameters->isValid())
+ if (!m_hasAPI14 || !m_parameters.isValid())
return false;
- return m_parameters->callMethod<jboolean>("getAutoWhiteBalanceLock");
+ return m_parameters.callMethod<jboolean>("getAutoWhiteBalanceLock");
}
void JCamera::setAutoWhiteBalanceLock(bool toggle)
{
- if (!m_hasAPI14 || !m_parameters || !m_parameters->isValid())
+ if (!m_hasAPI14 || !m_parameters.isValid())
return;
- m_parameters->callMethod<void>("setAutoWhiteBalanceLock", "(Z)V", toggle);
+ m_parameters.callMethod<void>("setAutoWhiteBalanceLock", "(Z)V", toggle);
applyParameters();
}
int JCamera::getExposureCompensation()
{
- if (!m_parameters || !m_parameters->isValid())
+ if (!m_parameters.isValid())
return 0;
- return m_parameters->callMethod<jint>("getExposureCompensation");
+ return m_parameters.callMethod<jint>("getExposureCompensation");
}
void JCamera::setExposureCompensation(int value)
{
- if (!m_parameters || !m_parameters->isValid())
+ if (!m_parameters.isValid())
return;
- m_parameters->callMethod<void>("setExposureCompensation", "(I)V", value);
+ m_parameters.callMethod<void>("setExposureCompensation", "(I)V", value);
applyParameters();
}
float JCamera::getExposureCompensationStep()
{
- if (!m_parameters || !m_parameters->isValid())
+ if (!m_parameters.isValid())
return 0;
- return m_parameters->callMethod<jfloat>("getExposureCompensationStep");
+ return m_parameters.callMethod<jfloat>("getExposureCompensationStep");
}
int JCamera::getMinExposureCompensation()
{
- if (!m_parameters || !m_parameters->isValid())
+ if (!m_parameters.isValid())
return 0;
- return m_parameters->callMethod<jint>("getMinExposureCompensation");
+ return m_parameters.callMethod<jint>("getMinExposureCompensation");
}
int JCamera::getMaxExposureCompensation()
{
- if (!m_parameters || !m_parameters->isValid())
+ if (!m_parameters.isValid())
return 0;
- return m_parameters->callMethod<jint>("getMaxExposureCompensation");
+ return m_parameters.callMethod<jint>("getMaxExposureCompensation");
}
QStringList JCamera::getSupportedSceneModes()
@@ -535,11 +523,11 @@ QString JCamera::getSceneMode()
{
QString value;
- if (m_parameters && m_parameters->isValid()) {
- QJNILocalRef<jstring> sceneMode = m_parameters->callObjectMethod<jstring>("getSceneMode",
- "()Ljava/lang/String;");
- if (!sceneMode.isNull())
- value = qt_convertJString(sceneMode.object());
+ if (m_parameters.isValid()) {
+ QJNIObjectPrivate sceneMode = m_parameters.callObjectMethod("getSceneMode",
+ "()Ljava/lang/String;");
+ if (sceneMode.isValid())
+ value = sceneMode.toString();
}
return value;
@@ -547,12 +535,12 @@ QString JCamera::getSceneMode()
void JCamera::setSceneMode(const QString &value)
{
- if (!m_parameters || !m_parameters->isValid())
+ if (!m_parameters.isValid())
return;
- m_parameters->callMethod<void>("setSceneMode",
- "(Ljava/lang/String;)V",
- qt_toJString(value).object());
+ m_parameters.callMethod<void>("setSceneMode",
+ "(Ljava/lang/String;)V",
+ QJNIObjectPrivate::fromString(value).object());
applyParameters();
}
@@ -565,11 +553,11 @@ QString JCamera::getWhiteBalance()
{
QString value;
- if (m_parameters && m_parameters->isValid()) {
- QJNILocalRef<jstring> wb = m_parameters->callObjectMethod<jstring>("getWhiteBalance",
- "()Ljava/lang/String;");
- if (!wb.isNull())
- value = qt_convertJString(wb.object());
+ if (m_parameters.isValid()) {
+ QJNIObjectPrivate wb = m_parameters.callObjectMethod("getWhiteBalance",
+ "()Ljava/lang/String;");
+ if (wb.isValid())
+ value = wb.toString();
}
return value;
@@ -577,12 +565,12 @@ QString JCamera::getWhiteBalance()
void JCamera::setWhiteBalance(const QString &value)
{
- if (!m_parameters || !m_parameters->isValid())
+ if (!m_parameters.isValid())
return;
- m_parameters->callMethod<void>("setWhiteBalance",
- "(Ljava/lang/String;)V",
- qt_toJString(value).object());
+ m_parameters.callMethod<void>("setWhiteBalance",
+ "(Ljava/lang/String;)V",
+ QJNIObjectPrivate::fromString(value).object());
applyParameters();
emit whiteBalanceChanged();
@@ -590,10 +578,10 @@ void JCamera::setWhiteBalance(const QString &value)
void JCamera::setRotation(int rotation)
{
- if (!m_parameters || !m_parameters->isValid())
+ if (!m_parameters.isValid())
return;
- m_parameters->callMethod<void>("setRotation", "(I)V", rotation);
+ m_parameters.callMethod<void>("setRotation", "(I)V", rotation);
applyParameters();
}
@@ -601,16 +589,14 @@ QList<QSize> JCamera::getSupportedPictureSizes()
{
QList<QSize> list;
- if (m_parameters && m_parameters->isValid()) {
- QJNILocalRef<jobject> sizeListRef = m_parameters->callObjectMethod<jobject>("getSupportedPictureSizes",
- "()Ljava/util/List;");
- QJNIObject sizeList(sizeListRef.object());
+ if (m_parameters.isValid()) {
+ QJNIObjectPrivate sizeList = m_parameters.callObjectMethod("getSupportedPictureSizes",
+ "()Ljava/util/List;");
int count = sizeList.callMethod<jint>("size");
for (int i = 0; i < count; ++i) {
- QJNILocalRef<jobject> sizeRef = sizeList.callObjectMethod<jobject>("get",
- "(I)Ljava/lang/Object;",
- i);
- QJNIObject size(sizeRef.object());
+ QJNIObjectPrivate size = sizeList.callObjectMethod("get",
+ "(I)Ljava/lang/Object;",
+ i);
list.append(QSize(size.getField<jint>("width"), size.getField<jint>("height")));
}
@@ -622,19 +608,19 @@ QList<QSize> JCamera::getSupportedPictureSizes()
void JCamera::setPictureSize(const QSize &size)
{
- if (!m_parameters || !m_parameters->isValid())
+ if (!m_parameters.isValid())
return;
- m_parameters->callMethod<void>("setPictureSize", "(II)V", size.width(), size.height());
+ m_parameters.callMethod<void>("setPictureSize", "(II)V", size.width(), size.height());
applyParameters();
}
void JCamera::setJpegQuality(int quality)
{
- if (!m_parameters || !m_parameters->isValid())
+ if (!m_parameters.isValid())
return;
- m_parameters->callMethod<void>("setJpegQuality", "(I)V", quality);
+ m_parameters.callMethod<void>("setJpegQuality", "(I)V", quality);
applyParameters();
}
@@ -657,27 +643,25 @@ void JCamera::applyParameters()
{
callMethod<void>("setParameters",
"(Landroid/hardware/Camera$Parameters;)V",
- m_parameters->object());
+ m_parameters.object());
}
QStringList JCamera::callStringListMethod(const char *methodName)
{
QStringList stringList;
- if (m_parameters && m_parameters->isValid()) {
- QJNILocalRef<jobject> listRef = m_parameters->callObjectMethod<jobject>(methodName,
- "()Ljava/util/List;");
+ if (m_parameters.isValid()) {
+ QJNIObjectPrivate list = m_parameters.callObjectMethod(methodName,
+ "()Ljava/util/List;");
- if (!listRef.isNull()) {
- QJNIObject list(listRef.object());
+ if (list.isValid()) {
int count = list.callMethod<jint>("size");
for (int i = 0; i < count; ++i) {
- QJNILocalRef<jobject> stringRef = list.callObjectMethod<jobject>("get",
- "(I)Ljava/lang/Object;",
- i);
+ QJNIObjectPrivate string = list.callObjectMethod("get",
+ "(I)Ljava/lang/Object;",
+ i);
- QJNIObject string(stringRef.object());
- stringList.append(qt_convertJString(string.callObjectMethod<jstring>("toString").object()));
+ stringList.append(string.toString());
}
}
}
diff --git a/src/plugins/android/src/wrappers/jcamera.h b/src/plugins/android/src/wrappers/jcamera.h
index 100628721..0aea81f38 100644
--- a/src/plugins/android/src/wrappers/jcamera.h
+++ b/src/plugins/android/src/wrappers/jcamera.h
@@ -43,13 +43,13 @@
#define JCAMERA_H
#include <qobject.h>
-#include <QtPlatformSupport/private/qjniobject_p.h>
+#include <QtCore/private/qjni_p.h>
#include <qsize.h>
#include <qrect.h>
QT_BEGIN_NAMESPACE
-class JCamera : public QObject, public QJNIObject
+class JCamera : public QObject, public QJNIObjectPrivate
{
Q_OBJECT
public:
@@ -153,8 +153,8 @@ private:
QStringList callStringListMethod(const char *methodName);
int m_cameraId;
- QJNIObject *m_info;
- QJNIObject *m_parameters;
+ QJNIObjectPrivate m_info;
+ QJNIObjectPrivate m_parameters;
QSize m_previewSize;
diff --git a/src/plugins/android/src/wrappers/jmediametadataretriever.cpp b/src/plugins/android/src/wrappers/jmediametadataretriever.cpp
index ae5abcf43..91c40905c 100644
--- a/src/plugins/android/src/wrappers/jmediametadataretriever.cpp
+++ b/src/plugins/android/src/wrappers/jmediametadataretriever.cpp
@@ -41,21 +41,14 @@
#include "jmediametadataretriever.h"
-#include <QtPlatformSupport/private/qjnihelpers_p.h>
-#include <qpa/qplatformnativeinterface.h>
-#include <qguiapplication.h>
+#include <QtCore/private/qjnihelpers_p.h>
+#include <QtCore/private/qjni_p.h>
QT_BEGIN_NAMESPACE
-static jobject g_activity = 0;
-
JMediaMetadataRetriever::JMediaMetadataRetriever()
- : QJNIObject("android/media/MediaMetadataRetriever")
+ : QJNIObjectPrivate("android/media/MediaMetadataRetriever")
{
- if (!g_activity) {
- QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
- g_activity = static_cast<jobject>(nativeInterface->nativeResourceForIntegration("QtActivity"));
- }
}
JMediaMetadataRetriever::~JMediaMetadataRetriever()
@@ -66,11 +59,11 @@ QString JMediaMetadataRetriever::extractMetadata(MetadataKey key)
{
QString value;
- QJNILocalRef<jstring> metadata = callObjectMethod<jstring>("extractMetadata",
- "(I)Ljava/lang/String;",
- jint(key));
- if (!metadata.isNull())
- value = qt_convertJString(metadata.object());
+ QJNIObjectPrivate metadata = callObjectMethod("extractMetadata",
+ "(I)Ljava/lang/String;",
+ jint(key));
+ if (metadata.isValid())
+ value = metadata.toString();
return value;
}
@@ -82,22 +75,22 @@ void JMediaMetadataRetriever::release()
bool JMediaMetadataRetriever::setDataSource(const QUrl &url)
{
- QAttachedJNIEnv env;
+ QJNIEnvironmentPrivate env;
bool loaded = false;
- QJNILocalRef<jstring> string = qt_toJString(url.toString());
+ QJNIObjectPrivate string = QJNIObjectPrivate::fromString(url.toString());
- QJNILocalRef<jobject> uri = callStaticObjectMethod<jobject>("android/net/Uri",
- "parse",
- "(Ljava/lang/String;)Landroid/net/Uri;",
- string.object());
+ QJNIObjectPrivate uri = callStaticObjectMethod("android/net/Uri",
+ "parse",
+ "(Ljava/lang/String;)Landroid/net/Uri;",
+ string.object());
if (env->ExceptionCheck()) {
env->ExceptionClear();
} else {
callMethod<void>("setDataSource",
"(Landroid/content/Context;Landroid/net/Uri;)V",
- g_activity,
+ QtAndroidPrivate::activity(),
uri.object());
if (env->ExceptionCheck())
env->ExceptionClear();
@@ -110,11 +103,13 @@ bool JMediaMetadataRetriever::setDataSource(const QUrl &url)
bool JMediaMetadataRetriever::setDataSource(const QString &path)
{
- QAttachedJNIEnv env;
+ QJNIEnvironmentPrivate env;
bool loaded = false;
- callMethod<void>("setDataSource", "(Ljava/lang/String;)V", qt_toJString(path).object());
+ callMethod<void>("setDataSource",
+ "(Ljava/lang/String;)V",
+ QJNIObjectPrivate::fromString(path).object());
if (env->ExceptionCheck())
env->ExceptionClear();
else
diff --git a/src/plugins/android/src/wrappers/jmediametadataretriever.h b/src/plugins/android/src/wrappers/jmediametadataretriever.h
index dd63e0d87..7b22c955d 100644
--- a/src/plugins/android/src/wrappers/jmediametadataretriever.h
+++ b/src/plugins/android/src/wrappers/jmediametadataretriever.h
@@ -42,12 +42,12 @@
#ifndef JMEDIAMETADATARETRIEVER_H
#define JMEDIAMETADATARETRIEVER_H
-#include <QtPlatformSupport/private/qjniobject_p.h>
+#include <QtCore/private/qjni_p.h>
#include <qurl.h>
QT_BEGIN_NAMESPACE
-class JMediaMetadataRetriever : public QJNIObject
+class JMediaMetadataRetriever : public QJNIObjectPrivate
{
public:
enum MetadataKey {
diff --git a/src/plugins/android/src/wrappers/jmediaplayer.cpp b/src/plugins/android/src/wrappers/jmediaplayer.cpp
index f6e03ee22..3d7f7f9d1 100644
--- a/src/plugins/android/src/wrappers/jmediaplayer.cpp
+++ b/src/plugins/android/src/wrappers/jmediaplayer.cpp
@@ -42,9 +42,9 @@
#include "jmediaplayer.h"
#include <QString>
-#include <qpa/qplatformnativeinterface.h>
-#include <qguiapplication.h>
-#include <QtPlatformSupport/private/qjnihelpers_p.h>
+#include <QtCore/private/qjni_p.h>
+#include <QtCore/private/qjnihelpers_p.h>
+#include <QMap>
namespace {
@@ -60,19 +60,17 @@ bool JMediaPlayer::mActivitySet = false;
JMediaPlayer::JMediaPlayer()
: QObject()
- , QJNIObject(mediaPlayerClass, "(J)V", reinterpret_cast<jlong>(this))
+ , QJNIObjectPrivate(mediaPlayerClass, "(J)V", reinterpret_cast<jlong>(this))
, mId(reinterpret_cast<jlong>(this))
, mDisplay(0)
{
mplayers.insert(mId, this);
if (!mActivitySet) {
- QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
- jobject activity = static_cast<jobject>(nativeInterface->nativeResourceForIntegration("QtActivity"));
- QJNIObject::callStaticMethod<void>(mediaPlayerClass,
+ QJNIObjectPrivate::callStaticMethod<void>(mediaPlayerClass,
"setActivity",
"(Landroid/app/Activity;)V",
- activity);
+ QtAndroidPrivate::activity());
mActivitySet = true;
}
}
@@ -164,7 +162,7 @@ void JMediaPlayer::setMuted(bool mute)
void JMediaPlayer::setDataSource(const QString &path)
{
- QJNILocalRef<jstring> string = qt_toJString(path);
+ QJNIObjectPrivate string = QJNIObjectPrivate::fromString(path);
callMethod<void>("setMediaPath", "(Ljava/lang/String;)V", string.object());
}
diff --git a/src/plugins/android/src/wrappers/jmediaplayer.h b/src/plugins/android/src/wrappers/jmediaplayer.h
index 710246b9a..c737cfa26 100644
--- a/src/plugins/android/src/wrappers/jmediaplayer.h
+++ b/src/plugins/android/src/wrappers/jmediaplayer.h
@@ -43,11 +43,11 @@
#define QANDROIDMEDIAPLAYER_H
#include <QObject>
-#include <QtPlatformSupport/private/qjniobject_p.h>
+#include <QtCore/private/qjni_p.h>
QT_BEGIN_NAMESPACE
-class JMediaPlayer : public QObject, public QJNIObject
+class JMediaPlayer : public QObject, public QJNIObjectPrivate
{
Q_OBJECT
public:
diff --git a/src/plugins/android/src/wrappers/jmediarecorder.cpp b/src/plugins/android/src/wrappers/jmediarecorder.cpp
index b7cbe5724..1a9ee33f7 100644
--- a/src/plugins/android/src/wrappers/jmediarecorder.cpp
+++ b/src/plugins/android/src/wrappers/jmediarecorder.cpp
@@ -42,7 +42,7 @@
#include "jmediarecorder.h"
#include "jcamera.h"
-#include <QtPlatformSupport/private/qjnihelpers_p.h>
+#include <QtCore/private/qjni_p.h>
#include <qmap.h>
QT_BEGIN_NAMESPACE
@@ -66,7 +66,7 @@ static void notifyInfo(JNIEnv* , jobject, jlong id, jint what, jint extra)
JMediaRecorder::JMediaRecorder()
: QObject()
- , QJNIObject(g_qtMediaRecorderClass, "(J)V", reinterpret_cast<jlong>(this))
+ , QJNIObjectPrivate(g_qtMediaRecorderClass, "(J)V", reinterpret_cast<jlong>(this))
, m_id(reinterpret_cast<jlong>(this))
{
if (isValid())
@@ -85,7 +85,7 @@ void JMediaRecorder::release()
bool JMediaRecorder::prepare()
{
- QAttachedJNIEnv env;
+ QJNIEnvironmentPrivate env;
callMethod<void>("prepare");
if (env->ExceptionCheck()) {
env->ExceptionClear();
@@ -101,7 +101,7 @@ void JMediaRecorder::reset()
bool JMediaRecorder::start()
{
- QAttachedJNIEnv env;
+ QJNIEnvironmentPrivate env;
callMethod<void>("start");
if (env->ExceptionCheck()) {
env->ExceptionClear();
@@ -112,7 +112,7 @@ bool JMediaRecorder::start()
void JMediaRecorder::stop()
{
- QAttachedJNIEnv env;
+ QJNIEnvironmentPrivate env;
callMethod<void>("stop");
if (env->ExceptionCheck())
env->ExceptionClear();
@@ -125,7 +125,7 @@ void JMediaRecorder::setAudioChannels(int numChannels)
void JMediaRecorder::setAudioEncoder(AudioEncoder encoder)
{
- QAttachedJNIEnv env;
+ QJNIEnvironmentPrivate env;
callMethod<void>("setAudioEncoder", "(I)V", int(encoder));
if (env->ExceptionCheck())
env->ExceptionClear();
@@ -143,7 +143,7 @@ void JMediaRecorder::setAudioSamplingRate(int samplingRate)
void JMediaRecorder::setAudioSource(AudioSource source)
{
- QAttachedJNIEnv env;
+ QJNIEnvironmentPrivate env;
callMethod<void>("setAudioSource", "(I)V", int(source));
if (env->ExceptionCheck())
env->ExceptionClear();
@@ -151,13 +151,13 @@ void JMediaRecorder::setAudioSource(AudioSource source)
void JMediaRecorder::setCamera(JCamera *camera)
{
- QJNILocalRef<jobject> cam = camera->getObjectField<jobject>("m_camera", "Landroid/hardware/Camera;");
+ QJNIObjectPrivate cam = camera->getObjectField("m_camera", "Landroid/hardware/Camera;");
callMethod<void>("setCamera", "(Landroid/hardware/Camera;)V", cam.object());
}
void JMediaRecorder::setVideoEncoder(VideoEncoder encoder)
{
- QAttachedJNIEnv env;
+ QJNIEnvironmentPrivate env;
callMethod<void>("setVideoEncoder", "(I)V", int(encoder));
if (env->ExceptionCheck())
env->ExceptionClear();
@@ -170,7 +170,7 @@ void JMediaRecorder::setVideoEncodingBitRate(int bitRate)
void JMediaRecorder::setVideoFrameRate(int rate)
{
- QAttachedJNIEnv env;
+ QJNIEnvironmentPrivate env;
callMethod<void>("setVideoFrameRate", "(I)V", rate);
if (env->ExceptionCheck())
env->ExceptionClear();
@@ -178,7 +178,7 @@ void JMediaRecorder::setVideoFrameRate(int rate)
void JMediaRecorder::setVideoSize(const QSize &size)
{
- QAttachedJNIEnv env;
+ QJNIEnvironmentPrivate env;
callMethod<void>("setVideoSize", "(II)V", size.width(), size.height());
if (env->ExceptionCheck())
env->ExceptionClear();
@@ -186,7 +186,7 @@ void JMediaRecorder::setVideoSize(const QSize &size)
void JMediaRecorder::setVideoSource(VideoSource source)
{
- QAttachedJNIEnv env;
+ QJNIEnvironmentPrivate env;
callMethod<void>("setVideoSource", "(I)V", int(source));
if (env->ExceptionCheck())
env->ExceptionClear();
@@ -194,7 +194,7 @@ void JMediaRecorder::setVideoSource(VideoSource source)
void JMediaRecorder::setOrientationHint(int degrees)
{
- QAttachedJNIEnv env;
+ QJNIEnvironmentPrivate env;
callMethod<void>("setOrientationHint", "(I)V", degrees);
if (env->ExceptionCheck())
env->ExceptionClear();
@@ -202,7 +202,7 @@ void JMediaRecorder::setOrientationHint(int degrees)
void JMediaRecorder::setOutputFormat(OutputFormat format)
{
- QAttachedJNIEnv env;
+ QJNIEnvironmentPrivate env;
callMethod<void>("setOutputFormat", "(I)V", int(format));
if (env->ExceptionCheck())
env->ExceptionClear();
@@ -210,8 +210,10 @@ void JMediaRecorder::setOutputFormat(OutputFormat format)
void JMediaRecorder::setOutputFile(const QString &path)
{
- QAttachedJNIEnv env;
- callMethod<void>("setOutputFile", "(Ljava/lang/String;)V", qt_toJString(path).object());
+ QJNIEnvironmentPrivate env;
+ callMethod<void>("setOutputFile",
+ "(Ljava/lang/String;)V",
+ QJNIObjectPrivate::fromString(path).object());
if (env->ExceptionCheck())
env->ExceptionClear();
}
diff --git a/src/plugins/android/src/wrappers/jmediarecorder.h b/src/plugins/android/src/wrappers/jmediarecorder.h
index ef26b8a72..2bdb06b9f 100644
--- a/src/plugins/android/src/wrappers/jmediarecorder.h
+++ b/src/plugins/android/src/wrappers/jmediarecorder.h
@@ -43,14 +43,14 @@
#define JMEDIARECORDER_H
#include <qobject.h>
-#include <QtPlatformSupport/private/qjniobject_p.h>
+#include <QtCore/private/qjni_p.h>
#include <qsize.h>
QT_BEGIN_NAMESPACE
class JCamera;
-class JMediaRecorder : public QObject, public QJNIObject
+class JMediaRecorder : public QObject, public QJNIObjectPrivate
{
Q_OBJECT
public:
diff --git a/src/plugins/android/src/wrappers/jmultimediautils.cpp b/src/plugins/android/src/wrappers/jmultimediautils.cpp
index 6832e6b6e..a20d54477 100644
--- a/src/plugins/android/src/wrappers/jmultimediautils.cpp
+++ b/src/plugins/android/src/wrappers/jmultimediautils.cpp
@@ -41,7 +41,7 @@
#include "jmultimediautils.h"
-#include <QtPlatformSupport/private/qjnihelpers_p.h>
+#include <QtCore/private/qjni_p.h>
QT_BEGIN_NAMESPACE
@@ -49,7 +49,7 @@ static jclass g_qtMultimediaUtilsClass = 0;
JMultimediaUtils::JMultimediaUtils()
: QObject()
- , QJNIObject(g_qtMultimediaUtilsClass)
+ , QJNIObjectPrivate(g_qtMultimediaUtilsClass)
{
}
@@ -65,11 +65,11 @@ int JMultimediaUtils::getDeviceOrientation()
QString JMultimediaUtils::getDefaultMediaDirectory(MediaType type)
{
- QJNILocalRef<jstring> path = callStaticObjectMethod<jstring>(g_qtMultimediaUtilsClass,
- "getDefaultMediaDirectory",
- "(I)Ljava/lang/String;",
- jint(type));
- return qt_convertJString(path.object());
+ QJNIObjectPrivate path = callStaticObjectMethod(g_qtMultimediaUtilsClass,
+ "getDefaultMediaDirectory",
+ "(I)Ljava/lang/String;",
+ jint(type));
+ return path.toString();
}
void JMultimediaUtils::registerMediaFile(const QString &file)
@@ -77,7 +77,7 @@ void JMultimediaUtils::registerMediaFile(const QString &file)
callStaticMethod<void>(g_qtMultimediaUtilsClass,
"registerMediaFile",
"(Ljava/lang/String;)V",
- qt_toJString(file).object());
+ QJNIObjectPrivate::fromString(file).object());
}
bool JMultimediaUtils::initJNI(JNIEnv *env)
diff --git a/src/plugins/android/src/wrappers/jmultimediautils.h b/src/plugins/android/src/wrappers/jmultimediautils.h
index 909f5c155..9896f7f31 100644
--- a/src/plugins/android/src/wrappers/jmultimediautils.h
+++ b/src/plugins/android/src/wrappers/jmultimediautils.h
@@ -43,11 +43,11 @@
#define JMULTIMEDIAUTILS_H
#include <qobject.h>
-#include <QtPlatformSupport/private/qjniobject_p.h>
+#include <QtCore/private/qjni_p.h>
QT_BEGIN_NAMESPACE
-class JMultimediaUtils : public QObject, public QJNIObject
+class JMultimediaUtils : public QObject, public QJNIObjectPrivate
{
Q_OBJECT
public:
diff --git a/src/plugins/android/src/wrappers/jsurfacetexture.cpp b/src/plugins/android/src/wrappers/jsurfacetexture.cpp
index 60c85cdf0..1505443a8 100644
--- a/src/plugins/android/src/wrappers/jsurfacetexture.cpp
+++ b/src/plugins/android/src/wrappers/jsurfacetexture.cpp
@@ -40,7 +40,7 @@
****************************************************************************/
#include "jsurfacetexture.h"
-#include <QtPlatformSupport/private/qjnihelpers_p.h>
+#include <QtCore/private/qjni_p.h>
QT_BEGIN_NAMESPACE
@@ -57,7 +57,7 @@ static void notifyFrameAvailable(JNIEnv* , jobject, int id)
JSurfaceTexture::JSurfaceTexture(unsigned int texName)
: QObject()
- , QJNIObject(g_qtSurfaceTextureClass, "(I)V", jint(texName))
+ , QJNIObjectPrivate(g_qtSurfaceTextureClass, "(I)V", jint(texName))
, m_texID(int(texName))
{
if (isValid())
@@ -72,7 +72,7 @@ JSurfaceTexture::~JSurfaceTexture()
QMatrix4x4 JSurfaceTexture::getTransformMatrix()
{
- QAttachedJNIEnv env;
+ QJNIEnvironmentPrivate env;
QMatrix4x4 matrix;
jfloatArray array = env->NewFloatArray(16);
diff --git a/src/plugins/android/src/wrappers/jsurfacetexture.h b/src/plugins/android/src/wrappers/jsurfacetexture.h
index 2a2f27ae3..d65fc01e9 100644
--- a/src/plugins/android/src/wrappers/jsurfacetexture.h
+++ b/src/plugins/android/src/wrappers/jsurfacetexture.h
@@ -43,13 +43,13 @@
#define JSURFACETEXTURE_H
#include <qobject.h>
-#include <QtPlatformSupport/private/qjniobject_p.h>
+#include <QtCore/private/qjni_p.h>
#include <QMatrix4x4>
QT_BEGIN_NAMESPACE
-class JSurfaceTexture : public QObject, public QJNIObject
+class JSurfaceTexture : public QObject, public QJNIObjectPrivate
{
Q_OBJECT
public:
diff --git a/src/plugins/android/src/wrappers/jsurfacetextureholder.cpp b/src/plugins/android/src/wrappers/jsurfacetextureholder.cpp
index 4ec8935c2..b6d1433d1 100644
--- a/src/plugins/android/src/wrappers/jsurfacetextureholder.cpp
+++ b/src/plugins/android/src/wrappers/jsurfacetextureholder.cpp
@@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE
static jclass g_qtSurfaceTextureHolderClass = 0;
JSurfaceTextureHolder::JSurfaceTextureHolder(jobject surface)
- : QJNIObject(g_qtSurfaceTextureHolderClass, "(Landroid/view/Surface;)V", surface)
+ : QJNIObjectPrivate(g_qtSurfaceTextureHolderClass, "(Landroid/view/Surface;)V", surface)
{
}
diff --git a/src/plugins/android/src/wrappers/jsurfacetextureholder.h b/src/plugins/android/src/wrappers/jsurfacetextureholder.h
index 5b567de3a..556cb4a40 100644
--- a/src/plugins/android/src/wrappers/jsurfacetextureholder.h
+++ b/src/plugins/android/src/wrappers/jsurfacetextureholder.h
@@ -42,11 +42,11 @@
#ifndef JSURFACETEXTUREHOLDER_H
#define JSURFACETEXTUREHOLDER_H
-#include <QtPlatformSupport/private/qjniobject_p.h>
+#include <QtCore/private/qjni_p.h>
QT_BEGIN_NAMESPACE
-class JSurfaceTextureHolder : public QJNIObject
+class JSurfaceTextureHolder : public QJNIObjectPrivate
{
public:
JSurfaceTextureHolder(jobject surface);