|
@@ -1,5 +1,6 @@
|
|
|
package com.sckj.camera.service;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.sckj.camera.hik.HCNetTools;
|
|
|
import com.sckj.camera.manager.CameraProperties;
|
|
@@ -16,21 +17,23 @@ import com.sckj.common.aop.CameraLogin;
|
|
|
import com.sckj.common.exception.OperateException;
|
|
|
import com.sckj.common.util.UrlUtils;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import javax.annotation.PostConstruct;
|
|
|
+import javax.annotation.PreDestroy;
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.File;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
|
|
|
@Service
|
|
|
@Transactional
|
|
@@ -73,91 +76,121 @@ public class CameraServiceImpl extends ServiceImpl<CameraMapper, Camera> {
|
|
|
str.append(cameraDTO.getChannelList().get(i)).append("&");
|
|
|
}
|
|
|
}
|
|
|
- resultDTO.setMsg(str.toString());
|
|
|
+ resultDTO.setResult(str.toString());
|
|
|
System.out.println(cameraProperties);
|
|
|
return resultDTO;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 开始推流(rtsp->rtmp)
|
|
|
+ * 所有可用摄像头开始推流(rtsp->rtmp)
|
|
|
*
|
|
|
- * @param cameraDTO 相机信息
|
|
|
+ * @param
|
|
|
* @return ResultDTO
|
|
|
*/
|
|
|
- @CameraLogin
|
|
|
- public ResultDTO startTranscode(CameraDTO cameraDTO) {
|
|
|
- ResultDTO resultDTO = new ResultDTO();
|
|
|
- if (ObjectUtils.isEmpty(cameraDTO)) {
|
|
|
- resultDTO.setMsg("未找到设备");
|
|
|
- return resultDTO;
|
|
|
+ // @PostConstruct
|
|
|
+ public List<ResultDTO> startTranscodeList() {
|
|
|
+ logger.info("自动开启视频推送");
|
|
|
+ QueryWrapper<Camera> queryWrapper = new QueryWrapper<>();
|
|
|
+ //排除禁用的设备
|
|
|
+ queryWrapper.lambda().ne(Camera::getStatus, "0").eq(Camera::getType,"1");
|
|
|
+
|
|
|
+ List<Camera> cameraList = list(queryWrapper);
|
|
|
+ if (ObjectUtils.isEmpty(cameraList)) {
|
|
|
+ return null;
|
|
|
}
|
|
|
+ List<ResultDTO> resultDTOList = new ArrayList<>();
|
|
|
+ for (Camera camera : cameraList) {
|
|
|
+ ResultDTO resultDTO = new ResultDTO();
|
|
|
+ CameraDTO cameraDTO = new CameraDTO();
|
|
|
+ BeanUtils.copyProperties(camera, cameraDTO);
|
|
|
+ HCNetTools hcNetTools = new HCNetTools();
|
|
|
+ int userId = hcNetTools.deviceLogin(camera.getIp(), camera.getPort(), camera.getAccount(), camera.getPassword());
|
|
|
+ if (userId > -1) {
|
|
|
+ //登录成功
|
|
|
+ List<String> channelNumberList = hcNetTools.getChannelNumber();
|
|
|
+ if (ObjectUtils.isEmpty(channelNumberList)) {
|
|
|
+ resultDTO.setResult("通道获取失败");
|
|
|
+ } else {
|
|
|
+ int channelNumber = HikCameraUtils.analyzeChannel(channelNumberList.get(0));
|
|
|
+ String appName = cameraDTO.getAccount() + cameraDTO.getIp().replace(".", "");
|
|
|
+ String channelNumberStr = channelNumber + "02"; //新通道(2012年之后设备,02代表子码流)
|
|
|
+ String rtspName = "rtsp://" + cameraDTO.getAccount() + ":" + cameraDTO.getPassword() + "@" + cameraDTO.getIp() + ":554/" + channelNumberStr + "?transportmode=unicast"; //新码流
|
|
|
+ pushStream(cameraDTO, appName, rtspName);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ resultDTO.setResult("login failed");
|
|
|
+ }
|
|
|
+ resultDTOList.add(resultDTO);
|
|
|
+ }
|
|
|
+ return resultDTOList;
|
|
|
+ }
|
|
|
|
|
|
- String appName = cameraDTO.getAccount() + cameraDTO.getIp().replace(".", "");
|
|
|
-
|
|
|
-// if (channelNumber == -1) {
|
|
|
-// logger.info("实时流-未搜索到ip:" + cameraDTO.getIp() + ", ipc:" + cameraDTO.getIpcAddress() + " 的设备");
|
|
|
-// }
|
|
|
-
|
|
|
+ /***
|
|
|
+ * 推送即时视频并保存到本地
|
|
|
+ * @param cameraDTO
|
|
|
+ * @param appName
|
|
|
+ * @param rtspName
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private ResultDTO pushStream(CameraDTO cameraDTO, String appName, String rtspName) {
|
|
|
String rtmpUrl = "rtmp://" + cameraProperties.getRtmp().getRtmphost() + "/live/" + appName; //rtmp链
|
|
|
- String flvUrl = "http://" + cameraProperties.getRtmp().getHttphost() + "/live/" + appName + ".flv"; //http-flv链
|
|
|
+ String flvUrl = "http://" + cameraProperties.getRtmp().getHttphost() + "/live/" + appName + ".live.flv"; //live-flv链
|
|
|
String hlsUrl = "http://" + cameraProperties.getRtmp().getHttphost() + "/live/" + appName + "/hls.m3u8"; //hls链
|
|
|
|
|
|
- boolean runFlag = ffmpegService.taskerIsRun(appName);
|
|
|
CameraFlow cameraFlow = flowService.findByRtmpUrl(rtmpUrl);
|
|
|
- if (cameraFlow != null && !runFlag) {
|
|
|
+ if (cameraFlow != null) {
|
|
|
+ //终止推流
|
|
|
+ ffmpegService.stopTranscoding(appName);
|
|
|
+ //删除流路径
|
|
|
flowService.removeById(cameraFlow.getId());
|
|
|
}
|
|
|
|
|
|
- if (runFlag) {
|
|
|
- //已推流
|
|
|
- if (cameraFlow != null) {
|
|
|
- resultDTO.setTaskName(appName);
|
|
|
- resultDTO.setMsg(HikCameraUtils.resultNames[0]);
|
|
|
- resultDTO.setRtmpUrl(rtmpUrl);
|
|
|
- resultDTO.setFlvUrl(flvUrl);
|
|
|
- resultDTO.setHlsUrl(hlsUrl);
|
|
|
- cameraFlow.setClient(cameraFlow.getClient() + 1);
|
|
|
- flowService.updateById(cameraFlow);
|
|
|
- } else {
|
|
|
- //停止推流
|
|
|
- flowService.stopByTaskName(appName);
|
|
|
- resultDTO.setMsg("推流失败");
|
|
|
- return resultDTO;
|
|
|
- }
|
|
|
+ //开始推流
|
|
|
+ String taskName = ffmpegService.startTranscoding(appName, rtspName, rtmpUrl);
|
|
|
+ ResultDTO resultDTO = new ResultDTO();
|
|
|
+ if (ObjectUtils.isNotEmpty(taskName)) {
|
|
|
+ resultDTO.setTaskName(taskName);
|
|
|
+ resultDTO.setResult("success");
|
|
|
+ resultDTO.setRtmpUrl(rtmpUrl);
|
|
|
+ resultDTO.setFlvUrl(flvUrl);
|
|
|
+ resultDTO.setHlsUrl(hlsUrl);
|
|
|
+
|
|
|
+ cameraFlow = new CameraFlow();
|
|
|
+ cameraFlow.setCameraId(cameraDTO.getId());
|
|
|
+ cameraFlow.setTaskName(taskName);
|
|
|
+ cameraFlow.setFlowType(FlowUtils.FlowType.HIK.ordinal());
|
|
|
+ cameraFlow.setRtsp(rtspName);
|
|
|
+ cameraFlow.setRtmp(rtmpUrl);
|
|
|
+ cameraFlow.setFlv(flvUrl);
|
|
|
+ cameraFlow.setHls(hlsUrl);
|
|
|
+ cameraFlow.setClient(1);
|
|
|
+ cameraFlow.setCreateTime(new Date());
|
|
|
+ cameraFlow.setUpdateTime(new Date());
|
|
|
+ flowService.save(cameraFlow);
|
|
|
} else {
|
|
|
- //未推流
|
|
|
- String channelNumberStr = cameraDTO.getChannelNumber() + "02"; //新通道(2012年之后设备,02代表子码流)
|
|
|
-
|
|
|
- String rtspName = cameraDTO.getAccount() + ":" + cameraDTO.getPassword() + "@" + cameraDTO.getIp() + ":554/" + channelNumberStr + "?transportmode=unicast"; //新码流
|
|
|
- String rtmpName = cameraProperties.getRtmp().getRtmphost() + "/live/"; //rtmp服务器推流入口
|
|
|
-
|
|
|
- String tasker = ffmpegService.startTranscoding(appName, rtspName, rtmpName);
|
|
|
- if (StringUtils.isNotEmpty(tasker)) {
|
|
|
- resultDTO.setTaskName(tasker);
|
|
|
- resultDTO.setMsg(HikCameraUtils.resultNames[0]);
|
|
|
- resultDTO.setRtmpUrl(rtmpUrl);
|
|
|
- resultDTO.setFlvUrl(flvUrl);
|
|
|
- resultDTO.setHlsUrl(hlsUrl);
|
|
|
-
|
|
|
- //添加流记录
|
|
|
- cameraFlow = new CameraFlow();
|
|
|
- cameraFlow.setCameraId(cameraDTO.getId());
|
|
|
- cameraFlow.setTaskName(tasker);
|
|
|
- cameraFlow.setFlowType(FlowUtils.FlowType.HIK.ordinal());
|
|
|
- cameraFlow.setRtsp("rtsp://" + rtspName);
|
|
|
- cameraFlow.setRtmp(rtmpUrl);
|
|
|
- cameraFlow.setFlv(flvUrl);
|
|
|
- cameraFlow.setClient(1);
|
|
|
- cameraFlow.setCreateTime(new Date());
|
|
|
- cameraFlow.setUpdateTime(new Date());
|
|
|
- flowService.save(cameraFlow);
|
|
|
- } else {
|
|
|
- resultDTO.setMsg("推流失败");
|
|
|
- return resultDTO;
|
|
|
- }
|
|
|
+ resultDTO.setResult("failed");
|
|
|
}
|
|
|
return resultDTO;
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 开始推流(rtsp->rtmp)
|
|
|
+ *
|
|
|
+ * @param cameraDTO 相机信息
|
|
|
+ * @return ResultDTO
|
|
|
+ */
|
|
|
+ @CameraLogin
|
|
|
+ public ResultDTO startTranscode(CameraDTO cameraDTO) {
|
|
|
+ ResultDTO resultDTO = new ResultDTO();
|
|
|
+ if (ObjectUtils.isEmpty(cameraDTO)) {
|
|
|
+ resultDTO.setResult("未找到该设备");
|
|
|
+ return resultDTO;
|
|
|
+ }
|
|
|
+ String appName = cameraDTO.getAccount() + cameraDTO.getIp().replace(".", "");
|
|
|
+ String channelNumberStr = cameraDTO.getChannelNumber() + "02"; //新通道(2012年之后设备,02代表子码流)
|
|
|
+ String rtspName = "rtsp://" + cameraDTO.getAccount() + ":" + cameraDTO.getPassword() + "@" + cameraDTO.getIp() + ":554/" + channelNumberStr + "?transportmode=unicast"; //新码流
|
|
|
+ resultDTO = pushStream(cameraDTO, appName, rtspName);
|
|
|
+ return resultDTO;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -185,83 +218,23 @@ public class CameraServiceImpl extends ServiceImpl<CameraMapper, Camera> {
|
|
|
//摄像机
|
|
|
appName = "history" + cameraDTO.getVcr().getAccount() + cameraDTO.getVcr().getIp().replace(".", "") + "to" + cameraDTO.getIp().replace(".", "") + "start" + startTime + "end" + endTime;
|
|
|
} else {
|
|
|
- throw new OperateException("目前只支持录像机回放数据");
|
|
|
+ throw new OperateException("目前只支持带有录像机的回放数据");
|
|
|
//NVR
|
|
|
//appName = "history" + cameraDTO.getAccount() + cameraDTO.getIp().replace(".", "") + "to" + cameraDTO.getIpcAddress().replace(".", "") + "start" + startTime + "end" + endTime;
|
|
|
//channelNumber = HikCameraUtils.getIpcChannel(cameraDTO.getChannelList(), cameraDTO.getIpcAddress());
|
|
|
}
|
|
|
-
|
|
|
// if (channelNumber == -1) {
|
|
|
// logger.info("历史流-未搜索到ip:" + cameraDTO.getIp() + ", ipc:" + cameraDTO.getIpcAddress() + " 的设备");
|
|
|
// }
|
|
|
- String rtmpUrl = "rtmp://" + cameraProperties.getRtmp().getRtmphost() + "/live/" + appName; //rtmp链
|
|
|
- String flvUrl = "http://" + cameraProperties.getRtmp().getHttphost() + "/live/" + appName + ".flv"; //http-flv链
|
|
|
- String hlsUrl = "http://" + cameraProperties.getRtmp().getHttphost() + "/live/" + appName + "/hls.m3u8"; //hls链
|
|
|
-
|
|
|
- boolean runFlag = ffmpegService.taskerIsRun(appName);
|
|
|
- CameraFlow cameraFlow = flowService.findByRtmpUrl(rtmpUrl);
|
|
|
- if (cameraFlow != null && !runFlag) {
|
|
|
- flowService.removeById(cameraFlow.getId());
|
|
|
- }
|
|
|
-
|
|
|
- if (runFlag) {
|
|
|
- //已推流
|
|
|
- if (cameraFlow != null) {
|
|
|
- resultDTO.setTaskName(appName);
|
|
|
- resultDTO.setMsg(HikCameraUtils.resultNames[0]);
|
|
|
- resultDTO.setRtmpUrl(rtmpUrl);
|
|
|
- resultDTO.setFlvUrl(flvUrl);
|
|
|
- resultDTO.setHlsUrl(hlsUrl);
|
|
|
- cameraFlow.setClient(cameraFlow.getClient() + 1);
|
|
|
- flowService.updateById(cameraFlow);
|
|
|
- } else {
|
|
|
- //停止推流
|
|
|
- flowService.stopByTaskName(appName);
|
|
|
- resultDTO.setMsg("推流失败");
|
|
|
- return resultDTO;
|
|
|
- }
|
|
|
+ //未推流
|
|
|
+ String channelNumberStr = cameraDTO.getChannelNumber() + "01"; //回放流只有主码流
|
|
|
+ String rtspName = "rtsp://";
|
|
|
+ if (endTime != null) {
|
|
|
+ rtspName += cameraDTO.getVcr().getAccount() + ":" + cameraDTO.getVcr().getPassword() + "@" + cameraDTO.getVcr().getIp() + ":554/Streaming/tracks/" + channelNumberStr + "?starttime=" + startTime + "&endtime=" + endTime;
|
|
|
} else {
|
|
|
- //未推流
|
|
|
- String channelNumberStr = cameraDTO.getChannelNumber() + "01"; //回放流只有主码流
|
|
|
- String rtspName;
|
|
|
- if (endTime != null) {
|
|
|
- rtspName = cameraDTO.getVcr().getAccount() + ":" + cameraDTO.getVcr().getPassword() + "@" + cameraDTO.getVcr().getIp() + ":554/Streaming/tracks/" + channelNumberStr + "?starttime=" + startTime + "&endtime=" + endTime;
|
|
|
- } else {
|
|
|
- rtspName = cameraDTO.getVcr().getAccount() + ":" + cameraDTO.getVcr().getPassword() + "@" + cameraDTO.getVcr().getIp() + ":554/Streaming/tracks/" + channelNumberStr + "?starttime=" + startTime;
|
|
|
- }
|
|
|
- String rtmpName = cameraProperties.getRtmp().getRtmphost() + "/live/"; //rtmp服务器推流入口
|
|
|
-
|
|
|
- String tasker = ffmpegService.startTranscoding(appName, rtspName, rtmpName);
|
|
|
- if (StringUtils.isNotEmpty(tasker)) {
|
|
|
- resultDTO.setTaskName(tasker);
|
|
|
- resultDTO.setMsg(HikCameraUtils.resultNames[0]);
|
|
|
- resultDTO.setRtmpUrl(rtmpUrl);
|
|
|
- resultDTO.setFlvUrl(flvUrl);
|
|
|
- resultDTO.setHlsUrl(hlsUrl);
|
|
|
-
|
|
|
- //添加流记录
|
|
|
- cameraFlow = new CameraFlow();
|
|
|
- cameraFlow.setCameraId(cameraDTO.getId());
|
|
|
-// if (cameraDTO.getType() == 0) {
|
|
|
-// cameraFlow.setCameraIpc(cameraDTO.getIp());
|
|
|
-// } else {
|
|
|
-// cameraFlow.setCameraIpc(cameraDTO.getIpcAddress());
|
|
|
-// }
|
|
|
- cameraFlow.setTaskName(tasker);
|
|
|
- cameraFlow.setFlowType(FlowUtils.FlowType.HIK.ordinal());
|
|
|
- cameraFlow.setRtsp("rtsp://" + rtspName);
|
|
|
- cameraFlow.setRtmp(rtmpUrl);
|
|
|
- cameraFlow.setFlv(flvUrl);
|
|
|
- cameraFlow.setHls(hlsUrl);
|
|
|
- cameraFlow.setClient(1);
|
|
|
- cameraFlow.setCreateTime(new Date());
|
|
|
- cameraFlow.setUpdateTime(new Date());
|
|
|
- flowService.save(cameraFlow);
|
|
|
- } else {
|
|
|
- resultDTO.setMsg("推流失败");
|
|
|
- return resultDTO;
|
|
|
- }
|
|
|
+ rtspName += cameraDTO.getVcr().getAccount() + ":" + cameraDTO.getVcr().getPassword() + "@" + cameraDTO.getVcr().getIp() + ":554/Streaming/tracks/" + channelNumberStr + "?starttime=" + startTime;
|
|
|
}
|
|
|
+ resultDTO = pushStream(cameraDTO, appName, rtspName);
|
|
|
return resultDTO;
|
|
|
}
|
|
|
|
|
@@ -274,7 +247,7 @@ public class CameraServiceImpl extends ServiceImpl<CameraMapper, Camera> {
|
|
|
public ResultDTO catchPic(CameraDTO cameraDTO) {
|
|
|
ResultDTO resultDTO = new ResultDTO();
|
|
|
if (ObjectUtils.isEmpty(cameraDTO)) {
|
|
|
- resultDTO.setMsg("未找到设备");
|
|
|
+ resultDTO.setResult("未找到设备");
|
|
|
return resultDTO;
|
|
|
}
|
|
|
|
|
@@ -284,7 +257,7 @@ public class CameraServiceImpl extends ServiceImpl<CameraMapper, Camera> {
|
|
|
pathName = cameraDTO.getIp().replace(".", "");
|
|
|
} else {
|
|
|
//NVR
|
|
|
- resultDTO.setMsg("NVR设备不支持抓图");
|
|
|
+ resultDTO.setResult("NVR设备不支持抓图");
|
|
|
return resultDTO;
|
|
|
}
|
|
|
|
|
@@ -299,7 +272,7 @@ public class CameraServiceImpl extends ServiceImpl<CameraMapper, Camera> {
|
|
|
cameraFile.setUpdateTime(new Date());
|
|
|
long size = new File(filePath).length();
|
|
|
if (success && size > 0) {
|
|
|
- resultDTO.setMsg(UrlUtils.toAbsoluteUrl(path + name));
|
|
|
+ resultDTO.setResult(UrlUtils.toAbsoluteUrl(path + name));
|
|
|
cameraFile.setStatus("1");
|
|
|
} else {
|
|
|
cameraFile.setStatus("2");
|
|
@@ -331,11 +304,11 @@ public class CameraServiceImpl extends ServiceImpl<CameraMapper, Camera> {
|
|
|
cameraFileService.pathCreator(cameraProperties.getFilepath() + path);
|
|
|
Integer fileId = cameraFileService.findByPathAndName(path, name);
|
|
|
if (fileId > 0) {
|
|
|
- resultDTO.setMsg(fileId.toString());
|
|
|
+ resultDTO.setResult(fileId.toString());
|
|
|
return resultDTO;
|
|
|
}
|
|
|
hikCameraManager.downloadVideoAsync(cameraDTO, path, name, cameraDTO.getChannelNumber() + 32);
|
|
|
- resultDTO.setMsg(UrlUtils.toAbsoluteUrl(path + name));
|
|
|
+ resultDTO.setResult(UrlUtils.toAbsoluteUrl(path + name));
|
|
|
return resultDTO;
|
|
|
}
|
|
|
|
|
@@ -362,10 +335,10 @@ public class CameraServiceImpl extends ServiceImpl<CameraMapper, Camera> {
|
|
|
// }
|
|
|
HCNetTools hcTool = cameraDTO.getHcTool();
|
|
|
List<HashMap<String, String>> map = hcTool.getVideoFileList(cameraDTO.getHistoryDTO().getStartTime(), cameraDTO.getHistoryDTO().getEndTime(), cameraDTO.getChannelNumber() + 32);
|
|
|
- resultDTO.setMsg(map);
|
|
|
+ resultDTO.setResult(map);
|
|
|
return resultDTO;
|
|
|
} else {
|
|
|
- resultDTO.setMsg("未找到设备");
|
|
|
+ resultDTO.setResult("未找到设备");
|
|
|
return resultDTO;
|
|
|
}
|
|
|
}
|
|
@@ -387,4 +360,52 @@ public class CameraServiceImpl extends ServiceImpl<CameraMapper, Camera> {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 停止推流
|
|
|
+ *
|
|
|
+ * @param taskName 执行任务名
|
|
|
+ */
|
|
|
+ public Boolean stopRtmpByTaskName(String taskName) {
|
|
|
+ if (ObjectUtils.isEmpty(taskName)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return ffmpegService.stopTranscoding(taskName);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 停止推流
|
|
|
+ *
|
|
|
+ * @param ip 执行任务名
|
|
|
+ */
|
|
|
+ public Boolean stopRtmpByIP(String ip) {
|
|
|
+ if (ObjectUtils.isEmpty(ip)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ QueryWrapper<CameraFlow> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.lambda().likeLeft(CameraFlow::getTaskName,ip.replace(".",""));
|
|
|
+ List<CameraFlow> list = flowService.list(queryWrapper);
|
|
|
+ if(ObjectUtils.isEmpty(list)){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return ffmpegService.stopTranscoding(list.get(0).getTaskName());
|
|
|
+ }
|
|
|
+
|
|
|
+ @CameraLogin(type = CameraLogin.Operation.CATCH_PICTURE)
|
|
|
+ public Integer getState(CameraDTO cameraDTO) {
|
|
|
+ if (ObjectUtils.isEmpty(cameraDTO.getHcTool())) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ return cameraDTO.getHcTool().getState();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @PreDestroy
|
|
|
+ public void closeRealStream() {
|
|
|
+ logger.info("关闭推送流");
|
|
|
+ for (CameraFlow cameraFlow : flowService.list()) {
|
|
|
+ String taskName = cameraFlow.getTaskName();
|
|
|
+ ffmpegService.stopTranscoding(taskName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|