#ifndef __CAMERAWRAPPER_CLIENT_H__
|
#define __CAMERAWRAPPER_CLIENT_H__
|
|
#define MAX_FACE 5
|
#define MAX_FACE_WIDTH 240
|
#define MAX_FACE_HEIGHT 320
|
#include "FaceCache.h"
|
|
#include <PipeLine.h>
|
#include <PL_RTSPClient.h>
|
#include <PL_AndroidMediaCodecDecoder.h>
|
#include <PL_AndroidSurfaceViewRender.h>
|
#include <PL_SensetimeFaceTrackMultiTrd.h>
|
#include <PL_Paint.h>
|
#include <PL_Scale.h>
|
//#include "looper.h"
|
#include <android/native_window_jni.h>
|
#include <media/NdkMediaCodec.h>
|
|
#include <pthread.h>
|
#include <jni.h>
|
|
class CameraWrapper
|
{
|
public:
|
PipeLine* pipeLineDecoderDetector;
|
PipeLine* pipeLineRender;
|
|
PL_RTSPClient_Config rtspConfig;
|
PL_AndroidMediaCodecDecoder_Config amcdConfig;
|
PL_AndroidSurfaceViewRender_Config asvrConfig;
|
PL_Scale_Config plScaleCfg;
|
int faceCount;
|
int cameraIdx;
|
bool faceCountChanged;
|
JavaVM* javaVM;
|
JNIEnv* javaEnv;
|
jclass faceCallbackClazz;
|
jmethodID faceCallbackFunc;
|
void* windowRender;
|
void* windowDecode;
|
|
pthread_t decoder_thid;
|
pthread_t live_daemon_thid;
|
pthread_t jni_call_thid;
|
pthread_mutex_t live_daemon_mut;
|
bool running;
|
volatile bool killed;
|
time_t lastAliveTime;
|
|
bool faceCacheLocked;
|
//FaceCache faceCache;
|
FaceCacheForPLBG faceCache;
|
|
PLPLContext plplContext;
|
|
std::map<int, std::wstring> faceLabels;
|
|
std::string fontPath;
|
|
CameraWrapper() :
|
pipeLineDecoderDetector(nullptr), pipeLineRender(nullptr), rtspConfig(), amcdConfig(), asvrConfig(),
|
cameraIdx(0), javaVM(nullptr), javaEnv(nullptr), faceCallbackClazz(0), faceCallbackFunc(0), windowRender(nullptr), windowDecode(nullptr),
|
decoder_thid(0), live_daemon_thid(0),jni_call_thid(0), live_daemon_mut(), running(false), killed(false), lastAliveTime(0),
|
faceCacheLocked(false), faceCache(),
|
plplContext(), faceLabels(), fontPath()
|
{
|
}
|
|
~CameraWrapper();
|
|
bool start();
|
void stop();
|
bool initPl();
|
|
void lockFace();
|
void releaseFace();
|
void fireFaceCount(int faceCount);
|
void setFaceLabel(int st_track_id, const std::wstring& label);
|
|
private:
|
static void* decoder_thd(void *arg);
|
static void* live_daemon_thd(void *arg);
|
static void* jni_call_thd(void *arg);
|
|
bool resetPl();
|
bool initPl_DecoderPl();
|
};
|
|
#endif
|