| | |
| | | package com.ruoyi.media.controller; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.device.camera.domain.CameraCmd; |
| | | import com.ruoyi.device.camera.service.ICameraSdkService; |
| | | import com.ruoyi.media.service.IMediaService; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | { |
| | | @Autowired |
| | | private IVtduService vtduService; |
| | | |
| | | @Resource |
| | | private ICameraSdkService cameraSdkService; |
| | | /** |
| | | * 查询流媒体管理列表 |
| | | */ |
| | |
| | | @GetMapping(value = "/{name}") |
| | | public AjaxResult getInfo(@PathVariable("name") String name) |
| | | { |
| | | //region 自动转码 |
| | | String[] nameArray = name.split("_"); |
| | | String cameraId=nameArray[0]; |
| | | Integer chanNo=Integer.valueOf(nameArray[1]); |
| | | CameraCmd cmd=new CameraCmd(); |
| | | cmd.setCameraId(cameraId); |
| | | cmd.setChanNo(chanNo); |
| | | Map<String, Object> videoCompressionCfg = cameraSdkService.getVideoCompressionCfg(cmd); |
| | | String videoEncType = (String)videoCompressionCfg.get("videoEncType"); |
| | | Vtdu vtdu = vtduService.selectVtduByName(name); |
| | | if(!videoEncType.equals("标准h264")) |
| | | { |
| | | vtdu.setIsCode("1"); |
| | | } |
| | | else |
| | | { |
| | | vtdu.setIsCode("0"); |
| | | } |
| | | vtduService.deleteVtduByName(name); |
| | | vtduService.insertVtdu(vtdu); |
| | | //endregion |
| | | return success(vtduService.selectVtduByName(name)); |
| | | } |
| | | |
| | |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody Vtdu vtdu) |
| | | { |
| | | if (StringUtils.isEmpty(vtdu.getName())) { |
| | | return AjaxResult.error("通道名称不能为空"); |
| | | } |
| | | if (StringUtils.isEmpty(vtdu.getRtspSource())) { |
| | | return AjaxResult.error("rtsp地址不能为空"); |
| | | } |
| | | return toAjax(vtduService.insertVtdu(vtdu)); |
| | | } |
| | | |