| | |
| | | #ifdef TestCode |
| | | DBG("waitSignal(\"DecoderImageOK\") after"); |
| | | #endif |
| | | // 从ffmpeg解码类中获取图片 |
| | | p_this->m_fFmpegDecoderJPG.getImage().copyTo(p_this->m_image); |
| | | |
| | | { |
| | | if (p_this->m_publishVideoRet) { |
| | | if (p_this->videoPublishElement == nullptr) { |
| | |
| | | cv::Size size_(appConfig.getIntProperty("pulish.width"), appConfig.getIntProperty("pulish.height")); |
| | | int gupIdx = appPref.getIntData("gpu.index"); |
| | | DBG("videoPublishpath: " << p_this->m_chanPubID << path << " h:" << size_.height); |
| | | p_this->videoPublishElement = new ffmpeg::VideoPublishElement(path, size_, "flv", 25, gupIdx); |
| | | p_this->videoPublishElement = new ffmpeg::PipeVideoPublishElement(path, size_, "flv", 25, gupIdx); |
| | | p_this->videoPublishElement->start(); |
| | | } else { |
| | | // DBG("videoPublishElement->setImage() : " << p_this->m_chanPubID); |
| | | if (!p_this->m_image.empty()) { |
| | | p_this->videoPublishElement->setImage(p_this->m_image); |
| | | p_this->videoPublishElement->submit(); |
| | | } else { |
| | | ERR("m_image.empty()"); |
| | | } |
| | |
| | | p_this->m_picCount.store(0); |
| | | } |
| | | |
| | | // 从ffmpeg解码类中获取图片 |
| | | p_this->m_fFmpegDecoderJPG.getImage().copyTo(p_this->m_image); |
| | | { |
| | | cv::Mat copyMat; |
| | | std::string imageName = p_this->m_fFmpegDecoderJPG.GetImageName(); |
| | |
| | | //用来保存录像视频的路径 |
| | | std::string m_cutPath; |
| | | std::atomic<bool> m_publishVideoRet{false}; |
| | | ffmpeg::VideoPublishElement * videoPublishElement{nullptr}; |
| | | ffmpeg::PipeVideoPublishElement * videoPublishElement{nullptr}; |
| | | private: |
| | | /*** |
| | | * 启动实时流接收数据线程 |
| | |
| | | string path = appConfig.getStringProperty("srsAddr") + "cam" + m_camId + ".flv"; |
| | | cv::Size size_(appConfig.getIntProperty("pulish.width"), appConfig.getIntProperty("pulish.height")); |
| | | int gupIdx = appPref.getIntData("gpu.index"); |
| | | videoPublishElement = new ffmpeg::VideoPublishElement(path, size_, "flv", 25, gupIdx); |
| | | videoPublishElement = new ffmpeg::PipeVideoPublishElement(path, size_, "flv", 25, gupIdx); |
| | | videoPublishElement->start(); |
| | | } else { |
| | | // DBG("videoPublishElement->setImage()"); |
| | |
| | | |
| | | if (!copyMat.empty()) { |
| | | videoPublishElement->setImage(copyMat); |
| | | videoPublishElement->submit(); |
| | | } else { |
| | | DBG("copyMat.empty()"); |
| | | } |
| | |
| | | //几张选一张放入Redis |
| | | m_picCount++; |
| | | if (m_picCount % m_nPicsPickOne != 0) { |
| | | // return; |
| | | return; |
| | | } else { |
| | | m_picCount.store(0); |
| | | |
| | | if (copyMat.empty()) { |
| | | // ERR("copyMat.empty()"); |
| | | m_capture->retrieveFrame(0, &data, &step, &width, &height, &cn); |
| | | cv::Mat img(height, width, CV_8UC3, data, step); |
| | | img.copyTo(copyMat); |
| | | } |
| | | std::string imageName = m_capture->GetImageName(); |
| | | m_pManager->SaveImageToRedis(m_camId, imageName, copyMat); |
| | | } |
| | | |
| | | if (copyMat.empty()) { |
| | | // ERR("copyMat.empty()"); |
| | | m_capture->retrieveFrame(0, &data, &step, &width, &height, &cn); |
| | | cv::Mat img(height, width, CV_8UC3, data, step); |
| | | img.copyTo(copyMat); |
| | | } |
| | | std::string imageName = m_capture->GetImageName(); |
| | | m_pManager->SaveImageToRedis(m_camId, imageName, copyMat); |
| | | |
| | | fireConnectors(); |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | std::atomic<bool> m_publishVideoRet{false}; |
| | | ffmpeg::VideoPublishElement *videoPublishElement{nullptr}; |
| | | ffmpeg::PipeVideoPublishElement *videoPublishElement{nullptr}; |
| | | // Redis的工具类 |
| | | // HiredisTool m_redisTool; |
| | | |