|
@@ -9,11 +9,14 @@ import com.zd.iot.vmp.media.zlm.dto.MediaServerItem;
|
|
|
import com.zd.iot.vmp.onvif.IONVIFServer;
|
|
import com.zd.iot.vmp.onvif.IONVIFServer;
|
|
|
import com.zd.iot.vmp.service.IMediaServerService;
|
|
import com.zd.iot.vmp.service.IMediaServerService;
|
|
|
import com.zd.iot.vmp.vmanager.bean.WVPResult;
|
|
import com.zd.iot.vmp.vmanager.bean.WVPResult;
|
|
|
|
|
+import com.zd.iot.vmp.web.ApiStreamController;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -31,6 +34,8 @@ import java.util.UUID;
|
|
|
@RequestMapping("/api/onvif")
|
|
@RequestMapping("/api/onvif")
|
|
|
public class ONVIFController {
|
|
public class ONVIFController {
|
|
|
|
|
|
|
|
|
|
+ private final static Logger logger = LoggerFactory.getLogger(ONVIFController.class);
|
|
|
|
|
+
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IMediaServerService mediaServerService;
|
|
private IMediaServerService mediaServerService;
|
|
|
|
|
|
|
@@ -152,9 +157,8 @@ public class ONVIFController {
|
|
|
if (errorCode == 0) {
|
|
if (errorCode == 0) {
|
|
|
MediaServerItem mediaServerItem = mediaServerService.getOne("your_server_id");
|
|
MediaServerItem mediaServerItem = mediaServerService.getOne("your_server_id");
|
|
|
Map<String,Object> map=new HashMap<>();
|
|
Map<String,Object> map=new HashMap<>();
|
|
|
-
|
|
|
|
|
map.put("type",1);
|
|
map.put("type",1);
|
|
|
- map.put("vhost",UUID.randomUUID().toString());
|
|
|
|
|
|
|
+ map.put("vhost","__defaultVhost__");
|
|
|
map.put("customized_path","/home/upload");
|
|
map.put("customized_path","/home/upload");
|
|
|
map.put("max_second",360000);
|
|
map.put("max_second",360000);
|
|
|
String name=hostname.replace(".","");
|
|
String name=hostname.replace(".","");
|
|
@@ -203,9 +207,9 @@ public class ONVIFController {
|
|
|
String appName="app"+hostname;
|
|
String appName="app"+hostname;
|
|
|
String streamName="stream"+hostname;
|
|
String streamName="stream"+hostname;
|
|
|
map.put("type",1);
|
|
map.put("type",1);
|
|
|
- map.put("vhost",UUID.randomUUID().toString());
|
|
|
|
|
map.put("app",appName);
|
|
map.put("app",appName);
|
|
|
map.put("stream",streamName);
|
|
map.put("stream",streamName);
|
|
|
|
|
+ map.put("vhost","__defaultVhost__");
|
|
|
boolean isTrue=onvifServer.isRecording(mediaServerItem,map);
|
|
boolean isTrue=onvifServer.isRecording(mediaServerItem,map);
|
|
|
if(isTrue==false){
|
|
if(isTrue==false){
|
|
|
WVPResult<String> resultData = new WVPResult();
|
|
WVPResult<String> resultData = new WVPResult();
|
|
@@ -217,7 +221,11 @@ public class ONVIFController {
|
|
|
}
|
|
}
|
|
|
String urlPath=onvifServer.stopRecord(mediaServerItem,map);
|
|
String urlPath=onvifServer.stopRecord(mediaServerItem,map);
|
|
|
urlPath=urlPath.replace("/.","/");
|
|
urlPath=urlPath.replace("/.","/");
|
|
|
- boolean isCloseTrue=onvifServer.closeStream(mediaServerItem,map);
|
|
|
|
|
|
|
+ logger.error("返回路径是否重复日志:"+urlPath);
|
|
|
|
|
+ Map<String,Object> closeMap=new HashMap<>();
|
|
|
|
|
+ closeMap.put("app",appName);
|
|
|
|
|
+ closeMap.put("stream",streamName);
|
|
|
|
|
+ boolean isCloseTrue=onvifServer.closeStream(mediaServerItem,closeMap);
|
|
|
WVPResult<String> resultData = new WVPResult();
|
|
WVPResult<String> resultData = new WVPResult();
|
|
|
if(StringUtils.isNotBlank(urlPath) && isCloseTrue){
|
|
if(StringUtils.isNotBlank(urlPath) && isCloseTrue){
|
|
|
resultData.setCode(HttpStatus.SUCCESS);
|
|
resultData.setCode(HttpStatus.SUCCESS);
|