From ed223aee5fe5f3b222488549597976f34c679c3d Mon Sep 17 00:00:00 2001
From: pansen <pansen626@sina.com>
Date: 星期二, 05 三月 2019 14:00:47 +0800
Subject: [PATCH] 代码格式化及部分bug修改
---
QiaoJiaSystem/StructureApp/NewRecordVideoElement.cpp | 55 +++++++++++++++++++++++++++++++++++++------------------
1 files changed, 37 insertions(+), 18 deletions(-)
diff --git a/QiaoJiaSystem/StructureApp/NewRecordVideoElement.cpp b/QiaoJiaSystem/StructureApp/NewRecordVideoElement.cpp
index b9e696c..3b8498f 100644
--- a/QiaoJiaSystem/StructureApp/NewRecordVideoElement.cpp
+++ b/QiaoJiaSystem/StructureApp/NewRecordVideoElement.cpp
@@ -5,29 +5,38 @@
//#todo index int -> string
NewRecordVideoElement::NewRecordVideoElement(std::string camid) :
//videoEncoderElement(cv::Size(1920, 1080), 5, 0),
-camID(camid)
+camID(camid),
+m_bSaveWH(false)
{
// basicPath();
+ //isRecord=false;
m_cutPath= appPref.getStringData("user.loop.absolute.path");
- recordInit(60,360);
+
+ recordInit(appPref.getIntData("n_cut_min_duration"),appPref.getIntData("n_cut_max_duration"));
}
NewRecordVideoElement::~NewRecordVideoElement() {
std::queue<ImgInfo> empty;
empty.swap(m_imgBufQue);
-//m_imgBufQue.clear();
+
}
std::string NewRecordVideoElement::startRecord() {
-// ImgInfo info=m_HiredisTool.getImage(camID);
+
+
ImgInfo info;
getImg(info);
std::string srcPath= getFileName(info.time);
m_filename=srcPath;
- DBG("m_filename: " << m_filename);
+ // DBG("m_filename: " << m_filename);
+ if(!m_bSaveWH)
+ {
+ m_bSaveWH=m_hiredisTool.hashSet(camID,"width",info.img.cols) && m_hiredisTool.hashSet(camID,"height",info.img.rows);
+ DBG("m_bSaveWH="<<m_bSaveWH);
+ }
m_hiredisTool.pushImageBuf(m_filename,info.img);
m_hiredisTool.addFileInfo(m_filename,RECORD_DOING);
@@ -44,6 +53,7 @@
// DBG("sdkTrigger:" << sdkTrigger);
m_hiredisTool.pushImageBuf(m_filename,info.img);
m_hiredisTool.addFileInfo(m_filename,RECORD_ENDING);
+
}
void NewRecordVideoElement::doRecord() {
@@ -80,7 +90,7 @@
QDateTime dt = QDateTime::fromString(QString::fromStdString(timeStamp), "yyyy-MM-dd hh:mm:ss:zzz");
std::string t_strTime=dt.toString("yyyyMMddhh").toStdString();
- DBG("t_strTime="<<t_strTime);
+ // DBG("t_strTime="<<t_strTime);
t_FilePath.append(camID + "/" + t_strTime.substr(0, 6)+ "/" +t_strTime.substr(6, 2) + "/");
//YYYYMMDDHH
t_FilePath.append(t_strTime.substr(0,10)+ "/");
@@ -93,16 +103,22 @@
}
void NewRecordVideoElement::pushImgBuf(const std::string& time,cv::Mat& img)
{
+// std::string tmp="camId="+camID+"pushImgBuf";
+// ClockTimer cl(tmp);
ImgInfo info;
img.copyTo(info.img);
// info.img=img;
info.time=time;
m_imgBufQue.push(info);
+ // if(isRecord)
+ // DBG("camId="<<camID<<"pushtime="<<info.time);
// int size=m_imgBufQue.size();
// DBG("m_imgBufQue size="<<size);
}
void NewRecordVideoElement::getImg(ImgInfo& info)
{
+// std::string tmp="camId="+camID+"getImg";
+// ClockTimer cl(tmp);
info=m_imgBufQue.front();
int size=m_imgBufQue.size();
// DBG("m_imgBufQue size="<<size<<" camId="<<camID<<" fileMin="<<fileMin/2);
@@ -110,19 +126,20 @@
{
m_imgBufQue.pop();
}
-
-
-
- }
- void NewRecordVideoElement::threadFunc()
- {
-// Record();
- }
- void NewRecordVideoElement::threadInitial()
- {
+// if(isRecord)
+// DBG("camId="<<camID<<"gettime="<<info.time);
}
+// void NewRecordVideoElement::threadFunc()
+// {
+// Record();
+// }
+// void NewRecordVideoElement::threadInitial()
+// {
+
+
+// }
void NewRecordVideoElement::Record() {
switch(recordStatus)
@@ -193,6 +210,8 @@
}
}
void NewRecordVideoElement::setSdkTrigger(bool isTrigger) {
+// std::string tmp="camId="+camID+"setSdkTrigger";
+// ClockTimer cl(tmp);
if(isTrigger)
{
// DBG("setSdkTrigger time=" << AppUtil::getTimeUSecString());
@@ -213,8 +232,8 @@
void NewRecordVideoElement::recordInit(int videoMin, int videoMax) {
sdkTrigger = false;
- fileMin = videoMin;
- fileMax = videoMax;
+ fileMin = videoMin*8;//fps=8
+ fileMax = videoMax*8;
triggerDelay = fileMin/2;
recordStatus = RECORD_STOP;
--
Gitblit v1.8.0