DvppSourceManager.h 685 Bytes

#include<map>
#include<string>

#include "dvpp_headers.h"

using namespace std;

class DvppSourceManager{
public:
    static DvppSourceManager* getInstance(){
		static DvppSourceManager* singleton = nullptr;
		if (singleton == nullptr){
			singleton = new DvppSourceManager();
			int ret = aclInit(nullptr);
			if (ret != ACL_ERROR_NONE) { 
				cout << "aclInit failed" << endl; 
				return nullptr;
			}
		}
		return singleton;
	}

    aclrtContext getContext(int devId);

	int getChannel(int devId);
	void releaseChannel(int devId, int channel);

private:
    DvppSourceManager(){}
	~DvppSourceManager();

private:
    map<int, aclrtContext> ctxMap;
	map<string, int> channelMap;
};