#include "NewEncodeVideoManager.h"
|
#include "NewRecordVideoElement.h"
|
#include <basic/util/app/AppConfig.h>
|
NewEncodeVideoManager::NewEncodeVideoManager():
|
TimerElement(1000)
|
{
|
// m_hiredisTool.delKey("")
|
int thread_num=appConfig.getIntProperty("encode_thread_num");
|
for(int i=0;i<thread_num;++i)
|
{
|
NewEncodeVideo* newEncodeViedo=new NewEncodeVideo;
|
if(newEncodeViedo)
|
{
|
m_newEncodeVideoVec.push_back(newEncodeViedo);
|
newEncodeViedo->start();
|
}
|
|
}
|
|
}
|
NewEncodeVideoManager::~NewEncodeVideoManager()
|
{
|
for(int i=0;i<m_newEncodeVideoVec.size();++i)
|
{
|
if(m_newEncodeVideoVec[i])
|
{
|
m_newEncodeVideoVec[i]->stop();
|
delete m_newEncodeVideoVec[i];
|
}
|
}
|
|
}
|
void NewEncodeVideoManager::timerFunc()
|
{
|
std::map<std::string,int> fileMap=m_hiredisTool.findAllFileStatus();
|
// auto it=fileMap.begin();
|
for(auto it=fileMap.begin();it!=fileMap.end();it++)
|
{
|
if(it->second == RECORD_ENDING)
|
{
|
|
|
|
|
for(int i=0;i<m_newEncodeVideoVec.size();++i)
|
{
|
if(m_newEncodeVideoVec[i] && !m_newEncodeVideoVec[i]->isBusy())
|
{
|
m_hiredisTool.hashSet(file_list,it->first,RECORD_STOP);
|
m_newEncodeVideoVec[i]->setProperty("src_path",it->first);
|
m_newEncodeVideoVec[i]->submit();
|
break;
|
}
|
}
|
|
|
}
|
}
|
}
|