| | |
| | | package com.genersoft.iot.vmp.vmanager.streamProxy; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.IMediaServerItem; |
| | | import com.genersoft.iot.vmp.common.StreamInfo; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; |
| | | import com.genersoft.iot.vmp.service.IMediaServerService; |
| | | import com.genersoft.iot.vmp.service.IMediaService; |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | import com.genersoft.iot.vmp.service.IStreamProxyService; |
| | | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| | | import com.github.pagehelper.PageInfo; |
| | | import io.netty.util.internal.StringUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | public WVPResult save(@RequestBody StreamProxyItem param){ |
| | | logger.info("添加代理: " + JSONObject.toJSONString(param)); |
| | | if (StringUtils.isEmpty(param.getMediaServerId())) param.setMediaServerId("auto"); |
| | | String msg = streamProxyService.save(param); |
| | | WVPResult<Object> result = new WVPResult<>(); |
| | | result.setCode(0); |
| | | result.setMsg(msg); |
| | | if (StringUtils.isEmpty(param.getType())) param.setType("default"); |
| | | if (StringUtils.isEmpty(param.getGbId())) param.setGbId(null); |
| | | WVPResult<StreamInfo> result = streamProxyService.save(param); |
| | | return result; |
| | | } |
| | | |
| | | @ApiOperation("修改代理") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "param", value = "代理参数", dataTypeClass = StreamProxyItem.class), |
| | | }) |
| | | @PostMapping(value = "/update") |
| | | @ResponseBody |
| | | public WVPResult update(@RequestBody StreamProxyItem param){ |
| | | logger.info("修改代理: " + JSONObject.toJSONString(param)); |
| | | WVPResult<StreamInfo> result = new WVPResult<>(); |
| | | if(StringUtils.isEmpty(param.getApp())||StringUtils.isEmpty(param.getStream())){ |
| | | result.setCode(400); |
| | | result.setMsg("app不能为null且stream不能为null,请检查具体参数!"); |
| | | return result; |
| | | } |
| | | streamProxyService.del(param.getApp(), param.getStream()); |
| | | if (StringUtils.isEmpty(param.getMediaServerId())) param.setMediaServerId("auto"); |
| | | if (StringUtils.isEmpty(param.getType())) param.setType("default"); |
| | | if (StringUtils.isEmpty(param.getGbId())) param.setGbId(null); |
| | | param.setEnable(false); |
| | | result = streamProxyService.save(param); |
| | | return result; |
| | | } |
| | | @ApiOperation("获取ffmpeg.cmd模板") |
| | | @GetMapping(value = "/ffmpeg_cmd/list") |
| | | @ApiImplicitParams({ |
| | |
| | | public WVPResult getFFmpegCMDs(@RequestParam String mediaServerId){ |
| | | logger.debug("获取节点[ {} ]ffmpeg.cmd模板", mediaServerId ); |
| | | |
| | | IMediaServerItem mediaServerItem = mediaServerService.getOne(mediaServerId); |
| | | MediaServerItem mediaServerItem = mediaServerService.getOne(mediaServerId); |
| | | JSONObject data = streamProxyService.getFFmpegCMDs(mediaServerItem); |
| | | WVPResult<JSONObject> result = new WVPResult<>(); |
| | | result.setCode(0); |