派生自 development/c++

pansen
2019-03-07 d3b7bbe7102cd089680a828f5d8f6402c8cf6342
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
60
61
#include "NewEncodeVideo.h"
 
NewEncodeVideo::NewEncodeVideo():
videoEncoderElement(cv::Size(1920, 1080), 8, 0)
{
 
}
NewEncodeVideo::~NewEncodeVideo()
{
 
}
 
void NewEncodeVideo::threadFunc()
{
 
    std::string src_path=getProperty("src_path");
    if(src_path.empty())
    {
        return ;
    }
    int size=m_hiredisTool.getSize(src_path);
  //  DBG("buf_size="<<size<<"  file_name="<<src_path);
    bool fileCreate = false;
    for(int i=0;i<size;++i)
    {
        cv::Mat img;
        m_hiredisTool.getImage(src_path,img);
        if(img.empty())
         continue;
        if(!fileCreate)
        {
            fileCreate = true;
            DBG("fileCreate buf_size="<<size<<"  file_name="<<src_path);
             videoEncoderElement.threadInitial(getProperty("src_path"),img);
 
        }
        else
        {
            videoEncoderElement.doFunc(img);
        }
         usleep(2*1000);
    }
 //    bool isOpen=false;
//    while(!m_imgQue.empty())
//    {
//        if(!isOpen)
//        {
//           videoEncoderElement.threadInitial(getProperty("src_path"),m_imgQue.back());
//           isOpen=true;
//        }
//        else
//        {
//              videoEncoderElement.doFunc(m_imgQue.back());
 
//        }
//        m_imgQue.pop();
//    }
    videoEncoderElement.threadClosing();
    m_hiredisTool.delKey(src_path);
    m_hiredisTool.hashDel(file_list,src_path);
}