Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qandroidcamera_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QANDROIDCAMERA_H
5#define QANDROIDCAMERA_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "qffmpeghwaccel_p.h"
19#include <private/qplatformcamera_p.h>
20#include <QObject>
21#include <QJniObject>
22
24
25class QVideoFrame;
26
28{
30public:
33 ~QAndroidCamera() override;
34
35 bool isActive() const override { return m_state == State::Started; }
37 bool isFlashReady() const override;
39 void setActive(bool active) override;
40 void setCamera(const QCameraDevice &camera) override;
41 bool setCameraFormat(const QCameraFormat &format) override;
44 void zoomTo(float factor, float rate) override;
45
46 std::optional<int> ffmpegHWPixelFormat() const override;
47
48 static bool registerNativeMethods();
49
50 void capture();
51 void updateExif(const QString &filename);
52public slots:
55 void onCameraDisconnect();
56 void onCameraError(int error);
57 void frameAvailable(QJniObject image, bool takePhoto = false);
60 void onCaptureSessionFailed(int reason, long frameNumber);
61 void onSessionActive();
62 void onSessionClosed();
63
65 void onCaptured(const QVideoFrame&);
66
67private:
68 bool isActivating() const { return m_state != State::Closed; }
69
70 void setState(State newState);
71 QtVideo::Rotation rotation();
72 void updateCameraCharacteristics();
73 void cleanCameraCharacteristics();
74
75 State m_state = State::Closed;
76 QCameraDevice m_cameraDevice;
77 long lastTimestamp = 0;
78 QJniObject m_jniCamera;
79
80 std::unique_ptr<QFFmpeg::HWAccel> m_hwAccel;
81
82 QVideoFrameFormat::PixelFormat m_androidFramePixelFormat;
83 QList<QCamera::FlashMode> m_supportedFlashModes;
84 bool m_waitingForFirstFrame = false;
85 bool m_TorchModeSupported = false;
86 bool m_wasActive = false;
87};
88
90
91#endif // QANDROIDCAMERA_H
bool isTorchModeSupported(QCamera::TorchMode mode) const override
void onApplicationStateChanged()
QAndroidCamera(QCamera *camera)
void setFlashMode(QCamera::FlashMode mode) override
static bool registerNativeMethods()
void onCaptureSessionFailed(int reason, long frameNumber)
void zoomTo(float factor, float rate) override
~QAndroidCamera() override
void setCamera(const QCameraDevice &camera) override
void onCaptureSessionConfigured()
bool setCameraFormat(const QCameraFormat &format) override
void frameAvailable(QJniObject image, bool takePhoto=false)
void onCaptured(const QVideoFrame &)
bool isFlashReady() const override
void onCameraOpened()
void updateExif(const QString &filename)
bool isFlashModeSupported(QCamera::FlashMode mode) const override
std::optional< int > ffmpegHWPixelFormat() const override
void onCaptureSessionConfigureFailed()
void setActive(bool active) override
bool isActive() const override
void onCameraError(int error)
void setTorchMode(QCamera::TorchMode mode) override
The QCameraDevice class provides general information about camera devices.
The QCameraFormat class describes a video format supported by a camera device. \inmodule QtMultimedia...
The QCamera class provides interface for system camera devices.
Definition qcamera.h:28
TorchMode
\value TorchOff Torch is Off.
Definition qcamera.h:84
FlashMode
\value FlashOff Flash is Off.
Definition qcamera.h:77
\inmodule QtCore
QCamera::Error error() const
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
PixelFormat
Enumerates video data types.
The QVideoFrame class represents a frame of video data.
Definition qvideoframe.h:27
QCamera * camera
Definition camera.cpp:19
void newState(QList< State > &states, const char *token, const char *lexem, bool pre)
Combined button and popup list for selecting options.
Definition image.cpp:4
GLenum mode
GLint GLsizei GLsizei GLenum format
GLuint GLenum * rate
#define Q_OBJECT
#define slots
#define Q_SIGNALS