10#include <private/qmediastoragelocation_p.h>
12#include <QtCore/qfileinfo.h>
13#include <QtCore/qfuture.h>
14#include <QtCore/qpromise.h>
15#include <QtCore/qthread.h>
17#include <camera/camera_api.h>
67 return m_camera && m_camera->
isActive();
84 if (resolvedFileName.isEmpty()) {
92 const int id = m_lastId++;
95 saveFrame(
id,
frame, fn);
110 const int id = m_lastId++;
119QFuture<QImage> QQnxImageCapture::decodeFrame(
int id,
const QVideoFrame &
frame)
121 if (!
frame.isValid()) {
126 QPromise<QImage> promise;
127 QFuture<QImage>
future = promise.future();
131 auto runner = [
frame, promise=std::move(promise)]()
mutable {
133 promise.addResult(
frame.toImage());
139 auto onFinished = [
this, worker,
id,
future]()
mutable {
140 worker->deleteLater();
145 qWarning(
"QQnxImageCapture: failed to capture image to buffer");
160 QFuture<QImage> decodeFuture = decodeFrame(
id,
frame);
162 if (decodeFuture.isCanceled())
165 QPromise<bool> promise;
166 QFuture<bool> saveFuture = promise.future();
170 auto runner = [
future=std::move(decodeFuture),
171 promise=std::move(promise),
fileName]()
mutable {
179 auto onFinished = [
this, worker,
id,
future=std::move(saveFuture), fn=std::move(
fileName)]() {
180 worker->deleteLater();
205 if (m_session == captureSession)
211 m_session = captureSession;
215 this, &QQnxImageCapture::onCameraChanged);
221void QQnxImageCapture::onCameraChanged()
230 this, &QQnxImageCapture::onCameraChanged);
233 updateReadyForCapture();
236void QQnxImageCapture::onCameraActiveChanged(
bool active)
240 updateReadyForCapture();
243void QQnxImageCapture::updateReadyForCapture()
247 if (m_lastReadyForCapture == readyForCapture)
250 m_lastReadyForCapture = readyForCapture;
257#include "moc_qqnximagecapture_p.cpp"
QString canonicalFilePath() const
Returns the file system entry's canonical path, including the entry's name, that is,...
static QString fileFormatName(FileFormat c)
Returns the name of the given format, f.
@ NotSupportedFeatureError
FileFormat
Choose one of the following image formats:
QImageCapture::FileFormat format() const
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
QQnxImageCapture(QImageCapture *parent)
void setImageSettings(const QImageEncoderSettings &settings) override
QImageEncoderSettings imageSettings() const override
void setCaptureSession(QQnxMediaCaptureSession *session)
int captureToBuffer() override
int capture(const QString &fileName) override
bool isReadyForCapture() const override
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString & append(QChar c)
static QThread * create(Function &&f, Args &&... args)
void finished(QPrivateSignal)
The QVideoFrame class represents a frame of video data.
Combined button and popup list for selecting options.
DBusConnection const char DBusError * error
GLint GLsizei GLsizei GLenum format
GLsizei const GLchar *const * path
static QString resolveFileName(const QString &fileName, QImageCapture::FileFormat format)
static QString formatExtension(QImageCapture::FileFormat format)
static QString errorMessage(QUrlPrivate::ErrorCode errorCode, const QString &errorSource, qsizetype errorPosition)
QFuture< void > future
[5]
QSettings settings("MySoft", "Star Runner")
[0]