From 4f70d72daca6818a8a7ba36d794b0cd7f985cbcc Mon Sep 17 00:00:00 2001 From: pansen <pansen626@sina.com> Date: 星期四, 10 一月 2019 18:23:04 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/ywv1.2' into ywv1.2 --- QiaoJiaSystem/DataManagerServer/http_configserver.cpp | 46 ++++++++++++++++++++++++++++++++-------------- 1 files changed, 32 insertions(+), 14 deletions(-) diff --git a/QiaoJiaSystem/DataManagerServer/http_configserver.cpp b/QiaoJiaSystem/DataManagerServer/http_configserver.cpp index 65fdc9e..d27d6fd 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\"}"; } @@ -2541,8 +2559,8 @@ qint64 t = dt.toMSecsSinceEpoch(); std::vector<std::string> vec = forEachFile(t_FilePath); std::sort(vec.begin(), vec.end()); - DBG("t_FilePath" << t_FilePath); - DBG("vec.size()" << vec.size()); +// DBG("t_FilePath" << t_FilePath); +// DBG("vec.size()" << vec.size()); int size = vec.size(); for (int i = 0; i < size; ++i) { qint64 t1 = QDateTime::fromString(QString::fromStdString(vec[i]), @@ -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