houxiao
2017-04-06 63d598d4443f906b34bedaf49e870b7a2be1a5c8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#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_SensetimeFaceTrack.h>
 
//#include "looper.h"
#include <android/native_window_jni.h>
#include <media/NdkMediaCodec.h>
 
#include <pthread.h>
 
class CameraWrapper
{
public:
    PipeLine* pipeLine;
    
    PL_RTSPClient_Config rtspConfig;
    PL_AndroidMediaCodecDecoder_Config amcdConfig;
    SensetimeFaceTrackConfig sftConfig;
    
    int cameraIdx;
    jmethodID faceCallback;
    ANativeWindow* window;
    
    pthread_t live_daemon_thid;
    bool running;
    
    bool faceCacheLocked;
    FaceCache faceCache;
 
    CameraWrapper() : 
        pipeLine(nullptr), rtspConfig(), amcdConfig(), sftConfig(), 
        cameraIdx(0), faceCallback(0), window(nullptr), 
        live_daemon_thid(0), running(false),
        faceCacheLocked(false), faceCache()
    {
    }
    
    ~CameraWrapper();
    
    bool start();
    void stop();
    bool initPl();
    
    void lockFace();
    void releaseFace();
 
private:
    static void* live_daemon_thd(void* arg);
};
 
#endif