From 255a6915a9898fe6c1a6649cae707649226ec177 Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期五, 08 九月 2023 16:30:34 +0800
Subject: [PATCH] 程序启动清空相机缓存列表重新加载 增加sdk获取相机聚焦值接口 修改相机登录时离线清空通道列表 增加获取码流压缩参数(分辨率/编码格式/码率/流类型) 优化相机在线离线业务方法,修改仅在线设备上传ptz
---
ard-work/src/main/java/com/ruoyi/media/service/impl/MediaServiceImpl.java | 26 ++--
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/SdkTask.java | 9 +
ard-work/src/main/java/com/ruoyi/device/hiksdk/controller/SdkController.java | 54 +++++-----
ard-work/src/main/java/com/ruoyi/device/hiksdk/service/impl/HikClientServiceImpl.java | 138 +++++++++++++++++++--------
ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm | 7
ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java | 4
ard-work/src/main/java/com/ruoyi/device/hiksdk/sdk/LoginResultCallBack.java | 12 +-
ard-work/src/main/java/com/ruoyi/device/hiksdk/service/IHikClientService.java | 4
ard-work/src/main/resources/templates/preview.html | 4
9 files changed, 162 insertions(+), 96 deletions(-)
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 9bfeeb1..af164ea 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
@@ -49,6 +49,10 @@
@PostConstruct
public void loadCameras() {
+ //娓呯┖鐩告満缂撳瓨
+ Collection<String> cacheKeys = redisCache.keys(getCacheKey("*"));
+ redisCache.deleteObject(cacheKeys);
+ //閲嶆柊鍔犺浇鐩告満鍒扮紦瀛�
List<ArdCameras> ardCameras = selectArdCamerasListNoDataScope(new ArdCameras());
for (ArdCameras ardCamera : ardCameras) {
redisCache.setCacheObject(getCacheKey(ardCamera.getId()), ardCamera);
diff --git a/ard-work/src/main/java/com/ruoyi/device/hiksdk/controller/SdkController.java b/ard-work/src/main/java/com/ruoyi/device/hiksdk/controller/SdkController.java
index 6d48ea2..fcc65a1 100644
--- a/ard-work/src/main/java/com/ruoyi/device/hiksdk/controller/SdkController.java
+++ b/ard-work/src/main/java/com/ruoyi/device/hiksdk/controller/SdkController.java
@@ -74,14 +74,13 @@
return AjaxResult.success("鐩告満鍒楄〃锛�", list);
}
- @ApiOperation("瑙嗛鍒嗚鲸鐜�")
- @PostMapping("/videoResolution")
- @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum"})
- @Log(title = "瑙嗛鍒嗚鲸鐜�", businessType = BusinessType.CONTROL)
+ @ApiOperation("鑾峰彇鐮佹祦鍘嬬缉鍙傛暟")
+ @PostMapping("/getVideoCompressionCfg")
+ @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.chanNo"})
+ @Log(title = "鑾峰彇鐮佹祦鍘嬬缉鍙傛暟", businessType = BusinessType.CONTROL)
public @ResponseBody
- AjaxResult getVideoResolution(@RequestBody CameraCmd cmd) {
- String videoResolution = sdk.getVideoResolution(cmd);
- return toAjaxString(videoResolution, "瑙嗛鍒嗚鲸鐜囷細");
+ AjaxResult getVideoCompressionCfg(@RequestBody CameraCmd cmd) {
+ return AjaxResult.success(sdk.getVideoCompressionCfg(cmd));
}
@ApiOperation("鍦ㄧ嚎鐘舵��")
@@ -91,13 +90,14 @@
public @ResponseBody
AjaxResult getOnlineState(@RequestBody CameraCmd cmd) {
cmd.setOperator(SecurityUtils.getUserId());
- return toAjax(sdk.isOnLine(cmd));
+ boolean onLine = sdk.isOnLine(cmd);
+ return AjaxResult.success(onLine);
}
@ApiOperation(value = "浜戝彴鎺у埗", notes = "Code:1-宸︿笂 2-涓� 3-鍙充笂 4-宸� 5-宸¤埅 6-鍙� 7-宸︿笅 8-涓� 9-鍙充笅 10-鐒﹁窛鍙樺ぇ 11-鐒﹁窛鍙樺皬\n" +
"12-鐒︾偣鍓嶈皟 13-鐒︾偣鍚庤皟 14-鍏夊湀鎵╁ぇ 15-鍏夊湀缂╁皬 16-闆ㄥ埛寮�鍚�")
@PostMapping("/PTZControlWithSpeed")
- @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum", "cmd.speed", "cmd.enable", "cmd.code"})
+ @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.chanNo", "cmd.speed", "cmd.enable", "cmd.code"})
@Log(title = "浜戝彴鎺у埗", businessType = BusinessType.CONTROL)
public @ResponseBody
AjaxResult PTZControlWithSpeed(@RequestBody CameraCmd cmd) {
@@ -108,7 +108,7 @@
@ApiOperation("璋冪敤棰勭疆鐐�")
@PostMapping("/gotoPreset")
- @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum", "cmd.presetIndex"})
+ @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.chanNo", "cmd.presetIndex"})
@Log(title = "璋冪敤棰勭疆鐐�", businessType = BusinessType.CONTROL)
public @ResponseBody
AjaxResult gotoPreset(@RequestBody CameraCmd cmd) {
@@ -118,7 +118,7 @@
@ApiOperation("璁剧疆棰勭疆鐐�")
@PostMapping("/setPreset")
- @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum", "cmd.presetIndex"})
+ @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.chanNo", "cmd.presetIndex"})
@Log(title = "璁剧疆棰勭疆鐐�", businessType = BusinessType.CONTROL)
public @ResponseBody
AjaxResult setPreset(@RequestBody CameraCmd cmd) {
@@ -128,7 +128,7 @@
@ApiOperation("鑾峰彇鑱氱劍鍊�")
@PostMapping("/getFocusPos")
- @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum"})
+ @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.chanNo"})
@Log(title = "鑾峰彇鑱氱劍鍊�", businessType = BusinessType.CONTROL)
public @ResponseBody
AjaxResult getFocusPos(@RequestBody CameraCmd cmd) {
@@ -139,7 +139,7 @@
@ApiOperation("璁剧疆鑱氱劍鍊�")
@PostMapping("/setFocusPos")
- @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum", "cmd.dwFocusPos"})
+ @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.chanNo", "cmd.dwFocusPos"})
@Log(title = "璁剧疆鑱氱劍鍊�", businessType = BusinessType.CONTROL)
public @ResponseBody
AjaxResult setFocusPos(@RequestBody CameraCmd cmd) {
@@ -149,7 +149,7 @@
@ApiOperation("鑾峰彇PTZ")
@PostMapping("/getPTZ")
- @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum"})
+ @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.chanNo"})
@Log(title = "鑾峰彇PTZ", businessType = BusinessType.CONTROL)
public @ResponseBody
AjaxResult GetPTZ(@RequestBody CameraCmd cmd) {
@@ -161,7 +161,7 @@
@ApiOperation("鑾峰彇PTZ鑼冨洿")
@PostMapping("/getPTZScope")
@Log(title = "鑾峰彇PTZ鑼冨洿", businessType = BusinessType.CONTROL)
- @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum"})
+ @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.chanNo"})
public @ResponseBody
AjaxResult GetPTZScope(@RequestBody CameraCmd cmd) {
cmd.setOperator(SecurityUtils.getUserId());
@@ -172,7 +172,7 @@
@ApiOperation("璁剧疆PTZ")
@PostMapping("/setPTZ")
@Log(title = "璁剧疆PTZ", businessType = BusinessType.CONTROL)
- @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum", "cmd.ptzMap"})
+ @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.chanNo", "cmd.ptzMap"})
public @ResponseBody
AjaxResult SetPTZ(@RequestBody CameraCmd cmd) {
cmd.setOperator(SecurityUtils.getUserId());
@@ -182,7 +182,7 @@
@ApiOperation("鎸囧悜鐩爣")
@PostMapping("/setTargetPosition")
@Log(title = "鎸囧悜鐩爣", businessType = BusinessType.CONTROL)
- @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum", "cmd.targetPosition"})
+ @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.chanNo", "cmd.targetPosition"})
public @ResponseBody
AjaxResult setTargetPosition(@RequestBody CameraCmd cmd) {
cmd.setOperator(SecurityUtils.getUserId());
@@ -193,7 +193,7 @@
@ApiOperation("璁剧疆闆舵柟浣嶈")
@PostMapping("/setZeroPTZ")
@Log(title = "璁剧疆闆舵柟浣嶈", businessType = BusinessType.CONTROL)
- @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum"})
+ @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.cmd.chanNo"})
public @ResponseBody
AjaxResult SetZeroPTZ(@RequestBody CameraCmd cmd) {
cmd.setOperator(SecurityUtils.getUserId());
@@ -222,7 +222,7 @@
@ApiOperation("鑾峰彇浜戝彴閿佸畾淇℃伅")
@PostMapping("/getPTZLockInfo")
- @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum"})
+ @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.chanNo"})
@Log(title = "鑾峰彇浜戝彴閿佸畾淇℃伅", businessType = BusinessType.CONTROL)
public @ResponseBody
AjaxResult getPTZLockInfo(@RequestBody CameraCmd cmd) {
@@ -240,7 +240,7 @@
@ApiOperation("閫忛浘寮�鍏�")
@PostMapping("/defogcfg")
@Log(title = "閫忛浘寮�鍏�", businessType = BusinessType.CONTROL)
- @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum", "cmd.enable"})
+ @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.chanNo", "cmd.enable"})
public @ResponseBody
AjaxResult defogcfg(@RequestBody CameraCmd cmd) {
cmd.setOperator(SecurityUtils.getUserId());
@@ -250,7 +250,7 @@
@ApiOperation("绾㈠寮�鍏�")
@PostMapping("/infrarecfg")
@Log(title = "绾㈠寮�鍏�", businessType = BusinessType.CONTROL)
- @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum", "cmd.enable"})
+ @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.chanNo", "cmd.enable"})
public @ResponseBody
AjaxResult infrarecfg(@RequestBody CameraCmd cmd) {
cmd.setOperator(SecurityUtils.getUserId());
@@ -260,7 +260,7 @@
@ApiOperation(value = "鎵嬪姩/鑷姩鑱氱劍", notes = "true鎵嬪姩flase鑷姩")
@PostMapping("/focusMode")
@Log(title = "鎵嬪姩/鑷姩鑱氱劍", businessType = BusinessType.CONTROL)
- @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum", "cmd.enable"})
+ @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.chanNo", "cmd.enable"})
public @ResponseBody
AjaxResult enableFocusMode(@RequestBody CameraCmd cmd) {
cmd.setOperator(SecurityUtils.getUserId());
@@ -279,7 +279,7 @@
@ApiOperation("浜戝彴鍔犵儹")
@PostMapping("/heateRpwron")
@Log(title = "浜戝彴鍔犵儹", businessType = BusinessType.CONTROL)
- @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum", "cmd.enable"})
+ @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.chanNo", "cmd.enable"})
public @ResponseBody
AjaxResult HeateRpwron(@RequestBody CameraCmd cmd) {
cmd.setOperator(SecurityUtils.getUserId());
@@ -290,7 +290,7 @@
@ApiOperation("闀滃ご鍔犵儹")
@PostMapping("/cameraDeicing")
@Log(title = "闀滃ご鍔犵儹", businessType = BusinessType.CONTROL)
- @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum", "cmd.enable"})
+ @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.chanNo", "cmd.enable"})
public @ResponseBody
AjaxResult CameraDeicing(@RequestBody CameraCmd cmd) {
cmd.setOperator(SecurityUtils.getUserId());
@@ -308,7 +308,7 @@
@ApiOperation("鐩告満鎶撳浘")
@PostMapping("/picCutCate")
@Log(title = "鐩告満鎶撳浘", businessType = BusinessType.CONTROL)
- @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum"})
+ @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.chanNo"})
public @ResponseBody
AjaxResult picCutCate(@RequestBody CameraCmd cmd) {
cmd.setOperator(SecurityUtils.getUserId());
@@ -319,7 +319,7 @@
@ApiOperation("鎵嬪姩褰曞儚")
@PostMapping("/record")
@Log(title = "鎵嬪姩褰曞儚", businessType = BusinessType.CONTROL)
- @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum", "cmd.enable"})
+ @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.chanNo", "cmd.enable"})
public @ResponseBody
AjaxResult record(@RequestBody CameraCmd cmd) {
cmd.setOperator(SecurityUtils.getUserId());
@@ -329,7 +329,7 @@
@ApiOperation("鑾峰彇鐩告満鏋惰鍙傛暟")
@PostMapping("/getCameraSetupCFG")
@Log(title = "鑾峰彇鐩告満鏋惰鍙傛暟", businessType = BusinessType.CONTROL)
- @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum", "cmd.enable"})
+ @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.chanNo", "cmd.enable"})
public @ResponseBody
AjaxResult getCameraSetupCFG(@RequestBody CameraCmd cmd) {
cmd.setOperator(SecurityUtils.getUserId());
diff --git a/ard-work/src/main/java/com/ruoyi/device/hiksdk/sdk/LoginResultCallBack.java b/ard-work/src/main/java/com/ruoyi/device/hiksdk/sdk/LoginResultCallBack.java
index 66fb37b..8f369f6 100644
--- a/ard-work/src/main/java/com/ruoyi/device/hiksdk/sdk/LoginResultCallBack.java
+++ b/ard-work/src/main/java/com/ruoyi/device/hiksdk/sdk/LoginResultCallBack.java
@@ -41,26 +41,24 @@
if (GlobalVariable.loginMap.containsKey(camera.getId())) {
GlobalVariable.loginMap.remove(camera.getId());
}
+ //鍒犻櫎绠$悊閫氶亾
+ ardChannelService.deleteArdChannelByDeviceId(camera.getId());
if (dwResult == 1) {
GlobalVariable.loginMap.put(camera.getId(), lUserID);
log.debug(camera.getIp() + ":" + camera.getPort() + "鐧诲綍鎴愬姛");
camera.setLoginId(lUserID);
camera.setChanNum((int) lpDeviceinfo.byChanNum);
- camera.setStartDChan((int)lpDeviceinfo.byStartDChan);
-
+ camera.setStartDChan((int) lpDeviceinfo.byStartDChan);
//鑾峰彇鏈�鏂伴�氶亾
List<ArdChannel> cameraChannelList = hikClientService.getCameraChannelList(camera);
- if(cameraChannelList.size()>0) {
- //鍒犻櫎绠$悊閫氶亾
- ardChannelService.deleteArdChannelByDeviceId(camera.getId());
+ if (cameraChannelList.size() > 0) {
for (ArdChannel channel : cameraChannelList) {
channel.setId(IdUtils.simpleUUID());
ardChannelService.insertArdChannel(channel);
}
}
//鍒涘缓寮曞闃熷垪
- if(!GuidePriorityQueue.cameraQueueMap.containsKey(camera.getId()))
- {
+ if (!GuidePriorityQueue.cameraQueueMap.containsKey(camera.getId())) {
Comparator<GuideTask> comparator = GuidePriorityQueue.getComparator();
PriorityBlockingQueue<GuideTask> priorityQueue = new PriorityBlockingQueue<>(1000, comparator);
GuidePriorityQueue.cameraQueueMap.put(camera.getId(), priorityQueue);
diff --git a/ard-work/src/main/java/com/ruoyi/device/hiksdk/service/IHikClientService.java b/ard-work/src/main/java/com/ruoyi/device/hiksdk/service/IHikClientService.java
index 95464a3..eceef2f 100644
--- a/ard-work/src/main/java/com/ruoyi/device/hiksdk/service/IHikClientService.java
+++ b/ard-work/src/main/java/com/ruoyi/device/hiksdk/service/IHikClientService.java
@@ -44,8 +44,8 @@
//璋冪敤棰勭疆浣�
boolean gotoPreset(CameraCmd cmd);
- //鍒嗚鲸鐜囪幏鍙�
- String getVideoResolution(CameraCmd cmd);
+ //鑾峰彇鐮佹祦鍘嬬缉鍙傛暟
+ Map<String,String> getVideoCompressionCfg(CameraCmd cmd);
//閫忛浘
boolean controlDefogcfg(CameraCmd cmd);
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 12c8cc8..3485345 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
@@ -357,10 +357,10 @@
Integer userId = GlobalVariable.loginMap.get(cameraId);
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;
+ struGisInfo.struPtzPosEx.dwFocus = dwFocusPos;
struStdCfg.read();
IntByReference lchannel = new IntByReference(channelNum);
- struStdCfg.lpInBuffer= struGisInfo.getPointer();
+ struStdCfg.lpInBuffer = struGisInfo.getPointer();
struStdCfg.lpCondBuffer = lchannel.getPointer();
struStdCfg.dwCondSize = 4;
struStdCfg.dwInSize = struGisInfo.size();
@@ -406,7 +406,7 @@
} else {
struGisInfo.read();
Map<String, Object> map = new HashMap<>();
- map.put("dwFocus",struGisInfo.struPtzPosEx.dwFocus);
+ map.put("dwFocus", struGisInfo.struPtzPosEx.dwFocus);
return map;
}
}
@@ -458,7 +458,7 @@
}
/**
- * @鎻忚堪 鑾峰彇鍒嗚鲸鐜�
+ * @鎻忚堪 鑾峰彇閫氶亾鍘嬬缉鍙傛暟
* @鍙傛暟 [cameraId, channelNum]
* @杩斿洖鍊� java.lang.String
* @鍒涘缓浜� 鍒樿嫃涔�
@@ -466,92 +466,150 @@
* @淇敼浜哄拰鍏跺畠淇℃伅
*/
@Override
- public String getVideoResolution(CameraCmd cmd) {
+ public Map<String,String> getVideoCompressionCfg(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
- Integer channelNum = cmd.getChanNo();
+ Integer chanNo = cmd.getChanNo();
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
- return " ";
+ return null;
}
Integer userId = GlobalVariable.loginMap.get(cameraId);
- String ResResolution = "";
- NET_DVR_COMPRESSIONCFG_V30 resolution = new NET_DVR_COMPRESSIONCFG_V30();
- resolution.write();
- Pointer pioint = resolution.getPointer();
+ Map<String,String> map=new HashMap<>();
+ NET_DVR_COMPRESSIONCFG_V30 compressioncfg = new NET_DVR_COMPRESSIONCFG_V30();
+ compressioncfg.write();
+ Pointer pioint = compressioncfg.getPointer();
IntByReference ibrBytesReturned = new IntByReference(0);
try {
- boolean bool = hCNetSDK.NET_DVR_GetDVRConfig(userId, HCNetSDK.NET_DVR_GET_COMPRESSCFG_V30, channelNum, pioint, resolution.size(), ibrBytesReturned);
+ boolean bool = hCNetSDK.NET_DVR_GetDVRConfig(userId, HCNetSDK.NET_DVR_GET_COMPRESSCFG_V30, chanNo, pioint, compressioncfg.size(), ibrBytesReturned);
if (bool) {
- resolution.read();
+ compressioncfg.read();
+ //鐮佹祦绫诲瀷锛�0-瑙嗛娴侊紝1-澶嶅悎娴侊紝0xfe- 鑷姩锛堝拰婧愪竴鑷达級
+ String streamType="";
+ switch(compressioncfg.struNormHighRecordPara.byStreamType)
+ {
+ case 0: streamType="瑙嗛娴�";break;
+ case 1: streamType="澶嶅悎娴�";break;
+ default:streamType="鏈煡";break;
+ }
+ //瑙嗛缂栫爜绫诲瀷锛�0-绉佹湁264锛�1-鏍囧噯h264锛�2-鏍囧噯mpeg4锛�7-M-JPEG锛�8-MPEG2锛�9-SVAC锛�10-鏍囧噯h265锛�0xfe- 鑷姩锛堝拰婧愪竴鑷达級锛�0xff-鏃犳晥
+ String videoEncType="";
+ switch (compressioncfg.struNormHighRecordPara.byVideoEncType)
+ {
+ case 0:videoEncType="绉佹湁264";break;
+ case 1:videoEncType="鏍囧噯h264";break;
+ case 2:videoEncType="鏍囧噯mpeg4";break;
+ case 7:videoEncType="M-JPEG";break;
+ case 8:videoEncType="MPEG2";break;
+ case 9:videoEncType="SVAC";break;
+ case 10:videoEncType="鏍囧噯h265";break;
+ default: videoEncType="鏈煡";break;
+ }
+ //瑙嗛鐮佺巼
+ String videoBitrate="";
+ switch (compressioncfg.struNormHighRecordPara.dwVideoBitrate)
+ {
+ case 0:videoBitrate="淇濈暀";break;
+ case 1:videoBitrate="16K(淇濈暀)";break;
+ case 2:videoBitrate="32K";break;
+ case 3:videoBitrate="48k";break;
+ case 4:videoBitrate="64k";break;
+ case 5:videoBitrate="80k";break;
+ case 6:videoBitrate="96k";break;
+ case 7:videoBitrate="128k";break;
+ case 8:videoBitrate="160k";break;
+ case 9:videoBitrate="192k";break;
+ case 10:videoBitrate="224k";break;
+ case 11:videoBitrate="256K";break;
+ case 12:videoBitrate="320K";break;
+ case 13:videoBitrate="384K";break;
+ case 14:videoBitrate="448K";break;
+ case 15:videoBitrate="512K";break;
+ case 16:videoBitrate="640K";break;
+ case 17:videoBitrate="768K";break;
+ case 18:videoBitrate="896K";break;
+ case 19:videoBitrate="1024K";break;
+ case 20:videoBitrate="1280K";break;
+ case 21:videoBitrate="1536K";break;
+ case 22:videoBitrate="1792K";break;
+ case 23:videoBitrate="2048K";break;
+ case 24:videoBitrate="3072K";break;
+ case 25:videoBitrate="4096K";break;
+ case 26:videoBitrate="8192K";break;
+ case 27:videoBitrate="16384K";break;
+ default:videoBitrate="鍏朵粬";break;
+ }
//瑙嗛杈撳嚭鍙e垎杈ㄧ巼锛�0- 1024x768锛�1- 1280x720锛�2-1280x1024锛�3- 1680x1050锛�4- 1920x1080锛�5- 3840*2160
-// byte byStreamType = resolution.struNormHighRecordPara.byStreamType;
-// int dwVideoBitrate = resolution.struNormHighRecordPara.dwVideoBitrate;
- int byResolution = resolution.struNormHighRecordPara.byResolution;
- switch (byResolution) {
+ String resolution="";
+ switch (compressioncfg.struNormHighRecordPara.byResolution) {
case 0:
- ResResolution = "DCIF(528*384/528*320)";
+ resolution = "DCIF(528*384/528*320)";
break;
case 1:
- ResResolution = "CIF(352*288/352*240)";
+ resolution = "CIF(352*288/352*240)";
break;
case 2:
- ResResolution = "QCIF(176*144/176*120)";
+ resolution = "QCIF(176*144/176*120)";
break;
case 3:
- ResResolution = "4CIF(704*576/704*480)";
+ resolution = "4CIF(704*576/704*480)";
break;
case 4:
- ResResolution = "2CIF(704*288/704*240)";
+ resolution = "2CIF(704*288/704*240)";
break;
case 6:
- ResResolution = "QVGA(320*240)";
+ resolution = "QVGA(320*240)";
break;
case 7:
- ResResolution = "QQVGA(160*120)";
+ resolution = "QQVGA(160*120)";
break;
case 16:
- ResResolution = "VGA(640*480)";
+ resolution = "VGA(640*480)";
break;
case 17:
- ResResolution = "UXGA(1600*1200)";
+ resolution = "UXGA(1600*1200)";
break;
case 18:
- ResResolution = "SVGA(800*600)";
+ resolution = "SVGA(800*600)";
break;
case 19:
- ResResolution = "HD720P(1280*720)";
+ resolution = "HD720P(1280*720)";
break;
case 20:
- ResResolution = "XVGA(1280*960)";
+ resolution = "XVGA(1280*960)";
break;
case 21:
- ResResolution = "HD900P(1600*900)";
+ resolution = "HD900P(1600*900)";
break;
case 22:
- ResResolution = "1360*1024";
+ resolution = "1360*1024";
break;
case 23:
- ResResolution = "1536*1536";
+ resolution = "1536*1536";
break;
case 24:
- ResResolution = "1920*1920";
+ resolution = "1920*1920";
break;
case 27:
- ResResolution = "1920*1080p";
+ resolution = "1920*1080p";
break;
case 28:
- ResResolution = "2560*1920";
+ resolution = "2560*1920";
break;
case 29:
- ResResolution = "1600*304";
+ resolution = "1600*304";
break;
case 30:
- ResResolution = "2048*1536";
+ resolution = "2048*1536";
break;
default:
- ResResolution = "涓嶅湪褰撳墠鍒嗚鲸鐜囩储寮曪紝璇疯仈绯荤鐞嗗憳娣诲姞";
+ resolution = "涓嶅湪褰撳墠鍒嗚鲸鐜囩储寮曪紝璇疯仈绯荤鐞嗗憳娣诲姞";
break;
}
+ map.put("resolution",resolution);
+ map.put("videoBitrate",videoBitrate);
+ map.put("videoEncType",videoEncType);
+ map.put("streamType",streamType);
+
} else {
int code = hCNetSDK.NET_DVR_GetLastError();
log.error("鎺у埗澶辫触,璇风◢鍚庨噸璇�" + code);
@@ -559,7 +617,7 @@
} catch (Exception ex) {
log.error(ex.getMessage());
}
- return ResResolution;
+ return map;
}
/**
@@ -1478,7 +1536,7 @@
struGisInfo.read();
Map<String, Object> map = new HashMap<>();
map.put("p", struGisInfo.struPtzPos.fPanPos);
- map.put("t", struGisInfo.struPtzPos.fTiltPos<0?struGisInfo.struPtzPos.fTiltPos+360:struGisInfo.struPtzPos.fTiltPos);
+ map.put("t", struGisInfo.struPtzPos.fTiltPos < 0 ? struGisInfo.struPtzPos.fTiltPos + 360 : struGisInfo.struPtzPos.fTiltPos);
map.put("z", struGisInfo.struPtzPos.fZoomPos);
map.put("fHorFieldAngle", struGisInfo.fHorizontalValue);// 姘村钩瑙嗗満瑙�
map.put("fVerFieldAngle", struGisInfo.fVerticalValue);// 鍨傜洿瑙嗗満瑙�
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 5eecbc0..4966e7e 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
@@ -53,7 +53,7 @@
String processName = "mediamtx.exe";
@Override
- public void run(ApplicationArguments args){
+ public void run(ApplicationArguments args) {
try {
log.info("寮�濮嬪姞杞芥祦濯掍綋鍒楄〃");
List<StreamInfo> paths = paths();
@@ -64,12 +64,11 @@
for (Vtdu v : vtduList) {
addPath(v.getName(), v.getRtspUrl(), v.getCodeType(), v.getIsCode());
}
- }
- catch (Exception ex)
- {
- log.error("鍔犺浇娴佸獟浣撳垪琛ㄥ紓甯�:"+ex.getMessage());
+ } catch (Exception ex) {
+ log.error("鍔犺浇娴佸獟浣撳垪琛ㄥ紓甯�:" + ex.getMessage());
}
}
+
@PostConstruct
public void initMediaMtx() {
if (mediamtxEnabled) {
@@ -109,11 +108,12 @@
public String addPath(String name, String rtspPath, String mode, String isCode) {
String rtspUrl = "rtsp://" + mediamtxHost + ":7554/" + name;
Conf mediaInfo = new Conf();
- String rootPath = System.getProperty("user.dir").replaceAll("\\\\", "/")+ "/lib/mediamtx/";
+ String rootPath = System.getProperty("user.dir").replaceAll("\\\\", "/") + "/lib/mediamtx/";
//-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
+ //-sc_threshold 0 //灏嗗叾璁剧疆涓�0锛�-sc_threshold 0锛夌鐢ㄥ満鏅彉鍖栨娴�
//-rtsp_transport tcp //杩欎釜閫夐」鍛婅瘔 FFmpeg 浣跨敤 TCP 浣滀负 RTSP 鐨勪紶杈撳崗璁�
//-threads 4: 鎸囧畾瑕佷娇鐢ㄧ殑绾跨▼鏁颁负 4銆�//杩欏厑璁� FFmpeg 鍦ㄥ鏍稿鐞嗗櫒涓婁娇鐢ㄥ涓嚎绋嬫潵杩涜瑙嗛缂栫爜锛屼互鍔犲揩閫熷害銆�
// -i //鐢ㄤ簬鎸囧畾杈撳叆濯掍綋鏂囦欢鎴栬緭鍏ユ祦鐨勫湴鍧�
@@ -124,11 +124,11 @@
//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 -g 20 -threads 6 -b:v 2048k -f rtsp rtsp://localhost:$RTSP_PORT/$MTX_PATH";
+ String cmd = rootPath + "ffmpeg -rtsp_transport tcp -i " + rtspPath + " -vcodec libx264 -preset:v ultrafast -r 25 -keyint_min 20 -g 20 -sc_threshold 0 -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";
+ cmd = rootPath + "ffmpeg -hwaccel cuvid -c:v h264_cuvid -rtsp_transport tcp -i " + rtspPath + " -c:v h264_nvenc -r 25 -g 60 -threads 6 -b:v 2048k -bf 0 -f rtsp rtsp://localhost:$RTSP_PORT/$MTX_PATH";
}
- if (mode.equals("1")) {
+ if (mode.equals("0")) {
mediaInfo.setRunondemand(cmd);
mediaInfo.setRunondemandrestart(true);
} else {
@@ -153,10 +153,10 @@
String runondemand = item.getConf().getRunondemand();
if (StringUtils.isNotEmpty(runondemand)) {
runoninit = item.getConf().getRunondemand();
- info.setMode("1");
+ info.setMode("0");
} else {
runoninit = item.getConf().getRunoninit();
- info.setMode("0");
+ info.setMode("1");
}
//RTSP婧愬湴鍧�
String regex = "rtsp://[^\\s\"]+";
@@ -194,10 +194,10 @@
String runondemand = item.getConf().getRunondemand();
if (StringUtils.isNotEmpty(runondemand)) {
runoninit = item.getConf().getRunondemand();
- info.setMode("1");
+ info.setMode("0");
} else {
runoninit = item.getConf().getRunoninit();
- info.setMode("0");
+ info.setMode("1");
}
//RTSP婧愬湴鍧�
String regex = "rtsp://[^\\s\"]+";
diff --git a/ard-work/src/main/resources/templates/preview.html b/ard-work/src/main/resources/templates/preview.html
index 323ed06..49c1059 100644
--- a/ard-work/src/main/resources/templates/preview.html
+++ b/ard-work/src/main/resources/templates/preview.html
@@ -21,7 +21,7 @@
.container {
background-color: #151414; /* 灏嗙綉鏍奸」鐩殑棰滆壊璁剧疆涓虹孩鑹茶儗鏅� */
flex: 9;
- border: 1px solid #ccc;
+ border: 10px solid;
box-sizing: border-box;
display: grid;
grid-template-columns: repeat(2, 1fr); /* 榛樿 2x2 缃戞牸 */
@@ -35,7 +35,7 @@
display: flex;
justify-content: center;
align-items: center;
- border: 1px solid #ccc;
+ border: 2px solid #384551;
box-sizing: border-box;
padding: 10px; /* 鍐呰竟璺濅负 10px */
position: relative; /* 娣诲姞鐩稿瀹氫綅 */
diff --git a/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm b/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm
index 9e7b90a..72d9136 100644
--- a/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm
+++ b/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm
@@ -11,11 +11,10 @@
import com.ruoyi.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import java.util.ArrayList;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.SecurityUtils;
#if($table.sub)
- import java.util.ArrayList;
-
- import com.ruoyi.common.utils.StringUtils;
- import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.transaction.annotation.Transactional;
import ${packageName}.domain.${subClassName};
#end
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 816709f..ad33328 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
@@ -45,6 +45,11 @@
if (Objects.size() > 0) {
for (Object obj : Objects) {
ArdCameras camera = (ArdCameras) obj;
+ if (!GlobalVariable.loginMap.containsKey(camera.getId()))//鍙帹閫侀娆$櫥褰曟垚鍔熺殑鐩告満
+ {
+ continue;
+ }
+ //鎺ㄩ�佸ぇ鍏夌數
if(!"1".equals(camera.getGdtype()))
{
continue;
@@ -53,7 +58,9 @@
cmd.setCameraId(camera.getId());
cmd.setChanNo(1);
cmd.setOperator(camera.getOperatorId());
- if (!GlobalVariable.loginMap.containsKey(camera.getId()))//鍙帹閫佺櫥褰曟垚鍔熺殑鐩告満
+ //鎺ㄩ�佸湪绾跨殑鐩告満
+ boolean onLine = hikClientService.isOnLine(cmd);
+ if(!onLine)
{
continue;
}
--
Gitblit v1.9.3