summaryrefslogtreecommitdiffstats
path: root/src/plugins/android/src/mediacapture/qandroidcamerasession.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-11-201-2/+11
|\ | | | | | | Change-Id: Ib250ceecd02291f752b7775f329f0f494c4aed38
| * Android: Remove usage of qt_androidRequestPermissionVal Doroshchuk2019-11-151-1/+1
| | | | | | | | | | | | | | Use specific function instead, e.g. qt_androidRequestCameraPermission. Change-Id: I925e4d8ac4f1993c073930a79453894dd516d769 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
| * Android: Don't close camera when recording permission is askedVal Doroshchuk2019-11-151-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If camera permission is granted and recording is requested it also requires recording audio permission. If it was not granted before the popup will be shown to ask the user to grant the permission and the app goes to inactive state, which destroys the camera handlers. When the camera is loaded but the app requires additional permissions, it should not destroy the camera. Change-Id: Iee3662a7ac3381b0eb29190779b0116f9f64304f Fixes: QTBUG-79909 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | Introduce QVideoFrame::image()VaL Doroshchuk2019-10-311-2/+1
|/ | | | | | | | | | | | | Since QVideoFrame::pixelFormat's do not 100% match QImage::Format's, introducing converstion function. Returns an image based on current frame. Converts data if needed to supported QImage format. Change-Id: I3331578c01cf9c999a380efc4a83bf9eddb07901 (cherry picked from commit 93f966335e1ed8ed47b7e8b32452d43c2f8a7bb1) Reviewed-by: Daniel Smith <Daniel.Smith@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Android: Allow starting camera without viewfinder availableVal Doroshchuk2019-05-131-11/+32
| | | | | | | | | | | | | | Currently it is not able to start camera without viewfinder. For this purpose there is QAndroidCameraDataVideoOutput with SurfaceView in order to be able to start the camera preview. Implemented dummy QAbstractVideoSurface to render to it when no video output is provided before starting the preview. Task-number: QTBUG-73582 Fixes: QTBUG-73237 Change-Id: Ic76d247b5d5352e8539ba61271484e56d3a40fbd Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Android: Don't postpone setting of camera's stateVal Doroshchuk2019-05-031-19/+21
| | | | | | | | | | | | | | | | | | | | | Currently if the application is inactive, the state is postponed to be set and processed when the app becomes active. This also postpones stateChanged() signal and saving the state value, while it should be set (but not processed) immediately as done in another backends. Added a fix to store the state and emit stateChanged regardless of activity of the application. When the application becames available, the state will be processed. In case of an error while opening the camera: - UnloadedState is emitted - CameraError - UnloadedStatus Change-Id: Ie376d29366168a6b15eccea884f385070f94fe35 Task-number: QTBUG-73582 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Android: Use CaptureStillImage as default capture modeVal Doroshchuk2019-03-281-1/+1
| | | | | | | | Fixes tst_QCameraBackend::testCaptureMode. Change-Id: I2f6486102ebcbf7e1ab0feea8c13658772d5b90f Fixes: QTBUG-73582 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Fix crash when an app is sent to background while capturing an imageVal Doroshchuk2017-11-101-3/+7
| | | | | | | | | | | Since the native notify* methods for QtCameraListener.java are executed on different thread, there is a potential for a race condition when the applicationStateChanged is received before the notify* signals, which leads to the camera being release before the slots are executed. Task-number: QTBUG-52366 Change-Id: Ifc82f3a75a7e88e4e76fac3edbf16bb9f138fde7 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
* Android: Run-time permission checks for cameraChristian Strømme2017-04-231-1/+1
| | | | | | | | | | | | | | | 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/+6
| | | | | | | | | | | | 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-0/+6
|\ | | | | | | Change-Id: I3204cdf695f4b47730a88a7c41fc7a6de967b161
| * Android: restart preview when image capture failsYoann Lopes2016-08-121-0/+3
| | | | | | | | | | | | | | | | The preview must be restarted after taking a picture but were doing that only when the capture succeeded. We now also do it when it fails. Change-Id: I8bfff06a811d9333220050e5e81561438f5a3786 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
| * Android: don't process capture previews when capture is canceledYoann Lopes2016-08-121-0/+3
| | | | | | | | | | Change-Id: Ia068b0fcc30412755639412ec03e49c740b66bed Reviewed-by: Christian Stromme <christian.stromme@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Yoann Lopes2016-08-011-2/+13
|\| | | | | | | Change-Id: Ic29cb09048003f18ff86d4546cd547be715eaec8
| * Android camera: use closest viewfinder resolutionAnatoly Stolbov2016-07-271-2/+13
| | | | | | | | | | | | | | | | | | | | For some cameras difference between preview aspect rate and capture aspect rate is more than 0.01. Therefore it is better to use preview size with closest aspect rate. Task-number: QTBUG-50813 Change-Id: I1284c8ec2be1aa160a656e396a52960fa06aaa56 Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
* | Implement QCameraViewfinderSettingsControl2 interface for AndroidRuslan Baratov2016-06-021-40/+191
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.6' into devChristian Strømme2016-01-151-85/+84
|\| | | | | | | | | | | | | | | Conflicts: src/plugins/android/src/mediacapture/qandroidcamerasession.cpp src/plugins/wmf/mftvideo.cpp Change-Id: I78868b416ea4baec89ca3e2dc9eb4712db16d5fc
| * Merge remote-tracking branch 'origin/5.5' into 5.6Liang Qi2016-01-071-0/+29
| |\ | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/android/src/wrappers/jni/androidcamera.cpp Change-Id: Ibb34f710b1dfb9a23b378462f31432581c6c26f4
| | * Android: check for exceptions in some camera operations.Yoann Lopes2015-12-031-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: support non OpenGL video surfaces for the camera.Yoann Lopes2015-12-041-85/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Replace foreach with range-based forAnton Kudryavtsev2016-01-151-1/+1
|/ / | | | | | | | | | | | | ... in Android, AudioCapture and m3u plugins. Change-Id: If06a97e49cfa4d32a41da2f043710cfdbd8a7b20 Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
* / Add private API for conversion from QVideoFrame to QImage.Yoann Lopes2015-10-201-5/+6
|/ | | | | | | | | | The Android plugin had a function to convert from NV21 to RGB32. It's now moved to the Qt Multimedia library and it supports additional source formats. It could be further improved with more SIMD code, it could then become a public API. Change-Id: Ibee349027048a263a1a7ea74dc51237f7747912c Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
* Android: minor refactor of the camera frame callback.Yoann Lopes2015-08-201-40/+41
| | | | | Change-Id: I6b281c9b2d02cf223e66e04e31fdd0268aa277fc Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
* Android: fix setting the camera preview resolution.Yoann Lopes2015-05-271-16/+18
| | | | | | | | | | | | | - 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>
* Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2015-02-131-9/+14
|\ | | | | | | Change-Id: I5575a4ba13212c9bfe73a3de3ef17c6528beafc3
| * Android: fix adjusting camera viewfinder resolution.Yoann Lopes2015-02-111-9/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | The viewfinder resolution must be in the same aspect ratio as the image capture resolution. When adjusting the viewfinder resolution to comply with that restriction, we assumed that the ratios had to be exactly equal. Though, in practice, there can be a small difference. For example for resolutions 2592x1952 (ratio=1.3278) and resolution 640x480 (ratio=1.3333). Task-number: QTBUG-37525 Change-Id: Ia5a6dd3a4a6d901b24bf74f8aa4e34bffe61f89b 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>
* Update license headers and add new license filesAntti Kokko2014-08-241-18/+10
| | | | | | | | | - 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-3/+4
| | | | | | | | | | 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 start camera preview until the viewfinder is ready.Yoann Lopes2014-06-051-11/+25
| | | | | | | | | If no video output is set for a camera, don't try to start the camera and report an error. If the video output is not ready, delay starting until it is. Change-Id: Id08e31a4e795b71ac036a6532e9499ca5670d790 Reviewed-by: Christian Stromme <christian.stromme@digia.com>
* Android: Don't expose java calls in the control classes.Christian Strømme2014-06-041-28/+2
| | | | | | | 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-16/+16
| | | | | Change-Id: I2ce15c8475da3186f128ba59b7c58f9b5b0a67e1 Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
* Moved QMediaStorageLocation out of the Android plugin.Yoann Lopes2014-05-091-2/+6
| | | | | | | | It's now a private API in the QtMultimedia library in order to be accessible in other plugins. Change-Id: I63541de1e8c540cebc210f9037646ce74d866c6f Reviewed-by: Christian Stromme <christian.stromme@digia.com>
* Android: Release the surface texture when not in useChristian Strømme2014-04-121-2/+8
| | | | | | | | | | | With some Android versions the preview texture is released when the application is suspended. If we don't release the texture in our code, the preview will be empty when the application resumes. Task-number: QTBUG-38165 Change-Id: I72244727081d8f94ee5f6cb0ab660ca59f4bb2de Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
* Android: implement QCameraInfoControl.Yoann Lopes2014-02-281-18/+51
| | | | | | | | | VideoOutput will now take into account the camera sensor orientation to adjust the viewport orientation, we don't need to apply a rotation on the Android Camera anymore. Change-Id: Ia7639f0a5711ab6cc6f80b9716bc1a6f389499b4 Reviewed-by: Christian Stromme <christian.stromme@digia.com>
* Android: add missing information in frames retrieved with QVideoProbe.Yoann Lopes2014-01-301-6/+11
| | | | | | | | The number of bytes per line was missing. Change-Id: I0afbdcfd6d7195b7beb3fd09f4ed262f756be848 Reviewed-by: Denis Kormalev <dkormalev@ics.com> Reviewed-by: Christian Stromme <christian.stromme@digia.com>
* Android: QVideoProbe support for cameraDenis Kormalev2014-01-081-4/+48
| | | | | | | | | | | QMediaVideoProbeControl sublclass added to capture service to make QVideoProbe work with Android camera. [ChangeLog][QtMultimedia][Android] QVideoProbe support for camera Task-number: QTBUG-35416 Change-Id: I14d0a0e8abd14ee8f577e2901b976b8ed46eb320 Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
* Android: camera moved to a dedicated threadDenis Kormalev2013-12-231-13/+28
| | | | | | | | | | | | | Actual camera work moved to JCameraWorker which lives in dedicated thread. JCamera now acts as proxy calling JCameraWorker methods with invokeMethod (when it is needed). [ChangeLog][QtMultimedia][Android] camera operations moved to a dedicated thread Task-number: QTBUG-35564 Change-Id: Ie4edcbf0869d56b0fef4ad0c820450cc77657fdd Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
* Android: fix camera previewDenis Kormalev2013-12-111-13/+7
| | | | | | | | | | | | | At some(?) devices we can't rely on one shot preview callback because it receives data only after we start new previewing session. And this cause situation when imageCaptured signal is never emitted. This fix applies preview callback with already allocated buffers and collects all preview images in these buffers. When we capture image - we can simply fetch last preview image (if there was any) from c++ part. Task-number: QTBUG-34993 Change-Id: I608750c344ca3c089f4673df4907e0f47e57e2ba Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
* Android: fix camera viewfinder orientation.Yoann Lopes2013-12-051-5/+32
| | | | | | | | | | | | | | | The camera sensor on Android devices might be in a different orientation than the device natural orientation. There is no API in Qt to know about the camera orientation, so correcting the viewfinder orientation is not possible without making guesses. This patch makes sure the viewfinder orientation always matches the device natural orientation. For example, if the camera is mounted in landscape, and the device natural orientation is portrait, the viewfinder will automatically be rotated 90 degrees counter-clockwise. Task-number: QTBUG-35086 Change-Id: Ia890872971d72657debe709f61edba27d09dec65 Reviewed-by: Christian Stromme <christian.stromme@digia.com>
* Android: use correct format when capturing a picture to a buffer.Yoann Lopes2013-11-061-10/+39
| | | | | | | | Don't decode the JPEG data to raw RGB using QImage. QCameraImageCapture reports anyway that JPEG is the only supported buffer format. Change-Id: Ib17760e4361b004775c002b686ef7529b3768aab Reviewed-by: Christian Stromme <christian.stromme@digia.com>
* Android: fix camera preview showing black frames after restarting it.Yoann Lopes2013-10-291-1/+5
| | | | | | | | | Clear the camera preview size when stopping the preview in order to force it to be reset when starting it again. Task-number: QTBUG-34346 Change-Id: I0edf8d996348745b9aa7cf0790c16b6cd813b33b Reviewed-by: Christian Stromme <christian.stromme@digia.com>
* Add Linguist comment for translation of Drive-mode.Friedemann Kleint2013-10-151-0/+1
| | | | | | | | | Translators not familiar with cameras might mistake it for something related to driving a car. Change-Id: If54a563a32af537d291b79253056b7b57e108f5b Reviewed-by: Robert Loehning <robert.loehning@digia.com> Reviewed-by: Andy Nichols <andy.nichols@digia.com>
* Android: fixed image capture preview.Yoann Lopes2013-10-011-4/+32
| | | | | | | | | | We used to generate the capture preview from the video output, grabbing the pixels of the last frame (in a FBO). This is not possible anymore, we instead query the camera for a preview frame, which is in the NV21 format and needs to be converted to RGB. Change-Id: I1c728b3a708a6f052a83aebf9f15f511eab7a02f Reviewed-by: Christian Stromme <christian.stromme@digia.com>
* Android: refactor video renderer.Yoann Lopes2013-10-011-16/+11
| | | | | | | | | | | | | Removed the overhead of having to create a shared OpenGL context in the GUI thread and pre-render the frame into a FBO. We now directly render the GL_TEXTURE_EXTERNAL_OES in the QtQuick render thread, using an Android-specific QSGVideoNode. We also use a callback from the render thread to create the texture from there and not have to create a separate shared OpenGL context. Change-Id: I6c8eb94b47d0a03329c912701b8af3fb5ebd1876 Reviewed-by: Christian Stromme <christian.stromme@digia.com>
* Android: added camera support.Yoann Lopes2013-09-121-0/+553
This patch includes all camera features: viewport, settings, image capture, and video recording. It also adds support for QAudioRecorder. Change-Id: Ib962177cc8de4bac03f42a2bc0f534e03464bbfc Reviewed-by: Christian Stromme <christian.stromme@digia.com>