mirror of
https://gitee.com/pan648540858/wvp-GB28181-pro.git
synced 2026-05-23 21:47:49 +08:00
临时提交
This commit is contained in:
parent
867b26b9a8
commit
edeb8d6b3f
@ -1,21 +1,24 @@
|
|||||||
package com.genersoft.iot.vmp.common.enums;
|
package com.genersoft.iot.vmp.common.enums;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支持的通道数据类型
|
* 支持的通道数据类型
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public enum ChannelDataType {
|
public class ChannelDataType {
|
||||||
|
|
||||||
GB28181(1,"国标28181"),
|
public final static int GB28181 = 1;
|
||||||
STREAM_PUSH(2,"推流设备"),
|
public final static int STREAM_PUSH = 2;
|
||||||
STREAM_PROXY(3,"拉流代理");
|
public final static int STREAM_PROXY = 3;
|
||||||
|
|
||||||
public final int value;
|
public static Map<String, Integer> getDescMap() {
|
||||||
|
Map<String, Integer> map = new HashMap<>();
|
||||||
public final String desc;
|
map.put("国标28181", ChannelDataType.GB28181);
|
||||||
|
map.put("推流设备", ChannelDataType.STREAM_PUSH);
|
||||||
ChannelDataType(Integer value, String desc) {
|
map.put("拉流代理", ChannelDataType.STREAM_PROXY);
|
||||||
this.value = value;
|
return map;
|
||||||
this.desc = desc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,7 +25,7 @@ public interface IGbChannelPlayService {
|
|||||||
|
|
||||||
void playPush(CommonGBChannel channel, String platformDeviceId, String platformName, ErrorCallback<StreamInfo> callback);
|
void playPush(CommonGBChannel channel, String platformDeviceId, String platformName, ErrorCallback<StreamInfo> callback);
|
||||||
|
|
||||||
void stopPlayPush(CommonGBChannel channel);
|
void stopPlayPush(CommonGBChannel channel);
|
||||||
|
|
||||||
void pauseRtp(String streamId);
|
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.InviteSessionType;
|
||||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
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.common.enums.ChannelDataType;
|
||||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
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.CommonGBChannel;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.bean.InviteMessageInfo;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.Platform;
|
import com.genersoft.iot.vmp.gb28181.bean.Platform;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.PlayException;
|
import com.genersoft.iot.vmp.gb28181.bean.PlayException;
|
||||||
import com.genersoft.iot.vmp.gb28181.service.IGbChannelPlayService;
|
import com.genersoft.iot.vmp.gb28181.service.IGbChannelPlayService;
|
||||||
import com.genersoft.iot.vmp.gb28181.service.IPlayService;
|
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.service.bean.ErrorCallback;
|
||||||
import com.genersoft.iot.vmp.streamProxy.service.IStreamProxyPlayService;
|
import com.genersoft.iot.vmp.streamProxy.service.IStreamProxyPlayService;
|
||||||
import com.genersoft.iot.vmp.streamPush.service.IStreamPushPlayService;
|
import com.genersoft.iot.vmp.streamPush.service.IStreamPushPlayService;
|
||||||
@ -23,6 +24,7 @@ import javax.sip.InvalidArgumentException;
|
|||||||
import javax.sip.SipException;
|
import javax.sip.SipException;
|
||||||
import javax.sip.message.Response;
|
import javax.sip.message.Response;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@ -40,6 +42,9 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private UserSetting userSetting;
|
private UserSetting userSetting;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private Map<String, ISourcePlayService> sourcePlayServiceMap;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start(CommonGBChannel channel, InviteMessageInfo inviteInfo, Platform platform, ErrorCallback<StreamInfo> callback) {
|
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");
|
throw new PlayException(Response.SERVER_INTERNAL_ERROR, "server internal error");
|
||||||
}
|
}
|
||||||
log.info("[点播通用通道] 类型:{}, 通道: {}({})", inviteInfo.getSessionName(), channel.getGbName(), channel.getGbDeviceId());
|
log.info("[点播通用通道] 类型:{}, 通道: {}({})", inviteInfo.getSessionName(), channel.getGbName(), channel.getGbDeviceId());
|
||||||
|
|
||||||
if ("Play".equalsIgnoreCase(inviteInfo.getSessionName())) {
|
if ("Play".equalsIgnoreCase(inviteInfo.getSessionName())) {
|
||||||
play(channel, platform, userSetting.getRecordSip(), callback);
|
play(channel, platform, userSetting.getRecordSip(), callback);
|
||||||
}else if ("Playback".equals(inviteInfo.getSessionName())) {
|
}else if ("Playback".equals(inviteInfo.getSessionName())) {
|
||||||
@ -119,6 +125,17 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
|
|||||||
@Override
|
@Override
|
||||||
public void play(CommonGBChannel channel, Platform platform, Boolean record, ErrorCallback<StreamInfo> callback) {
|
public void play(CommonGBChannel channel, Platform platform, Boolean record, ErrorCallback<StreamInfo> callback) {
|
||||||
log.info("[通用通道] 播放, 类型: {}, 编号:{}", channel.getDataType(), channel.getGbDeviceId());
|
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) {
|
if (channel.getDataType() == ChannelDataType.GB28181.value) {
|
||||||
// 国标通道
|
// 国标通道
|
||||||
playGbDeviceChannel(channel, record, callback);
|
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))
|
@Operation(summary = "获取系统接入的数据类型", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
public List<Map<String, Object>> getDataType() {
|
public List<Map<String, Object>> getDataType() {
|
||||||
List<Map<String, Object>> result = new LinkedList<>();
|
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<String, Object> map = new LinkedHashMap<>();
|
||||||
map.put("key", item.desc);
|
map.put("key", key);
|
||||||
map.put("value", item.value);
|
map.put("value", descMap.get(key));
|
||||||
result.add(map);
|
result.add(map);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user