临时提交
This commit is contained in:
@@ -1,21 +1,24 @@
|
||||
package com.genersoft.iot.vmp.common.enums;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 支持的通道数据类型
|
||||
*/
|
||||
|
||||
public enum ChannelDataType {
|
||||
public class ChannelDataType {
|
||||
|
||||
GB28181(1,"国标28181"),
|
||||
STREAM_PUSH(2,"推流设备"),
|
||||
STREAM_PROXY(3,"拉流代理");
|
||||
public final static int GB28181 = 1;
|
||||
public final static int STREAM_PUSH = 2;
|
||||
public final static int STREAM_PROXY = 3;
|
||||
|
||||
public final int value;
|
||||
|
||||
public final String desc;
|
||||
|
||||
ChannelDataType(Integer value, String desc) {
|
||||
this.value = value;
|
||||
this.desc = desc;
|
||||
public static Map<String, Integer> getDescMap() {
|
||||
Map<String, Integer> map = new HashMap<>();
|
||||
map.put("国标28181", ChannelDataType.GB28181);
|
||||
map.put("推流设备", ChannelDataType.STREAM_PUSH);
|
||||
map.put("拉流代理", ChannelDataType.STREAM_PROXY);
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public interface IGbChannelPlayService {
|
||||
|
||||
void playPush(CommonGBChannel channel, String platformDeviceId, String platformName, ErrorCallback<StreamInfo> callback);
|
||||
|
||||
void stopPlayPush(CommonGBChannel channel);
|
||||
void stopPlayPush(CommonGBChannel channel);
|
||||
|
||||
void pauseRtp(String streamId);
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.genersoft.iot.vmp.gb28181.service;
|
||||
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
|
||||
public interface ISourcePlayService {
|
||||
|
||||
void play(CommonGBChannel channel, Boolean record, ErrorCallback<StreamInfo> callback);
|
||||
|
||||
void stopPlay(CommonGBChannel channel, String stream);
|
||||
|
||||
}
|
||||
@@ -2,16 +2,17 @@ package com.genersoft.iot.vmp.gb28181.service.impl;
|
||||
|
||||
import com.genersoft.iot.vmp.common.InviteSessionType;
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||
import com.genersoft.iot.vmp.conf.exception.ServiceException;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||
import com.genersoft.iot.vmp.conf.exception.ServiceException;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.InviteMessageInfo;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Platform;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.PlayException;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IGbChannelPlayService;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IPlayService;
|
||||
import com.genersoft.iot.vmp.gb28181.service.ISourcePlayService;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
import com.genersoft.iot.vmp.streamProxy.service.IStreamProxyPlayService;
|
||||
import com.genersoft.iot.vmp.streamPush.service.IStreamPushPlayService;
|
||||
@@ -23,6 +24,7 @@ import javax.sip.InvalidArgumentException;
|
||||
import javax.sip.SipException;
|
||||
import javax.sip.message.Response;
|
||||
import java.text.ParseException;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@@ -40,6 +42,9 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
|
||||
@Autowired
|
||||
private UserSetting userSetting;
|
||||
|
||||
@Autowired
|
||||
private Map<String, ISourcePlayService> sourcePlayServiceMap;
|
||||
|
||||
|
||||
@Override
|
||||
public void start(CommonGBChannel channel, InviteMessageInfo inviteInfo, Platform platform, ErrorCallback<StreamInfo> callback) {
|
||||
@@ -48,6 +53,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
|
||||
throw new PlayException(Response.SERVER_INTERNAL_ERROR, "server internal error");
|
||||
}
|
||||
log.info("[点播通用通道] 类型:{}, 通道: {}({})", inviteInfo.getSessionName(), channel.getGbName(), channel.getGbDeviceId());
|
||||
|
||||
if ("Play".equalsIgnoreCase(inviteInfo.getSessionName())) {
|
||||
play(channel, platform, userSetting.getRecordSip(), callback);
|
||||
}else if ("Playback".equals(inviteInfo.getSessionName())) {
|
||||
@@ -119,6 +125,17 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
|
||||
@Override
|
||||
public void play(CommonGBChannel channel, Platform platform, Boolean record, ErrorCallback<StreamInfo> callback) {
|
||||
log.info("[通用通道] 播放, 类型: {}, 编号:{}", channel.getDataType(), channel.getGbDeviceId());
|
||||
Integer dataType = channel.getDataType();
|
||||
ISourcePlayService sourceChannelPlayService = sourcePlayServiceMap.get("SourceChannelPlayService" + dataType);
|
||||
if (sourceChannelPlayService == null) {
|
||||
// 通道数据异常
|
||||
log.error("[点播通用通道] 类型编号: {} 不支持实时流预览", dataType);
|
||||
throw new PlayException(Response.BUSY_HERE, "channel not support");
|
||||
}
|
||||
sourceChannelPlayService.play(channel, record, callback);
|
||||
|
||||
|
||||
|
||||
if (channel.getDataType() == ChannelDataType.GB28181.value) {
|
||||
// 国标通道
|
||||
playGbDeviceChannel(channel, record, callback);
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.genersoft.iot.vmp.gb28181.service.impl;
|
||||
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.service.ISourcePlayService;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service("SourcePlayService" + ChannelDataType.GB28181)
|
||||
public class SourcePlayServiceForGbImpl implements ISourcePlayService {
|
||||
|
||||
@Override
|
||||
public void play(CommonGBChannel channel, Boolean record, ErrorCallback<StreamInfo> callback) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopPlay(CommonGBChannel channel, String stream) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -339,10 +339,11 @@ public class ServerController {
|
||||
@Operation(summary = "获取系统接入的数据类型", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
public List<Map<String, Object>> getDataType() {
|
||||
List<Map<String, Object>> result = new LinkedList<>();
|
||||
for (ChannelDataType item : ChannelDataType.values()) {
|
||||
Map<String, Integer> descMap = ChannelDataType.getDescMap();
|
||||
for (String key : descMap.keySet()) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("key", item.desc);
|
||||
map.put("value", item.value);
|
||||
map.put("key", key);
|
||||
map.put("value", descMap.get(key));
|
||||
result.add(map);
|
||||
}
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user