| | |
| | | import com.ruoyi.alarm.global.domain.GuideTask; |
| | | import com.ruoyi.alarm.global.service.impl.QueueHandler; |
| | | import com.ruoyi.common.annotation.SdkOperate; |
| | | import com.ruoyi.common.config.ARDConfig; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.file.FileUtils; |
| | | import com.ruoyi.common.utils.file.MimeTypeUtils; |
| | | import com.ruoyi.common.utils.spring.SpringUtils; |
| | |
| | | import com.ruoyi.device.camera.domain.ArdCameras; |
| | | import com.ruoyi.device.camera.domain.CameraCmd; |
| | | import com.ruoyi.device.camera.service.IArdCamerasService; |
| | | import com.ruoyi.device.camera.service.ICameraSdkService; |
| | | import com.ruoyi.device.channel.domain.ArdChannel; |
| | | import com.ruoyi.device.channel.service.IArdChannelService; |
| | | import com.ruoyi.media.domain.Vtdu; |
| | |
| | | private IArdChannelService ardChannelService; |
| | | @Resource |
| | | private IVtduService vtduService; |
| | | |
| | | @Resource |
| | | ICameraSdkService cameraSdkService; |
| | | @Value("${minio.endpoint}") |
| | | private String minioEndPoint; |
| | | @Resource |
| | |
| | | float t = (float) dh_ptz_location_info.nPTZTilt / 10 * -1; |
| | | String nPTZTilt = df.format(t < 0 ? t + 360 : t); |
| | | String nPTZZoom = df.format((float) dh_ptz_location_info.nPTZZoom); |
| | | ptzMap.put("p", nPTZPan); |
| | | ptzMap.put("t", nPTZTilt); |
| | | ptzMap.put("z", nPTZZoom); |
| | | ptzMap.put("p" , nPTZPan); |
| | | ptzMap.put("t" , nPTZTilt); |
| | | ptzMap.put("z" , nPTZZoom); |
| | | return AjaxResult.success(ptzMap); |
| | | } |
| | | |
| | |
| | | return AjaxResult.warn("设备未登录"); |
| | | } |
| | | LLong loginId = (LLong) GlobalVariable.loginMap.get(cameraId); |
| | | String imagePath = FileUtils.createFile("D:/LocalCaptureTemp/" + cameraId + ".jpeg"); |
| | | // 本地临时录像地址 |
| | | String tempPath = ARDConfig.getProfile() + Constants.LOCAL_RECORD_TEMP_PREFIX; |
| | | String imagePath = FileUtils.createFile(tempPath + "/" + cameraId + ".jpeg"); |
| | | fCaptureReceiveCB1 m_CaptureReceiveCB = new fCaptureReceiveCB1(imagePath); |
| | | CapturePictureModule.setSnapRevCallBack(m_CaptureReceiveCB); |
| | | boolean b = CapturePictureModule.remoteCapturePicture(loginId, chanNo - 1); |
| | |
| | | @Override |
| | | public AjaxResult localRecordStart(CameraCmd cmd) { |
| | | try { |
| | | String operator = cmd.getOperator(); |
| | | String cameraId = cmd.getCameraId(); |
| | | Integer chanNo = cmd.getChanNo(); |
| | | |
| | |
| | | // GlobalVariable.previewMap.remove(cameraId); |
| | | // log.debug("停止当前录像"); |
| | | //} |
| | | String path = FileUtils.createFile("D:/LocalRecordTemp/" + cameraId + ".mp4"); |
| | | |
| | | // 本地临时录像地址 |
| | | String tempPath = ARDConfig.getProfile() + Constants.LOCAL_RECORD_TEMP_PREFIX; |
| | | String path = FileUtils.createFile(tempPath + "/" + operator + "/" + cameraId + ".mp4"); |
| | | LLong lRealHandle = RealPlayModule.startRealPlay(loginId, chanNo - 1, path); |
| | | if (lRealHandle.longValue() <= 0) { |
| | | log.error("取流失败" + getErrorCodePrint()); |
| | |
| | | // return false; |
| | | //} |
| | | log.debug("本地录像开始"); |
| | | return AjaxResult.success("本地录像开始", lRealHandle); |
| | | return AjaxResult.success("本地录像开始" , lRealHandle); |
| | | } catch (Exception ex) { |
| | | log.error("本地录像开始异常" + ex.getMessage()); |
| | | return AjaxResult.error("本地录像开始异常" + ex.getMessage()); |
| | |
| | | @Override |
| | | public AjaxResult localRecordStop(CameraCmd cmd) { |
| | | try { |
| | | String operator = cmd.getOperator(); |
| | | String cameraId = cmd.getCameraId(); |
| | | LLong lRealHandle = new LLong(cmd.getRecordId()); |
| | | if (!GlobalVariable.loginMap.containsKey(cameraId)) { |
| | | return AjaxResult.warn("设备未登录"); |
| | | } |
| | | |
| | | RealPlayModule.stopRealPlay(lRealHandle); |
| | | log.debug("本地录像停止"); |
| | | String recordPath = FileUtils.createFile("D:/LocalRecordTemp/" + cameraId + ".mp4"); |
| | | // 本地临时录像地址 |
| | | String tempPath = ARDConfig.getProfile() + Constants.LOCAL_RECORD_TEMP_PREFIX; |
| | | String recordPath = FileUtils.createFile(tempPath + "/" + operator + "/" + cameraId + ".mp4"); |
| | | byte[] imageBytes = Files.readAllBytes(Paths.get(recordPath)); |
| | | // OutputStream outputStream = response.getOutputStream(); |
| | | // outputStream.write(imageBytes); |
| | | return AjaxResult.success(imageBytes); |
| | | //if (GlobalVariable.previewMap.containsKey(cameraId)) { |
| | | // lRealHandle = new LLong(GlobalVariable.previewMap.get(cameraId)); |
| | | // RealPlayModule.stopRealPlay(lRealHandle); |
| | | // GlobalVariable.previewMap.remove(cameraId); |
| | | // log.debug("本地录像停止"); |
| | | // String recordPath = FileUtils.createFile("D:/LocalRecordTemp/" + cameraId + ".mp4"); |
| | | // byte[] imageBytes = Files.readAllBytes(Paths.get(recordPath)); |
| | | // // OutputStream outputStream = response.getOutputStream(); |
| | | // // outputStream.write(imageBytes); |
| | | // return AjaxResult.success(imageBytes); |
| | | //} |
| | | //else { |
| | | // return AjaxResult.error("设备未开始录像"); |
| | | //} |
| | | } catch (Exception ex) { |
| | | log.error("本地录像停止异常" + ex.getMessage()); |
| | | return AjaxResult.error("本地录像停止异常" + ex.getMessage()); |
| | |
| | | String url = ""; |
| | | String cameraId = cmd.getCameraId(); |
| | | Integer chanNo = cmd.getChanNo(); |
| | | String path = FileUtils.createFile("D:/recordTemp/" + cameraId + ".mp4"); |
| | | // 本地临时录像地址 |
| | | String tempPath = ARDConfig.getProfile() + Constants.LOCAL_RECORD_TEMP_PREFIX; |
| | | String path = FileUtils.createFile(tempPath + "/" + cameraId + ".mp4"); |
| | | boolean enable = cmd.isEnable(); |
| | | if (!GlobalVariable.loginMap.containsKey(cameraId)) { |
| | | return ""; |
| | |
| | | try { |
| | | String cameraId = cmd.getCameraId(); |
| | | Integer chanNo = cmd.getChanNo(); |
| | | String path = FileUtils.createFile("D:/recordTemp/" + cameraId + ".mp4"); |
| | | // 本地临时录像地址 |
| | | String tempPath = ARDConfig.getProfile() + Constants.LOCAL_RECORD_TEMP_PREFIX; |
| | | String path = FileUtils.createFile(tempPath + "/" + cameraId + ".mp4"); |
| | | if (!GlobalVariable.loginMap.containsKey(cameraId)) { |
| | | return false; |
| | | } |
| | |
| | | String url = ""; |
| | | try { |
| | | String cameraId = cmd.getCameraId(); |
| | | String path = FileUtils.createFile("D:/recordTemp/" + cameraId + ".mp4"); |
| | | // 本地临时录像地址 |
| | | String tempPath = ARDConfig.getProfile() + Constants.LOCAL_RECORD_TEMP_PREFIX; |
| | | String path = FileUtils.createFile(tempPath + "/" + cameraId + ".mp4"); |
| | | if (!GlobalVariable.loginMap.containsKey(cameraId)) { |
| | | return ""; |
| | | } |
| | |
| | | double[] cameraPositon = new double[]{cameras.getLongitude(), cameras.getLatitude(), cameras.getAltitude()}; |
| | | double[] targetPositions = cmd.getTargetPosition(); |
| | | double[] cameraPTZ = GisUtil.getCameraPTZ(cameraPositon, targetPositions, 20, 150); |
| | | //修正俯仰 |
| | | double correctPitch = cameraSdkService.correctPitch(cmd); |
| | | double newt = cameraPTZ[1] + correctPitch; |
| | | int p = (int) (cameraPTZ[0] * 10); |
| | | int t = (int) (cameraPTZ[1] * 10); |
| | | int t = (int) (newt * 10); |
| | | int z = (int) (cameraPTZ[2]); |
| | | boolean bool = netsdk.CLIENT_DHPTZControlEx(loginId, chanNo - 1, NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_EXACTGOTO, p, t, z, 0); |
| | | if (!bool) { |
| | | log.error("设置ptz失败:" + getErrorCodePrint()); |
| | | return AjaxResult.warn("设置ptz失败:" + getErrorCodePrint()); |
| | | } |
| | | return AjaxResult.success("引导目标位置成功"); |
| | | return AjaxResult.success("引导目标位置成功",correctPitch); |
| | | } catch (Exception ex) { |
| | | log.error("引导目标位置异常:" + ex.getMessage()); |
| | | return AjaxResult.error("引导目标位置异常:" + ex.getMessage()); |
| | |
| | | int nHeight = cfg_encode_info.stuMainStream[0].stuVideoFormat.nHeight; |
| | | String resolution = nWidth + "*" + nHeight; |
| | | float nFrameRate = cfg_encode_info.stuMainStream[0].stuVideoFormat.nFrameRate; |
| | | map.put("resolution", resolution);//分辨率 |
| | | map.put("videoBitrate", String.valueOf(nBitRate));//比特率 |
| | | map.put("videoEncType", videoEncType);//编码 |
| | | map.put("nFrameRate", String.valueOf(nFrameRate));//帧率 |
| | | map.put("resolution" , resolution);//分辨率 |
| | | map.put("videoBitrate" , String.valueOf(nBitRate));//比特率 |
| | | map.put("videoEncType" , videoEncType);//编码 |
| | | map.put("nFrameRate" , String.valueOf(nFrameRate));//帧率 |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error("取码流压缩参数异常:" + ex.getMessage()); |
| | |
| | | float nAngelH = (float) dh_out_ptz_view_range_status.nAngelH / 10; |
| | | float nAngelV = (float) dh_out_ptz_view_range_status.nAngelV / 10; |
| | | Map<String, Object> map = getPtz(cmd);//获取ptz |
| | | map.put("fHorFieldAngle", nAngelH);// 水平视场角 |
| | | map.put("fVerFieldAngle", nAngelV);// 垂直视场角 |
| | | map.put("fHorFieldAngle" , nAngelH);// 水平视场角 |
| | | map.put("fVerFieldAngle" , nAngelV);// 垂直视场角 |
| | | return AjaxResult.success(map); |
| | | } catch (Exception ex) { |
| | | log.error("获取云台可视域异常" + ex.getMessage()); |