派生自 development/c++

pansen
2019-03-04 f2a3422c62a1176b50038e0e7bd81f05227834b7
QiaoJiaSystem/VideoToImageMulth/RtspCaptureElement.cpp
@@ -8,7 +8,9 @@
#include <QString>
#include <QDateTime>
#include "RtspAnalysManager.h"
RtspCaptureElement::RtspCaptureElement(const std::string &path, const std::string& camId,int fps, int reopenTime, int gpuIndex,RtspAnalysManager* manager):
RtspCaptureElement::RtspCaptureElement(const std::string &path, const std::string &camId, int fps, int reopenTime,
                                       int gpuIndex, RtspAnalysManager *manager) :
    TimerElement(10),m_path(path),m_gpuIndex(gpuIndex),
    m_reopenTime(reopenTime),m_camId(camId),m_pManager(manager){
    m_cutPath= appPref.getStringData("user.loop.absolute.path");
@@ -18,8 +20,7 @@
}
//定时抓取图片,通过将图片放入RtspImageRedisElement的队列中,来减少视频的丢帧
void RtspCaptureElement::timerFunc()
{
void RtspCaptureElement::timerFunc() {
    bool ret = m_capture->grabFrame();
    if (!ret) {
@@ -58,8 +59,7 @@
    fireConnectors();
}
std::string RtspCaptureElement::MakeDir(const std::string &timeStamp)
{
std::string RtspCaptureElement::MakeDir(const std::string &timeStamp) {
    std::string t_FilePath = m_cutPath;
    if (t_FilePath.back() != '/') {
@@ -80,8 +80,8 @@
    return t_FilePath;
}
void RtspCaptureElement::SaveVideo(const std::string &strImageName)
{
void RtspCaptureElement::SaveVideo(const std::string &strImageName) {
    INFO("SaveVideo: "<<strImageName);
    std::string strTimeStamp= AppUtil::getTimeUSecString();
    std::string strPath=MakeDir(strTimeStamp);
@@ -89,8 +89,7 @@
}
void RtspCaptureElement::openVideo()
{
void RtspCaptureElement::openVideo() {
    if(m_gpuIndex>=0){
        setenv("CUDA_VISIBLE_DEVICES", std::to_string(m_gpuIndex).c_str(),0);
    }
@@ -98,22 +97,19 @@
    m_capture->open(m_path.c_str(),m_gpuIndex>=0);
}
void RtspCaptureElement::threadInitial()
{
void RtspCaptureElement::threadInitial() {
    INFO("MYH DEBUG");
    openVideo();
}
void RtspCaptureElement::threadClosing()
{
void RtspCaptureElement::threadClosing() {
    INFO("MYH DEBUG");
    m_capture->close();
    delete m_capture;
    m_capture = nullptr;
}
void RtspCaptureElement::SetVideoMinMaxSeconds(const int minSeconds, const int maxSeconds)
{
void RtspCaptureElement::SetVideoMinMaxSeconds(const int minSeconds, const int maxSeconds) {
    m_capture->SetMinMaxVideoSeconds(minSeconds,maxSeconds);
}