| | |
| | | import com.genersoft.iot.vmp.service.bean.SSRCInfo;
|
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
| | | import com.genersoft.iot.vmp.vmanager.gb28181.session.InfoCseqCache;
|
| | | import gov.nist.javax.sip.SipProviderImpl;
|
| | | import gov.nist.javax.sip.SipStackImpl;
|
| | | import gov.nist.javax.sip.message.SIPRequest;
|
| | |
| | | public boolean frontEndCmd(Device device, String channelId, int cmdCode, int parameter1, int parameter2, int combineCode2) {
|
| | | try {
|
| | | String cmdStr= frontEndCmdString(cmdCode, parameter1, parameter2, combineCode2);
|
| | | logger.info("控制字符串:" + cmdStr);
|
| | | logger.debug("控制字符串:" + cmdStr);
|
| | | StringBuffer ptzXml = new StringBuffer(200);
|
| | | ptzXml.append("<?xml version=\"1.0\" ?>\r\n");
|
| | | ptzXml.append("<Control>\r\n");
|
| | |
| | | @Override
|
| | | public boolean catalogQuery(Device device, SipSubscribe.Event errorEvent) {
|
| | | // 清空通道
|
| | | storager.cleanChannelsForDevice(device.getDeviceId());
|
| | | // storager.cleanChannelsForDevice(device.getDeviceId());
|
| | | try {
|
| | | StringBuffer catalogXml = new StringBuffer(200);
|
| | | catalogXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n");
|
| | |
| | | @Override
|
| | | public void playPauseCmd(Device device, StreamInfo streamInfo) {
|
| | | try {
|
| | |
|
| | | Long cseq = redisCatchStorage.getCSEQ(Request.INFO);
|
| | | StringBuffer content = new StringBuffer(200);
|
| | | content.append("PAUSE RTSP/1.0\r\n");
|
| | | content.append("CSeq: " + InfoCseqCache.CSEQCACHE.get(streamInfo.getStreamId()) + "\r\n");
|
| | | content.append("CSeq: " + cseq + "\r\n");
|
| | | content.append("PauseTime: now\r\n");
|
| | | Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString());
|
| | | Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString(), cseq);
|
| | | logger.info(request.toString());
|
| | | ClientTransaction clientTransaction = null;
|
| | | if ("TCP".equals(device.getTransport())) {
|
| | |
| | | @Override
|
| | | public void playResumeCmd(Device device, StreamInfo streamInfo) {
|
| | | try {
|
| | | Long cseq = redisCatchStorage.getCSEQ(Request.INFO);
|
| | | StringBuffer content = new StringBuffer(200);
|
| | | content.append("PLAY RTSP/1.0\r\n");
|
| | | content.append("CSeq: " + InfoCseqCache.CSEQCACHE.get(streamInfo.getStreamId()) + "\r\n");
|
| | | content.append("CSeq: " + cseq + "\r\n");
|
| | | content.append("Range: npt=now-\r\n");
|
| | | Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString());
|
| | | Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString(), cseq);
|
| | | logger.info(request.toString());
|
| | | ClientTransaction clientTransaction = null;
|
| | | if ("TCP".equals(device.getTransport())) {
|
| | |
| | | @Override
|
| | | public void playSeekCmd(Device device, StreamInfo streamInfo, long seekTime) {
|
| | | try {
|
| | | Long cseq = redisCatchStorage.getCSEQ(Request.INFO);
|
| | | StringBuffer content = new StringBuffer(200);
|
| | | content.append("PLAY RTSP/1.0\r\n");
|
| | | content.append("CSeq: " + InfoCseqCache.CSEQCACHE.get(streamInfo.getStreamId()) + "\r\n");
|
| | | content.append("CSeq: " + cseq + "\r\n");
|
| | | content.append("Range: npt=" + Math.abs(seekTime) + "-\r\n");
|
| | |
|
| | | Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString());
|
| | | Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString(), cseq);
|
| | | logger.info(request.toString());
|
| | | ClientTransaction clientTransaction = null;
|
| | | if ("TCP".equals(device.getTransport())) {
|
| | |
| | | @Override
|
| | | public void playSpeedCmd(Device device, StreamInfo streamInfo, Double speed) {
|
| | | try {
|
| | | Long cseq = redisCatchStorage.getCSEQ(Request.INFO);
|
| | | StringBuffer content = new StringBuffer(200);
|
| | | content.append("PLAY RTSP/1.0\r\n");
|
| | | content.append("CSeq: " + InfoCseqCache.CSEQCACHE.get(streamInfo.getStreamId()) + "\r\n");
|
| | | content.append("CSeq: " + cseq + "\r\n");
|
| | | content.append("Scale: " + String.format("%.1f",speed) + "\r\n");
|
| | | Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString());
|
| | | Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString(), cseq);
|
| | | logger.info(request.toString());
|
| | | ClientTransaction clientTransaction = null;
|
| | | if ("TCP".equals(device.getTransport())) {
|