Blame view

src/decoder/dvpp/FFRecoderTaskManager.h 1.66 KB
746db74c   Hu Chunming   实现recode
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  #include "FFRecoder.h"
  
  #include "../../ai_platform/common_header.h"
  #include "depend_headers.h"
  
  #include <list>
  #include <queue>
  #include <map>
  #include <string>
  #include <thread>
  #include <mutex>
  
  using namespace std;
  
  struct RecodeParam {
      AVRational time_base;
      RecoderInfo recoderInfo;
      AVCodecContext* avctx;
  };
  
d9fc3e82   Hu Chunming   recode添加colse功能和mq功能
21
22
  typedef std::function<bool(const char *msg)> mq_callback_t;
  
746db74c   Hu Chunming   实现recode
23
24
25
26
27
28
29
30
31
32
33
  class FFRecoderTaskManager {
  public:
      FFRecoderTaskManager();
  	virtual ~FFRecoderTaskManager();
  
      void cache_pkt(AVPacket* pkt, long long frame_nb);
      void create_recode_task(AVRational time_base, AVCodecContext* avctx, RecoderInfo& recoderInfo);
  
      bool init(AVRational time_base, AVCodecContext* avctx);
      void create_recode_task2(RecoderInfo& recoderInfo);
  
d9fc3e82   Hu Chunming   recode添加colse功能和mq功能
34
35
36
37
      void close();
  
      void set_mq_callback(mq_callback_t cb);
  
746db74c   Hu Chunming   实现recode
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
  public:
      void recode_thread(RecodeParam param);
      list<DataPacket*>::iterator getStartIterator(unsigned long long frame_nb);
  
      void recode_thread2();
  
  private:
      void save_intask_frame_nb(unsigned long long frame_nb);
      void save_intask_recoderinfo(RecoderInfo info);
      
  private:
      std::queue<int> m_key_frame_interval;
      std::list<unsigned long long> m_keyframe_nb_list;
      std::list<DataPacket*> m_pkt_list;
      mutex m_pkt_list_mtx; 
      unsigned long long m_last_key_frame_nb;
  
      std::list<unsigned long long> m_intask_frame_nb_list;
  
      std::list<RecoderInfo> m_recoderinfo_list;
      mutex m_recoderinfo_list_mtx;
  
      bool m_bExit{false};
  
      map<string, thread*> m_id_recoderTask;
      mutex m_task_creat_mtx; 
  
      AVRational m_time_base;
      AVCodecContext* m_avctx;
  
d9fc3e82   Hu Chunming   recode添加colse功能和mq功能
68
69
70
      thread* m_recoder_thread{nullptr};
  
      mq_callback_t mq_publish_func;
746db74c   Hu Chunming   实现recode
71
  };