com.dahuatech.icc.multiinone.admin.vo.RealTimeRequest Maven / Gradle / Ivy
The newest version!
package com.dahuatech.icc.multiinone.admin.vo;
import com.dahuatech.icc.admin.enums.PlayBackFormatEnum;
import com.dahuatech.icc.admin.enums.StreamTypeEnum;
import com.dahuatech.icc.common.ParamValidEnum;
import com.dahuatech.icc.multiinone.exception.BusinessException;
import com.dahuatech.icc.multiinone.utils.StringUtils;
import com.dahuatech.icc.multiinone.vo.BaseRequest;
public class RealTimeRequest extends BaseRequest {
private String channelId;//视频通道编码
private String streamType;//码流类型:1=主码流, 2=辅码流,3=辅码流2
private String type;//hls,flv,rtmp,rtsp
public String getChannelId() {
return channelId;
}
public void setChannelId(String channelId) {
this.channelId = channelId;
}
public String getStreamType() {
return streamType;
}
public void setStreamType(String streamType) {
this.streamType = streamType;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public void businessValid() {
if(StringUtils.isEmpty(channelId) || !channelId.contains("$")){
throw new BusinessException(ParamValidEnum.PARAM_FORMAT_ERROR.getCode(),"通道编码非法");
}
String[] arr = channelId.split("\\$");
if(arr.length != 4 || !"1".equals(arr[1])){
throw new BusinessException(ParamValidEnum.PARAM_FORMAT_ERROR.getCode(),"非视频通道");
}
if(!StreamTypeEnum.isRight(streamType)){
throw new BusinessException(ParamValidEnum.PARAM_FORMAT_ERROR.getCode(),"码流类型非法");
}
if(!PlayBackFormatEnum.isRight(type)){
throw new BusinessException(ParamValidEnum.PARAM_FORMAT_ERROR.getCode(),"播放格式非法");
}
}
}