1078-支持设备录像检索播放

This commit is contained in:
panlinlin
2024-06-09 20:50:59 +08:00
parent b4dddb0b08
commit 4b90298c99
5 changed files with 586 additions and 152 deletions

View File

@@ -7,6 +7,7 @@ import com.genersoft.iot.vmp.jt1078.proc.response.Rs;
import com.genersoft.iot.vmp.jt1078.service.Ijt1078Service;
import com.genersoft.iot.vmp.jt1078.session.Session;
import com.genersoft.iot.vmp.jt1078.session.SessionManager;
import com.genersoft.iot.vmp.utils.DateUtil;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil;
import org.springframework.context.ApplicationEvent;
@@ -35,8 +36,10 @@ public class J1205 extends Re {
for (int i = 0; i < size; i++) {
JRecordItem item = new JRecordItem();
item.setChannelId(buf.readUnsignedByte());
item.setStartTime(ByteBufUtil.hexDump(buf.readSlice(6)));
item.setEndTime(ByteBufUtil.hexDump(buf.readSlice(6)));
String startTime = ByteBufUtil.hexDump(buf.readSlice(6));
item.setStartTime(DateUtil.jt1078Toyyyy_MM_dd_HH_mm_ss(startTime));
String endTime = ByteBufUtil.hexDump(buf.readSlice(6));
item.setEndTime(DateUtil.jt1078Toyyyy_MM_dd_HH_mm_ss(endTime));
item.setWarn(buf.readLong());
item.setMediaType(buf.readUnsignedByte());
item.setStreamType(buf.readUnsignedByte());

View File

@@ -241,6 +241,14 @@ public class jt1078ServiceImpl implements Ijt1078Service {
public void stopPlay(String phoneNumber, Integer channelId) {
String playKey = VideoManagerConstants.INVITE_INFO_1078_PLAY + phoneNumber + ":" + channelId;
dynamicTask.stop(playKey);
// 清理回调
List<GeneralCallback<StreamInfo>> generalCallbacks = inviteErrorCallbackMap.get(playKey);
if (generalCallbacks != null && !generalCallbacks.isEmpty()) {
for (GeneralCallback<StreamInfo> callback : generalCallbacks) {
callback.run(InviteErrorCode.ERROR_FOR_FINISH.getCode(), InviteErrorCode.ERROR_FOR_FINISH.getMsg(), null);
}
}
jt1078Template.checkTerminalStatus(phoneNumber);
StreamInfo streamInfo = (StreamInfo) redisTemplate.opsForValue().get(playKey);
// 发送停止命令
J9102 j9102 = new J9102();
@@ -256,13 +264,7 @@ public class jt1078ServiceImpl implements Ijt1078Service {
mediaServerService.closeRTPServer(streamInfo.getMediaServerId(), streamInfo.getStream());
redisTemplate.delete(playKey);
}
// 清理回调
List<GeneralCallback<StreamInfo>> generalCallbacks = inviteErrorCallbackMap.get(playKey);
if (generalCallbacks != null && !generalCallbacks.isEmpty()) {
for (GeneralCallback<StreamInfo> callback : generalCallbacks) {
callback.run(InviteErrorCode.ERROR_FOR_FINISH.getCode(), InviteErrorCode.ERROR_FOR_FINISH.getMsg(), null);
}
}
}
@Override
@@ -445,7 +447,7 @@ public class jt1078ServiceImpl implements Ijt1078Service {
@Override
public void stopPlayback(String phoneNumber, Integer channelId) {
playbackControl(phoneNumber, channelId, 2, null, String.valueOf(0));
playbackControl(phoneNumber, channelId, 2, null, null);
}
private Map<String, GeneralCallback<String>> fileUploadMap = new ConcurrentHashMap<>();