|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig; | 
|---|
|  |  |  | import org.springframework.util.StringUtils; | 
|---|
|  |  |  | import io.swagger.v3.oas.annotations.media.Schema; | 
|---|
|  |  |  | import org.springframework.util.ObjectUtils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public class MediaServerItem implements IMediaServerItem{ | 
|---|
|  |  |  | @Schema(description = "流媒体服务信息") | 
|---|
|  |  |  | public class MediaServerItem{ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(description = "ID") | 
|---|
|  |  |  | private String id; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(description = "IP") | 
|---|
|  |  |  | private String ip; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(description = "hook使用的IP(zlm访问WVP使用的IP)") | 
|---|
|  |  |  | private String hookIp; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(description = "SDP IP") | 
|---|
|  |  |  | private String sdpIp; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(description = "流IP") | 
|---|
|  |  |  | private String streamIp; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(description = "HTTP端口") | 
|---|
|  |  |  | private int httpPort; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(description = "HTTPS端口") | 
|---|
|  |  |  | private int httpSSlPort; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(description = "RTMP端口") | 
|---|
|  |  |  | private int rtmpPort; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(description = "RTMPS端口") | 
|---|
|  |  |  | private int rtmpSSlPort; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(description = "RTP收流端口(单端口模式有用)") | 
|---|
|  |  |  | private int rtpProxyPort; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(description = "RTSP端口") | 
|---|
|  |  |  | private int rtspPort; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(description = "RTSPS端口") | 
|---|
|  |  |  | private int rtspSSLPort; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(description = "是否开启自动配置ZLM") | 
|---|
|  |  |  | private boolean autoConfig; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(description = "ZLM鉴权参数") | 
|---|
|  |  |  | private String secret; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private String streamNoneReaderDelayMS; | 
|---|
|  |  |  | @Schema(description = "keepalive hook触发间隔,单位秒") | 
|---|
|  |  |  | private Float hookAliveInterval; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(description = "是否使用多端口模式") | 
|---|
|  |  |  | private boolean rtpEnable; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(description = "状态") | 
|---|
|  |  |  | private boolean status; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(description = "多端口RTP收流端口范围") | 
|---|
|  |  |  | private String rtpPortRange; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(description = "assist服务端口") | 
|---|
|  |  |  | private int recordAssistPort; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(description = "创建时间") | 
|---|
|  |  |  | private String createTime; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(description = "更新时间") | 
|---|
|  |  |  | private String updateTime; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private boolean docker; | 
|---|
|  |  |  | @Schema(description = "上次心跳时间") | 
|---|
|  |  |  | private String lastKeepaliveTime; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private int count; | 
|---|
|  |  |  | @Schema(description = "是否是默认ZLM") | 
|---|
|  |  |  | private boolean defaultServer; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(description = "当前使用到的端口") | 
|---|
|  |  |  | private int currentPort; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public MediaServerItem() { | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | public MediaServerItem(ZLMServerConfig zlmServerConfig, String sipIp) { | 
|---|
|  |  |  | id = zlmServerConfig.getGeneralMediaServerId(); | 
|---|
|  |  |  | ip = zlmServerConfig.getIp(); | 
|---|
|  |  |  | hookIp = StringUtils.isEmpty(zlmServerConfig.getHookIp())? sipIp: zlmServerConfig.getHookIp(); | 
|---|
|  |  |  | sdpIp = StringUtils.isEmpty(zlmServerConfig.getSdpIp())? zlmServerConfig.getIp(): zlmServerConfig.getSdpIp(); | 
|---|
|  |  |  | streamIp = StringUtils.isEmpty(zlmServerConfig.getStreamIp())? zlmServerConfig.getIp(): zlmServerConfig.getStreamIp(); | 
|---|
|  |  |  | hookIp = ObjectUtils.isEmpty(zlmServerConfig.getHookIp())? sipIp: zlmServerConfig.getHookIp(); | 
|---|
|  |  |  | sdpIp = ObjectUtils.isEmpty(zlmServerConfig.getSdpIp())? zlmServerConfig.getIp(): zlmServerConfig.getSdpIp(); | 
|---|
|  |  |  | streamIp = ObjectUtils.isEmpty(zlmServerConfig.getStreamIp())? zlmServerConfig.getIp(): zlmServerConfig.getStreamIp(); | 
|---|
|  |  |  | httpPort = zlmServerConfig.getHttpPort(); | 
|---|
|  |  |  | httpSSlPort = zlmServerConfig.getHttpSSLport(); | 
|---|
|  |  |  | rtmpPort = zlmServerConfig.getRtmpPort(); | 
|---|
|  |  |  | 
|---|
|  |  |  | rtspSSLPort = zlmServerConfig.getRtspSSlport(); | 
|---|
|  |  |  | autoConfig = true; // 默认值true; | 
|---|
|  |  |  | secret = zlmServerConfig.getApiSecret(); | 
|---|
|  |  |  | streamNoneReaderDelayMS = zlmServerConfig.getGeneralStreamNoneReaderDelayMS(); | 
|---|
|  |  |  | hookAliveInterval = zlmServerConfig.getHookAliveInterval(); | 
|---|
|  |  |  | rtpEnable = false; // 默认使用单端口;直到用户自己设置开启多端口 | 
|---|
|  |  |  | rtpPortRange = zlmServerConfig.getPortRange().replace("_",","); // 默认使用30000,30500作为级联时发送流的端口号 | 
|---|
|  |  |  | recordAssistPort = 0; // 默认关闭 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | this.secret = secret; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getStreamNoneReaderDelayMS() { | 
|---|
|  |  |  | return streamNoneReaderDelayMS; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setStreamNoneReaderDelayMS(String streamNoneReaderDelayMS) { | 
|---|
|  |  |  | this.streamNoneReaderDelayMS = streamNoneReaderDelayMS; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public boolean isRtpEnable() { | 
|---|
|  |  |  | return rtpEnable; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | this.recordAssistPort = recordAssistPort; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public boolean isDocker() { | 
|---|
|  |  |  | return docker; | 
|---|
|  |  |  | public boolean isDefaultServer() { | 
|---|
|  |  |  | return defaultServer; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void setDocker(boolean docker) { | 
|---|
|  |  |  | this.docker = docker; | 
|---|
|  |  |  | public void setDefaultServer(boolean defaultServer) { | 
|---|
|  |  |  | this.defaultServer = defaultServer; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getCreateTime() { | 
|---|
|  |  |  | 
|---|
|  |  |  | this.updateTime = updateTime; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public int getCount() { | 
|---|
|  |  |  | return count; | 
|---|
|  |  |  | public int getCurrentPort() { | 
|---|
|  |  |  | return currentPort; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setCount(int count) { | 
|---|
|  |  |  | this.count = count; | 
|---|
|  |  |  | public void setCurrentPort(int currentPort) { | 
|---|
|  |  |  | this.currentPort = currentPort; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public boolean isStatus() { | 
|---|
|  |  |  | return status; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setStatus(boolean status) { | 
|---|
|  |  |  | this.status = status; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getLastKeepaliveTime() { | 
|---|
|  |  |  | return lastKeepaliveTime; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setLastKeepaliveTime(String lastKeepaliveTime) { | 
|---|
|  |  |  | this.lastKeepaliveTime = lastKeepaliveTime; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public Float getHookAliveInterval() { | 
|---|
|  |  |  | return hookAliveInterval; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setHookAliveInterval(Float hookAliveInterval) { | 
|---|
|  |  |  | this.hookAliveInterval = hookAliveInterval; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|