DvppSourceManager.cpp 949 Bytes
#include "DvppSourceManager.h"

#include "dvpp_headers.h"
#include "depend_headers.h"

using namespace std;

DvppSourceManager::~DvppSourceManager()
{
    channelMap.clear();

    // aclFinalize();
}

int DvppSourceManager::getChannel(int devId){
    // channel 最大值暂定为32, 华为没有接口获取最大channel,只有文档说明
    for(int iChannel = 0; iChannel < 32; iChannel++){
        string channelKey = "channel_" + to_string(devId) + "_" + to_string(iChannel) ;
        auto it = channelMap.find(channelKey);
        if(it == channelMap.end()){
            channelMap[channelKey] = iChannel;
            return iChannel;
        }
    }
    return -1;
}

void DvppSourceManager::releaseChannel(int devId, int iChannel){
    string channelKey = "channel_" + to_string(devId) + "_" + to_string(iChannel) ;
    auto it = channelMap.find(channelKey);
    if(it != channelMap.end()){
        channelMap.erase(channelKey);
    }
}