| | |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.file.FileUtils; |
| | | import com.ruoyi.constant.sdkPriority; |
| | | import com.ruoyi.device.camera.domain.CameraCmd; |
| | | import com.ruoyi.device.camera.mapper.ArdCamerasMapper; |
| | |
| | | return; |
| | | } |
| | | Integer userId = GlobalVariable.loginMap.get(cameraId); |
| | | String path = ""; |
| | | //强制I帧结构体对象 |
| | | HCNetSDK.NET_DVR_I_FRAME netDvrIFrame = new HCNetSDK.NET_DVR_I_FRAME(); //新建结构体对象 |
| | | netDvrIFrame.read(); |
| | | netDvrIFrame.dwChannel = channelNum; //因为上文代码中设置了通道号,按照上文中的设置 |
| | | netDvrIFrame.dwChannel = channelNum;//因为上文代码中设置了通道号,按照上文中的设置 |
| | | netDvrIFrame.byStreamType = 0; |
| | | netDvrIFrame.dwSize = netDvrIFrame.size(); |
| | | netDvrIFrame.write(); |
| | | |
| | | if(!hCNetSDK.NET_DVR_RemoteControl(userId,3402,netDvrIFrame.getPointer(),netDvrIFrame.dwSize)){ |
| | | log.error("强制I帧 错误码为: " + hCNetSDK.NET_DVR_GetLastError()); |
| | | } |
| | |
| | | return; |
| | | } |
| | | log.info("取流成功"); |
| | | File file = new File("D:/recordTemp/" + cameraId + ".mp4"); |
| | | if (!file.exists()) { |
| | | File fileParent = file.getParentFile(); |
| | | if (!fileParent.exists()) { |
| | | fileParent.mkdirs(); |
| | | } |
| | | file.createNewFile(); |
| | | } |
| | | path = file.getCanonicalPath(); |
| | | |
| | | String path= FileUtils.createFile("D:/recordTemp/" + cameraId + ".mp4"); |
| | | recordInfo info = new recordInfo(); |
| | | info.setLRealHandle(lRealHandle); |
| | | info.setRecordPath(path); |
| | |
| | | } |
| | | hCNetSDK.NET_DVR_StopRealPlay(info.getLRealHandle()); |
| | | log.info("录像停止"); |
| | | //存入minio |
| | | String BucketName = cmd.getRecordBucketName(); |
| | | String ObjectName = cmd.getRecordObjectName(); |
| | | String ContentType = "video/MP4"; |
| | | FileInputStream stream = new FileInputStream(info.getRecordPath()); |
| | | boolean b = MinioUtils.uploadObject(BucketName, ObjectName, stream, stream.available(), ContentType); |
| | | if (b) { |
| | | log.info("上传文件成功!" + MinioClientSingleton.domainUrl + "/"+ BucketName + "/" + ObjectName); |
| | | GlobalVariable.user_real_Map.remove(userId); |
| | | if(cmd.isUploadMinio()) { |
| | | //存入minio |
| | | String BucketName = cmd.getRecordBucketName(); |
| | | String ObjectName = cmd.getRecordObjectName(); |
| | | String ContentType = "video/MP4"; |
| | | FileInputStream stream = new FileInputStream(info.getRecordPath()); |
| | | boolean b = MinioUtils.uploadObject(BucketName, ObjectName, stream, stream.available(), ContentType); |
| | | if (b) { |
| | | log.info("上传文件成功!" + MinioClientSingleton.domainUrl + "/" + BucketName + "/" + ObjectName); |
| | | GlobalVariable.user_real_Map.remove(userId); |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception ex) { |