From db043cb402515837303880cb0948d060e9d76490 Mon Sep 17 00:00:00 2001 From: chenshijun <csj_sky@126.com> Date: 星期一, 15 四月 2019 17:13:16 +0800 Subject: [PATCH] 整合代码 --- QiaoJiaSystem/GB28181DecoderModel/FFmpegDecoderJPG.cpp | 22 +++++----------------- 1 files changed, 5 insertions(+), 17 deletions(-) diff --git a/QiaoJiaSystem/GB28181DecoderModel/FFmpegDecoderJPG.cpp b/QiaoJiaSystem/GB28181DecoderModel/FFmpegDecoderJPG.cpp index f1386f5..299ec03 100644 --- a/QiaoJiaSystem/GB28181DecoderModel/FFmpegDecoderJPG.cpp +++ b/QiaoJiaSystem/GB28181DecoderModel/FFmpegDecoderJPG.cpp @@ -5,7 +5,6 @@ #include <zconf.h> #include <opencv2/opencv.hpp> #include "FFmpegDecoderJPG.h" -#include <cstring> void BASICGB28181::initFFmpeg() { av_register_all(); @@ -280,19 +279,9 @@ // BASICGB28181::avframe_to_cvmat(frame).copyTo(p_this->m_image); p_this->m_image = std::move(BASICGB28181::avframe_to_cvmat(p_this->frame)); if(p_this->m_image.empty()) { - ERR("camID:" << p_this->m_camIdx << " frameW:" << p_this->frame->width << "frame.data.len" << strlen(p_this->frame->data[0])); + ERR("camID:" << p_this->m_camIdx << " frameW:" << p_this->frame->width); continue; } -// else { -// static int count =0; -// count ++; -// if(count > 100){ -// ERR("camID:" << p_this->m_camIdx << " cols:" << p_this->m_image.cols <<\ -// " rows:" << p_this->m_image.rows << " channels:" << p_this->m_image.channels()); -// count = 0; -// } -// -// } // 灏唅甯т繚瀛樹负蹇収 if (p_this->m_SnapshotNotSaveRet && (p_this->pkt.flags & AV_PKT_FLAG_KEY)) { try { @@ -332,7 +321,6 @@ #endif //瑙﹀彂涓婂眰淇″彿 gSignalLock.emitSigal(p_this->m_camIdx + "DecoderImageOK"); -// DBG("emitSigal: " << p_this->m_camIdx); //#ifdef TestCode // DBG("emitSigal(\"DecoderImageOK\") after"); //#endif @@ -450,7 +438,7 @@ if (!m_packetsVec.empty()) { auto iter = m_packetsVec.begin(); while (iter->m_frameId < lastFrameId) { - INFO("DropFrame: " << iter->m_frameId); +// INFO("DropFrame: " << iter->m_frameId); delete iter->m_packet.data; iter = m_packetsVec.erase(iter); } @@ -480,7 +468,7 @@ bool BASICGB28181::FFmpegDecoderJPG::SaveVideo(std::string path, int64_t lastFrameId) { std::lock_guard<std::mutex> lock(g_mutex); - INFO("SaveVideo: " << path << "m_packetsVec.size : " << m_packetsVec.size()); +// INFO("SaveVideo: " << path << "m_packetsVec.size : " << m_packetsVec.size()); if (!m_packetsVec.empty()) { startWrite(path.c_str()); int64_t firstKeyFramePts = m_packetsVec[0].m_packet.pts; @@ -488,7 +476,7 @@ unsigned long int frame_index = 0; for (const auto &item:m_packetsVec) { if (item.m_frameId < lastFrameId) { - DBG("item.m_frameId < lastFrameId " << item.m_frameId << " " << lastFrameId); +// DBG("item.m_frameId < lastFrameId " << item.m_frameId << " " << lastFrameId); conversion(const_cast<AVPacket *> (&item.m_packet), firstKeyFramePts, firstKeyFrameDts, video_st, frame_index); frame_index++; @@ -634,7 +622,7 @@ AVPacket *pkg = static_cast<AVPacket *>(packet); - DBG("frame_index==%d\n" << frame_index); +// DBG("frame_index==\n" << frame_index); //Write PTS AVRational time_base1 = inStream->time_base; //Duration between 2 frames (us) -- Gitblit v1.8.0