From c73d6fde347cfb6e0386ab1c651e8f38f939e89e Mon Sep 17 00:00:00 2001 From: pansen <pansen626@sina.com> Date: 星期三, 06 三月 2019 11:49:03 +0800 Subject: [PATCH] GB28181集成完成。录像bug暂未解决,已注释 --- QiaoJiaSystem/GB28181DecoderModel/FFmpegDecoderJPG.cpp | 22 ++++++++++++++-------- 1 files changed, 14 insertions(+), 8 deletions(-) diff --git a/QiaoJiaSystem/GB28181DecoderModel/FFmpegDecoderJPG.cpp b/QiaoJiaSystem/GB28181DecoderModel/FFmpegDecoderJPG.cpp index ebf1de9..5106cbf 100644 --- a/QiaoJiaSystem/GB28181DecoderModel/FFmpegDecoderJPG.cpp +++ b/QiaoJiaSystem/GB28181DecoderModel/FFmpegDecoderJPG.cpp @@ -128,6 +128,10 @@ return bufsize; } +/*** + * 瑙g爜绾跨▼ + * @param p_this + */ void BASICGB28181::FFmpegDecoderJPG::BareFlowDecoderThd(FFmpegDecoderJPG *p_this) { DBG(p_this->m_camIdx << " BareFlowDecoderThd ok ... gpuIdx is " << p_this->m_gpuIdx); p_this->m_running = true; @@ -188,11 +192,6 @@ //# todo save package p_this->frame_number++; - //DBG("GotPicture "<<m_camId<<":"<<frame_number); - //鏀惧湪姝ゅ鏄洜涓轰箣鍓嶆斁鍦ㄥ墠闈�,鏀跺埌鐨勫抚涓嶅畬鎴� - p_this->SaveToPacketVector(pkt); - p_this->CheckSave(); - int err6 = avcodec_send_packet(ctx, &pkt); av_packet_unref(&pkt); int err7 = avcodec_receive_frame(ctx, frame); @@ -201,12 +200,17 @@ usleep(40000); continue; } + //DBG("GotPicture "<<m_camId<<":"<<frame_number); + //鏀惧湪姝ゅ鏄洜涓轰箣鍓嶆斁鍦ㄥ墠闈�,鏀跺埌鐨勫抚涓嶅畬鎴� + p_this->SaveToPacketVector(pkt); + p_this->CheckSave(); + // BASICGB28181::avframe_to_cvmat(frame).copyTo(p_this->m_image); p_this->m_image = std::move(BASICGB28181::avframe_to_cvmat(frame)); #ifdef TestCode { -// TestCode +// TestCode 娴嬭瘯浠g爜淇濆瓨鍥剧墖鍒版湰鍦� ClockTimer cl("TestCode"); std::string strNewTime2 = AppUtil::getTimeUSecString(); cv::putText(p_this->m_image, strNewTime2, cv::Point(408, 540), cv::HersheyFonts::FONT_HERSHEY_PLAIN, @@ -228,7 +232,7 @@ #ifdef TestCode DBG("emitSigal(\"DecoderImageOK\") begin"); #endif - + //瑙﹀彂淇″彿 gSignalLock.emitSigal(p_this->m_camIdx + "DecoderImageOK"); //#ifdef TestCode // DBG("emitSigal(\"DecoderImageOK\") after"); @@ -278,7 +282,7 @@ bool BASICGB28181::FFmpegDecoderJPG::stopThd() { TryCath( - DBG(m_camIdx << " FFmpegDecoderJPG stopThd ... "); + DBG(m_camIdx << " FFmpegDecoderJPG stopThd ... " << m_camIdx); m_running = false; ); return true; @@ -380,9 +384,11 @@ int64_t firstKeyFrameDts = m_packetsVec[0].m_packet.dts; for (const auto &item:m_packetsVec) { if (item.m_frameId < lastFrameId) { + DBG("item.m_frameId < lastFrameId " << item.m_frameId << " " << lastFrameId); conversion(const_cast<AVPacket *> (&item.m_packet), firstKeyFramePts, firstKeyFrameDts, video_st); av_write_frame(m_pOutFmtCtx, &item.m_packet); } else { + DBG("item.m_frameId > lastFrameId " << item.m_frameId << " " << lastFrameId); break; } } -- Gitblit v1.8.0