派生自 development/c++

pansen
2019-03-06 a2dfb4907fd11e0a64ba16419dce066509462297
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
#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;
               }
           }
 
 
       }
   }
}