支持点播、停止点播和云台控制

This commit is contained in:
648540858
2025-10-07 10:56:18 +08:00
parent 61c64589b2
commit d4da1dc91c
13 changed files with 214 additions and 43 deletions

View File

@@ -612,4 +612,5 @@ public interface CommonGBChannelMapper {
CommonGBChannel queryByDataIdAndDeviceID(Integer deviceDbId, String deviceId);
}

View File

@@ -21,7 +21,7 @@ public interface IGbChannelPlayService {
void download(CommonGBChannel channel, Long startTime, Long stopTime, Integer downloadSpeed,
ErrorCallback<StreamInfo> callback);
void stopPlay(CommonGBChannel channel, String stream);
void stopPlay(CommonGBChannel channel);
void play(CommonGBChannel channel, Platform platform, Boolean record, ErrorCallback<StreamInfo> callback);

View File

@@ -72,6 +72,8 @@ public interface IPlayService {
void play(CommonGBChannel channel, Boolean record, ErrorCallback<StreamInfo> callback);
void stopPlay(InviteSessionType inviteSessionType, CommonGBChannel channel);
void stop(InviteSessionType inviteSessionType, CommonGBChannel channel, String stream);
void playBack(CommonGBChannel channel, Long startTime, Long stopTime, ErrorCallback<StreamInfo> callback);

View File

@@ -12,6 +12,6 @@ public interface ISourcePlayService {
void play(CommonGBChannel channel, Platform platform, Boolean record, ErrorCallback<StreamInfo> callback);
void stopPlay(CommonGBChannel channel, String stream);
void stopPlay(CommonGBChannel channel);
}

View File

@@ -70,7 +70,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
public void stopInvite(InviteSessionType type, CommonGBChannel channel, String stream) {
switch (type) {
case PLAY:
stopPlay(channel, stream);
stopPlay(channel);
break;
case PLAYBACK:
stopPlayback(channel, stream);
@@ -135,7 +135,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
}
@Override
public void stopPlay(CommonGBChannel channel, String stream) {
public void stopPlay(CommonGBChannel channel) {
Integer dataType = channel.getDataType();
ISourcePlayService sourceChannelPlayService = sourcePlayServiceMap.get(ChannelDataType.PLAY_SERVICE + dataType);
if (sourceChannelPlayService == null) {
@@ -143,7 +143,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
log.error("[点播通用通道] 类型编号: {} 不支持停止实时流", dataType);
throw new PlayException(Response.BUSY_HERE, "channel not support");
}
sourceChannelPlayService.stopPlay(channel, stream);
sourceChannelPlayService.stopPlay(channel);
}
@Override

View File

@@ -1741,6 +1741,18 @@ public class PlayServiceImpl implements IPlayService {
}
@Override
public void stopPlay(InviteSessionType inviteSessionType, CommonGBChannel channel) {
Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) {
log.warn("[停止播放] 未找到通道{}的设备信息", channel);
throw new PlayException(Response.SERVER_INTERNAL_ERROR, "server internal error");
}
DeviceChannel deviceChannel = deviceChannelService.getOneForSourceById(channel.getGbId());
String stream = String.format("%s_%s", device.getDeviceId(), deviceChannel.getDeviceId());
stop(inviteSessionType, device, deviceChannel, stream);
}
@Override
public void stop(InviteSessionType inviteSessionType, CommonGBChannel channel, String stream) {
Device device = deviceService.getDevice(channel.getDataDeviceId());

View File

@@ -40,10 +40,10 @@ public class SourcePlayServiceForGbImpl implements ISourcePlayService {
}
@Override
public void stopPlay(CommonGBChannel channel, String stream) {
public void stopPlay(CommonGBChannel channel) {
// 国标通道
try {
deviceChannelPlayService.stop(InviteSessionType.PLAY, channel, stream);
deviceChannelPlayService.stopPlay(InviteSessionType.PLAY, channel);
} catch (Exception e) {
log.error("[停止点播失败] {}({})", channel.getGbName(), channel.getGbDeviceId(), e);
}