Blame view

src/decoder/dvpp/DvppDec.h 2.09 KB
0b4cd5d5   Hu Chunming   完成轨迹定时抓拍
1
2
3
4
5
6
7
8
9
10
11
  #include<string>
  #include <pthread.h>
  
  #include "dvpp_headers.h"
  #include "depend_headers.h"
  #include "user_mem.h"
  #include "CircularQueue.hpp"
  #include "VpcPicConverter.h"
  #include "FFReceiver.h"
  
  #include <queue>
9b4d4adf   Hu Chunming   添加定时抓拍;
12
13
  #include <mutex>
  #include <condition_variable>
0b4cd5d5   Hu Chunming   完成轨迹定时抓拍
14
15
16
  
  using namespace std;
  
9b4d4adf   Hu Chunming   添加定时抓拍;
17
  // #define TEST_DECODER
0b4cd5d5   Hu Chunming   完成轨迹定时抓拍
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
  
  struct DvppDecConfig{
      string dec_name;                         
      POST_DECODE_CALLBACK post_decoded_cbk;  // 解码数据回调接口
      string dev_id;                           // gpu id
      bool force_tcp{true};                   // 是否指定使用tcp连接
      int skip_frame{1};                      // 跳帧数
      int codec_id;                           // 0 : h264   1:h265
      int profile;
      CircularQueue<AVPacket*> *pktQueueptr;
  
      int width;
      int height;
  };
  
  
  class DvppDec {
  public:
      DvppDec();
      ~DvppDec();
      bool init_vdpp(DvppDecConfig cfg);
      void setPostDecArg(const void* postDecArg);
      bool start();
      void close();
      void pause();
      void resume();
9b4d4adf   Hu Chunming   添加定时抓拍;
44
      DeviceMemory* snapshot();
0b4cd5d5   Hu Chunming   完成轨迹定时抓拍
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
  
  public:
      void doProcessReport();
      void doVdppVdecCallBack(acldvppStreamDesc *input, acldvppPicDesc *output);
  
  private:
      void decode_thread();
      void releaseResource();
      bool sendVdecEos(aclvdecChannelDesc *vdecChannelDesc);
      int sentFrame(aclvdecChannelDesc *vdecChannelDesc, uint64_t frame_count);
  
  private:
  
      bool m_bRunning{false};
      bool m_bPause{false};
      bool m_bExitReportThd{false};
  
      int m_dvpp_deviceId {-1};
      int m_dvpp_channel {-1};
      aclrtContext m_context;
      acldvppStreamFormat enType;
  
      pthread_t m_decode_thread;
      
      DvppDecConfig m_cfg;
      string m_dec_name;
  
      vector<void*> m_vec_vdec;
      CircularQueue<void *> m_vdecQueue;
      CircularQueue<AVPacket *> *m_pktQueueptr;
  
      const void * m_postDecArg;
      POST_DECODE_CALLBACK post_decoded_cbk;
  
      VpcPicConverter picConverter;
  
      int m_vdec_out_size {-1};
  
9b4d4adf   Hu Chunming   添加定时抓拍;
83
84
85
86
87
      bool m_bSnapShoting{false};
      DvppDataMemory* m_cached_mem;
      mutex m_cached_mutex;
      condition_variable m_cached_cond;
  
0b4cd5d5   Hu Chunming   完成轨迹定时抓拍
88
89
90
91
92
93
  #ifdef TEST_DECODER
      void *vdecHostAddr = nullptr;
      int count_frame = 0;
  #endif
  
  };