修复ui录象播放
优化录象查询接口
This commit is contained in:
@@ -1,12 +1,18 @@
|
||||
package com.genersoft.iot.vmp.gb28181.bean;
|
||||
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description:设备录像bean
|
||||
* @author: swwheihei
|
||||
* @date: 2020年5月8日 下午2:06:54
|
||||
*/
|
||||
public class RecordItem {
|
||||
public class RecordItem implements Comparable<RecordItem>{
|
||||
|
||||
private String deviceId;
|
||||
|
||||
@@ -97,4 +103,21 @@ public class RecordItem {
|
||||
public void setRecorderId(String recorderId) {
|
||||
this.recorderId = recorderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(@NotNull RecordItem recordItem) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
try {
|
||||
Date startTime_now = sdf.parse(startTime);
|
||||
Date startTime_param = sdf.parse(recordItem.getStartTime());
|
||||
if (startTime_param.compareTo(startTime_now) > 0) {
|
||||
return -1;
|
||||
}else {
|
||||
return 1;
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public interface ISIPCommander {
|
||||
* @param startTime 开始时间,格式要求:yyyy-MM-dd HH:mm:ss
|
||||
* @param endTime 结束时间,格式要求:yyyy-MM-dd HH:mm:ss
|
||||
*/
|
||||
public String playbackStreamCmd(Device device,String channelId, String startTime, String endTime);
|
||||
public StreamInfo playbackStreamCmd(Device device,String channelId, String startTime, String endTime);
|
||||
|
||||
/**
|
||||
* 视频流停止
|
||||
|
||||
@@ -279,7 +279,7 @@ public class SIPCommander implements ISIPCommander {
|
||||
* @param endTime 结束时间,格式要求:yyyy-MM-dd HH:mm:ss
|
||||
*/
|
||||
@Override
|
||||
public String playbackStreamCmd(Device device, String channelId, String startTime, String endTime) {
|
||||
public StreamInfo playbackStreamCmd(Device device, String channelId, String startTime, String endTime) {
|
||||
try {
|
||||
MediaServerConfig mediaInfo = storager.getMediaInfo();
|
||||
String ssrc = streamSession.createPlayBackSsrc();
|
||||
@@ -324,7 +324,13 @@ public class SIPCommander implements ISIPCommander {
|
||||
|
||||
ClientTransaction transaction = transmitRequest(device, request);
|
||||
streamSession.put(ssrc, transaction);
|
||||
return ssrc;
|
||||
|
||||
StreamInfo streamInfo = new StreamInfo();
|
||||
streamInfo.setSsrc(ssrc);
|
||||
streamInfo.setCahnnelId(channelId);
|
||||
streamInfo.setDeviceID(device.getDeviceId());
|
||||
boolean b = storager.startPlayBlack(streamInfo);
|
||||
return streamInfo;
|
||||
|
||||
} catch ( SipException | ParseException | InvalidArgumentException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -2,11 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.request.impl;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import javax.sip.InvalidArgumentException;
|
||||
import javax.sip.RequestEvent;
|
||||
@@ -316,6 +312,7 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
|
||||
record.setRecorderId(XmlUtil.getText(itemRecord,"RecorderID"));
|
||||
recordList.add(record);
|
||||
}
|
||||
// recordList.sort(Comparator.naturalOrder());
|
||||
recordInfo.setRecordList(recordList);
|
||||
}
|
||||
|
||||
@@ -349,9 +346,13 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
|
||||
// 走到这里,有以下可能:1、没有录像信息,第一次收到recordinfo的消息即返回响应数据,无redis操作
|
||||
// 2、有录像数据,且第一次即收到完整数据,返回响应数据,无redis操作
|
||||
// 3、有录像数据,在超时时间内收到多次包组装后数量足够,返回数据
|
||||
|
||||
// 对记录进行排序
|
||||
RequestMessage msg = new RequestMessage();
|
||||
msg.setDeviceId(deviceId);
|
||||
msg.setType(DeferredResultHolder.CALLBACK_CMD_RECORDINFO);
|
||||
// 自然顺序排序, 元素进行升序排列
|
||||
recordInfo.getRecordList().sort(Comparator.naturalOrder());
|
||||
msg.setData(recordInfo);
|
||||
deferredResultHolder.invokeResult(msg);
|
||||
} catch (DocumentException e) {
|
||||
|
||||
Reference in New Issue
Block a user