From d3b7bbe7102cd089680a828f5d8f6402c8cf6342 Mon Sep 17 00:00:00 2001 From: pansen <pansen626@sina.com> Date: 星期四, 07 三月 2019 14:43:28 +0800 Subject: [PATCH] GB28181集成完成,集成推流模块 --- QiaoJiaSystem/VideoToImage/RtspCaptureElement.cpp | 31 +++++++++++++++++-------------- 1 files changed, 17 insertions(+), 14 deletions(-) diff --git a/QiaoJiaSystem/VideoToImage/RtspCaptureElement.cpp b/QiaoJiaSystem/VideoToImage/RtspCaptureElement.cpp index 5053e4b..67ad6cd 100644 --- a/QiaoJiaSystem/VideoToImage/RtspCaptureElement.cpp +++ b/QiaoJiaSystem/VideoToImage/RtspCaptureElement.cpp @@ -16,10 +16,14 @@ m_capture = new CvCapture_FFMPEG(m_camId); } +//瀹氭椂鎵ц,灏� void RtspCaptureElement::timerFunc() { - u_char *data; - int width = 0, height = 0, step = 0, cn = 0; + u_char *data = nullptr; + int width = 0; + int height = 0; + int step = 0; + int cn = 0; DBG("GRABFrame "<<m_camId); bool ret = m_capture->grabFrame(); if (!ret) { @@ -44,14 +48,7 @@ m_picCount.store(0); } - //姣忎釜Cam鐨勯槦鍒楁渶澶歁_CAM_PIC_MAX_COUNT寮� { - /*ClockTimer timer("RedisTime "); - auto imageCount = m_redisTool.getSize(m_camId); - if (imageCount > M_CAM_PIC_MAX_COUNT) { - ERR("Too Much Pics In Cam " << m_camId << " QUeue"); - return; - }*/ ClockTimer timer("FrameToImage"); m_capture->retrieveFrame(0, &data, &step, &width, &height, &cn); @@ -59,10 +56,6 @@ cv::Mat copyMat; img.copyTo(copyMat); std::string imageName = m_capture->GetImageName(); - /*ClockTimer SetImageValueTimer("RedisTimeSetKey "); - m_redisTool.setKeyImage(imageName, copyMat); - ClockTimer SetImageNameTimer("RedisTimeSetKey "); - m_redisTool.listLpush(m_camId, imageName);*/ } fireConnectors(); } @@ -102,14 +95,22 @@ if(m_gpuIndex>=0){ setenv("CUDA_VISIBLE_DEVICES", std::to_string(m_gpuIndex).c_str(),0); } - m_capture->open(m_path.c_str(),m_gpuIndex>=0); + bool bResult = m_capture->open(m_path.c_str(),m_gpuIndex>=0); + if(bResult) + { + INFO("GPUIndex: "<<m_gpuIndex<<" VideoPath:"<<m_path<<" Succeed"); + } else{ + ERR("GPUIndex: "<<m_gpuIndex<<" VideoPath:"<<m_path<<" Failed"); + } } +//绾跨▼鍚姩涔嬪墠璋冪敤, void RtspCaptureElement::threadInitial() { openVideo(); } +//绾跨▼缁撴潫鐨勬椂鍊欒皟鐢�,鍏抽棴ffmpeg娴� void RtspCaptureElement::threadClosing() { m_capture->close(); @@ -117,8 +118,10 @@ m_capture = nullptr; } +//璁剧疆淇濆瓨瑙嗛鐨勬渶灏忓拰鏈�澶ф椂闀� void RtspCaptureElement::SetVideoMinMaxSeconds(const int minSeconds, const int maxSeconds) { + INFO("VideoMinSeconds: "<<minSeconds<<" VideoMaxSeconds: "<<maxSeconds); m_capture->SetMinMaxVideoSeconds(minSeconds,maxSeconds); } -- Gitblit v1.8.0