| | |
| | | |
| | | 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\"}"; |
| | | } |
| | | |
| | |
| | | DBG("path=" << vec[i]); |
| | | t_FilePath += vec[i] + ".mp4"; |
| | | sub = t - t1; |
| | | find = sub < getVideoTime(t_FilePath); |
| | | // find = sub < getVideoTime(t_FilePath); |
| | | break; |
| | | } |
| | | |
| | |
| | | DBG("path=" << vec[i]); |
| | | t_FilePath += vec[i] + ".mp4"; |
| | | |
| | | find = sub < getVideoTime(t_FilePath); |
| | | // find = sub < getVideoTime(t_FilePath); |
| | | |
| | | DBG("find:" << find); |
| | | break; |
| | |
| | | |
| | | } |
| | | 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; |
| | | |
| | |
| | | return ""; |
| | | // return "{\"error\":\"传输错误,请检查!\"}"; |
| | | } |
| | | } |
| | | } |