From 2fa66c208202f420a5f001cf0d67e5aa1bf94578 Mon Sep 17 00:00:00 2001 From: aijinhui <aijinhui> Date: 星期四, 07 九月 2023 16:53:39 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ard-work/src/main/resources/templates/test.html | 65 +++++++--- ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/SdkTask.java | 2 ard-work/src/main/java/com/ruoyi/device/camera/domain/CameraCmd.java | 3 ard-work/src/main/java/com/ruoyi/inspect/service/impl/InspectionTaskManager.java | 2 ard-work/src/main/resources/templates/preview.html | 2 ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/QueueTaskExecutor.java | 2 ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java | 10 + ard-work/src/main/java/com/ruoyi/media/service/impl/MediaServiceImpl.java | 3 ard-work/src/main/java/com/ruoyi/device/hiksdk/service/impl/HikClientServiceImpl.java | 110 +++++++++-------- ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectTaskServiceImpl.java | 6 lib/webrtc/webrtc-streamer.exe | 0 ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java | 44 +++++-- lib/mediamtx/mediamtx.yml | 77 ++++++------ 13 files changed, 189 insertions(+), 137 deletions(-) diff --git a/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java b/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java index 0af7c58..b6c55f2 100644 --- a/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java +++ b/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java @@ -1025,9 +1025,13 @@ //鑾峰彇闆疯揪鎵�鍦ㄥ涓婄殑澶у厜鐢� String cameraIdWithTower = ardEquipRadarMapper.getCameraByRadar(radarId); if (StringUtils.isNotNull(cameraIdWithTower) && StringUtils.isNotEmpty(cameraIdWithTower)) { - log.info("鑾峰彇鍒伴浄杈惧涓婄殑鍏夌數:" + cameraIdWithTower); + log.debug("鑾峰彇鍒伴浄杈惧涓婄殑鍏夌數:" + cameraIdWithTower); //濡傛灉闆疯揪濉斾笂鏈夊厜鐢� messagesEnqueued(cameraIdWithTower, alarmId, alarmType, createTime, 1, 1, coordinate); + } + else + { + log.debug("鏈幏鍙栧埌闆疯揪濉斾笂鐨勫厜鐢�"); } //鑾峰彇鎶ヨ鐐瑰叧鑱旂殑澶у厜鐢� ArdAlarmpointsWell ardAlarmpointsWell = ardAlarmpointsWellMapper.selectArdAlarmpointsWellByWellId(alarmpointName); @@ -1040,6 +1044,10 @@ //濡傛灉鎶ヨ鐐瑰叧鑱斾簡鍏夌數 messagesEnqueued(cameraId, alarmId, alarmType, createTime, 1, 2, coordinate); } + else + { + log.debug("鏈幏鍙栧埌鎶ヨ鐐瑰叧鑱旂殑鍏夌數"); + } } diff --git a/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/QueueTaskExecutor.java b/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/QueueTaskExecutor.java index 2dceaa2..8b0eb56 100644 --- a/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/QueueTaskExecutor.java +++ b/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/QueueTaskExecutor.java @@ -53,7 +53,7 @@ try { CameraCmd cmd = new CameraCmd(); cmd.setCameraId(guideTask.getCameraId()); - cmd.setChannelNum(guideTask.getChanNum()); + cmd.setChanNo(guideTask.getChanNum()); cmd.setTargetPosition(guideTask.getTargetPosition()); cmd.setOperator(guideTask.getAlarmType()); cmd.setExpired(30); diff --git a/ard-work/src/main/java/com/ruoyi/device/camera/domain/CameraCmd.java b/ard-work/src/main/java/com/ruoyi/device/camera/domain/CameraCmd.java index 4ec8ce2..ad30ca7 100644 --- a/ard-work/src/main/java/com/ruoyi/device/camera/domain/CameraCmd.java +++ b/ard-work/src/main/java/com/ruoyi/device/camera/domain/CameraCmd.java @@ -2,6 +2,7 @@ import io.swagger.annotations.ApiModel; import lombok.Data; +import org.springframework.boot.context.properties.bind.DefaultValue; import java.util.Map; @@ -13,7 +14,7 @@ /*鐩告満ID*/ String cameraId; /*鐩告満閫氶亾鍙�*/ - Integer channelNum; + Integer chanNo; /*浜戝彴浠g爜*/ Integer code; /*浜戝彴閫熷害*/ diff --git a/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java b/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java index e79c3ec..9bfeeb1 100644 --- a/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java +++ b/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java @@ -86,7 +86,18 @@ @Override @DataScope(deptAlias = "d", userAlias = "u") public List<ArdCameras> selectArdCamerasList(ArdCameras ardCameras) { - return ardCamerasMapper.selectArdCamerasList(ardCameras); + List<ArdCameras> ardCamerasList = ardCamerasMapper.selectArdCamerasList(ardCameras); + if (ardCamerasList.size() > 0) { + for (ArdCameras camera : ardCamerasList) { + ArdChannel ardChannel = new ArdChannel(); + ardChannel.setDeviceId(camera.getId()); + List<ArdChannel> ardChannels = ardChannelMapper.selectArdChannelList(ardChannel); + if (ardChannels != null) { + camera.setChannelList(ardChannels); + } + } + } + return ardCamerasList; } /** @@ -216,11 +227,10 @@ } if (ardCameras.size() > 0) { for (ArdCameras camera : ardCameras) { - ArdChannel ardChannel=new ArdChannel(); + ArdChannel ardChannel = new ArdChannel(); ardChannel.setDeviceId(camera.getId()); List<ArdChannel> ardChannels = ardChannelMapper.selectArdChannelList(ardChannel); - if(ardChannels!=null) - { + if (ardChannels != null) { camera.setChannelList(ardChannels); } Map<String, Object> cameraMap = ArdTool.convertEntityToMap(camera); @@ -268,7 +278,13 @@ camera.setChanNo(ArdTool.getChannelBydayNightTime(dayNightTime)); ardCameras.put(distance, camera); } - + //鑾峰彇閫氶亾鍒楄〃 + ArdChannel ardChannel = new ArdChannel(); + ardChannel.setDeviceId(camera.getId()); + List<ArdChannel> ardChannels = ardChannelMapper.selectArdChannelList(ardChannel); + if (ardChannels != null) { + camera.setChannelList(ardChannels); + } } return ardCameras; } catch (Exception ex) { @@ -285,7 +301,7 @@ @Override public List<ArdCameras> getNearCameras(SchedulingParam param) { try { - Long deptId=SecurityUtils.getLoginUser().getUser().getDeptId(); + Long deptId = SecurityUtils.getLoginUser().getUser().getDeptId(); Double longitude = param.getLongitude(); Double latitude = param.getLatitude(); if (longitude == null && latitude == null) { @@ -299,7 +315,7 @@ } String dayNightTime = redisCache.getCacheObject("sys_config:dayNightTime"); //鑾峰彇鎵�鏈夊厜鐢�(鎸夐儴闂�) - ArdCameras cameras= new ArdCameras(); + ArdCameras cameras = new ArdCameras(); cameras.setDeptId(deptId); List<ArdCameras> ardCamerasList = ardCamerasMapper.selectArdCamerasList(cameras); //缁熻鎵�鏈夊厜鐢靛彲瑙嗚寖鍥村唴涓庢姤璀︾偣鐨勮窛绂� @@ -312,7 +328,7 @@ double distance = GisUtil.getDistance(new double[]{longitude, latitude}, camPosition); if (distance <= radius) { /*鑾峰彇閫氶亾鍒楄〃*/ - ArdChannel ardChannel=new ArdChannel(); + ArdChannel ardChannel = new ArdChannel(); ardChannel.setDeviceId(camera.getId()); List<ArdChannel> ardChannels = ardChannelMapper.selectArdChannelList(ardChannel); camera.setChannelList(ardChannels); @@ -329,6 +345,7 @@ } return null; } + /** * 鑾峰彇鐩戞帶鍦堝唴鎵�鏈夊湪绾垮厜鐢� * 鍒樿嫃涔� @@ -337,16 +354,15 @@ @Override public List<ArdCameras> getNearCamerasWithPolygon(SchedulingParam param) { try { - Long deptId=SecurityUtils.getLoginUser().getUser().getDeptId(); + Long deptId = SecurityUtils.getLoginUser().getUser().getDeptId(); List<Point> partitionLocation = param.getPartitionLocation(); - if(partitionLocation==null) - { + if (partitionLocation == null) { log.debug("澶氳竟褰㈠潗鏍囬泦鍚堜负绌�"); return null; } String dayNightTime = redisCache.getCacheObject("sys_config:dayNightTime"); //鑾峰彇鎵�鏈夊厜鐢�(鎸夐儴闂�) - ArdCameras cameras= new ArdCameras(); + ArdCameras cameras = new ArdCameras(); cameras.setDeptId(deptId); List<ArdCameras> ardCamerasList = ardCamerasMapper.selectArdCamerasList(cameras); List<ArdCameras> ardCameras = new ArrayList<>(); @@ -355,11 +371,11 @@ continue; } /*鍒ゆ柇鍧愭爣鏄惁鍦ㄥ杈瑰舰鑼冨洿鍐�*/ - Point camPosition=new Point(camera.getLongitude(),camera.getLatitude()); + Point camPosition = new Point(camera.getLongitude(), camera.getLatitude()); boolean inPolygon = GisUtil.isInPolygon(camPosition, partitionLocation); if (inPolygon) { /*鑾峰彇閫氶亾鍒楄〃*/ - ArdChannel ardChannel=new ArdChannel(); + ArdChannel ardChannel = new ArdChannel(); ardChannel.setDeviceId(camera.getId()); List<ArdChannel> ardChannels = ardChannelMapper.selectArdChannelList(ardChannel); camera.setChannelList(ardChannels); diff --git a/ard-work/src/main/java/com/ruoyi/device/hiksdk/service/impl/HikClientServiceImpl.java b/ard-work/src/main/java/com/ruoyi/device/hiksdk/service/impl/HikClientServiceImpl.java index d03fb83..12c8cc8 100644 --- a/ard-work/src/main/java/com/ruoyi/device/hiksdk/service/impl/HikClientServiceImpl.java +++ b/ard-work/src/main/java/com/ruoyi/device/hiksdk/service/impl/HikClientServiceImpl.java @@ -262,7 +262,7 @@ public boolean pTZControlWithSpeed(CameraCmd cmd) { String cameraId = cmd.getCameraId(); boolean enable = cmd.isEnable(); - Integer channelNum = cmd.getChannelNum(); + Integer channelNum = cmd.getChanNo(); Integer speed = cmd.getSpeed(); Integer code = cmd.getCode(); if (!GlobalVariable.loginMap.containsKey(cameraId)) { @@ -348,23 +348,31 @@ @SdkOperate public boolean setFocusPos(CameraCmd cmd) { String cameraId = cmd.getCameraId(); - Integer channelNum = cmd.getChannelNum(); + Integer channelNum = cmd.getChanNo(); Integer dwFocusPos = cmd.getDwFocusPos(); if (!GlobalVariable.loginMap.containsKey(cameraId)) { return false; } + // 鑾峰彇鍙傛暟 Integer userId = GlobalVariable.loginMap.get(cameraId); - - NET_DVR_FOCUSMODE_CFG focusmodeCfg = new NET_DVR_FOCUSMODE_CFG(); - Pointer point = focusmodeCfg.getPointer(); - IntByReference ibrBytesReturned = new IntByReference(0); - focusmodeCfg.dwFocusPos = dwFocusPos; - boolean bool = hCNetSDK.NET_DVR_GetDVRConfig(userId, NET_DVR_GET_FOCUSMODECFG, channelNum, point, focusmodeCfg.size(), ibrBytesReturned); + HCNetSDK.NET_DVR_STD_CONFIG struStdCfg = new HCNetSDK.NET_DVR_STD_CONFIG(); + HCNetSDK.NET_DVR_GIS_INFO struGisInfo = new HCNetSDK.NET_DVR_GIS_INFO(); + struGisInfo.struPtzPosEx.dwFocus=dwFocusPos; + struStdCfg.read(); + IntByReference lchannel = new IntByReference(channelNum); + struStdCfg.lpInBuffer= struGisInfo.getPointer(); + struStdCfg.lpCondBuffer = lchannel.getPointer(); + struStdCfg.dwCondSize = 4; + struStdCfg.dwInSize = struGisInfo.size(); + struStdCfg.write();//璁剧疆鍓嶄箣鍓嶈write() + boolean bool = hCNetSDK.NET_DVR_SetSTDConfig(userId, NET_DVR_GET_GISINFO, struStdCfg); if (!bool) { int code = hCNetSDK.NET_DVR_GetLastError(); - log.error("璁剧疆鑱氱劍鍊煎け璐�,璇风◢鍚庨噸璇�" + code); + log.error("璁剧疆GIS淇℃伅鏁版嵁澶辫触,璇风◢鍚庨噸璇�" + code); + return false; + } else { + return true; } - return bool; } /** @@ -375,31 +383,31 @@ @Override public Map<String, Object> getFocusPos(CameraCmd cmd) { String cameraId = cmd.getCameraId(); - Integer channelNum = cmd.getChannelNum(); - + Integer channelNum = cmd.getChanNo(); if (!GlobalVariable.loginMap.containsKey(cameraId)) { return new HashMap<>(); } + // 鑾峰彇鍙傛暟 Integer userId = GlobalVariable.loginMap.get(cameraId); - - NET_DVR_FOCUSMODE_CFG focusmodeCfg = new NET_DVR_FOCUSMODE_CFG(); - Pointer point = focusmodeCfg.getPointer(); - IntByReference ibrBytesReturned = new IntByReference(0); - focusmodeCfg.byFocusMode = 1; - focusmodeCfg.byAutoFocusMode = 0; - focusmodeCfg.write(); - boolean bool = hCNetSDK.NET_DVR_GetDVRConfig(userId, NET_DVR_GET_FOCUSMODECFG, channelNum, point, focusmodeCfg.size(), ibrBytesReturned); - if (bool) { - focusmodeCfg.read(); - Map<String, Object> map = new HashMap<>(); - map.put("dwFocusPos", focusmodeCfg.dwFocusPos); - map.put("byFocusDefinitionDisplay ", focusmodeCfg.byFocusDefinitionDisplay); - map.put("dwRelativeFocusPos", focusmodeCfg.dwRelativeFocusPos); - return map; - } else { + HCNetSDK.NET_DVR_STD_CONFIG struStdCfg = new HCNetSDK.NET_DVR_STD_CONFIG(); + HCNetSDK.NET_DVR_GIS_INFO struGisInfo = new HCNetSDK.NET_DVR_GIS_INFO(); + struStdCfg.read(); + IntByReference lchannel = new IntByReference(channelNum); + struStdCfg.lpCondBuffer = lchannel.getPointer(); + struStdCfg.dwCondSize = 4; + struStdCfg.lpOutBuffer = struGisInfo.getPointer(); + struStdCfg.dwOutSize = struGisInfo.size(); + struStdCfg.write();//璁剧疆鍓嶄箣鍓嶈write() + boolean bool = hCNetSDK.NET_DVR_GetSTDConfig(userId, NET_DVR_GET_GISINFO, struStdCfg); + if (!bool) { int code = hCNetSDK.NET_DVR_GetLastError(); - log.debug("鑾峰彇鑱氱劍鍊煎け璐�,璇风◢鍚庨噸璇�" + code); + log.error("鑾峰彇GIS淇℃伅鏁版嵁澶辫触,璇风◢鍚庨噸璇�" + code); return new HashMap<>(); + } else { + struGisInfo.read(); + Map<String, Object> map = new HashMap<>(); + map.put("dwFocus",struGisInfo.struPtzPosEx.dwFocus); + return map; } } @@ -412,7 +420,7 @@ @SdkOperate public boolean setPreset(CameraCmd cmd) { String cameraId = cmd.getCameraId(); - Integer channelNum = cmd.getChannelNum(); + Integer channelNum = cmd.getChanNo(); Integer PresetIndex = cmd.getPresetIndex(); if (!GlobalVariable.loginMap.containsKey(cameraId)) { return false; @@ -435,7 +443,7 @@ @SdkOperate public boolean gotoPreset(CameraCmd cmd) { String cameraId = cmd.getCameraId(); - Integer channelNum = cmd.getChannelNum(); + Integer channelNum = cmd.getChanNo(); Integer PresetIndex = cmd.getPresetIndex(); if (!GlobalVariable.loginMap.containsKey(cameraId)) { return false; @@ -460,7 +468,7 @@ @Override public String getVideoResolution(CameraCmd cmd) { String cameraId = cmd.getCameraId(); - Integer channelNum = cmd.getChannelNum(); + Integer channelNum = cmd.getChanNo(); if (!GlobalVariable.loginMap.containsKey(cameraId)) { return " "; } @@ -565,7 +573,7 @@ @Override public Map<String, Object> getPtz(CameraCmd cmd) { String cameraId = cmd.getCameraId(); - Integer channelNum = cmd.getChannelNum(); + Integer channelNum = cmd.getChanNo(); if (!GlobalVariable.loginMap.containsKey(cameraId)) { return null; } @@ -616,7 +624,7 @@ @SdkOperate public boolean setPtz(CameraCmd cmd) { String cameraId = cmd.getCameraId(); - Integer channelNum = cmd.getChannelNum(); + Integer channelNum = cmd.getChanNo(); Map<String, Double> ptz = cmd.getPtzMap(); if (!GlobalVariable.loginMap.containsKey(cameraId)) { return false; @@ -649,7 +657,7 @@ @SdkOperate public boolean guideTargetPosition(CameraCmd cmd) { String cameraId = cmd.getCameraId(); - Integer channelNum = cmd.getChannelNum(); + Integer channelNum = cmd.getChanNo(); if (!GlobalVariable.loginMap.containsKey(cameraId)) { return false; } @@ -736,7 +744,7 @@ @Override public int getPTZLockInfo(CameraCmd cmd) { String cameraId = cmd.getCameraId(); - Integer channelNum = cmd.getChannelNum(); + Integer channelNum = cmd.getChanNo(); if (!GlobalVariable.loginMap.containsKey(cameraId)) { return -1; } @@ -768,7 +776,7 @@ @SdkOperate public boolean setZeroPtz(CameraCmd cmd) { String cameraId = cmd.getCameraId(); - Integer channelNum = cmd.getChannelNum(); + Integer channelNum = cmd.getChanNo(); if (!GlobalVariable.loginMap.containsKey(cameraId)) { return false; } @@ -800,7 +808,7 @@ @Override public Map<String, Object> getPtzScope(CameraCmd cmd) { String cameraId = cmd.getCameraId(); - Integer channelNum = cmd.getChannelNum(); + Integer channelNum = cmd.getChanNo(); if (!GlobalVariable.loginMap.containsKey(cameraId)) { return new HashMap<>(); } @@ -849,7 +857,7 @@ public boolean controlDefogcfg(CameraCmd cmd) { String cameraId = cmd.getCameraId(); boolean enable = cmd.isEnable(); - Integer channelNum = cmd.getChannelNum(); + Integer channelNum = cmd.getChanNo(); if (!GlobalVariable.loginMap.containsKey(cameraId)) { return false; } @@ -895,7 +903,7 @@ public boolean controlInfrarecfg(CameraCmd cmd) { String cameraId = cmd.getCameraId(); boolean enable = cmd.isEnable(); - Integer channelNum = cmd.getChannelNum(); + Integer channelNum = cmd.getChanNo(); if (!GlobalVariable.loginMap.containsKey(cameraId)) { return false; } @@ -943,7 +951,7 @@ public boolean controlFocusMode(CameraCmd cmd) { String cameraId = cmd.getCameraId(); boolean enable = cmd.isEnable(); - Integer channelNum = cmd.getChannelNum(); + Integer channelNum = cmd.getChanNo(); if (!GlobalVariable.loginMap.containsKey(cameraId)) { return false; } @@ -986,7 +994,7 @@ */ public String getFocusMode(CameraCmd cmd) { String cameraId = cmd.getCameraId(); - Integer channelNum = cmd.getChannelNum(); + Integer channelNum = cmd.getChanNo(); if (!GlobalVariable.loginMap.containsKey(cameraId)) { return ""; } @@ -1016,7 +1024,7 @@ public boolean controlPTHeateRpwron(CameraCmd cmd) { String cameraId = cmd.getCameraId(); boolean enable = cmd.isEnable(); - Integer channelNum = cmd.getChannelNum(); + Integer channelNum = cmd.getChanNo(); if (!GlobalVariable.loginMap.containsKey(cameraId)) { return false; } @@ -1049,7 +1057,7 @@ public boolean controlCameraDeicing(CameraCmd cmd) { String cameraId = cmd.getCameraId(); boolean enable = cmd.isEnable(); - Integer channelNum = cmd.getChannelNum(); + Integer channelNum = cmd.getChanNo(); if (!GlobalVariable.loginMap.containsKey(cameraId)) { return false; } @@ -1086,7 +1094,7 @@ */ public String captureJPEGPicture(CameraCmd cmd) { String cameraId = cmd.getCameraId(); - Integer channelNum = cmd.getChannelNum(); + Integer channelNum = cmd.getChanNo(); if (!GlobalVariable.loginMap.containsKey(cameraId)) { return ""; } @@ -1129,7 +1137,7 @@ @SdkOperate public String picCutCate(CameraCmd cmd) { String cameraId = cmd.getCameraId(); - Integer channelNum = cmd.getChannelNum(); + Integer channelNum = cmd.getChanNo(); if (!GlobalVariable.loginMap.containsKey(cameraId)) { return ""; } @@ -1191,7 +1199,7 @@ public String record(CameraCmd cmd) { try { String cameraId = cmd.getCameraId(); - Integer channelNum = cmd.getChannelNum(); + Integer channelNum = cmd.getChanNo(); String path = FileUtils.createFile("D:/recordTemp/" + cameraId + ".mp4"); boolean enable = cmd.isEnable(); if (!GlobalVariable.loginMap.containsKey(cameraId)) { @@ -1253,7 +1261,7 @@ public void recordStart(CameraCmd cmd) { try { String cameraId = cmd.getCameraId(); - Integer channelNum = cmd.getChannelNum(); + Integer channelNum = cmd.getChanNo(); String path = FileUtils.createFile("D:/recordTemp/" + cameraId + ".mp4"); if (!GlobalVariable.loginMap.containsKey(cameraId)) { return; @@ -1308,7 +1316,7 @@ String url = ""; try { String cameraId = cmd.getCameraId(); - Integer channelNum = cmd.getChannelNum(); + Integer channelNum = cmd.getChanNo(); String path = FileUtils.createFile("D:/recordTemp/" + cameraId + ".mp4"); if (!GlobalVariable.loginMap.containsKey(cameraId)) { return ""; @@ -1362,7 +1370,7 @@ public void recordStopNotToMinio(CameraCmd cmd) { try { String cameraId = cmd.getCameraId(); - Integer channelNum = cmd.getChannelNum(); + Integer channelNum = cmd.getChanNo(); if (!GlobalVariable.loginMap.containsKey(cameraId)) { return; } @@ -1446,7 +1454,7 @@ @Override public Map<String, Object> getGisInfo(CameraCmd cmd) { String cameraId = cmd.getCameraId(); - Integer channelNum = cmd.getChannelNum(); + Integer channelNum = cmd.getChanNo(); if (!GlobalVariable.loginMap.containsKey(cameraId)) { return new HashMap<>(); } diff --git a/ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectTaskServiceImpl.java b/ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectTaskServiceImpl.java index 0e09344..4ad799a 100644 --- a/ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectTaskServiceImpl.java +++ b/ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectTaskServiceImpl.java @@ -451,7 +451,7 @@ /*鎺у埗鐩告満宸℃*/ CameraCmd cmd = new CameraCmd(); cmd.setCameraId(cameraId); - cmd.setChannelNum(channel); + cmd.setChanNo(channel); cmd.setTargetPosition(targetPositon); cmd.setOperator("sys_patrol_inspect"); cmd.setExpired(step.getRecordingTime() * 60); @@ -509,7 +509,7 @@ /*鎺у埗鐩告満宸℃*/ CameraCmd cmd = new CameraCmd(); cmd.setCameraId(cameraId); - cmd.setChannelNum(channel); + cmd.setChanNo(channel); cmd.setTargetPosition(targetPositon); cmd.setOperator("sys_patrol_inspect"); cmd.setExpired(step.getRecordingTime() * 60); @@ -548,7 +548,7 @@ /*鍋滄褰曞儚*/ CameraCmd cmd = new CameraCmd(); cmd.setCameraId(cameraId); - cmd.setChannelNum(channel); + cmd.setChanNo(channel); cmd.setOperator("sys_patrol_inspect"); cmd.setRecordBucketName("record"); cmd.setRecordObjectName("inspect_" + IdUtils.fastSimpleUUID()); diff --git a/ard-work/src/main/java/com/ruoyi/inspect/service/impl/InspectionTaskManager.java b/ard-work/src/main/java/com/ruoyi/inspect/service/impl/InspectionTaskManager.java index bf0ff9d..f06e33d 100644 --- a/ard-work/src/main/java/com/ruoyi/inspect/service/impl/InspectionTaskManager.java +++ b/ard-work/src/main/java/com/ruoyi/inspect/service/impl/InspectionTaskManager.java @@ -76,7 +76,7 @@ { //褰撳墠鐩告満姝e湪褰曞儚锛屽垯鍋滄褰曞儚 CameraCmd cmd = new CameraCmd(); cmd.setCameraId(ardVideoInspectTask.getCameraId()); - cmd.setChannelNum(ardVideoInspectTask.getChannel()); + cmd.setChanNo(ardVideoInspectTask.getChannel()); hikClientService.recordStopNotToMinio(cmd); GlobalVariable.previewMap.remove(cameraId); } diff --git a/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaServiceImpl.java b/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaServiceImpl.java index e27adb7..5eecbc0 100644 --- a/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaServiceImpl.java +++ b/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaServiceImpl.java @@ -113,6 +113,7 @@ //-vcodec libx264 //鎸囧畾瑙嗛缂栫爜鍣ㄤ负 libx264锛屼娇鐢� H.264 缂栫爜鏍煎紡杩涜瑙嗛鍘嬬缉 //-preset ultrafast //--preset鐨勫弬鏁颁富瑕佽皟鑺傜紪鐮侀�熷害鍜岃川閲忕殑骞宠 锛屾湁ultrafast锛堣浆鐮侀�熷害鏈�蹇紝瑙嗛寰�寰�涔熸渶妯$硦锛夈�乻uperfast銆乿eryfast銆乫aster銆乫ast銆乵edium銆乻low銆乻lower銆乿eryslow銆乸lacebo杩�10涓�夐」锛屼粠蹇埌鎱� //-r 25 //璁剧疆杈撳嚭瑙嗛鐨勫抚鐜囦负 25 甯�/绉� + //-g 20 //鍏抽敭甯ч棿闅�20 //-rtsp_transport tcp //杩欎釜閫夐」鍛婅瘔 FFmpeg 浣跨敤 TCP 浣滀负 RTSP 鐨勪紶杈撳崗璁� //-threads 4: 鎸囧畾瑕佷娇鐢ㄧ殑绾跨▼鏁颁负 4銆�//杩欏厑璁� FFmpeg 鍦ㄥ鏍稿鐞嗗櫒涓婁娇鐢ㄥ涓嚎绋嬫潵杩涜瑙嗛缂栫爜锛屼互鍔犲揩閫熷害銆� // -i //鐢ㄤ簬鎸囧畾杈撳叆濯掍綋鏂囦欢鎴栬緭鍏ユ祦鐨勫湴鍧� @@ -123,7 +124,7 @@ //GPU纭В鐮佺紪鐮� -hwaccel cuvid -c:v h264_cuvid 浣跨敤cuda瑙g爜 -c:v h264_nvenc 浣跨敤cuda缂栫爜 //String cmd = rootPath + "/lib/mediamtx/" + "ffmpeg -hwaccel cuvid -c:v h264_cuvid -rtsp_transport udp -i " + rtspPath + " -c:v h264_nvenc -r 25 -threads 4 -b:v 2048k -bf 0 -f rtsp rtsp://localhost:$RTSP_PORT/$MTX_PATH"; if (isCode.equals("1")) { - String cmd = "ffmpeg -rtsp_transport tcp -i " + rtspPath + " -vcodec libx264 -preset:v ultrafast -r 25 -threads 6 -b:v 1024k -f rtsp rtsp://localhost:$RTSP_PORT/$MTX_PATH"; + String cmd = "ffmpeg -rtsp_transport tcp -i " + rtspPath + " -vcodec libx264 -preset:v ultrafast -r 25 -g 20 -threads 6 -b:v 2048k -f rtsp rtsp://localhost:$RTSP_PORT/$MTX_PATH"; if (!softwareDecoding) { cmd = "ffmpeg -hwaccel cuvid -c:v h264_cuvid -rtsp_transport tcp -i " + rtspPath + " -c:v h264_nvenc -r 25 -threads 6 -b:v 2048k -bf 0 -f rtsp rtsp://localhost:$RTSP_PORT/$MTX_PATH"; } diff --git a/ard-work/src/main/resources/templates/preview.html b/ard-work/src/main/resources/templates/preview.html index 1a57d63..323ed06 100644 --- a/ard-work/src/main/resources/templates/preview.html +++ b/ard-work/src/main/resources/templates/preview.html @@ -148,7 +148,7 @@ } - let mediamtxHost = "192.168.1.12" + let mediamtxHost = "192.168.1.227" var chanMap = new Map(); window.onload = function () { changeGrid(2, 2); diff --git a/ard-work/src/main/resources/templates/test.html b/ard-work/src/main/resources/templates/test.html index 25cbd19..25ea102 100644 --- a/ard-work/src/main/resources/templates/test.html +++ b/ard-work/src/main/resources/templates/test.html @@ -308,7 +308,7 @@ $("#setPreset").click(function () { cameraId = $('#select option:selected').val(); - opt = {"cameraId": cameraId, "channelNum": 1, "speed": 8, "presetIndex": 1}; + opt = {"cameraId": cameraId, "chanNo": 1, "speed": 8, "presetIndex": 1}; $.ajax({ headers: { 'Accept': 'application/json', @@ -326,7 +326,7 @@ }) $("#gotoPreset").click(function () { cameraId = $('#select option:selected').val(); - opt = {"cameraId": cameraId, "channelNum": 1, "speed": 8, "presetIndex": 1}; + opt = {"cameraId": cameraId, "chanNo": 1, "speed": 8, "presetIndex": 1}; $.ajax({ headers: { 'Accept': 'application/json', @@ -344,7 +344,7 @@ }) $("#getPTZ").click(function () { cameraId = $('#select option:selected').val(); - opt = {"cameraId": cameraId, "channelNum": 1}; + opt = {"cameraId": cameraId, "chanNo": 1}; $.ajax({ headers: { 'Accept': 'application/json', @@ -370,7 +370,7 @@ var z = $('#z').val(); //瀹氫箟涓�涓甫鏈塎ap瀛楁鐨勫疄浣撳璞� var myEntity = { - channelNum: 1, + chanNo: 1, cameraId: cameraId, ptzMap: { p: p, @@ -401,7 +401,7 @@ var targetP = $('#targetPostion').val(); //瀹氫箟涓�涓甫鏈塎ap瀛楁鐨勫疄浣撳璞� var myEntity = { - channelNum: 1, + chanNo: 1, cameraId: cameraId, targetPosition: targetP, camPosition: camP, @@ -424,7 +424,7 @@ }) $("#setZeroPTZ").click(function () { cameraId = $('#select option:selected').val(); - opt = {"cameraId": cameraId, "channelNum": 1}; + opt = {"cameraId": cameraId, "chanNo": 1}; $.ajax({ headers: { 'Accept': 'application/json', @@ -442,7 +442,7 @@ }) $("#WiperPwron").click(function () { cameraId = $('#select option:selected').val(); - opt = {"cameraId": cameraId, "channelNum": 1, "speed": 8, "enable": true, "code": 16}; + opt = {"cameraId": cameraId, "chanNo": 1, "speed": 8, "enable": true, "code": 16}; $.ajax({ headers: { 'Accept': 'application/json', @@ -461,8 +461,8 @@ var defogflag = true; $("#Defogcfg").click(function () { cameraId = $('#select option:selected').val(); - optOpen = {"cameraId": cameraId, "channelNum": 1, "enable": true}; - optClose = {"cameraId": cameraId, "channelNum": 1, "enable": false}; + optOpen = {"cameraId": cameraId, "chanNo": 1, "enable": true}; + optClose = {"cameraId": cameraId, "chanNo": 1, "enable": false}; if (defogflag) { $(this).text("鍏抽棴閫忛浘"); defogflag = false; @@ -503,8 +503,8 @@ var infrareflag = true; $("#Infrarecfg").click(function () { cameraId = $('#select option:selected').val(); - optOpen = {"cameraId": cameraId, "channelNum": 1, "enable": true}; - optClose = {"cameraId": cameraId, "channelNum": 1, "enable": false}; + optOpen = {"cameraId": cameraId, "chanNo": 1, "enable": true}; + optClose = {"cameraId": cameraId, "chanNo": 1, "enable": false}; if (infrareflag) { $(this).text("鍏抽棴绾㈠"); infrareflag = false; @@ -545,8 +545,8 @@ var focusModeflag = true; $("#FocusMode").click(function () { cameraId = $('#select option:selected').val(); - optOpen = {"cameraId": cameraId, "channelNum": 1, "enable": true}; - optClose = {"cameraId": cameraId, "channelNum": 1, "enable": false}; + optOpen = {"cameraId": cameraId, "chanNo": 1, "enable": true}; + optClose = {"cameraId": cameraId, "chanNo": 1, "enable": false}; if (focusModeflag) { $(this).text("鑷姩鑱氱劍"); focusModeflag = false; @@ -583,11 +583,30 @@ }) } }) + $("#getFocusPos").click(function () { + cameraId = $('#select option:selected').val(); + opt = {"cameraId": cameraId, "chanNo": 1}; + $.ajax({ + headers: { + 'Accept': 'application/json', + 'Content-Type': 'application/json', + 'Authorization': token + }, + url: "../hik/getFocusPos", + type: "post", + dataType: "json", + data: JSON.stringify(opt), + success: function (datas) { + console.log(datas); + $("#focus").val(datas.data.dwFocus); + } + }) + }) var heateRpwronflag = true; $("#HeateRpwron").click(function () { cameraId = $('#select option:selected').val(); - optOpen = {"cameraId": cameraId, "channelNum": 1, "enable": true}; - optClose = {"cameraId": cameraId, "channelNum": 1, "enable": false}; + optOpen = {"cameraId": cameraId, "chanNo": 1, "enable": true}; + optClose = {"cameraId": cameraId, "chanNo": 1, "enable": false}; if (heateRpwronflag) { $(this).text("鍏抽棴浜戝彴鍔犵儹"); heateRpwronflag = false; @@ -627,8 +646,8 @@ var CameraDeicingflag = true; $("#CameraDeicing").click(function () { cameraId = $('#select option:selected').val(); - optOpen = {"cameraId": cameraId, "channelNum": 1, "enable": true}; - optClose = {"cameraId": cameraId, "channelNum": 1, "enable": false}; + optOpen = {"cameraId": cameraId, "chanNo": 1, "enable": true}; + optClose = {"cameraId": cameraId, "chanNo": 1, "enable": false}; if (CameraDeicingflag) { $(this).text("鍏抽棴闀滃ご鍔犵儹"); CameraDeicingflag = false; @@ -666,7 +685,7 @@ }) $("#realCutPic").click(function () { cameraId = $('#select option:selected').val(); - opt = {"cameraId": cameraId, "channelNum": 1}; + opt = {"cameraId": cameraId, "chanNo": 1}; $.ajax({ headers: { 'Accept': 'application/json', @@ -685,7 +704,7 @@ }) $("#saveCutPic").click(function () { cameraId = $('#select option:selected').val(); - opt = {"cameraId": cameraId, "channelNum": 1}; + opt = {"cameraId": cameraId, "chanNo": 1}; $.ajax({ headers: { 'Accept': 'application/json', @@ -705,8 +724,8 @@ var recordflag = true; $("#record").click(function () { cameraId = $('#select option:selected').val(); - optOpen = {"cameraId": cameraId, "channelNum": 1, "enable": true}; - optClose = {"cameraId": cameraId, "channelNum": 1, "enable": false}; + optOpen = {"cameraId": cameraId, "chanNo": 1, "enable": true}; + optClose = {"cameraId": cameraId, "chanNo": 1, "enable": false}; if (recordflag) { $(this).text("鍋滄褰曞儚"); recordflag = false; @@ -749,7 +768,7 @@ /*浜戝彴鍏叡鏂规硶*/ function commondMethod(url, code, enable) { cameraId = $('#select option:selected').val(); - opt = {"cameraId": cameraId, "channelNum": 1, "speed": 8, "enable": enable, "code": code}; + opt = {"cameraId": cameraId, "chanNo": 1, "speed": 8, "enable": enable, "code": code}; $.ajax({ headers: { 'Accept': 'application/json', @@ -790,7 +809,7 @@ //棰勮娴峰悍鐩告満 function realViewHik(serverip, elem, username, password, ipaddr, port) { // webRtcServer = new WebRtcStreamer(elem, "http://" + serverip + ":8000"); - webRtcServer = new WebRtcStreamer(elem, "http://192.168.1.227:9000"); + webRtcServer = new WebRtcStreamer(elem, "http://192.168.1.227:8000"); let rtspUrl = "rtsp://" + username + ":" + password + "@" + ipaddr + ":" + port + "/ch1/main/av_stream"; let option = "rtptransport=tcp"; console.log("rtsp鍦板潃锛�" + rtspUrl); diff --git a/lib/mediamtx/mediamtx.yml b/lib/mediamtx/mediamtx.yml index 4be3390..9dfc5b5 100644 --- a/lib/mediamtx/mediamtx.yml +++ b/lib/mediamtx/mediamtx.yml @@ -1,6 +1,6 @@ ############################################### -# General parameters +# General settings # Sets the verbosity of the program; available values are "error", "warn", "info", "debug". logLevel: info @@ -13,10 +13,10 @@ readTimeout: 10s # Timeout of write operations. writeTimeout: 10s -# Number of read buffers. -# A higher value allows a wider throughput, a lower value allows to save RAM. -readBufferCount: 512 -# Maximum size of payload of outgoing UDP packets. +# Size of the queue of outgoing packets. +# A higher value allows to increase throughput, a lower value allows to save RAM. +writeQueueSize: 512 +# Maximum size of outgoing UDP packets. # This can be decreased to avoid fragmentation on networks with a low UDP MTU. udpMaxPayloadSize: 1472 @@ -40,7 +40,7 @@ # Enable the HTTP API. api: yes # Address of the API listener. -apiAddress: 127.0.0.1:9997 +apiAddress: 192.168.1.227:9997 # Enable Prometheus-compatible metrics. metrics: no @@ -62,9 +62,9 @@ runOnConnectRestart: no ############################################### -# RTSP parameters +# RTSP settings -# Enable support for the RTSP protocol. +# Allow publishing and reading streams with the RTSP protocol. rtsp: yes # List of enabled RTSP transport protocols. # UDP is the most performant, but doesn't work when there's a NAT/firewall between @@ -102,9 +102,9 @@ authMethods: [basic] ############################################### -# RTMP parameters +# RTMP settings -# Enable support for the RTMP protocol. +# Allow publishing and reading streams with the RTMP protocol. rtmp: yes # Address of the RTMP listener. This is needed only when encryption is "no" or "optional". rtmpAddress: :1935 @@ -122,9 +122,9 @@ rtmpServerCert: server.crt ############################################### -# HLS parameters +# HLS settings -# Enable support for the HLS protocol. +# Allow reading streams with the HLS protocol. hls: no # Address of the HLS listener. hlsAddress: :8888 @@ -178,9 +178,9 @@ hlsDirectory: '' ############################################### -# WebRTC parameters +# WebRTC settings -# Enable support for the WebRTC protocol. +# Allow publishing and reading streams with the WebRTC protocol. webrtc: yes # Address of the WebRTC listener. webrtcAddress: :8889 @@ -206,36 +206,36 @@ # STUN servers are used to obtain the public IP of server and clients. They are # needed when server and clients are on different LANs. # TURN/TURNS servers are needed when a direct connection between server and - # clients is not possible. All traffic is routed through them. stun:stun.l.google.com:19302 -- url: stun:192.168.1.15:3478 + # clients is not possible. All traffic is routed through them. +- url: stun:stun.l.google.com:19302 # if user is "AUTH_SECRET", then authentication is secret based. # the secret must be inserted into the password field. username: '' password: '' # List of public IP addresses that are to be used as a host. # This is used typically for servers that are behind 1:1 D-NAT. -webrtcICEHostNAT1To1IPs: [] +webrtcICEHostNAT1To1IPs: [192.168.1.227] # Address of a ICE UDP listener in format host:port. # If filled, ICE traffic will pass through a single UDP port, # allowing the deployment of the server inside a container or behind a NAT. -webrtcICEUDPMuxAddress: +webrtcICEUDPMuxAddress: 192.168.1.227:8189 # Address of a ICE TCP listener in format host:port. # If filled, ICE traffic will pass through a single TCP port, # allowing the deployment of the server inside a container or behind a NAT. -# Setting this parameter forces usage of the TCP protocol, which is not +# Using this setting forces usage of the TCP protocol, which is not # optimal for WebRTC. -webrtcICETCPMuxAddress: +webrtcICETCPMuxAddress: 192.168.1.227:8189 ############################################### -# SRT parameters +# SRT settings -# Enables support for the SRT protocol. +# Allow publishing and reading streams with the SRT protocol. srt: yes # Address of the SRT listener. srtAddress: :8890 ############################################### -# Path parameters +# Path settings # These settings are path-dependent, and the map key is the name of the path. # It's possible to use regular expressions by using a tilde as prefix, @@ -245,25 +245,24 @@ # another entry. paths: all: + ############################################### + # General path settings + # Source of the stream. This can be: - # * publisher -> the stream is published by a RTSP, RTMP, WebRTC or SRT client + # * publisher -> the stream is provided by a RTSP, RTMP, WebRTC or SRT client # * rtsp://existing-url -> the stream is pulled from another RTSP server / camera # * rtsps://existing-url -> the stream is pulled from another RTSP server / camera with RTSPS # * rtmp://existing-url -> the stream is pulled from another RTMP server / camera # * rtmps://existing-url -> the stream is pulled from another RTMP server / camera with RTMPS - # * http://existing-url/stream.m3u8 -> the stream is pulled from another HLS server - # * https://existing-url/stream.m3u8 -> the stream is pulled from another HLS server with HTTPS + # * http://existing-url/stream.m3u8 -> the stream is pulled from another HLS server / camera + # * https://existing-url/stream.m3u8 -> the stream is pulled from another HLS server / camera with HTTPS # * udp://ip:port -> the stream is pulled with UDP, by listening on the specified IP and port - # * srt://existing-url -> the stream is pulled from another SRT server - # * whep://existing-url -> the stream is pulled from another WebRTC server - # * wheps://existing-url -> the stream is pulled from another WebRTC server with HTTPS + # * srt://existing-url -> the stream is pulled from another SRT server / camera + # * whep://existing-url -> the stream is pulled from another WebRTC server / camera + # * wheps://existing-url -> the stream is pulled from another WebRTC server / camera with HTTPS # * redirect -> the stream is provided by another path or server # * rpiCamera -> the stream is provided by a Raspberry Pi Camera source: publisher - - ############################################### - # General path parameters - # If the source is a URL, and the source certificate is self-signed # or invalid, you can provide the fingerprint of the certificate in order to # validate it anyway. It can be obtained by running: @@ -283,7 +282,7 @@ maxReaders: 0 ############################################### - # Authentication path parameters + # Authentication path settings # Username required to publish. # SHA256-hashed values can be inserted with the "sha256:" prefix. @@ -304,7 +303,7 @@ readIPs: [] ############################################### - # Publisher path parameters (when source is "publisher") + # Publisher path settings (when source is "publisher") # allow another client to disconnect the current publisher and publish in its place. overridePublisher: yes @@ -313,7 +312,7 @@ fallback: ############################################### - # RTSP path parameters (when source is a RTSP or a RTSPS URL) + # RTSP path settings (when source is a RTSP or a RTSPS URL) # protocol used to pull the stream. available values are "automatic", "udp", "multicast", "tcp". sourceProtocol: automatic @@ -333,13 +332,13 @@ rtspRangeStart: ############################################### - # Redirect path parameters (when source is "redirect") + # Redirect path settings (when source is "redirect") # RTSP URL which clients will be redirected to. sourceRedirect: ############################################### - # Raspberry Pi Camera path parameters (when source is "rpiCamera") + # Raspberry Pi Camera path settings (when source is "rpiCamera") # ID of the camera rpiCameraCamID: 0 @@ -421,7 +420,7 @@ rpiCameraTextOverlay: '%Y-%m-%d %H:%M:%S - MediaMTX' ############################################### - # external commands path parameters + # External commands path settings # Command to run when this path is initialized. # This can be used to publish a stream and keep it always opened. diff --git a/lib/webrtc/webrtc-streamer.exe b/lib/webrtc/webrtc-streamer.exe index 5347950..e957c99 100644 --- a/lib/webrtc/webrtc-streamer.exe +++ b/lib/webrtc/webrtc-streamer.exe Binary files differ diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/SdkTask.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/SdkTask.java index e477f43..816709f 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/SdkTask.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/SdkTask.java @@ -51,7 +51,7 @@ } CameraCmd cmd = new CameraCmd(); cmd.setCameraId(camera.getId()); - cmd.setChannelNum(1); + cmd.setChanNo(1); cmd.setOperator(camera.getOperatorId()); if (!GlobalVariable.loginMap.containsKey(camera.getId()))//鍙帹閫佺櫥褰曟垚鍔熺殑鐩告満 { -- Gitblit v1.9.3