diff options
author | Andrey Yaromenok <ayaromenok@gmail.com> | 2022-12-16 10:47:19 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-12-16 12:45:01 +0000 |
commit | 8d9e4b000a11aad1b511be34595d800015990f28 (patch) | |
tree | 3484411457a6b6be6f88e976c7f0e7bb275d95b1 | |
parent | 1c6ef25809dec4b663a12863f2ad5f817b975482 (diff) | |
download | qtmultimedia-8d9e4b000a11aad1b511be34595d800015990f28.tar.gz |
Fix access to multi front/back cameras on Android devices
Allow to access second (and more) front or back cameras on Android
devices by adding a counter number at the end of additional camera name
and description (don't need to brake current code compatibility or
confuse majority of the users with only one front/back cameras on their
devices)
Fixes: QTBUG-59726
Change-Id: Icecb3af7521d4bbd3fbb0b953895c045cfdbf60a
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 633597b00423adf8359763bc14d185e3ca91efbe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/plugins/multimedia/android/wrappers/jni/androidcamera.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plugins/multimedia/android/wrappers/jni/androidcamera.cpp b/src/plugins/multimedia/android/wrappers/jni/androidcamera.cpp index 20d05c4c5..7ea626fa9 100644 --- a/src/plugins/multimedia/android/wrappers/jni/androidcamera.cpp +++ b/src/plugins/multimedia/android/wrappers/jni/androidcamera.cpp @@ -801,6 +801,12 @@ void AndroidCamera::getCameraInfo(int id, QCameraDevicePrivate *info) default: break; } + // Add a number to allow correct access to cameras on systems with two + // (and more) front/back cameras + if (id > 1) { + info->id.append(QByteArray::number(id)); + info->description.append(QString(" %1").arg(id)); + } } QVideoFrameFormat::PixelFormat AndroidCamera::QtPixelFormatFromAndroidImageFormat(AndroidCamera::ImageFormat format) |