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.cpp File Reference

(0dafe69a5371e856eb1b3f4539dbd79f62b0f60e)

#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:129
QCamera * camera
Definition camera.cpp:19
GLuint64 key

Definition at line 563 of file qandroidcamera.cpp.

Referenced by onCameraDisconnect(), onCameraError(), onCameraOpened(), onCaptureSessionConfigured(), onCaptureSessionConfigureFailed(), onCaptureSessionFailed(), onFrameAvailable(), onPhotoAvailable(), onSessionActive(), and onSessionClosed().

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 605 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 615 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 595 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 625 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 635 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 665 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 572 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 583 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 645 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 655 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