添加拉流代理相关接口-获取FFMPEG命令模板
parent
8d9916f94e
commit
7c7b35ca80
|
@ -7,6 +7,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.ServerKeepaliveData;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamMediaInfo;
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamMediaInfo;
|
||||||
import com.genersoft.iot.vmp.service.bean.MediaServerLoad;
|
import com.genersoft.iot.vmp.service.bean.MediaServerLoad;
|
||||||
import com.genersoft.iot.vmp.service.bean.SSRCInfo;
|
import com.genersoft.iot.vmp.service.bean.SSRCInfo;
|
||||||
|
import com.genersoft.iot.vmp.vmanager.bean.FFmpegCmdInfo;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.RecordFile;
|
import com.genersoft.iot.vmp.vmanager.bean.RecordFile;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -98,4 +99,6 @@ public interface IMediaServerService {
|
||||||
* 获取媒体流的信息
|
* 获取媒体流的信息
|
||||||
*/
|
*/
|
||||||
StreamMediaInfo getMediaInfo(String mediaServerId, String app, String stream);
|
StreamMediaInfo getMediaInfo(String mediaServerId, String app, String stream);
|
||||||
|
|
||||||
|
List<FFmpegCmdInfo> getFFmpegCMDList(String mediaServerID);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ import com.genersoft.iot.vmp.utils.DateUtil;
|
||||||
import com.genersoft.iot.vmp.utils.JsonUtil;
|
import com.genersoft.iot.vmp.utils.JsonUtil;
|
||||||
import com.genersoft.iot.vmp.utils.redis.RedisUtil;
|
import com.genersoft.iot.vmp.utils.redis.RedisUtil;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||||
|
import com.genersoft.iot.vmp.vmanager.bean.FFmpegCmdInfo;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.RecordFile;
|
import com.genersoft.iot.vmp.vmanager.bean.RecordFile;
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
|
@ -783,4 +784,25 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||||
}
|
}
|
||||||
return streamMediaInfo;
|
return streamMediaInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FFmpegCmdInfo> getFFmpegCMDList(String mediaServerId) {
|
||||||
|
MediaServerItem mediaServerItem = mediaServerMapper.queryOne(mediaServerId);
|
||||||
|
if (mediaServerItem == null) {
|
||||||
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "MediaServer不存在");
|
||||||
|
}
|
||||||
|
List<FFmpegCmdInfo> result = new ArrayList<>();
|
||||||
|
JSONObject mediaServerConfigResuly = zlmresTfulUtils.getMediaServerConfig(mediaServerItem);
|
||||||
|
if (mediaServerConfigResuly != null && mediaServerConfigResuly.getInteger("code") == 0
|
||||||
|
&& mediaServerConfigResuly.getJSONArray("data").size() > 0){
|
||||||
|
JSONObject mediaServerConfig = mediaServerConfigResuly.getJSONArray("data").getJSONObject(0);
|
||||||
|
|
||||||
|
for (String key : mediaServerConfig.keySet()) {
|
||||||
|
if (key.startsWith("ffmpeg.cmd")){
|
||||||
|
result.add(new FFmpegCmdInfo(key, mediaServerConfig.getString(key)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -258,9 +258,8 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
||||||
if (path.indexOf("/", 1) < 0) {
|
if (path.indexOf("/", 1) < 0) {
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "解析DstUrl失败, 至少两层路径");
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "解析DstUrl失败, 至少两层路径");
|
||||||
}
|
}
|
||||||
int appIndex = path.indexOf("/", 1);
|
String app = path.substring(1, path.indexOf("/", 2));
|
||||||
String app = path.substring(1, appIndex);
|
String stream = path.substring(path.indexOf("/", 2) + 1);
|
||||||
String stream = path.substring(path.indexOf(app));
|
|
||||||
param.setApp(app);
|
param.setApp(app);
|
||||||
param.setStream(stream);
|
param.setStream(stream);
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.genersoft.iot.vmp.vmanager.bean;
|
||||||
|
|
||||||
|
public class FFmpegCmdInfo {
|
||||||
|
private String key;
|
||||||
|
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
public FFmpegCmdInfo(String key, String value) {
|
||||||
|
this.key = key;
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKey(String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
}
|
|
@ -18,10 +18,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.StreamMediaInfo;
|
||||||
import com.genersoft.iot.vmp.service.*;
|
import com.genersoft.iot.vmp.service.*;
|
||||||
import com.genersoft.iot.vmp.service.bean.MediaServerLoad;
|
import com.genersoft.iot.vmp.service.bean.MediaServerLoad;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
import com.genersoft.iot.vmp.vmanager.bean.*;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
|
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.ResourceInfo;
|
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.SystemConfigInfo;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
|
@ -95,6 +92,13 @@ public class ServerController {
|
||||||
return mediaServerService.getAllOnline();
|
return mediaServerService.getAllOnline();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = "/media_server/ffmpeg_cmd/list")
|
||||||
|
@ResponseBody
|
||||||
|
@Operation(summary = "ffmpeg_cmd列表", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
|
public List<FFmpegCmdInfo> getFFmpegCMDList(String mediaServerId) {
|
||||||
|
return mediaServerService.getFFmpegCMDList(mediaServerId);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/media_server/one/{id}")
|
@GetMapping(value = "/media_server/one/{id}")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@Operation(summary = "停止视频回放", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
@Operation(summary = "停止视频回放", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
|
|
Loading…
Reference in New Issue