| | |
| | | #include <zconf.h> |
| | | #include <opencv2/opencv.hpp> |
| | | #include "FFmpegDecoderJPG.h" |
| | | #include <cstring> |
| | | |
| | | void BASICGB28181::initFFmpeg() { |
| | | av_register_all(); |
| | |
| | | |
| | | // 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])); |
| | | 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; |
| | | // } |
| | | // |
| | | // } |
| | | // 将i帧保存为快照 |
| | | if (p_this->m_SnapshotNotSaveRet && (p_this->pkt.flags & AV_PKT_FLAG_KEY)) { |
| | | try { |
| | |
| | | #endif |
| | | //触发上层信号 |
| | | gSignalLock.emitSigal(p_this->m_camIdx + "DecoderImageOK"); |
| | | // DBG("emitSigal: " << p_this->m_camIdx); |
| | | //#ifdef TestCode |
| | | // DBG("emitSigal(\"DecoderImageOK\") after"); |
| | | //#endif |
| | |
| | | m_frameIndex++; |
| | | m_packetsVec.push_back({m_frameIndex, newPacket}); |
| | | if (newPacket.flags & AV_PKT_FLAG_KEY) { |
| | | DBG("newPacket.flags & AV_PKT_FLAG_KEY "); |
| | | // DBG("newPacket.flags & AV_PKT_FLAG_KEY "); |
| | | m_last_I_FrameId = m_frameIndex; |
| | | } |
| | | } |