qvyuanxin
2017-07-10 2f52ba12c4518a0de2478fca130997e73e514e09
VisitFace/RtspNativeCodec/app/src/main/cpp/CameraWrapper.h
@@ -1,47 +1,66 @@
#ifndef __CameraWrapper_H__
#define __CameraWrapper_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_SensetimeFaceTrack.h>
#include <PL_Paint.h>
#include <PL_Queue.h>
//#include "looper.h"
#include <android/native_window_jni.h>
#include <media/NdkMediaCodec.h>
#include <pthread.h>
#define MAX_FACE 5
#define MAX_FACE_WIDTH 240
#define MAX_FACE_HEIGHT 320
#include <jni.h>
class CameraWrapper
{
public:
   PipeLine* pipeLine;
   PL_RTSPClient_Config rtspConfig;
   PL_AndroidMediaCodecDecoder_Config amcdConfig;
   SensetimeFaceTrackConfig sftConfig;
   PipeLine* pipeLineDecoderDetector;
   PipeLine* pipeLineAnalyzer;
   PipeLine* pipeLineRender;
    PL_Queue* queueFrame;
    PL_RTSPClient_Config rtspConfig;
    PL_AndroidMediaCodecDecoder_Config amcdConfig;
    PL_AndroidSurfaceViewRender_Config asvrConfig;
    SensetimeFaceTrackConfig sftConfig;
   int cameraIdx;
   jmethodID faceCallback;
   ANativeWindow* window;
   pthread_t live_daemon_thid;
    JavaVM* javaVM;
    JNIEnv* javaEnv;
   jclass faceCallbackClazz;
   jmethodID faceCallbackFunc;
   void* windowRender;
   void* windowDecode;
   pthread_t decoder_thid;
   pthread_t analyzer_thid;
   bool running;
   
   bool faceCacheLocked;
   FaceCache faceCache;
    //FaceCache faceCache;
    FaceCacheForPLBG faceCache;
   PLPLContext plplContext;
   std::map<int, std::string> faceLabels;
   CameraWrapper() : 
      pipeLine(nullptr), rtspConfig(), amcdConfig(), sftConfig(),
      cameraIdx(0), faceCallback(0), window(nullptr),
      live_daemon_thid(0), running(false),
      faceCacheLocked(false), faceCache()
      pipeLineDecoderDetector(nullptr), pipeLineAnalyzer(nullptr), pipeLineRender(nullptr), queueFrame(nullptr), rtspConfig(), amcdConfig(), asvrConfig(), sftConfig(),
        cameraIdx(0), javaVM(nullptr), javaEnv(nullptr), faceCallbackClazz(0), faceCallbackFunc(0), windowRender(nullptr), windowDecode(nullptr),
      decoder_thid(0), analyzer_thid(0), running(false),
      faceCacheLocked(false), faceCache(),
      plplContext(), faceLabels()
   {
   }
   
@@ -54,8 +73,11 @@
   void lockFace();
   void releaseFace();
   void setFaceLabel(int st_track_id, const std::string& label);
private:
   static void* live_daemon_thd(void* arg);
   static void* decoder_thd(void *arg);
   static void* analyzer_thd(void *arg);
};
#endif