diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2016-01-07 11:13:47 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2016-01-07 11:13:47 +0100 |
commit | 6166f102f5e52007f8e4e018adb73d26513557b3 (patch) | |
tree | ab6dcd29f68e07cf8c6643d69af679ed9b194019 /src/plugins/android/src/wrappers/jni/androidcamera.cpp | |
parent | 0a7b553eeab0b81502189f6244ffc65c33cdaaa0 (diff) | |
parent | 604a5753fa2d9b8e1ef65ccd8c5fb72465462479 (diff) |
Merge remote-tracking branch 'origin/5.5' into 5.6
Conflicts:
src/plugins/android/src/wrappers/jni/androidcamera.cpp
Change-Id: Ibb34f710b1dfb9a23b378462f31432581c6c26f4
Diffstat (limited to 'src/plugins/android/src/wrappers/jni/androidcamera.cpp')
-rw-r--r-- | src/plugins/android/src/wrappers/jni/androidcamera.cpp | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/plugins/android/src/wrappers/jni/androidcamera.cpp b/src/plugins/android/src/wrappers/jni/androidcamera.cpp index b506f4fd4..23200462e 100644 --- a/src/plugins/android/src/wrappers/jni/androidcamera.cpp +++ b/src/plugins/android/src/wrappers/jni/androidcamera.cpp @@ -244,12 +244,15 @@ public: Q_SIGNALS: void previewSizeChanged(); void previewStarted(); + void previewFailedToStart(); void previewStopped(); void autoFocusStarted(); void whiteBalanceChanged(); + void takePictureFailed(); + void lastPreviewFrameFetched(const QVideoFrame &frame); }; @@ -266,9 +269,11 @@ AndroidCamera::AndroidCamera(AndroidCameraPrivate *d, QThread *worker) connect(d, &AndroidCameraPrivate::previewSizeChanged, this, &AndroidCamera::previewSizeChanged); connect(d, &AndroidCameraPrivate::previewStarted, this, &AndroidCamera::previewStarted); + connect(d, &AndroidCameraPrivate::previewFailedToStart, this, &AndroidCamera::previewFailedToStart); connect(d, &AndroidCameraPrivate::previewStopped, this, &AndroidCamera::previewStopped); connect(d, &AndroidCameraPrivate::autoFocusStarted, this, &AndroidCamera::autoFocusStarted); connect(d, &AndroidCameraPrivate::whiteBalanceChanged, this, &AndroidCamera::whiteBalanceChanged); + connect(d, &AndroidCameraPrivate::takePictureFailed, this, &AndroidCamera::takePictureFailed); connect(d, &AndroidCameraPrivate::lastPreviewFrameFetched, this, &AndroidCamera::lastPreviewFrameFetched); } @@ -1131,15 +1136,21 @@ void AndroidCameraPrivate::setFocusAreas(const QList<QRect> &areas) void AndroidCameraPrivate::autoFocus() { + QJNIEnvironmentPrivate env; + m_camera.callMethod<void>("autoFocus", "(Landroid/hardware/Camera$AutoFocusCallback;)V", m_cameraListener.object()); - emit autoFocusStarted(); + + if (!exceptionCheckAndClear(env)) + emit autoFocusStarted(); } void AndroidCameraPrivate::cancelAutoFocus() { + QJNIEnvironmentPrivate env; m_camera.callMethod<void>("cancelAutoFocus"); + exceptionCheckAndClear(env); } bool AndroidCameraPrivate::isAutoExposureLockSupported() @@ -1388,25 +1399,40 @@ void AndroidCameraPrivate::setJpegQuality(int quality) void AndroidCameraPrivate::startPreview() { + QJNIEnvironmentPrivate env; + setupPreviewFrameCallback(); m_camera.callMethod<void>("startPreview"); - emit previewStarted(); + + if (exceptionCheckAndClear(env)) + emit previewFailedToStart(); + else + emit previewStarted(); } void AndroidCameraPrivate::stopPreview() { + QJNIEnvironmentPrivate env; + m_camera.callMethod<void>("stopPreview"); + + exceptionCheckAndClear(env); emit previewStopped(); } void AndroidCameraPrivate::takePicture() { + QJNIEnvironmentPrivate env; + m_camera.callMethod<void>("takePicture", "(Landroid/hardware/Camera$ShutterCallback;" "Landroid/hardware/Camera$PictureCallback;" "Landroid/hardware/Camera$PictureCallback;)V", m_cameraListener.object(), jobject(0), m_cameraListener.object()); + + if (exceptionCheckAndClear(env)) + emit takePictureFailed(); } void AndroidCameraPrivate::setupPreviewFrameCallback() |