summaryrefslogtreecommitdiffstats
path: root/src/plugins/avfoundation/camera
Commit message (Collapse)AuthorAgeFilesLines
* AVFoundation: Use 90 for the front facing camera's orientationAndy Shaw2017-12-121-1/+1
| | | | | | | | | | | | Since the information is not available as to what the orientation is from the AVFoundation API then we need to rely on common sense. Since the back facing camera is 270, then it stands to reason that the front one would be 90. This has been tested on macOS and iOS and all three cameras behave correctly. Task-number: QTBUG-37955 Change-Id: I1ab079cb5d4337948541e58321df51efbadf3e39 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* AVFoundation: Make AVFImageCaptureControl work without a previewTimur Pocheptsov2017-06-272-3/+5
| | | | | | | | | | | | We only need to wait for a new viewfinder frame if we have a videorenderer control. If there's no videorender control, then there's no preview set and we can therefore just save the capture image immediately. Task-number: QTBUG-60329 Change-Id: I9ba34919f7cd82258482507c65db6367e330e231 Reviewed-by: Christian Stromme <christian.stromme@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* AVFImageCaptureControl - do not block the capture's callbackTimur Pocheptsov2017-06-262-7/+23
| | | | | | | | | | | | | | | | | | It's possible to initiate an asynchronous image capture (via AVCaptureStillImageOutput object) and immediately stop AVCaptureSession. In this case image capture's callback can potentially block forever, waiting for a semaphore: (if) no new frames arrive after 'stop' (on whatever thread AVFoundation/GDC chooses), this semaphore is never released. To avoid this we try to acquire a semaphore with a (reasonable) timeout and report an error in case of failure. To make sure we are not leaking a semaphore and not creating a danling pointer, we use a QSharedPointer now. Task-number: QTBUG-61367 Change-Id: I208cd463f843bc807b53b23ac9651aab0382775a Reviewed-by: Christian Stromme <christian.stromme@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Emit the StoppedState change after the file has finished writingAndy Shaw2017-05-232-6/+12
| | | | | | | | | | | Where possible, we should be emitting the stateChanged() signal to StoppedState when we know the file is no longer being written to. The finializing status can be used to indicate it is finishing and when it is actually finished then StoppedState should be used. Task-number: QTBUG-50588 Change-Id: Ie3ac1c5cd00a6a36978e72b5485622e3302054ce Reviewed-by: Christian Stromme <christian.stromme@qt.io>
* Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-03-101-2/+0
|\ | | | | | | | | | | | | Conflicts: src/plugins/gstreamer/camerabin/camerabincontainer.h Change-Id: I4942d41d69112335fe0c994002f1b32ef3aad051
| * Use QT_CONFIG macro to check for featuresLars Knoll2017-02-271-2/+0
| | | | | | | | | | | | | | And remove many custom defines. Change-Id: I658cc8430d1d99ed3c0aafe03a77adce76621a29 Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
* | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-12-123-3/+4
|\| | | | | | | | | | | | | Conflicts: src/plugins/gstreamer/mediacapture/qgstreameraudioencode.cpp Change-Id: I7c30c2d13fdd07ee07e4449d5d3e256e988d3793
| * Add proper global headers for QtMultimediaLars Knoll2016-11-232-2/+2
| | | | | | | | | | | | | | And deprecate the old qtmultimediadefs.h Change-Id: I2d4164f3a51d8e5d1813413b4f6691a721386fdf Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
| * Move qtmultimedia over to the new config systemLars Knoll2016-11-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | Use the new configuration system to define external libraries, configure tests and features. Don't use pkg-config outside of the configuration step. And move all command line options over from qtbase, so that we can remove them from there in a second step. Change-Id: I1aa4b557a6aee17eeceb00602005a2d28b426a26 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
* | Remove deprecated QSysInfo APIs and dead code from macOS/iOS backendJake Petroules2016-09-239-355/+185
| | | | | | | | | | | | | | Deployment targets are currently macOS 10.9 and iOS 7.0. Change-Id: I500a95c00eb3be6e693e38f0f2205941f7bc9601 Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
* | Fix AVFoundation camera plugin linking as shared libraryJake Petroules2016-08-231-2/+5
|/ | | | | | | Static linking was hiding the additional framework dependencies. Change-Id: I4e6b8f4a8adf6af073bca90d63b04199844fad78 Reviewed-by: Lorn Potter <lorn.potter@canonical.com>
* Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-08-176-78/+114
|\ | | | | | | Change-Id: Ib8d05d6e21c7beb19f618cd1edc52d248b1e43b8
| * Replaced old license headers with new and correct onesJani Heikkinen2016-08-126-78/+114
| | | | | | | | | | | | | | | | | | | | Replaced - header.LGPL3 with header.LGPL - header.LGPL21 with header.LGPL Change-Id: If11396da6ff12e9122281c17fc4354b05a554ee5 Reviewed-by: Ruslan Baratov <ruslan_baratov@yahoo.com> Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
* | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-08-024-77/+84
|\| | | | | | | | | | | | | | | Conflicts: .qmake.conf tests/auto/integration/qsoundeffect/BLACKLIST Change-Id: Icd2edd4410a4ee914d489634d26b262c0c146bf4
| * Merge remote-tracking branch 'origin/5.6' into 5.7Yoann Lopes2016-08-014-77/+84
| |\ | | | | | | | | | Change-Id: Ic29cb09048003f18ff86d4546cd547be715eaec8
| | * AVFMediaAssetWriter - fix race conditionsTimur Pocheptsov2016-07-264-65/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Apple recommends starting/setting up a session (AVCaptureSession) on a special queue and in the past we did this on the writer's queue. Unfortunately, we also can access the same session from a different thread and this results in race conditions and different weird crashes, for example, we're calling start/stopRunning from the writer's queue, while the session is being configured (in between beginConfiguration/commitConfiguration on the recorder control's thread). So we have to limit access to the session by the control's thread. Apple docs say we have to ensure all appendSampleBuffer calls done _before_ finishWriting. We ensure this by dispatching_sync an empty block on the writer's queue after store-release of m_state. We also do the same with video queue to ensure it does not try to access viewfinder's data after stop/abort executed. All these changes also make lock/mutex unneeded. Task-number: QTBUG-54890 Change-Id: I38e86c879b6b62306bdfbeade65405d6ac3be9f3 Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
| | * AVFMediaAssetWriter - fix atomics useTimur Pocheptsov2016-07-192-27/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. No need in two different atomics (m_stopped/m_aborted) - the single one 'm_state' with states (Idle/Active/Aborted) should be enough. 2. QAtomicInt::load/store actually have relaxed memory ordering semantics, (not like std::atomic with sequential ordering as the default one) which is not always appropriate - replace with loadAquire/storeRelease instead. Change-Id: I4ce8c9ca7556de3d2c7e369b8a05276b2870460c Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
* | | Merge remote-tracking branch 'origin/5.7' into devEdward Welbourne2016-07-2124-297/+1411
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/directshow/player/directshowiosource.cpp One side disintermediated filling a vector; the other reduced it to one entry. src/plugins/directshow/player/directshowiosource.h One side renamed a member, the other added another adjacent to it. src/plugins/pulseaudio/qpulseaudioengine.h One side added a header, the other replaced the next with a different header. Change-Id: I3a031975f5af43ca39cca571f215c612f640b7d6
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-06-3024-297/+1411
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| | * AVFoundation: improve changing the capture device format.Yoann Lopes2016-06-145-43/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | Make sure the device format is always set in the same way. We don't actually set the format anymore when it's the same as the current one. We also make sure the frame rate is preserved. Change-Id: I1c68239bc99d9c3cef920effcf47fc253220c26f Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
| | * AVFoundation: re-apply viewfinder settings on mode changes.Yoann Lopes2016-06-135-10/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | Since the active viewfinder resolution can be overridden by the image and video capture resolutions, we need to re-evaluate the viewfinder settings whenever the capture mode changes. Change-Id: Ibdb7a070585cf67ebb2fcfb95ccbdd105f5f41cf Reviewed-by: Christian Stromme <christian.stromme@qt.io>
| | * AVFoundation: fix orientation of recorded videos.Yoann Lopes2016-06-134-4/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make sure the video is recorded in the same orientation as the device. That means the top of the video matches the physical side of the device which is on top when starting recording. This patch makes sure the behavior is the same as on Android. In a future version, we should have an API to pick the desired orientation of the recorded video. Change-Id: Ia8bbfe621a0e54de3cb6bfe0a520f37e8a932539 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
| | * AVFoundation: implement QAudioEncoderSettings.Yoann Lopes2016-06-0910-23/+346
| | | | | | | | | | | | | | | | | | Change-Id: I24d3da1417142bc80bc6b6c1c8124c246afe03db Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> Reviewed-by: Christian Stromme <christian.stromme@qt.io>
| | * AVFoundation: implement QMediaContainerControl.Yoann Lopes2016-06-098-5/+193
| | | | | | | | | | | | | | | Change-Id: I5097a0450f5836e48a697249619a1822775f3ad8 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
| | * AVFoundation: correctly set default frame rate on OSX.Yoann Lopes2016-06-031-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | On OSX, it's not possible to reset the frame rate to the default value by passing kCMTimeInvalid, so just set the first value from the supported frame rates. Change-Id: I984101c2a95e13053228e56f19b353e716eb2b67 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
| | * AVFoundation: implement QVideoEncoderSettingsControl.Yoann Lopes2016-06-0316-258/+781
| | | | | | | | | | | | | | | | | | Task-number: QTBUG-40338 Change-Id: Ic23dabaad94d7b293019460710ae1a097002e227 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-05-137-113/+86
|\| | | | | | | | | | | Change-Id: I773db005bbdc511169917ee35eb5b517e898926b
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-05-107-113/+86
| |\| | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/winrt/qwinrtcameracontrol.cpp Change-Id: I45d3042adf19577a72794610fa1c310cb22e26c4
| | * Fix unused variable warningChristian Stromme2016-04-261-2/+5
| | | | | | | | | | | | | | | | | | | | | - warning: unused variable 'm_renderer' [-Wunused-variable] Change-Id: Ie7d8ebe35a3ab0beb66cda3448595ed952f7dea4 Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
| | * AVFMediaAssetWriter - fix potential race condition(s)Timur Pocheptsov2016-04-214-109/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. m_writerQueue is now shared by recorder control and asset writer to ensure it lives long enough. 2. m_delegate->method() calls from async block can be dangerous, since by the time this block is actually executed, delegate can be deleted already. This fix uses Q_INVOKABLE and invokeMethod with QueuedConnection instead. 3. -finishWritingWithCompletionHandler: is async and when the block finally gets executed, lock and 'if aborted' test are still needed. 4. Simplify the logic and reduce locking. Change-Id: If23daf2fe22043244033427a7f6517a0fe3f23d1 Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
| | * AVFFoundation - fix a compilation error (iOS, XCode 7.3)Timur Pocheptsov2016-04-191-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | __weak previously was a simple noop, but now it ends up in a compilation error in non-ARC'ed source code ('declaration uses __weak, but ARC is disabled'). Task-number: QTBUG-52671 Change-Id: I574519f892ba1d5f71488c5cc26423d04d5e02cf Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
| | * AVFoundation: fix switching to still image capture mode.Yoann Lopes2016-04-131-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | It would reset the active format on the capture device. The patch prevents that. Change-Id: I97c192c064bf3c6ed4ba1f8d78768196927819a7 Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
| | * AVFoundation: return correct viewfinder settings.Yoann Lopes2016-04-131-1/+6
| | | | | | | | | | | | | | | | | | | | | When the camera is unloaded, return the requested settings. Change-Id: If39e158cd8d0fd8d4bbd7cf6cd48226cdefc1272 Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
* | | Add YUV 4:2:2 8Bit to supported formats of OS X camera plugin.Samuel Gaist2016-04-291-0/+10
|/ / | | | | | | | | | | | | | | | | | | | | Now that QtQuick handles YUV 4:2:2 8Bit video formats, let the input use them. [ChangeLog][OS X][Input format] Added YUV 4:2:2 8 bit to supported camera video formats. Change-Id: Ib9b927a530232111a1d1139689b4cd2adf34da3f Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-03-071-5/+6
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/avfoundation/mediaplayer/mediaplayer.pro tests/auto/unit/qmediaserviceprovider/mockserviceplugin1/mockserviceplugin1.pro tests/auto/unit/qmediaserviceprovider/mockserviceplugin2/mockserviceplugin2.pro tests/auto/unit/qmediaserviceprovider/mockserviceplugin3/mockserviceplugin3.pro tests/auto/unit/qmediaserviceprovider/mockserviceplugin4/mockserviceplugin4.pro tests/auto/unit/qmediaserviceprovider/mockserviceplugin5/mockserviceplugin5.pro Change-Id: I5742596230dc510ba2a09eba624429bb67179194
| * standardize statement order in project files a bitOswald Buddenhagen2016-02-251-1/+2
| | | | | | | | | | Change-Id: I96bbe1343eedbad6b48579d700bbb6b5b80d69f1 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
| * consistently put {qt,qml}_{module,plugin} at the end of project filesOswald Buddenhagen2016-02-251-4/+4
| | | | | | | | | | | | | | | | this fixes static builds by ensuring that all dependencies are exported. Task-number: QTBUG-51071 Change-Id: I8e1554b648327ea2fb342b882ce8e439bd6f271d Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
* | Updated license headersAntti Kokko2016-01-1945-631/+901
| | | | | | | | | | | | | | | | | | | | | | 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-157-147/+172
|\| | | | | | | | | | | | | | | 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-077-147/+172
| |\ | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/android/src/wrappers/jni/androidcamera.cpp Change-Id: Ibb34f710b1dfb9a23b378462f31432581c6c26f4
| | * AVFoundation: correctly set the activeFormat on the AVCaptureDevice.Yoann Lopes2015-12-107-38/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to the AVCaptureDevice documentation, the device must be locked before starting the capture session to prevent the activeFormat from being overridden. We now do that, but only if we explicitly set an activeFormat. Otherwise the device is not locked, which allows the session to find an appropriate format for the capture device. The device is also locked when enabling video capture, as doing so might also reset the activeFormat. Task-number: QTBUG-49170 Change-Id: I75478fd4bbfec96cd2abd2c3ae2951088b38978e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
| | * AVFoundation: fix setting up the video capture session.Yoann Lopes2015-12-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Because of an incorrect 'if' condition, the video capture session was set up twice when starting the camera. Change-Id: I4211a8c77ab9b8086628fb0f12fb28842de830cf Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
| | * AVFoundation: fix setting the camera viewfinder resolution.Yoann Lopes2015-12-033-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Image capture resolution and viewfinder resolution must be the same, with the image capture resolution taking precedence over the viewfinder resolution when both are explicitly set. The code was getting the active image capture resolution, instead of the one explicitly requested, to adjust the viewfinder resolution. That effectively made the viewfinder resolution always ignored since the active capture resolution always has a default value. Task-number: QTBUG-49170 Change-Id: I2f3d01366d83a3e28c0a1ea0109663cfdfa75963 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
| | * AVFoundation: improve viewfinder settings.Yoann Lopes2015-11-202-110/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Retrieving the supported viewfinder settings don't actually require a video surface, we just need a capture device. The supported settings can now be retrieved without calling QCamera::setSurface(). More generally, all viewfinder settings that don't require a video surface can now be gotten/set before calling setSurface(). Task-number: QTBUG-49170 Change-Id: I39b14eeb40517a9ba399748b5778be8bbc8cfcda Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
* | | AVFoundation: replace foreach with range-based forAnton Kudryavtsev2016-01-153-4/+6
|/ / | | | | | | | | Change-Id: I7a2f563f74fc67b55ea9b00f0e87d8ddaa2659c4 Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.5' into 5.6Yoann Lopes2015-11-203-44/+12
|\| | | | | | | Change-Id: I8e0f222f110cc23b426f2d68416f5cc3982e30f2
| * Add qt_real_to_fraction() helper function.Yoann Lopes2015-11-193-44/+12
| | | | | | | | | | | | | | | | | | | | Private API meant to be used by plugins whose backends expect frame rate values represented by a ratio. The function implementation was moved from the AVFoundation plugin to the QtMultimedia library. Change-Id: I555b9d5da5ca3bae88992ed03501869fb731e45f Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
* | Fix use-after-free in AVFCameraService during renderer destructionJohn Brooks2015-11-191-7/+4
| | | | | | | | | | Change-Id: I10a994b71e55565c0de31aa0c34f32964e2e3a1b Reviewed-by: Jake Petroules <jake.petroules@theqtcompany.com>
* | AVFoundation: don't automatically rotate camera captures.Yoann Lopes2015-11-042-12/+4
| | | | | | | | | | | | | | | | | | | | | | | | We shouldn't do this automatically, as different kind of orientations might be wanted (sensor, device, UI). The default should be sensor orientation (no rotation applied). We should add an API to QCamera to enable automatic orientation of captured images. Change-Id: I56fff7f0c4aaaee37eb6ae2628e27073b4946b66 Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
* | AVFoundation: fix camera capture previews.Yoann Lopes2015-10-204-38/+82
| | | | | | | | | | | | | | | | | | | | Generate the preview from a viewfinder frame and not from the final JPG image. In addition, the preview is now rotated to always be in the same orientation as the device at the time of capture. Task-number: QTBUG-46971 Change-Id: I48851225738e50fbd89c2f94904bac366303a9ad Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>