diff options
author | Yoann Lopes <yoann.lopes@theqtcompany.com> | 2015-05-05 16:40:05 +0200 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@theqtcompany.com> | 2015-05-27 12:18:43 +0000 |
commit | 83d1255080ab2be678efbbc42e259c9681619619 (patch) | |
tree | 388001d4957d71fc672b8fda41ef022118317a12 /src/plugins/android/src/wrappers/jni/androidcamera.cpp | |
parent | 008d57e1d7c8208d5ac415db5a4bdd558688d638 (diff) |
Android: fix setting the camera preview resolution.
- When the video capture resolution or the image capture resolution
changes, we now always set the viewfinder resolution to the highest
available one with the same aspect ratio as the capture resolution.
We were previously not doing anything if the new capture resolution
had the same aspect ratio as the current viewfinder resolution.
- Some devices don't support using a viewfinder resolution different
from the video capture resolution. Make sure we handle this case.
Change-Id: I8d3ab7b01c56ed78d1ca838a522ba459692fc332
Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
Diffstat (limited to 'src/plugins/android/src/wrappers/jni/androidcamera.cpp')
-rw-r--r-- | src/plugins/android/src/wrappers/jni/androidcamera.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/plugins/android/src/wrappers/jni/androidcamera.cpp b/src/plugins/android/src/wrappers/jni/androidcamera.cpp index d9c8befaf..7496e9cdc 100644 --- a/src/plugins/android/src/wrappers/jni/androidcamera.cpp +++ b/src/plugins/android/src/wrappers/jni/androidcamera.cpp @@ -786,6 +786,9 @@ QSize AndroidCameraPrivate::getPreferredPreviewSizeForVideo() QJNIObjectPrivate size = m_parameters.callObjectMethod("getPreferredPreviewSizeForVideo", "()Landroid/hardware/Camera$Size;"); + if (!size.isValid()) + return QSize(); + return QSize(size.getField<jint>("width"), size.getField<jint>("height")); } |