派生自 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
#include "EncodeVideo.h"
 
EncodeVideo::EncodeVideo():
videoEncoderElement(cv::Size(1920, 1080), 8, 0)
{
 
}
EncodeVideo::~EncodeVideo()
{
 
}
 
void EncodeVideo::threadFunc()
{
//    std::string tmp="threadFunc";
//    ClockTimer cl(tmp);
 
    std::string src_path=getProperty("src_path");
    if(src_path.empty())
    {
        DBG("src_path.empty()");
        return ;
    }
    int size=m_hiredisTool.getSize(src_path);
 
    bool fileCreate = false;
    for(int i=0;i<size;++i)
    {
 
        cv::Mat img;
        m_hiredisTool.getImage(src_path,img);
        if(img.empty()){
            DBG("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(1000);
    }
 
    videoEncoderElement.threadClosing();
    m_hiredisTool.delKey(src_path);
    m_hiredisTool.hashDel(file_list,src_path);
}