From 61c0c3ccae4c23a90c405d7ac1cb49f7d5ee0479 Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期二, 12 九月 2023 09:48:35 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ard-work/src/main/java/com/ruoyi/media/domain/Conf.java | 3
ard-work/src/main/java/com/ruoyi/media/controller/MediaController.java | 21 +
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/SdkTask.java | 9
ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm | 7
ard-work/src/main/java/com/ruoyi/media/service/IMediaService.java | 4
ard-work/src/main/java/com/ruoyi/device/hiksdk/service/IHikClientService.java | 4
ard-work/src/main/java/com/ruoyi/media/domain/Vtdu.java | 15 +
ard-work/src/main/resources/templates/preview.html | 24 +
ard-work/src/main/java/com/ruoyi/media/service/impl/VtduServiceImpl.java | 10 +
ard-work/src/main/resources/mapper/vtdu/VtduMapper.xml | 83 ++++++--
ard-work/src/main/java/com/ruoyi/media/service/impl/MediaServiceImpl.java | 105 ++++++-----
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 ++++++++++----
ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java | 4
lib/mediamtx/mediamtx.yml | 2
ard-work/src/main/java/com/ruoyi/device/hiksdk/sdk/LoginResultCallBack.java | 12
16 files changed, 323 insertions(+), 172 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/controller/MediaController.java b/ard-work/src/main/java/com/ruoyi/media/controller/MediaController.java
index 411a27f..a4e65f3 100644
--- a/ard-work/src/main/java/com/ruoyi/media/controller/MediaController.java
+++ b/ard-work/src/main/java/com/ruoyi/media/controller/MediaController.java
@@ -18,6 +18,7 @@
import javax.annotation.Resource;
import java.util.List;
+import java.util.Map;
import java.util.stream.Collectors;
/**
@@ -51,14 +52,18 @@
if (StringUtils.isEmpty(streamInfo.getRtspSource())) {
return AjaxResult.error("rtsp鍦板潃涓嶈兘涓虹┖");
}
- String rtsp = mediaService.addPath(streamInfo.getName(), streamInfo.getRtspSource(), streamInfo.getMode(), streamInfo.getIsCode());
+ Map<String, String> map = mediaService.addPath(streamInfo.getName(), streamInfo.getRtspSource(), streamInfo.getMode(), streamInfo.getIsCode());
+ map.get("rtspUrl");
Vtdu vtdu = new Vtdu();
vtdu.setName(streamInfo.getName());
- vtdu.setRtspUrl(streamInfo.getRtspSource());
+ vtdu.setSourceUrl(streamInfo.getRtspSource());
vtdu.setIsCode(streamInfo.getIsCode());
vtdu.setCodeType(streamInfo.getMode());
+ vtdu.setRtspUrl(map.get("rtspUrl"));
+ vtdu.setRtmpUrl(map.get("rtmpUrl"));
+ vtdu.setWebrtcUrl(map.get("webrtcUrl"));
vtduService.insertVtdu(vtdu);
- return AjaxResult.success(rtsp);
+ return AjaxResult.success(map);
}
@@ -72,14 +77,16 @@
public AjaxResult edit(@RequestBody StreamInfo streamInfo) {
mediaService.removePath(new String[]{streamInfo.getName()});
vtduService.deleteVtduByName(streamInfo.getName());
- String rtsp = mediaService.addPath(streamInfo.getName(), streamInfo.getRtspSource(), streamInfo.getMode(), streamInfo.getIsCode());
+ Map<String, String> map = mediaService.addPath(streamInfo.getName(), streamInfo.getRtspSource(), streamInfo.getMode(), streamInfo.getIsCode());
Vtdu vtdu = new Vtdu();
vtdu.setName(streamInfo.getName());
- vtdu.setRtspUrl(streamInfo.getRtspSource());
+ vtdu.setSourceUrl(streamInfo.getRtspSource());
vtdu.setIsCode(streamInfo.getIsCode());
vtdu.setCodeType(streamInfo.getMode());
- vtduService.insertVtdu(vtdu);
- return AjaxResult.success(rtsp);
+ vtdu.setRtspUrl(map.get("rtspUrl"));
+ vtdu.setRtmpUrl(map.get("rtmpUrl"));
+ vtdu.setWebrtcUrl(map.get("webrtcUrl"));
+ return AjaxResult.success(map);
}
/**
diff --git a/ard-work/src/main/java/com/ruoyi/media/domain/Conf.java b/ard-work/src/main/java/com/ruoyi/media/domain/Conf.java
index 85480b8..e7cdc7e 100644
--- a/ard-work/src/main/java/com/ruoyi/media/domain/Conf.java
+++ b/ard-work/src/main/java/com/ruoyi/media/domain/Conf.java
@@ -130,4 +130,7 @@
private String runonread;
@JsonProperty("runOnReadRestart")
private boolean runonreadrestart;
+
+ @JsonProperty("maxReaders")
+ private Integer maxReaders;
}
diff --git a/ard-work/src/main/java/com/ruoyi/media/domain/Vtdu.java b/ard-work/src/main/java/com/ruoyi/media/domain/Vtdu.java
index bbf9d60..a2c5e14 100644
--- a/ard-work/src/main/java/com/ruoyi/media/domain/Vtdu.java
+++ b/ard-work/src/main/java/com/ruoyi/media/domain/Vtdu.java
@@ -27,7 +27,7 @@
* rtsp婧愬湴鍧�
*/
@Excel(name = "rtsp婧愬湴鍧�")
- private String rtspUrl;
+ private String sourceUrl;
/**
* 鏄惁杞爜
@@ -41,5 +41,16 @@
@Excel(name = "杞爜妯″紡")
private String codeType;
-
+ /**
+ * rtsp鎾斁鍦板潃
+ */
+ String rtspUrl;
+ /**
+ * rtmp鎾斁鍦板潃
+ */
+ String rtmpUrl;
+ /**
+ * webrtc鎾斁鍦板潃
+ */
+ String webrtcUrl;
}
diff --git a/ard-work/src/main/java/com/ruoyi/media/service/IMediaService.java b/ard-work/src/main/java/com/ruoyi/media/service/IMediaService.java
index 8337a5f..195ab1a 100644
--- a/ard-work/src/main/java/com/ruoyi/media/service/IMediaService.java
+++ b/ard-work/src/main/java/com/ruoyi/media/service/IMediaService.java
@@ -2,7 +2,9 @@
import com.ruoyi.media.domain.*;
+import java.lang.reflect.MalformedParameterizedTypeException;
import java.util.List;
+import java.util.Map;
public interface IMediaService {
/**
@@ -14,7 +16,7 @@
* 鍒樿嫃涔�
* 2023/8/12 13:56:52
*/
- String addPath(String name, String rtspPath, String mode, String isCode);
+ Map<String,String> addPath(String name, String rtspPath, String mode, String isCode);
StreamInfo getPathInfo(String name);
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..32fc297 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
@@ -1,6 +1,8 @@
package com.ruoyi.media.service.impl;
import com.alibaba.fastjson2.JSONObject;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.media.domain.*;
import com.ruoyi.media.mapper.VtduMapper;
@@ -20,10 +22,7 @@
import javax.annotation.PreDestroy;
import javax.annotation.Resource;
import java.io.File;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
+import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -53,7 +52,7 @@
String processName = "mediamtx.exe";
@Override
- public void run(ApplicationArguments args){
+ public void run(ApplicationArguments args) {
try {
log.info("寮�濮嬪姞杞芥祦濯掍綋鍒楄〃");
List<StreamInfo> paths = paths();
@@ -61,15 +60,19 @@
mediaClient.removePath(path.getName());
}
List<Vtdu> vtduList = vtduMapper.selectVtduList(new Vtdu());
- for (Vtdu v : vtduList) {
- addPath(v.getName(), v.getRtspUrl(), v.getCodeType(), v.getIsCode());
+ for (Vtdu vtdu : vtduList) {
+ Map<String, String> map = addPath(vtdu.getName(), vtdu.getSourceUrl(), vtdu.getCodeType(), vtdu.getIsCode());
+ vtdu.setRtspUrl(map.get("rtspUrl"));
+ vtdu.setRtmpUrl(map.get("rtmpUrl"));
+ vtdu.setWebrtcUrl(map.get("webrtcUrl"));
+ vtdu.setUpdateTime(DateUtils.getNowDate());
+ vtduMapper.updateVtdu(vtdu);
}
- }
- catch (Exception ex)
- {
- log.error("鍔犺浇娴佸獟浣撳垪琛ㄥ紓甯�:"+ex.getMessage());
+ } catch (Exception ex) {
+ log.error("鍔犺浇娴佸獟浣撳垪琛ㄥ紓甯�:" + ex.getMessage());
}
}
+
@PostConstruct
public void initMediaMtx() {
if (mediamtxEnabled) {
@@ -106,14 +109,18 @@
}
@Override
- public String addPath(String name, String rtspPath, String mode, String isCode) {
+ public Map<String,String> addPath(String name, String sourceUrl, String mode, String isCode) {
String rtspUrl = "rtsp://" + mediamtxHost + ":7554/" + name;
+ String rtmpUrl = "rtmp://" + mediamtxHost + ":1935/" + name;
+ String webrtcUrl = "http://" + mediamtxHost + ":8889/" + 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,23 +131,30 @@
//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 " + sourceUrl + " -vcodec libx264 -preset:v ultrafast -r 25 -keyint_min 25 -g 25 -sc_threshold 0 -threads 6 -b:v 4096k -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 " + sourceUrl + " -c:v h264_nvenc -r 25 -g 60 -threads 6 -b:v 4096k -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 {
mediaInfo.setRunoninit(cmd);
mediaInfo.setRunoninitrestart(true);
+ //mediaInfo.setRunonready(cmd);
+ //mediaInfo.setRunonreadyrestart(true);
}
} else {
- mediaInfo.setSource(rtspPath);
+ mediaInfo.setSource(sourceUrl);
}
+ mediaInfo.setMaxReaders(100);
mediaInfo.setSourceprotocol("tcp");
mediaClient.addPath(name, mediaInfo);
- return rtspUrl;
+ Map<String,String> map=new HashMap<>();
+ map.put("rtspUrl",rtspUrl);
+ map.put("rtmpUrl",rtmpUrl);
+ map.put("webrtcUrl",webrtcUrl);
+ return map;
}
@Override
@@ -149,19 +163,17 @@
StreamInfo info = new StreamInfo();
//ID
info.setName(name);
- String runoninit;
- String runondemand = item.getConf().getRunondemand();
- if (StringUtils.isNotEmpty(runondemand)) {
- runoninit = item.getConf().getRunondemand();
- info.setMode("1");
- } else {
- runoninit = item.getConf().getRunoninit();
+ String runOn;
+ if (StringUtils.isNotEmpty(item.getConf().getRunondemand())) {
+ runOn = item.getConf().getRunondemand();
info.setMode("0");
+ } else {
+ //runOn = item.getConf().getRunonready();
+ runOn = item.getConf().getRunoninit();
+ info.setMode("1");
}
//RTSP婧愬湴鍧�
- String regex = "rtsp://[^\\s\"]+";
- Pattern pattern = Pattern.compile(regex);
- Matcher matcher = pattern.matcher(runoninit);
+ Matcher matcher = Pattern.compile("rtsp://[^\\s\"]+").matcher(runOn);
if (matcher.find()) {
info.setRtspSource(matcher.group());
info.setIsCode("1");
@@ -190,19 +202,17 @@
//ID
String name = item.getName();
info.setName(name);
- String runoninit;
- String runondemand = item.getConf().getRunondemand();
- if (StringUtils.isNotEmpty(runondemand)) {
- runoninit = item.getConf().getRunondemand();
- info.setMode("1");
- } else {
- runoninit = item.getConf().getRunoninit();
+ String runOn;
+ if (StringUtils.isNotEmpty(item.getConf().getRunondemand())) {
+ runOn = item.getConf().getRunondemand();
info.setMode("0");
+ } else {
+ runOn = item.getConf().getRunoninit();
+ //runOn = item.getConf().getRunonready();
+ info.setMode("1");
}
//RTSP婧愬湴鍧�
- String regex = "rtsp://[^\\s\"]+";
- Pattern pattern = Pattern.compile(regex);
- Matcher matcher = pattern.matcher(runoninit);
+ Matcher matcher = Pattern.compile("rtsp://[^\\s\"]+").matcher(runOn);
if (matcher.find()) {
info.setRtspSource(matcher.group());
info.setIsCode("1");
@@ -211,9 +221,7 @@
info.setIsCode("0");
}
//浼犺緭鍗忚
- regex = "-rtsp_transport\\s+(\\w+)";
- pattern = Pattern.compile(regex);
- matcher = pattern.matcher(runoninit);
+ matcher = Pattern.compile("-rtsp_transport\\s+(\\w+)").matcher(runOn);
if (matcher.find()) {
info.setProtocol(matcher.group(1));
}
@@ -296,16 +304,14 @@
info.setRemoteAddr(rtspSession.getRemoteAddr());
}
//RTSP婧愬湴鍧�
- String runondemand = item.getConf().getRunondemand();
- String runoninit;
- if (StringUtils.isNotEmpty(runondemand)) {
- runoninit = item.getConf().getRunondemand();
+ String runOn;
+ if (StringUtils.isNotEmpty(item.getConf().getRunondemand())) {
+ runOn = item.getConf().getRunondemand();
} else {
- runoninit = item.getConf().getRunoninit();
+ runOn = item.getConf().getRunoninit();
+ //runOn = item.getConf().getRunonready();
}
- String regex = "rtsp://[^\\s\"]+";
- Pattern pattern = Pattern.compile(regex);
- Matcher matcher = pattern.matcher(runoninit);
+ Matcher matcher = Pattern.compile("rtsp://[^\\s\"]+").matcher(runOn);
if (matcher.find()) {
info.setRtspSource(matcher.group());
} else {
@@ -316,7 +322,6 @@
//鎷夋祦鏁伴噺
List<Readers> readers = item.getReaders();
info.setNum(readers.size());
-
PushStreamInfoList.add(info);
}
diff --git a/ard-work/src/main/java/com/ruoyi/media/service/impl/VtduServiceImpl.java b/ard-work/src/main/java/com/ruoyi/media/service/impl/VtduServiceImpl.java
index ebf5978..456fad4 100644
--- a/ard-work/src/main/java/com/ruoyi/media/service/impl/VtduServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/media/service/impl/VtduServiceImpl.java
@@ -2,12 +2,16 @@
import java.util.List;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.media.mapper.VtduMapper;
import com.ruoyi.media.domain.Vtdu;
import com.ruoyi.media.service.IVtduService;
+
+import javax.annotation.Resource;
/**
* 娴佸獟浣撶鐞哠ervice涓氬姟灞傚鐞�
@@ -17,7 +21,7 @@
*/
@Service
public class VtduServiceImpl implements IVtduService {
- @Autowired
+ @Resource
private VtduMapper vtduMapper;
/**
@@ -50,6 +54,8 @@
*/
@Override
public int insertVtdu(Vtdu vtdu) {
+ vtdu.setCreateBy(SecurityUtils.getUserId());
+ vtdu.setCreateTime(DateUtils.getNowDate());
return vtduMapper.insertVtdu(vtdu);
}
@@ -61,6 +67,8 @@
*/
@Override
public int updateVtdu(Vtdu vtdu) {
+ vtdu.setUpdateBy(SecurityUtils.getUserId());
+ vtdu.setUpdateTime(DateUtils.getNowDate());
return vtduMapper.updateVtdu(vtdu);
}
diff --git a/ard-work/src/main/resources/mapper/vtdu/VtduMapper.xml b/ard-work/src/main/resources/mapper/vtdu/VtduMapper.xml
index 30dd0fb..cfb9e36 100644
--- a/ard-work/src/main/resources/mapper/vtdu/VtduMapper.xml
+++ b/ard-work/src/main/resources/mapper/vtdu/VtduMapper.xml
@@ -1,63 +1,104 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.media.mapper.VtduMapper">
-
+
<resultMap type="Vtdu" id="VtduResult">
- <result property="name" column="name" />
- <result property="rtspUrl" column="rtsp_url" />
- <result property="isCode" column="is_code" />
- <result property="codeType" column="code_type" />
+ <result property="name" column="name"/>
+ <result property="sourceUrl" column="source_url"/>
+ <result property="isCode" column="is_code"/>
+ <result property="codeType" column="code_type"/>
+ <result property="rtspUrl" column="rtsp_url"/>
+ <result property="rtmpUrl" column="rtmp_url"/>
+ <result property="webrtcUrl" column="webrtc_url"/>
+ <result property="createBy" column="create_by"/>
+ <result property="createTime" column="create_time"/>
+ <result property="updateBy" column="update_by"/>
+ <result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectVtduVo">
- select name, rtsp_url, is_code, code_type from vtdu
+ select name,
+ source_url,
+ is_code,
+ code_type,
+ rtsp_url,
+ rtmp_url,
+ webrtc_url,
+ create_by,
+ create_time,
+ update_by,
+ update_time
+ from vtdu
</sql>
<select id="selectVtduList" parameterType="Vtdu" resultMap="VtduResult">
<include refid="selectVtduVo"/>
- <where>
- <if test="name != null and name != ''"> and name like '%'||#{name}||'%'</if>
- <if test="rtspUrl != null and rtspUrl != ''"> and rtsp_url = #{rtspUrl}</if>
- <if test="isCode != null and isCode != ''"> and is_code = #{isCode}</if>
- <if test="codeType != null and codeType != ''"> and code_type = #{codeType}</if>
+ <where>
+ <if test="name != null and name != ''">and name like '%'||#{name}||'%'</if>
+ <if test="sourceUrl != null and sourceUrl != ''">and source_url = #{sourceUrl}</if>
+ <if test="isCode != null and isCode != ''">and is_code = #{isCode}</if>
+ <if test="codeType != null and codeType != ''">and code_type = #{codeType}</if>
</where>
</select>
-
+
<select id="selectVtduByName" parameterType="String" resultMap="VtduResult">
<include refid="selectVtduVo"/>
where name = #{name}
</select>
-
+
<insert id="insertVtdu" parameterType="Vtdu">
insert into vtdu
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
- <if test="rtspUrl != null">rtsp_url,</if>
+ <if test="sourceUrl != null">source_url,</if>
<if test="isCode != null">is_code,</if>
<if test="codeType != null">code_type,</if>
- </trim>
+ <if test="rtspUrl != null">rtsp_url,</if>
+ <if test="rtmpUrl != null">rtmp_url,</if>
+ <if test="webrtcUrl != null">webrtc_url,</if>
+ <if test="createBy != null">create_by,</if>
+ <if test="createTime != null">create_time,</if>
+ <if test="updateBy != null">update_by,</if>
+ <if test="updateTime != null">update_time,</if>
+ </trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
- <if test="rtspUrl != null">#{rtspUrl},</if>
+ <if test="sourceUrl != null">#{sourceUrl},</if>
<if test="isCode != null">#{isCode},</if>
<if test="codeType != null">#{codeType},</if>
- </trim>
+ <if test="rtspUrl != null">#{rtspUrl},</if>
+ <if test="rtmpUrl != null">#{rtmpUrl},</if>
+ <if test="webrtcUrl != null">#{webrtcUrl},</if>
+ <if test="createBy != null">#{createBy},</if>
+ <if test="createTime != null">#{createTime},</if>
+ <if test="updateBy != null">#{updateBy},</if>
+ <if test="updateTime != null">#{updateTime},</if>
+ </trim>
</insert>
<update id="updateVtdu" parameterType="Vtdu">
update vtdu
<trim prefix="SET" suffixOverrides=",">
- <if test="rtspUrl != null">rtsp_url = #{rtspUrl},</if>
+ <if test="sourceUrl != null">source_url = #{sourceUrl},</if>
<if test="isCode != null">is_code = #{isCode},</if>
<if test="codeType != null">code_type = #{codeType},</if>
+ <if test="rtspUrl != null">rtsp_url = #{rtspUrl},</if>
+ <if test="rtmpUrl != null">rtmp_url = #{rtmpUrl},</if>
+ <if test="webrtcUrl != null">webrtc_url = #{webrtcUrl},</if>
+ <if test="createBy != null">create_by = #{createBy},</if>
+ <if test="createTime != null">create_time = #{createTime},</if>
+ <if test="updateBy != null">update_by = #{updateBy},</if>
+ <if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where name = #{name}
</update>
<delete id="deleteVtduByName" parameterType="String">
- delete from vtdu where name = #{name}
+ delete
+ from vtdu
+ where name = #{name}
</delete>
<delete id="deleteVtduByNames" parameterType="String">
diff --git a/ard-work/src/main/resources/templates/preview.html b/ard-work/src/main/resources/templates/preview.html
index 323ed06..63871f9 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; /* 娣诲姞鐩稿瀹氫綅 */
@@ -153,14 +153,22 @@
window.onload = function () {
changeGrid(2, 2);
chanMap.set("video1", "http://" + mediamtxHost + ":8889/164/");
- chanMap.set("video2", "http://" + mediamtxHost + ":8889/165/");
- chanMap.set("video3", "http://" + mediamtxHost + ":8889/245/");
+ chanMap.set("video2", "http://" + mediamtxHost + ":8889/164/");
+ chanMap.set("video3", "http://" + mediamtxHost + ":8889/164/");
chanMap.set("video4", "http://" + mediamtxHost + ":8889/164/");
- chanMap.set("video5", "http://" + mediamtxHost + ":8889/165/");
- chanMap.set("video6", "http://" + mediamtxHost + ":8889/245/");
+ chanMap.set("video5", "http://" + mediamtxHost + ":8889/164/");
+ chanMap.set("video6", "http://" + mediamtxHost + ":8889/164/");
chanMap.set("video7", "http://" + mediamtxHost + ":8889/164/");
- chanMap.set("video8", "http://" + mediamtxHost + ":8889/165/");
- chanMap.set("video9", "http://" + mediamtxHost + ":8889/245/");
+ chanMap.set("video8", "http://" + mediamtxHost + ":8889/164/");
+ chanMap.set("video9", "http://" + mediamtxHost + ":8889/164/");
+ chanMap.set("video10", "http://" + mediamtxHost + ":8889/164/");
+ chanMap.set("video11", "http://" + mediamtxHost + ":8889/164/");
+ chanMap.set("video12", "http://" + mediamtxHost + ":8889/164/");
+ chanMap.set("video13", "http://" + mediamtxHost + ":8889/164/");
+ chanMap.set("video14", "http://" + mediamtxHost + ":8889/164/");
+ chanMap.set("video15", "http://" + mediamtxHost + ":8889/164/");
+ chanMap.set("video16", "http://" + mediamtxHost + ":8889/164/");
+
console.log(chanMap);
}
const linkToIceServers = (links) => (
diff --git a/lib/mediamtx/mediamtx.yml b/lib/mediamtx/mediamtx.yml
index 9dfc5b5..df30797 100644
--- a/lib/mediamtx/mediamtx.yml
+++ b/lib/mediamtx/mediamtx.yml
@@ -15,7 +15,7 @@
writeTimeout: 10s
# Size of the queue of outgoing packets.
# A higher value allows to increase throughput, a lower value allows to save RAM.
-writeQueueSize: 512
+writeQueueSize: 8192
# Maximum size of outgoing UDP packets.
# This can be decreased to avoid fragmentation on networks with a low UDP MTU.
udpMaxPayloadSize: 1472
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