Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qandroidcamera.cpp File Reference
#include "qandroidcamera_p.h"
#include <jni.h>
#include <QMediaFormat>
#include <memory>
#include <optional>
#include <qmediadevices.h>
#include <qguiapplication.h>
#include <qscreen.h>
#include <QDebug>
#include <qloggingcategory.h>
#include <QtCore/qcoreapplication.h>
#include <QtCore/qpermissions.h>
#include <QtCore/private/qandroidextras_p.h>
#include <private/qcameradevice_p.h>
#include <QReadWriteLock>
#include <private/qvideoframeconverter_p.h>
#include <private/qvideotexturehelper_p.h>
#include <qffmpegvideobuffer_p.h>
#include <qandroidcameraframe_p.h>
#include <utility>
#include "libavutil/hwcontext.h"
#include "libavutil/pixfmt.h"
+ Include dependency graph for qandroidcamera.cpp:

Go to the source code of this file.

Macros

#define GET_CAMERA(cameraId)
 

Typedefs

typedef QMap< QString, QAndroidCamera * > QAndroidCameraMap
 

Functions

 Q_DECLARE_JNI_CLASS (QtCamera2, "org/qtproject/qt/android/multimedia/QtCamera2")
 
 Q_DECLARE_JNI_CLASS (QtVideoDeviceManager, "org/qtproject/qt/android/multimedia/QtVideoDeviceManager")
 
 Q_DECLARE_JNI_CLASS (AndroidImageFormat, "android/graphics/ImageFormat")
 
static QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY (qLCAndroidCamera, "qt.multimedia.ffmpeg.androidCamera")
 
static void deleteFrame (void *opaque, uint8_t *data)
 
static void onFrameAvailable (JNIEnv *env, jobject obj, jstring cameraId, QtJniTypes::AndroidImage image)
 
static void onPhotoAvailable (JNIEnv *env, jobject obj, jstring cameraId, QtJniTypes::AndroidImage image)
 
static void onCameraOpened (JNIEnv *env, jobject obj, jstring cameraId)
 
static void onCameraDisconnect (JNIEnv *env, jobject obj, jstring cameraId)
 
static void onCameraError (JNIEnv *env, jobject obj, jstring cameraId, jint error)
 
static void onCaptureSessionConfigured (JNIEnv *env, jobject obj, jstring cameraId)
 
static void onCaptureSessionConfigureFailed (JNIEnv *env, jobject obj, jstring cameraId)
 
static void onSessionActive (JNIEnv *env, jobject obj, jstring cameraId)
 
static void onSessionClosed (JNIEnv *env, jobject obj, jstring cameraId)
 
static void onCaptureSessionFailed (JNIEnv *env, jobject obj, jstring cameraId, jint reason, jlong framenumber)
 

Macro Definition Documentation

◆ GET_CAMERA

#define GET_CAMERA (   cameraId)
Value:
QString key = QJniObject(cameraId).toString(); \
QReadLocker locker(rwLock); \
if (!g_qcameras->contains(key)) { \
qCWarning(qLCAndroidCamera) << "Calling back a QtCamera2 after being destroyed."; \
return; \
} \
QAndroidCamera *camera = g_qcameras->find(key).value();
\inmodule QtCore
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
QCamera * camera
Definition camera.cpp:19
GLuint64 key

Definition at line 547 of file qandroidcamera.cpp.

Typedef Documentation

◆ QAndroidCameraMap

Definition at line 46 of file qandroidcamera.cpp.

Function Documentation

◆ deleteFrame()

static void deleteFrame ( void opaque,
uint8_t *  data 
)
static

Definition at line 143 of file qandroidcamera.cpp.

References frame, and Q_UNUSED.

Referenced by QAndroidCamera::frameAvailable().

+ Here is the caller graph for this function:

◆ onCameraDisconnect()

static void onCameraDisconnect ( JNIEnv *  env,
jobject  obj,
jstring  cameraId 
)
static

Definition at line 589 of file qandroidcamera.cpp.

References camera, GET_CAMERA, and Q_UNUSED.

Referenced by QAndroidCamera::registerNativeMethods().

+ Here is the caller graph for this function:

◆ onCameraError()

static void onCameraError ( JNIEnv *  env,
jobject  obj,
jstring  cameraId,
jint  error 
)
static

Definition at line 599 of file qandroidcamera.cpp.

References camera, error, GET_CAMERA, and Q_UNUSED.

Referenced by QAndroidCamera::registerNativeMethods().

+ Here is the caller graph for this function:

◆ onCameraOpened()

static void onCameraOpened ( JNIEnv *  env,
jobject  obj,
jstring  cameraId 
)
static

Definition at line 579 of file qandroidcamera.cpp.

References camera, GET_CAMERA, and Q_UNUSED.

Referenced by QAndroidCamera::registerNativeMethods().

+ Here is the caller graph for this function:

◆ onCaptureSessionConfigured()

static void onCaptureSessionConfigured ( JNIEnv *  env,
jobject  obj,
jstring  cameraId 
)
static

Definition at line 609 of file qandroidcamera.cpp.

References camera, GET_CAMERA, and Q_UNUSED.

Referenced by QAndroidCamera::registerNativeMethods().

+ Here is the caller graph for this function:

◆ onCaptureSessionConfigureFailed()

static void onCaptureSessionConfigureFailed ( JNIEnv *  env,
jobject  obj,
jstring  cameraId 
)
static

Definition at line 619 of file qandroidcamera.cpp.

References camera, GET_CAMERA, and Q_UNUSED.

Referenced by QAndroidCamera::registerNativeMethods().

+ Here is the caller graph for this function:

◆ onCaptureSessionFailed()

static void onCaptureSessionFailed ( JNIEnv *  env,
jobject  obj,
jstring  cameraId,
jint  reason,
jlong  framenumber 
)
static

Definition at line 649 of file qandroidcamera.cpp.

References camera, GET_CAMERA, and Q_UNUSED.

Referenced by QAndroidCamera::registerNativeMethods().

+ Here is the caller graph for this function:

◆ onFrameAvailable()

static void onFrameAvailable ( JNIEnv *  env,
jobject  obj,
jstring  cameraId,
QtJniTypes::AndroidImage  image 
)
static

Definition at line 556 of file qandroidcamera.cpp.

References camera, GET_CAMERA, and Q_UNUSED.

Referenced by QAndroidCamera::registerNativeMethods().

+ Here is the caller graph for this function:

◆ onPhotoAvailable()

static void onPhotoAvailable ( JNIEnv *  env,
jobject  obj,
jstring  cameraId,
QtJniTypes::AndroidImage  image 
)
static

Definition at line 567 of file qandroidcamera.cpp.

References camera, GET_CAMERA, and Q_UNUSED.

Referenced by QAndroidCamera::registerNativeMethods().

+ Here is the caller graph for this function:

◆ onSessionActive()

static void onSessionActive ( JNIEnv *  env,
jobject  obj,
jstring  cameraId 
)
static

Definition at line 629 of file qandroidcamera.cpp.

References camera, GET_CAMERA, and Q_UNUSED.

Referenced by QAndroidCamera::registerNativeMethods().

+ Here is the caller graph for this function:

◆ onSessionClosed()

static void onSessionClosed ( JNIEnv *  env,
jobject  obj,
jstring  cameraId 
)
static

Definition at line 639 of file qandroidcamera.cpp.

References camera, GET_CAMERA, and Q_UNUSED.

Referenced by QAndroidCamera::registerNativeMethods().

+ Here is the caller graph for this function:

◆ Q_DECLARE_JNI_CLASS() [1/3]

Q_DECLARE_JNI_CLASS ( AndroidImageFormat  ,
"android/graphics/ImageFormat"   
)

◆ Q_DECLARE_JNI_CLASS() [2/3]

Q_DECLARE_JNI_CLASS ( QtCamera2  ,
"org/qtproject/qt/android/multimedia/QtCamera2"   
)

◆ Q_DECLARE_JNI_CLASS() [3/3]

Q_DECLARE_JNI_CLASS ( QtVideoDeviceManager  ,
"org/qtproject/qt/android/multimedia/QtVideoDeviceManager"   
)

◆ Q_LOGGING_CATEGORY()

static QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY ( qLCAndroidCamera  ,
"qt.multimedia.ffmpeg.androidCamera"   
)
static