Blame view

src/ai_platform/task_manager.h 1.56 KB
6fdcb6a5   Hu Chunming   初次提交,代码大体完成编写,完善中
1
2
3
4
5
6
7
8
9
10
11
12
  #ifndef __AI_PLATFORM_TASK_MANAGER__
  #define __AI_PLATFORM_TASK_MANAGER__
  #include <map>
  #include <string>
  #include <vector>
  #include <memory>
  
  #include "header.h"
  
  #include "../decoder/dvpp/DvppDecoder.h"
  #include "../decoder/interface/utiltools.hpp"
  
6fdcb6a5   Hu Chunming   初次提交,代码大体完成编写,完善中
13
14
15
16
17
18
19
20
21
22
23
  using namespace std;
  
  typedef struct TaskInfo
  {
      string ipc_url;                      //rtsp流地址
  	string task_id;                      //外部传入任务id
      DvppDecoder* dec{nullptr};
  
      string result_folder_little;         //目标快照抠图保存地址
  	string result_folder;                //目标快照大图保存地址
  
6fdcb6a5   Hu Chunming   初次提交,代码大体完成编写,完善中
24
25
26
27
28
29
30
31
32
33
34
35
36
37
  } TaskInfo;
  
  class task_manager
  {
  public:
      task_manager(/* args */);
      ~task_manager();
  
      bool AddTask(const task_param& task_param, FFDecConfig& cfg);
      bool PauseTask(const string& task_id);
      bool RestartTask(const string& task_id);
      bool FinishTask(const string& task_id);
      bool StartTask(const string& task_id);
  
9e3f3176   Hu Chunming   修复关闭任务崩溃的问题
38
39
40
      bool CloseDecoder(const string& task_id);
      bool CloseAllDecoder();
  
6fdcb6a5   Hu Chunming   初次提交,代码大体完成编写,完善中
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
68
      bool GetResolution(const string& task_id, int &width, int &height );
      bool SetDecKeyframe(const string& task_id, bool bKeyframe);
  
      bool IsPausing(const string& task_id);
      bool IsRunning(const string& task_id);
      bool IsFinished(const string& task_id);
  
      int GetRunningTaskCount();
  
      DeviceMemory* SnapShot(const string& task_id);
  
      void Release();
  
      TaskInfo* GetTaskInfo(string task_id);
  
  private:
  
      DvppDecoder* create_decoder(FFDecConfig& cfg);
  
  private:
      map<string, TaskInfo> task_info_map;   //todo : 加锁
  };
  
  
  
  
  
  #endif  //__AI_PLATFORM_TASK_MANAGER__