mirror of
https://gitee.com/pan648540858/wvp-GB28181-pro.git
synced 2026-05-24 05:57:49 +08:00
1078-切换码流类型
This commit is contained in:
parent
84ef932964
commit
2b1645729b
@ -64,24 +64,20 @@ public class JT1078Controller {
|
|||||||
@GetMapping("/live/start")
|
@GetMapping("/live/start")
|
||||||
public DeferredResult<WVPResult<StreamContent>> startLive(HttpServletRequest request,
|
public DeferredResult<WVPResult<StreamContent>> startLive(HttpServletRequest request,
|
||||||
@Parameter(required = true) String deviceId,
|
@Parameter(required = true) String deviceId,
|
||||||
@Parameter(required = false) String channelId,
|
@Parameter(required = true) String channelId,
|
||||||
@Parameter(required = false) Integer type) {
|
@Parameter(required = false) Integer type) {
|
||||||
if (type == null || (type != 0 && type != 1 && type != 3)) {
|
if (type == null || (type != 0 && type != 1 && type != 3)) {
|
||||||
type = 0;
|
type = 0;
|
||||||
}
|
}
|
||||||
DeferredResult<WVPResult<StreamContent>> result = new DeferredResult<>(userSetting.getPlayTimeout().longValue());
|
DeferredResult<WVPResult<StreamContent>> result = new DeferredResult<>(userSetting.getPlayTimeout().longValue());
|
||||||
if (ObjectUtils.isEmpty(channelId)) {
|
|
||||||
channelId = "1";
|
|
||||||
}
|
|
||||||
String finalChannelId = channelId;
|
|
||||||
result.onTimeout(()->{
|
result.onTimeout(()->{
|
||||||
logger.info("[1078-点播等待超时] deviceId:{}, channelId:{}, ", deviceId, finalChannelId);
|
logger.info("[1078-点播等待超时] deviceId:{}, channelId:{}, ", deviceId, channelId);
|
||||||
// 释放rtpserver
|
// 释放rtpserver
|
||||||
WVPResult<StreamContent> wvpResult = new WVPResult<>();
|
WVPResult<StreamContent> wvpResult = new WVPResult<>();
|
||||||
wvpResult.setCode(ErrorCode.ERROR100.getCode());
|
wvpResult.setCode(ErrorCode.ERROR100.getCode());
|
||||||
wvpResult.setMsg("超时");
|
wvpResult.setMsg("超时");
|
||||||
result.setResult(wvpResult);
|
result.setResult(wvpResult);
|
||||||
service.stopPlay(deviceId, finalChannelId);
|
service.stopPlay(deviceId, channelId);
|
||||||
});
|
});
|
||||||
|
|
||||||
service.play(deviceId, channelId, type, (code, msg, streamInfo) -> {
|
service.play(deviceId, channelId, type, (code, msg, streamInfo) -> {
|
||||||
@ -123,10 +119,7 @@ public class JT1078Controller {
|
|||||||
@GetMapping("/live/stop")
|
@GetMapping("/live/stop")
|
||||||
public void stopLive(HttpServletRequest request,
|
public void stopLive(HttpServletRequest request,
|
||||||
@Parameter(required = true) String deviceId,
|
@Parameter(required = true) String deviceId,
|
||||||
@Parameter(required = false) String channelId) {
|
@Parameter(required = true) String channelId) {
|
||||||
if (ObjectUtils.isEmpty(channelId)) {
|
|
||||||
channelId = "1";
|
|
||||||
}
|
|
||||||
service.stopPlay(deviceId, channelId);
|
service.stopPlay(deviceId, channelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,10 +192,7 @@ public class JT1078Controller {
|
|||||||
@GetMapping("/talk/stop")
|
@GetMapping("/talk/stop")
|
||||||
public void stopTalk(HttpServletRequest request,
|
public void stopTalk(HttpServletRequest request,
|
||||||
@Parameter(required = true) String deviceId,
|
@Parameter(required = true) String deviceId,
|
||||||
@Parameter(required = false) String channelId) {
|
@Parameter(required = true) String channelId) {
|
||||||
if (ObjectUtils.isEmpty(channelId)) {
|
|
||||||
channelId = "1";
|
|
||||||
}
|
|
||||||
service.stopTalk(deviceId, channelId);
|
service.stopTalk(deviceId, channelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,10 +203,7 @@ public class JT1078Controller {
|
|||||||
@GetMapping("/live/pause")
|
@GetMapping("/live/pause")
|
||||||
public void pauseLive(HttpServletRequest request,
|
public void pauseLive(HttpServletRequest request,
|
||||||
@Parameter(required = true) String deviceId,
|
@Parameter(required = true) String deviceId,
|
||||||
@Parameter(required = false) String channelId) {
|
@Parameter(required = true) String channelId) {
|
||||||
if (ObjectUtils.isEmpty(channelId)) {
|
|
||||||
channelId = "1";
|
|
||||||
}
|
|
||||||
service.pausePlay(deviceId, channelId);
|
service.pausePlay(deviceId, channelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,13 +213,23 @@ public class JT1078Controller {
|
|||||||
@GetMapping("/live/continue")
|
@GetMapping("/live/continue")
|
||||||
public void continueLive(HttpServletRequest request,
|
public void continueLive(HttpServletRequest request,
|
||||||
@Parameter(required = true) String deviceId,
|
@Parameter(required = true) String deviceId,
|
||||||
@Parameter(required = false) String channelId) {
|
@Parameter(required = true) String channelId) {
|
||||||
if (ObjectUtils.isEmpty(channelId)) {
|
|
||||||
channelId = "1";
|
|
||||||
}
|
|
||||||
service.continueLivePlay(deviceId, channelId);
|
service.continueLivePlay(deviceId, channelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "1078-切换码流类型", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
|
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||||
|
@Parameter(name = "channelId", description = "通道国标编号, 一般为从1开始的数字", required = true)
|
||||||
|
@Parameter(name = "streamType", description = "0:主码流; 1:子码流", required = true)
|
||||||
|
@GetMapping("/live/continue")
|
||||||
|
public void changeStreamType(HttpServletRequest request,
|
||||||
|
@Parameter(required = true) String deviceId,
|
||||||
|
@Parameter(required = true) String channelId,
|
||||||
|
@Parameter(required = true) Integer streamType) {
|
||||||
|
service.changeStreamType(deviceId, channelId, streamType);
|
||||||
|
}
|
||||||
|
|
||||||
@Operation(summary = "1078-录像-查询资源列表", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
@Operation(summary = "1078-录像-查询资源列表", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||||
@Parameter(name = "channelId", description = "通道国标编号, 一般为从1开始的数字", required = true)
|
@Parameter(name = "channelId", description = "通道国标编号, 一般为从1开始的数字", required = true)
|
||||||
|
|||||||
@ -110,4 +110,6 @@ public interface Ijt1078Service {
|
|||||||
void startTalk(String deviceId, String channelId, String app, String stream, String mediaServerId, Boolean onlySend, GeneralCallback<StreamInfo> callback);
|
void startTalk(String deviceId, String channelId, String app, String stream, String mediaServerId, Boolean onlySend, GeneralCallback<StreamInfo> callback);
|
||||||
|
|
||||||
void stopTalk(String deviceId, String channelId);
|
void stopTalk(String deviceId, String channelId);
|
||||||
|
|
||||||
|
void changeStreamType(String deviceId, String channelId, Integer streamType);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -895,7 +895,7 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
// 发送停止命令
|
// 发送停止命令
|
||||||
J9102 j9102 = new J9102();
|
J9102 j9102 = new J9102();
|
||||||
j9102.setChannel(Integer.valueOf(channelId));
|
j9102.setChannel(Integer.valueOf(channelId));
|
||||||
j9102.setCommand(0);
|
j9102.setCommand(4);
|
||||||
j9102.setCloseType(0);
|
j9102.setCloseType(0);
|
||||||
j9102.setStreamType(1);
|
j9102.setStreamType(1);
|
||||||
jt1078Template.stopLive(deviceId, j9102, 6);
|
jt1078Template.stopLive(deviceId, j9102, 6);
|
||||||
@ -914,4 +914,22 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void changeStreamType(String deviceId, String channelId, Integer streamType) {
|
||||||
|
String playKey = VideoManagerConstants.INVITE_INFO_1078_PLAY + deviceId + ":" + channelId;
|
||||||
|
dynamicTask.stop(playKey);
|
||||||
|
StreamInfo streamInfo = (StreamInfo) redisTemplate.opsForValue().get(playKey);
|
||||||
|
if (streamInfo == null) {
|
||||||
|
logger.info("[1078-切换码流类型] 未找到点播信息 deviceId: {}, channelId: {}, streamType: {}", deviceId, channelId, streamType);
|
||||||
|
}
|
||||||
|
logger.info("[1078-切换码流类型] deviceId: {}, channelId: {}, streamType: {}", deviceId, channelId, streamType);
|
||||||
|
// 发送暂停命令
|
||||||
|
J9102 j9102 = new J9102();
|
||||||
|
j9102.setChannel(Integer.valueOf(channelId));
|
||||||
|
j9102.setCommand(1);
|
||||||
|
j9102.setCloseType(0);
|
||||||
|
j9102.setStreamType(streamType);
|
||||||
|
jt1078Template.stopLive(deviceId, j9102, 6);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user