summaryrefslogtreecommitdiffstats
path: root/src/plugins/android/src/wrappers/jni/androidcamera.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/tqtc/lts-5.15.13' into ↵v5.15.13-lts-lgpl5.15Tarja Sundqvist2024-01-041-0/+6
|\ | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: I3b153fa928169f990cd278566dda2f7c7706a015
| * Fix access to multi front/back cameras on Android devicesAndrey Yaromenok2022-12-161-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Revert "Update commercial license headers"v5.15.3-lts-lgplTarja Sundqvist2021-03-251-20/+20
|/ | | | | | | | | | | This reverts commit 80d46e3a5f64ff2456c40bdba63b6d5c69a32cdd. Revert of commercial license headers is required for Qt 5.15.3 opensource release. Task-number: QTBUG-91108 Change-Id: I5c64ffa120f916711e5cf01c828774f8456dec06 Reviewed-by: Akseli Salovaara <akseli.salovaara@qt.io>
* Update commercial license headersTarja Sundqvist2021-01-271-20/+20
| | | | | | | | | | | | | | | | Updated header.COMM to files in tqtc-qtmultimedia. Examples, tests or documentation files are not updated. The commercial license header may contain some additional lines so that its line count equals with the earlier license header. Reaso for this is that some autotests use hard coded line numbers and a change in the line count causes failures in tests. Task-number: QTQAINFRA-4171 Change-Id: I86ebf7c3653b55983cefff246c0cb019cbcda8c4 Reviewed-by: Akseli Salovaara <akseli.salovaara@qt.io>
* Android: Remove usage of qt_androidRequestPermissionVal Doroshchuk2019-11-151-11/+4
| | | | | | | Use specific function instead, e.g. qt_androidRequestCameraPermission. Change-Id: I925e4d8ac4f1993c073930a79453894dd516d769 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Port from QMutex::Recursive to QRecursiveMutexMarc Mutz2019-08-011-45/+46
| | | | | | | | Also port from QMutexLocker to std::lock_guard or std::unique_lock, as the former will not support QRecursiveMutex going forward. Change-Id: I1ed1a129e2b9b77aa0a729e8cab03c673566a345 Reviewed-by: VaL Doroshchuk <valentyn.doroshchuk@qt.io>
* Remove usages of deprecated qSortSona Kurazyan2019-06-201-2/+2
| | | | | | Task-number: QTBUG-76491 Change-Id: I7a22d6612848e25bb780d205c6cdbb314cd4762d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Android: Don't open camera if it was already openedVal Doroshchuk2019-05-131-1/+11
| | | | | | | | | | | | | The application should only have one Camera object active at a time for a particular hardware camera. Since there is no way to determine that the camera has been already opened by the same application, added a fix to prevent opening the camera if it was already opened and not released. Task-number: QTBUG-73582 Change-Id: Ide9ddea0c32489d86a613846ecf2e91ef94a776c Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Android: Run-time permission checks for cameraChristian Strømme2017-04-231-0/+14
| | | | | | | | | | | | | | | The camera should ask for permission before being used. Normally this should be handle by the user, which can provide proper reasons for why the camera is used. To verify that we are allowed to open the camera, and as a good default, we'll check the permission and request access if needed. [ChangeLog][Android] Added run-time permission checks for accessing the camera. Task-number: QTBUG-55992 Change-Id: Ifb4e176728aab3076fdba292e17e17d33b1260a2 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Android: Fix camera preview orientationChristian Strømme2017-04-201-0/+12
| | | | | | | | | | | | Before API level 24 the display orientation (the preview) was always set to 0. On newer versions of Android the clockwise rotation is set to be either 0 or 180, depending on the hardware. Since we don't want Android to apply transformation on our surface, we'll just enforce that the display orientation is always set to 0. Task-number: QTBUG-56536 Change-Id: Ie1aacda97540d5c97e6cbd8edb2afc53e7041e1e Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-131-2/+24
|\ | | | | | | Change-Id: I3204cdf695f4b47730a88a7c41fc7a6de967b161
| * Android: fix freeze when taking pictures on some devicesYoann Lopes2016-08-121-0/+5
| | | | | | | | | | | | | | | | | | On some devices and on the emulator, the preview callback must be cleared before taking a picture to avoid a camera server freeze. Task-number: QTBUG-54709 Change-Id: I9e4ad417fa08cddea7edfd232f5b5df40ada59ee Reviewed-by: Christian Stromme <christian.stromme@qt.io>
| * Android: fix imageCaptured() signalYoann Lopes2016-08-121-2/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When capturing two pictures in a row, the second capture would not trigger the imageCaptured() signal. The reason is that capturing a picture restarts the preview when done, which in turns clears the cached last preview frame. The second fetchLastPreviewFrame() would therefore not do anything. In this situation, we now retry fetching the frame as soon as a new one arrives (rather than bailing out). Task-number: QTBUG-48975 Change-Id: Id5476f37641c04b0edd92bddd40711d5125887f0 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-06-301-1/+0
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Blacklisted a few functions in tst_QAudioInput. Conflicts: .qmake.conf src/plugins/avfoundation/camera/avfcameracontrol.mm src/plugins/avfoundation/camera/avfcameraservice.h src/plugins/avfoundation/camera/avfcameraservice.mm src/plugins/avfoundation/camera/avfcamerasession.h src/plugins/avfoundation/camera/avfcamerasession.mm src/plugins/avfoundation/camera/avfcameraviewfindersettingscontrol.h src/plugins/avfoundation/camera/avfcameraviewfindersettingscontrol.mm src/plugins/avfoundation/camera/avfimagecapturecontrol.mm src/plugins/avfoundation/camera/avfimageencodercontrol.mm src/plugins/avfoundation/camera/avfmediarecordercontrol.h src/plugins/avfoundation/camera/avfmediarecordercontrol.mm tests/auto/integration/qaudioinput/BLACKLIST Task-number: QTBUG-54459 Task-number: QTBUG-49736 Change-Id: I3a1fe8cef50b44d5c2785aaf4cf69fe3f16728e6
| * Android: Fix crash in AndroidCamere::open()Christian Strømme2016-06-031-1/+0
| | | | | | | | | | | | | | | | | | | | | | We would attempt to delete the AndroidCameraPrivate object twice if the native call to open failed. On recent version of Android (~6.0), this problem is harder to reproduce, as the camera is properly released when the application goes into the background. Task-number: QTBUG-53536 Change-Id: I064d276f9025924dfdb071aa52311d2b553c6953 Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
* | Implement QCameraViewfinderSettingsControl2 interface for AndroidRuslan Baratov2016-06-021-0/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add class QAndroidViewfinderSettingsControl2 which implements QCameraViewfinderSettingsControl2 interface. This make next QCamera methods working on Android: * QCamera::setViewfinderSettings * QCamera::supportedViewfinderFrameRateRanges * QCamera::supportedViewfinderPixelFormats * QCamera::supportedViewfinderResolutions * QCamera::supportedViewfinderSettings * QCamera::viewfinderSettings Originally from: * https://github.com/headupinclouds/gatherer/issues/109 Change-Id: Ic43e434289a626691f01ed9832654fa9b0105c7d Reviewed-by: Ruslan Baratov <ruslan_baratov@yahoo.com> Reviewed-by: Christian Stromme <christian.stromme@qt.io>
* | Updated license headersAntti Kokko2016-01-191-14/+20
|/ | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I324f65c61171f36641472964d095d72e452afb3a Reviewed-by: Jani Heikkinen <jani.heikkinen@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.5' into 5.6Liang Qi2016-01-071-2/+28
|\ | | | | | | | | | | | | Conflicts: src/plugins/android/src/wrappers/jni/androidcamera.cpp Change-Id: Ibb34f710b1dfb9a23b378462f31432581c6c26f4
| * Android: check for exceptions in some camera operations.Yoann Lopes2015-12-031-2/+28
| | | | | | | | | | | | | | | | | | | | | | Not all camera operations are documented to raise exceptions, but they actually might do so depending on the hardware/drivers. Check for exceptions in all functions that could porentially fail and react appropriately. Task-number: QTBUG-49134 Change-Id: I633ca7f2e3aeb6532e1c445735e62135f52cf25f Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
* | Android: fix QMediaRecorder crashing the camera server on some devices.Yoann Lopes2015-12-041-0/+6
| | | | | | | | | | | | | | | | | | Some devices require MediaRecorder.setPreviewDisplay() to always be called, even though the Android doc says otherwise. Task-number: QTBUG-37837 Change-Id: I1e9b56f06e7c41bdf684f93b5ec7635f8ae9f379 Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
* | Android: support non OpenGL video surfaces for the camera.Yoann Lopes2015-12-041-8/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QCamera can now pass raw frame data to its QAbstractVideoSurface. The now deprecated Android camera API we're using doesn't allow to get frame data without also displaying the frames in a SurfaceView or a SurfaceTexture. To work around that, an invisible dummy SurfaceView is used. This allows to retrieve frames in the NV21, YV12, YUY2 or RGB565 formats, depending on the Android version and on the device. Task-number: QTBUG-35416 Change-Id: I77b4f50505c3b91efb4b2288a57f50398922c0db Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com> Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
* | Android: Camera updatesChristian Strømme2015-12-041-35/+42
|/ | | | | | | | | There's no need for callbacks to block any other threads from reading from the camera pool, so use a read/write lock instead. There's also no benefits gained from using a QMap, so use a QHash map instead. Change-Id: Iaac74c0173d2dddc296f5d2c03116724ffdc588c Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
* Android: minor refactor of the camera frame callback.Yoann Lopes2015-08-201-27/+18
| | | | | Change-Id: I6b281c9b2d02cf223e66e04e31fdd0268aa277fc Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
* Android: fix video probes when recording the camera.Yoann Lopes2015-08-201-11/+23
| | | | | | | | | The preview frame callback is cleared by the Android Camera whenever a MediaRecorder is set up. We need to reset the callback after starting the media recorder. Change-Id: I604320b11eb3a7f6f8d7d3167d5aae371999be14 Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
* Android: fix setting the camera preview resolution.Yoann Lopes2015-05-271-0/+3
| | | | | | | | | | | | | - 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>
* Update copyright headersAntti Kokko2015-02-121-7/+7
| | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I1c6faa4f59f8eca54f01ef20941fa60161dd7872 Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
* Android: Use the new findClass() method.Christian Strømme2014-10-171-17/+15
| | | | | | | Avoid local caching. Change-Id: I1e30896da664c5a45c38c09412c16cb8ff70c5c7 Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
* Update license headers and add new license filesAntti Kokko2014-08-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: Ied06887225df341064c12bcc14c259ae74116f2e Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
* Android: Make sure we check and clear exceptions from the camera.Christian Strømme2014-07-141-29/+51
| | | | | | | | | | In several places we where ignoring the fact that we might get an exception from the camera code on Android. Failing to clear them will cause the application to to terminate. Task-number: QTBUG-39425 Change-Id: Idfe40e1749f54d551d37dae25912d9ddbc3da01e Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
* Android: Don't expose java calls in the control classes.Christian Strømme2014-06-041-3/+43
| | | | | | | Makes the abstraction more clear. Change-Id: Ia9a7b0b157e1182158cd26b62775d13f6c5e1727 Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
* Android: Rename the wrapper classesChristian Strømme2014-06-041-0/+1366
Change-Id: I2ce15c8475da3186f128ba59b7c58f9b5b0a67e1 Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>