From 641eab08f214327f107ee6e96f9209f24baedabb Mon Sep 17 00:00:00 2001
From: zhangjixing <775834166@qq.com>
Date: 星期六, 05 一月 2019 19:23:20 +0800
Subject: [PATCH] 编码使用redis,多路存在问题,先传一版
---
QiaoJiaSystem/DataManagerServer/http_configserver.cpp | 42 ++++++++++++++++++++++++++++++------------
1 files changed, 30 insertions(+), 12 deletions(-)
diff --git a/QiaoJiaSystem/DataManagerServer/http_configserver.cpp b/QiaoJiaSystem/DataManagerServer/http_configserver.cpp
index 65fdc9e..6e5fc48 100644
--- a/QiaoJiaSystem/DataManagerServer/http_configserver.cpp
+++ b/QiaoJiaSystem/DataManagerServer/http_configserver.cpp
@@ -2371,9 +2371,27 @@
std::string str_tmpTime = AppUtil::getCmdResult(cmd_getVideoFileTime);
+
+
if (str_time > str_tmpTime) {
- ERR("{\"error\":\"Time error\"}" << str_time << " str_tmpTime " << str_tmpTime);
- str_time = str_tmpTime.size() > 0 ? str_tmpTime : str_time;
+
+ //str_time = str_tmpTime.size() > 0 ? str_tmpTime : str_time;
+ qint64 v_time=getVideoTime(str_tmpTime)-1000;
+ int haomiao = (v_time % 1000) > 50 ? ((v_time % 1000) - 50) : 0;
+ v_time /= 1000;
+ int m = v_time;
+ int shi, fen, miao;
+ char ch_time[128];
+ if (m / 3600 < 24) {
+ shi = m / 3600;
+ fen = m / 60 % 60;
+ miao = m % 60;
+ sprintf(ch_time, "%02d:%02d:%02d.%02d", shi, fen, miao, haomiao / 10);
+
+ } else printf("杈撳叆鏁板�煎お澶�");
+
+ str_time=ch_time;
+ ERR("{\"error\":\"Time error\"}" << str_time << " str_tmpTime " << str_tmpTime<<" ch_time="<<ch_time);
// return "{\"error\":\"Time error\"}";
}
@@ -2554,7 +2572,7 @@
DBG("path=" << vec[i]);
t_FilePath += vec[i] + ".mp4";
sub = t - t1;
- find = sub < getVideoTime(t_FilePath);
+// find = sub < getVideoTime(t_FilePath);
break;
}
@@ -2564,7 +2582,7 @@
DBG("path=" << vec[i]);
t_FilePath += vec[i] + ".mp4";
- find = sub < getVideoTime(t_FilePath);
+// find = sub < getVideoTime(t_FilePath);
DBG("find:" << find);
break;
@@ -2574,18 +2592,18 @@
}
DBG("sub=" << sub);
- if (!find) {
- t_FilePath = "";
- }
+// if (!find) {
+// t_FilePath = "";
+// }
return t_FilePath;
}
-qint64 devHttpServer_c::getVideoTime(const std::string &videoPath) {
- std::string cmd_getVideoFileTime(
- " ffmpeg -i '" + videoPath + "' 2>&1 | grep 'Duration' | cut -d ' ' -f 4 | sed s/,//");
+qint64 devHttpServer_c::getVideoTime(/*const std::string &videoPath,*/std::string& str_tmpTime) {
+// std::string cmd_getVideoFileTime(
+// " ffmpeg -i '" + videoPath + "' 2>&1 | grep 'Duration' | cut -d ' ' -f 4 | sed s/,//");
- std::string str_tmpTime = AppUtil::getCmdResult(cmd_getVideoFileTime);
+// str_tmpTime = AppUtil::getCmdResult(cmd_getVideoFileTime);
DBG("str_tmpTime:" << str_tmpTime);//00:00:06.89
qint64 len_ms = 0;
@@ -2814,4 +2832,4 @@
return "";
// return "{\"error\":\"浼犺緭閿欒锛岃妫�鏌ワ紒\"}";
}
-}
\ No newline at end of file
+}
--
Gitblit v1.8.0