Merge remote-tracking branch 'origin/master'
| | |
| | | |
| | | @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); |
| | |
| | | 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("在线状态") |
| | |
| | | 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) { |
| | |
| | | |
| | | @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) { |
| | |
| | | |
| | | @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) { |
| | |
| | | |
| | | @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) { |
| | |
| | | |
| | | @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) { |
| | |
| | | |
| | | @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) { |
| | |
| | | @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()); |
| | |
| | | @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()); |
| | |
| | | @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()); |
| | |
| | | @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()); |
| | |
| | | |
| | | @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) { |
| | |
| | | @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()); |
| | |
| | | @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()); |
| | |
| | | @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()); |
| | |
| | | @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()); |
| | |
| | | @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()); |
| | |
| | | @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()); |
| | |
| | | @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()); |
| | |
| | | @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()); |
| | |
| | | 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); |
| | |
| | | //调用预置位 |
| | | boolean gotoPreset(CameraCmd cmd); |
| | | |
| | | //分辨率获取 |
| | | String getVideoResolution(CameraCmd cmd); |
| | | //获取码流压缩参数 |
| | | Map<String,String> getVideoCompressionCfg(CameraCmd cmd); |
| | | |
| | | //透雾 |
| | | boolean controlDefogcfg(CameraCmd cmd); |
| | |
| | | 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(); |
| | |
| | | } else { |
| | | struGisInfo.read(); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("dwFocus",struGisInfo.struPtzPosEx.dwFocus); |
| | | map.put("dwFocus", struGisInfo.struPtzPosEx.dwFocus); |
| | | return map; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * @描述 获取分辨率 |
| | | * @描述 获取通道压缩参数 |
| | | * @参数 [cameraId, channelNum] |
| | | * @返回值 java.lang.String |
| | | * @创建人 刘苏义 |
| | |
| | | * @修改人和其它信息 |
| | | */ |
| | | @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; |
| | | } |
| | | //视频输出口分辨率: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); |
| | |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage()); |
| | | } |
| | | return ResResolution; |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | |
| | | 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);// 垂直视场角 |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | 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); |
| | | } |
| | | |
| | | |
| | |
| | | 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); |
| | | } |
| | | |
| | | /** |
| | |
| | | private String runonread; |
| | | @JsonProperty("runOnReadRestart") |
| | | private boolean runonreadrestart; |
| | | |
| | | @JsonProperty("maxReaders") |
| | | private Integer maxReaders; |
| | | } |
| | |
| | | * rtsp源地址 |
| | | */ |
| | | @Excel(name = "rtsp源地址") |
| | | private String rtspUrl; |
| | | private String sourceUrl; |
| | | |
| | | /** |
| | | * 是否转码 |
| | |
| | | @Excel(name = "转码模式") |
| | | private String codeType; |
| | | |
| | | |
| | | /** |
| | | * rtsp播放地址 |
| | | */ |
| | | String rtspUrl; |
| | | /** |
| | | * rtmp播放地址 |
| | | */ |
| | | String rtmpUrl; |
| | | /** |
| | | * webrtc播放地址 |
| | | */ |
| | | String webrtcUrl; |
| | | } |
| | |
| | | |
| | | import com.ruoyi.media.domain.*; |
| | | |
| | | import java.lang.reflect.MalformedParameterizedTypeException; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface IMediaService { |
| | | /** |
| | |
| | | * 刘苏义 |
| | | * 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); |
| | | |
| | |
| | | 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; |
| | |
| | | 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; |
| | | |
| | |
| | | String processName = "mediamtx.exe"; |
| | | |
| | | @Override |
| | | public void run(ApplicationArguments args){ |
| | | public void run(ApplicationArguments args) { |
| | | try { |
| | | log.info("开始加载流媒体列表"); |
| | | List<StreamInfo> paths = paths(); |
| | |
| | | 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) { |
| | |
| | | } |
| | | |
| | | @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(转码速度最快,视频往往也最模糊)、superfast、veryfast、faster、fast、medium、slow、slower、veryslow、placebo这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 //用于指定输入媒体文件或输入流的地址 |
| | |
| | | //GPU硬解码编码 -hwaccel cuvid -c:v h264_cuvid 使用cuda解码 -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 |
| | |
| | | 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"); |
| | |
| | | //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"); |
| | |
| | | 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)); |
| | | } |
| | |
| | | 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 { |
| | |
| | | //拉流数量 |
| | | List<Readers> readers = item.getReaders(); |
| | | info.setNum(readers.size()); |
| | | |
| | | |
| | | PushStreamInfoList.add(info); |
| | | } |
| | |
| | | |
| | | 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; |
| | | |
| | | /** |
| | | * 流媒体管理Service业务层处理 |
| | |
| | | */ |
| | | @Service |
| | | public class VtduServiceImpl implements IVtduService { |
| | | @Autowired |
| | | @Resource |
| | | private VtduMapper vtduMapper; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public int insertVtdu(Vtdu vtdu) { |
| | | vtdu.setCreateBy(SecurityUtils.getUserId()); |
| | | vtdu.setCreateTime(DateUtils.getNowDate()); |
| | | return vtduMapper.insertVtdu(vtdu); |
| | | } |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public int updateVtdu(Vtdu vtdu) { |
| | | vtdu.setUpdateBy(SecurityUtils.getUserId()); |
| | | vtdu.setUpdateTime(DateUtils.getNowDate()); |
| | | return vtduMapper.updateVtdu(vtdu); |
| | | } |
| | | |
| | |
| | | <?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"> |
| | |
| | | .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 网格 */ |
| | |
| | | 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; /* 添加相对定位 */ |
| | |
| | | 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) => ( |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | 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; |
| | |
| | | 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; |
| | | } |