task_manager.h
1.49 KB
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
61
62
63
64
65
#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"
using namespace std;
typedef struct TaskInfo
{
string ipc_url; //rtsp流地址
string task_id; //外部传入任务id
DvppDecoder* dec{nullptr};
string result_folder_little; //目标快照抠图保存地址
string result_folder; //目标快照大图保存地址
} 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);
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__