派生自 development/c++

xuxiuxi
2019-03-08 9a0afe1ccce6fd3a6882b4c19b72cee579a54dd1
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
#include "AppPipeController.h"
#include <basic/util/app/AppPreference.hpp>
#include <basic/util/app/AppUtil.h>
//#include <sstream>
#include <algorithm>
AppPipeController::AppPipeController(int index, const Json::Value &json):
    videoCaptureElement(json["rtsp"].asString(), 25,3000,appPref.getLongData("gpu.index")),
    index(index), videoPublishElement(appPref.getStringData("publish.basepath")+".flv",
                        cv::Size(appPref.getIntData("pulish.width"),appPref.getIntData("pulish.height")),
                        "flv", 25, appPref.getLongData("gpu.index"))
{
    if(appPref.getIntData("pulish.width") < 0 || appPref.getIntData("pulish.height") < 0)
    {
        ERR("pulish.width:  "<<appPref.getIntData("pulish.width") <<"  Height: "<< appPref.getIntData("pulish.height"));
    }
    videoCaptureElement.registerConnector([&]{
        //if(!videoPublishElement.isBusy()){
            videoPublishElement.setImage(videoCaptureElement.getImage());
            //videoPublishElement.submit();
        //}
 
    });
 
    registerElement(videoCaptureElement);
    registerElement(videoPublishElement);
 
    //videoCaptureElement.setOutPutInterval(3);
}
 
std::string AppPipeController::getRtmp()
{
    std::string ret = videoPublishElement.getPath();
    size_t pos = ret.find(".flv");
    ret = ret.substr(0,pos);
    INFO(ret);
    return ret;
}