diff options
author | Artem Dyomin <artem.dyomin@qt.io> | 2023-03-16 18:56:08 +0100 |
---|---|---|
committer | Artem Dyomin <artem.dyomin@qt.io> | 2023-03-20 23:17:20 +0100 |
commit | 7aa46959da986ada426de567d4eaf013db5c32cf (patch) | |
tree | d7c37c6c9d8ad5a27a261b03ffc5eae1459b7c6c /examples | |
parent | f4b22c3be62c93883f44bbd72d8997d4df0d21f3 (diff) | |
download | qtmultimedia-7aa46959da986ada426de567d4eaf013db5c32cf.tar.gz |
Improve ffmpeg camera formats selection on darwin OS
Handled a bunch of corner cases, briefly they are:
- handle the case when ffmpeg videotoolbox doesn't support format.
From now, it's optionally available to use sw frame or choose
another format. Both approaches are working, but for now,
the first one is prefferable.
- handle the rare case when device output formats don't contain
camera format.
- improve the best camera format selection, it'll take into
account an opoortunity to use hw acceleration for the format.
- improve logging.
Task-number: QTBUG-109009
Pick-to: 6.5
Change-Id: I82773f73a47bc1d22730f1e5ec2eaacbfa4ec1b1
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/multimedia/camera/camera.cpp | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/examples/multimedia/camera/camera.cpp b/examples/multimedia/camera/camera.cpp index 5fd8837f6..058f020e4 100644 --- a/examples/multimedia/camera/camera.cpp +++ b/examples/multimedia/camera/camera.cpp @@ -137,27 +137,6 @@ void Camera::setCamera(const QCameraDevice &cameraDevice) updateCaptureMode(); - if (m_camera->cameraFormat().isNull()) { - auto formats = cameraDevice.videoFormats(); - if (!formats.isEmpty()) { - // Choose a decent camera format: Maximum resolution at at least 30 FPS - // we use 29 FPS to compare against as some cameras report 29.97 FPS... - QCameraFormat bestFormat; - for (const auto &fmt : formats) { - if (bestFormat.maxFrameRate() < 29 - && fmt.maxFrameRate() > bestFormat.maxFrameRate()) - bestFormat = fmt; - else if (bestFormat.maxFrameRate() == fmt.maxFrameRate() - && bestFormat.resolution().width() * bestFormat.resolution().height() - < fmt.resolution().width() * fmt.resolution().height()) - bestFormat = fmt; - } - - m_camera->setCameraFormat(bestFormat); - m_mediaRecorder->setVideoFrameRate(bestFormat.maxFrameRate()); - } - } - m_camera->start(); } |