task_manager.h 1.49 KB
#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__