| | |
| | | // 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_SnapshotNotSaveRet && (p_this->pkt.flags & AV_PKT_FLAG_KEY)) { |
| | | try { |
| | | std::string strNewName = "./"; |
| | | strNewName.append(p_this->m_camIdx).append(".jpg"); |
| | | cv::imwrite(strNewName, p_this->m_image); |
| | | p_this->m_SnapshotNotSaveRet = false; |
| | | } catch (std::exception ex) { |
| | | ERR(ex.what()); |
| | | } |
| | | } |
| | | |
| | | |
| | | #ifdef TestCode |
| | | { |
| | | // TestCode 测试代码保存图片到本地 |
| | |
| | | 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, frame_index); |
| | | conversion(const_cast<AVPacket *> (&item.m_packet), firstKeyFramePts, firstKeyFrameDts, video_st, |
| | | frame_index); |
| | | frame_index++; |
| | | av_write_frame(m_pOutFmtCtx, &item.m_packet); |
| | | } else { |
| | |
| | | int stopWrite(); |
| | | |
| | | //对packet做转换 |
| | | void conversion(void *packet, const long int &firstKeyPts, const long int &firstKeyDts, void *inVideoStream, unsigned long int frame_index = 0); |
| | | void conversion(void *packet, const long int &firstKeyPts, const long int &firstKeyDts, void *inVideoStream, |
| | | unsigned long int frame_index = 0); |
| | | |
| | | bool m_bstartWrite = {false}; |
| | | bool m_bFirstKeyFrame = {false}; |
| | |
| | | int m_gpuIdx; |
| | | int m_fps; |
| | | bool m_PackageState; |
| | | bool m_SnapshotNotSaveRet{true}; |
| | | std::string m_camIdx; |
| | | |
| | | MyQueue<frameBuffInfo *> m_rtpQueue; |