From e82cfae81d016a5171224f1358eba663d2f60c68 Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期六, 12 八月 2023 15:23:49 +0800
Subject: [PATCH] 流媒体区分转码和不转码

---
 ard-work/src/main/java/com/ruoyi/media/controller/MediaController.java |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

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 52adb77..1ec2e16 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
@@ -7,6 +7,7 @@
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.device.camera.domain.ArdCameras;
 import com.ruoyi.media.domain.StreamInfo;
 import com.ruoyi.media.service.IMediaService;
@@ -37,7 +38,15 @@
     @PreAuthorize("@ss.hasPermi('media:stream:add')")
     @ApiOperationSupport(includeParameters = {"streamInfo.name", "streamInfo.rtspSource", "streamInfo.mode"})
     public AjaxResult addPath(@RequestBody StreamInfo streamInfo) {
-        String rtsp = mediaService.addPath(streamInfo.getName(), streamInfo.getRtspSource(), streamInfo.getMode());
+        if(StringUtils.isEmpty(streamInfo.getName()))
+        {
+            return AjaxResult.error("閫氶亾鍚嶇О涓嶈兘涓虹┖");
+        }
+        if(StringUtils.isEmpty(streamInfo.getRtspSource()))
+        {
+            return AjaxResult.error("rtsp鍦板潃涓嶈兘涓虹┖");
+        }
+        String rtsp = mediaService.addPath(streamInfo.getName(), streamInfo.getRtspSource(), streamInfo.getMode(),streamInfo.getIsCode());
         return AjaxResult.success(rtsp);
     }
     /**
@@ -56,7 +65,7 @@
     @PutMapping
     public AjaxResult edit(@RequestBody StreamInfo streamInfo) {
         mediaService.removePath(new String[]{streamInfo.getName()});
-        String rtsp = mediaService.addPath(streamInfo.getName(), streamInfo.getRtspSource(), streamInfo.getMode());
+        String rtsp = mediaService.addPath(streamInfo.getName(), streamInfo.getRtspSource(), streamInfo.getMode(),streamInfo.getIsCode());
         return AjaxResult.success(rtsp);
     }
 

--
Gitblit v1.9.3