去除所有的system.print, 优化日志显示
| | |
| | | @JSONField(name = "general.enableVhost") |
| | | private String generalEnableVhost; |
| | | |
| | | @JSONField(name = "general.mediaServerId") |
| | | private String generalMediaServerId; |
| | | |
| | | @JSONField(name = "general.flowThreshold") |
| | | private String generalFlowThreshold; |
| | | |
| | |
| | | public void setUpdateTime(long updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public String getGeneralMediaServerId() { |
| | | return generalMediaServerId; |
| | | } |
| | | |
| | | public void setGeneralMediaServerId(String generalMediaServerId) { |
| | | this.generalMediaServerId = generalMediaServerId; |
| | | } |
| | | } |
| | |
| | | import javax.sip.message.Response; |
| | | |
| | | import gov.nist.core.InternalErrorHandler; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | /** |
| | | * Implements the HTTP digest authentication method server side functionality. |
| | |
| | | */ |
| | | |
| | | public class DigestServerAuthenticationHelper { |
| | | |
| | | private Logger logger = LoggerFactory.getLogger(DigestServerAuthenticationHelper.class); |
| | | |
| | | private MessageDigest messageDigest; |
| | | |
| | |
| | | String A2 = request.getMethod().toUpperCase() + ":" + uri.toString(); |
| | | byte mdbytes[] = messageDigest.digest(A1.getBytes()); |
| | | String HA1 = toHexString(mdbytes); |
| | | System.out.println("A1: " + A1); |
| | | System.out.println("A2: " + A2); |
| | | logger.debug("A1: " + A1); |
| | | logger.debug("A2: " + A2); |
| | | |
| | | mdbytes = messageDigest.digest(A2.getBytes()); |
| | | String HA2 = toHexString(mdbytes); |
| | | System.out.println("HA1: " + HA1); |
| | | System.out.println("HA2: " + HA2); |
| | | logger.debug("HA1: " + HA1); |
| | | logger.debug("HA2: " + HA2); |
| | | String cnonce = authHeader.getCNonce(); |
| | | System.out.println("nonce: " + nonce); |
| | | System.out.println("nc: " + ncStr); |
| | | System.out.println("cnonce: " + cnonce); |
| | | System.out.println("qop: " + qop); |
| | | logger.debug("nonce: " + nonce); |
| | | logger.debug("nc: " + ncStr); |
| | | logger.debug("cnonce: " + cnonce); |
| | | logger.debug("qop: " + qop); |
| | | String KD = HA1 + ":" + nonce; |
| | | |
| | | if (qop != null && qop.equals("auth") ) { |
| | |
| | | KD += ":" + qop; |
| | | } |
| | | KD += ":" + HA2; |
| | | System.out.println("KD: " + KD); |
| | | logger.debug("KD: " + KD); |
| | | mdbytes = messageDigest.digest(KD.getBytes()); |
| | | String mdString = toHexString(mdbytes); |
| | | System.out.println("mdString: " + mdString); |
| | | logger.debug("mdString: " + mdString); |
| | | String response = authHeader.getResponse(); |
| | | System.out.println("response: " + response); |
| | | logger.debug("response: " + response); |
| | | return mdString.equals(response); |
| | | |
| | | } |
| | |
| | | package com.genersoft.iot.vmp.gb28181.event.offline; |
| | | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.connection.Message; |
| | | import org.springframework.data.redis.listener.KeyExpirationEventMessageListener; |
| | |
| | | */ |
| | | @Component |
| | | public class KeepaliveTimeoutListenerForPlatform extends KeyExpirationEventMessageListener { |
| | | |
| | | private Logger logger = LoggerFactory.getLogger(KeepaliveTimeoutListenerForPlatform.class); |
| | | |
| | | @Autowired |
| | | private EventPublisher publisher; |
| | |
| | | public void onMessage(Message message, byte[] pattern) { |
| | | // 获取失效的key |
| | | String expiredKey = message.toString(); |
| | | System.out.println(expiredKey); |
| | | logger.info(expiredKey); |
| | | if(!expiredKey.startsWith(VideoManagerConstants.PLATFORM_PREFIX)){ |
| | | System.out.println("收到redis过期监听,但开头不是"+VideoManagerConstants.PLATFORM_PREFIX+",忽略"); |
| | | logger.info("收到redis过期监听,但开头不是"+VideoManagerConstants.PLATFORM_PREFIX+",忽略"); |
| | | return; |
| | | } |
| | | // 平台心跳到期,需要重发, 判断是否已经多次未收到心跳回复, 多次未收到,则重新发起注册, 注册尝试多次未得到回复,则认为平台离线 |
| | |
| | | |
| | | publisher.platformKeepaliveExpireEventPublish(platformGBId); |
| | | }else if (expiredKey.startsWith(VideoManagerConstants.PLATFORM_REGISTER_PREFIX)) { |
| | | System.out.println("11111111111111"); |
| | | logger.info("11111111111111"); |
| | | String platformGBId = expiredKey.substring(VideoManagerConstants.PLATFORM_REGISTER_PREFIX.length(),expiredKey.length()); |
| | | |
| | | publisher.platformNotRegisterEventPublish(platformGBId); |
| | |
| | | package com.genersoft.iot.vmp.gb28181.event.offline;
|
| | |
|
| | | import org.slf4j.Logger;
|
| | | import org.slf4j.LoggerFactory;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.data.redis.connection.Message;
|
| | | import org.springframework.data.redis.listener.KeyExpirationEventMessageListener;
|
| | |
| | | */
|
| | | @Component
|
| | | public class KeepliveTimeoutListener extends KeyExpirationEventMessageListener {
|
| | |
|
| | | private Logger logger = LoggerFactory.getLogger(KeepliveTimeoutListener.class);
|
| | |
|
| | | @Autowired
|
| | | private EventPublisher publisher;
|
| | |
| | | // 获取失效的key
|
| | | String expiredKey = message.toString();
|
| | | if(!expiredKey.startsWith(VideoManagerConstants.KEEPLIVEKEY_PREFIX)){
|
| | | System.out.println("收到redis过期监听,但开头不是"+VideoManagerConstants.KEEPLIVEKEY_PREFIX+",忽略");
|
| | | logger.info("收到redis过期监听,但开头不是"+VideoManagerConstants.KEEPLIVEKEY_PREFIX+",忽略");
|
| | | return;
|
| | | }
|
| | |
|
| | |
| | | public boolean frontEndCmd(Device device, String channelId, int cmdCode, int parameter1, int parameter2, int combineCode2) {
|
| | | try {
|
| | | String cmdStr= frontEndCmdString(cmdCode, parameter1, parameter2, combineCode2);
|
| | | System.out.println("控制字符串:" + cmdStr);
|
| | | logger.info("控制字符串:" + cmdStr);
|
| | | StringBuffer ptzXml = new StringBuffer(200);
|
| | | ptzXml.append("<?xml version=\"1.0\" ?>\r\n");
|
| | | ptzXml.append("<Control>\r\n");
|
| | |
| | | import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcessor;
|
| | | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory;
|
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
| | | import org.slf4j.Logger;
|
| | | import org.slf4j.LoggerFactory;
|
| | |
|
| | | /**
|
| | | * @Description:ACK请求处理器
|
| | |
| | | * @date: 2020年5月3日 下午5:31:45
|
| | | */
|
| | | public class AckRequestProcessor extends SIPRequestAbstractProcessor {
|
| | |
|
| | |
|
| | | private Logger logger = LoggerFactory.getLogger(AckRequestProcessor.class);
|
| | |
|
| | | private IRedisCatchStorage redisCatchStorage;
|
| | |
|
| | |
| | | }
|
| | |
|
| | | redisCatchStorage.updateSendRTPSever(sendRtpItem);
|
| | | System.out.println(platformGbId);
|
| | | System.out.println(channelId);
|
| | | logger.info(platformGbId);
|
| | | logger.info(channelId);
|
| | | Map<String, Object> param = new HashMap<>();
|
| | | param.put("vhost","__defaultVhost__");
|
| | | param.put("app",streamInfo.getApp());
|
| | |
| | | if (System.currentTimeMillis() - startTime < 30 * 1000) {
|
| | | if (zlmrtpServerFactory.isStreamReady(streamInfo.getApp(), streamInfo.getStreamId())) {
|
| | | rtpPushed = true;
|
| | | System.out.println("已获取设备推流,开始向上级推流");
|
| | | logger.info("已获取设备推流,开始向上级推流");
|
| | | zlmrtpServerFactory.startSendRtpStream(param);
|
| | | } else {
|
| | | System.out.println("等待设备推流.......");
|
| | | logger.info("等待设备推流.......");
|
| | | Thread.sleep(1000);
|
| | | continue;
|
| | | }
|
| | | } else {
|
| | | rtpPushed = true;
|
| | | System.out.println("设备推流超时,终止向上级推流");
|
| | | logger.info("设备推流超时,终止向上级推流");
|
| | | }
|
| | | } catch (InterruptedException e) {
|
| | | e.printStackTrace();
|
| | |
| | | // CSeq csReq = (CSeq) request.getHeader(CSeq.NAME);
|
| | | // ackRequest = dialog.createAck(csReq.getSeqNumber());
|
| | | // dialog.sendAck(ackRequest);
|
| | | // System.out.println("send ack to callee:" + ackRequest.toString());
|
| | | // logger.info("send ack to callee:" + ackRequest.toString());
|
| | | // } catch (SipException e) {
|
| | | // e.printStackTrace();
|
| | | // } catch (InvalidArgumentException e) {
|
| | |
| | | import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcessor;
|
| | | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory;
|
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
| | | import org.slf4j.Logger;
|
| | | import org.slf4j.LoggerFactory;
|
| | |
|
| | | import java.text.ParseException;
|
| | | import java.util.HashMap;
|
| | |
| | | * @date: 2021年3月9日
|
| | | */
|
| | | public class ByeRequestProcessor extends SIPRequestAbstractProcessor {
|
| | |
|
| | | private Logger logger = LoggerFactory.getLogger(ByeRequestProcessor.class);
|
| | |
|
| | | private ISIPCommander cmder;
|
| | |
|
| | |
| | | param.put("vhost","__defaultVhost__");
|
| | | param.put("app",sendRtpItem.getApp());
|
| | | param.put("stream",streamId);
|
| | | System.out.println("停止向上级推流:" + streamId);
|
| | | logger.info("停止向上级推流:" + streamId);
|
| | | zlmrtpServerFactory.stopSendRtpStream(param);
|
| | | redisCatchStorage.deleteSendRTPServer(platformGbId, channelId);
|
| | | if (zlmrtpServerFactory.totalReaderCount(sendRtpItem.getApp(), streamId) == 0) {
|
| | | System.out.println(streamId + "无其它观看者,通知设备停止推流");
|
| | | logger.info(streamId + "无其它观看者,通知设备停止推流");
|
| | | cmder.streamByeCmd(sendRtpItem.getDeviceId(), channelId);
|
| | | }
|
| | | }
|
| | |
| | | String cmd = XmlUtil.getText(rootElement, "CmdType");
|
| | |
|
| | | if (MESSAGE_KEEP_ALIVE.equals(cmd)) {
|
| | | logger.info("接收到KeepAlive消息");
|
| | | logger.debug("接收到KeepAlive消息");
|
| | | processMessageKeepAlive(evt);
|
| | | } else if (MESSAGE_CONFIG_DOWNLOAD.equals(cmd)) {
|
| | | logger.info("接收到ConfigDownload消息");
|
| | | logger.debug("接收到ConfigDownload消息");
|
| | | processMessageConfigDownload(evt);
|
| | | } else if (MESSAGE_CATALOG.equals(cmd)) {
|
| | | logger.info("接收到Catalog消息");
|
| | | logger.debug("接收到Catalog消息");
|
| | | processMessageCatalogList(evt);
|
| | | } else if (MESSAGE_DEVICE_INFO.equals(cmd)) {
|
| | | // DeviceInfo消息处理
|
| | |
| | | // DeviceStatus消息处理
|
| | | processMessageDeviceStatus(evt);
|
| | | } else if (MESSAGE_DEVICE_CONTROL.equals(cmd)) {
|
| | | logger.info("接收到DeviceControl消息");
|
| | | logger.debug("接收到DeviceControl消息");
|
| | | processMessageDeviceControl(evt);
|
| | | } else if (MESSAGE_DEVICE_CONFIG.equals(cmd)) {
|
| | | logger.info("接收到DeviceConfig消息");
|
| | | processMessageDeviceConfig(evt);
|
| | | } else if (MESSAGE_ALARM.equals(cmd)) {
|
| | | logger.info("接收到Alarm消息");
|
| | | logger.debug("接收到Alarm消息");
|
| | | processMessageAlarm(evt);
|
| | | } else if (MESSAGE_RECORD_INFO.equals(cmd)) {
|
| | | logger.info("接收到RecordInfo消息");
|
| | | logger.debug("接收到RecordInfo消息");
|
| | | processMessageRecordInfo(evt);
|
| | | }else if (MESSAGE_MEDIA_STATUS.equals(cmd)) {
|
| | | logger.info("接收到MediaStatus消息");
|
| | | logger.debug("接收到MediaStatus消息");
|
| | | processMessageMediaStatus(evt);
|
| | | } else if (MESSAGE_MOBILE_POSITION.equals(cmd)) {
|
| | | logger.info("接收到MobilePosition消息");
|
| | | logger.debug("接收到MobilePosition消息");
|
| | | processMessageMobilePosition(evt);
|
| | | } else if (MESSAGE_PRESET_QUERY.equals(cmd)) {
|
| | | logger.info("接收到PresetQuery消息");
|
| | | logger.debug("接收到PresetQuery消息");
|
| | | processMessagePresetQuery(evt);
|
| | | } else if (MESSAGE_BROADCAST.equals(cmd)) {
|
| | | // Broadcast消息处理
|
| | | processMessageBroadcast(evt);
|
| | | } else {
|
| | | logger.info("接收到消息:" + cmd);
|
| | | logger.debug("接收到消息:" + cmd);
|
| | | responseAck(evt);
|
| | | }
|
| | | } catch (DocumentException | SipException |InvalidArgumentException | ParseException e) {
|
| | |
| | | cmderFroPlatform.deviceInfoResponse(parentPlatform, sn, fromHeader.getTag());
|
| | | }
|
| | | } else {
|
| | | logger.info("接收到DeviceInfo应答消息");
|
| | | logger.debug("接收到DeviceInfo应答消息");
|
| | | Device device = storager.queryVideoDevice(deviceId);
|
| | | if (device == null) {
|
| | | return;
|
| | |
| | | import javax.sip.RequestEvent;
|
| | |
|
| | | import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcessor;
|
| | | import org.slf4j.Logger;
|
| | | import org.slf4j.LoggerFactory;
|
| | |
|
| | | /**
|
| | | * @Description:暂不支持的消息请求处理器
|
| | |
| | | * @date: 2020年5月3日 下午5:32:59
|
| | | */
|
| | | public class OtherRequestProcessor extends SIPRequestAbstractProcessor {
|
| | |
|
| | | private Logger logger = LoggerFactory.getLogger(OtherRequestProcessor.class);
|
| | |
|
| | | /**
|
| | | * <p>Title: process</p>
|
| | |
| | | */
|
| | | @Override
|
| | | public void process(RequestEvent evt) {
|
| | | System.out.println("Unsupported the method: " + evt.getRequest().getMethod());
|
| | | logger.info("Unsupported the method: " + evt.getRequest().getMethod());
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import javax.sip.message.Response;
|
| | |
|
| | | import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcessor;
|
| | | import org.slf4j.Logger;
|
| | | import org.slf4j.LoggerFactory;
|
| | |
|
| | | /**
|
| | | * @Description:SUBSCRIBE请求处理器
|
| | |
| | | * @date: 2020年5月3日 下午5:31:20
|
| | | */
|
| | | public class SubscribeRequestProcessor extends SIPRequestAbstractProcessor {
|
| | |
|
| | | private Logger logger = LoggerFactory.getLogger(SubscribeRequestProcessor.class);
|
| | |
|
| | | /**
|
| | | * 处理SUBSCRIBE请求
|
| | |
| | | ExpiresHeader expireHeader = getHeaderFactory().createExpiresHeader(30);
|
| | | response.setExpires(expireHeader);
|
| | | }
|
| | | System.out.println("response : " + response.toString());
|
| | | logger.info("response : " + response.toString());
|
| | | ServerTransaction transaction = getServerTransaction(evt);
|
| | | if (transaction != null) {
|
| | | transaction.sendResponse(response);
|
| | | transaction.terminate();
|
| | | } else {
|
| | | System.out.println("processRequest serverTransactionId is null.");
|
| | | logger.info("processRequest serverTransactionId is null.");
|
| | | }
|
| | |
|
| | | } catch (ParseException e) {
|
| | |
| | | import javax.sip.message.Response;
|
| | |
|
| | | import gov.nist.javax.sip.ResponseEventExt;
|
| | | import org.slf4j.Logger;
|
| | | import org.slf4j.LoggerFactory;
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.genersoft.iot.vmp.conf.SipConfig;
|
| | |
| | | @Component
|
| | | public class InviteResponseProcessor implements ISIPResponseProcessor {
|
| | |
|
| | | // private final static Logger logger = LoggerFactory.getLogger(InviteResponseProcessor.class);
|
| | | private final static Logger logger = LoggerFactory.getLogger(InviteResponseProcessor.class);
|
| | |
|
| | | /**
|
| | | * 处理invite响应
|
| | |
| | | requestURI.setHost(event.getRemoteIpAddress());
|
| | | requestURI.setPort(event.getRemotePort());
|
| | | reqAck.setRequestURI(requestURI);
|
| | | System.out.println("向 " + event.getRemoteIpAddress() + ":" + event.getRemotePort() + "回复ack");
|
| | | logger.info("向 " + event.getRemoteIpAddress() + ":" + event.getRemotePort() + "回复ack");
|
| | | dialog.sendAck(reqAck);
|
| | | }
|
| | | } catch (InvalidArgumentException | SipException e) {
|
| | |
| | | package com.genersoft.iot.vmp.gb28181.utils; |
| | | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | /** |
| | | * 数值格式判断和处理 |
| | | * @author lawrencehj |
| | | * @date 2021年1月27日 |
| | | */ |
| | | public class NumericUtil { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(NumericUtil.class); |
| | | |
| | | /** |
| | | * 判断是否Double格式 |
| | |
| | | public static boolean isDouble(String str) { |
| | | try { |
| | | Double num2 = Double.valueOf(str); |
| | | System.out.println(num2 + " is a valid numeric string!"); |
| | | logger.debug(num2 + " is a valid numeric string!"); |
| | | return true; |
| | | } catch (Exception e) { |
| | | System.out.println(str + " is an invalid numeric string!"); |
| | | logger.debug(str + " is an invalid numeric string!"); |
| | | return false; |
| | | } |
| | | } |
| | |
| | | public static boolean isInteger(String str) { |
| | | try { |
| | | int num2 = Integer.valueOf(str); |
| | | System.out.println(num2 + " is an integer!"); |
| | | logger.debug(num2 + " is an integer!"); |
| | | return true; |
| | | } catch (Exception e) { |
| | | System.out.println(str + " is not an integer!"); |
| | | logger.debug(str + " is not an integer!"); |
| | | return false; |
| | | } |
| | | } |
| | |
| | | JSONArray tracks = json.getJSONArray("tracks");
|
| | | boolean regist = json.getBoolean("regist");
|
| | | if (tracks != null) {
|
| | | System.out.println("on_stream_changed->>" + schema);
|
| | | logger.info("[stream: " + streamId + "]on_stream_changed->>" + schema);
|
| | | }
|
| | | if ("rtmp".equals(schema)){
|
| | | if ("rtp".equals(app) && !regist ) {
|
| | |
| | | jsonObject.put("app", streamPushItem.getApp()); |
| | | jsonObject.put("stream", streamPushItem.getStream()); |
| | | subscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_play,jsonObject,(response)->{ |
| | | System.out.println(1222211111); |
| | | updateMedia(response.getString("app"), response.getString("stream")); |
| | | }); |
| | | } |
| | |
| | | } |
| | | |
| | | public JSONObject addFFmpegSource(String src_url, String dst_url, String timeout_ms){ |
| | | System.out.println(src_url); |
| | | System.out.println(dst_url); |
| | | logger.info(src_url); |
| | | logger.info(dst_url); |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("src_url", src_url); |
| | | param.put("dst_url", dst_url); |
| | |
| | | public Boolean startSendRtpStream(Map<String, Object>param) { |
| | | Boolean result = false; |
| | | JSONObject jsonObject = zlmresTfulUtils.startSendRtp(param); |
| | | System.out.println(jsonObject); |
| | | logger.info(jsonObject.toJSONString()); |
| | | if (jsonObject == null) { |
| | | logger.error("RTP推流失败: 请检查ZLM服务"); |
| | | } else if (jsonObject.getInteger("code") == 0) { |
| | |
| | | public Boolean stopSendRtpStream(Map<String, Object>param) { |
| | | Boolean result = false; |
| | | JSONObject jsonObject = zlmresTfulUtils.stopSendRtp(param); |
| | | System.out.println(jsonObject); |
| | | logger.info(jsonObject.toJSONString()); |
| | | if (jsonObject == null) { |
| | | logger.error("停止RTP推流失败: 请检查ZLM服务"); |
| | | } else if (jsonObject.getInteger("code") == 0) { |
| | |
| | | * zlm 连接成功或者zlm重启后 |
| | | */ |
| | | private void zLmRunning(MediaServerConfig mediaServerConfig){ |
| | | logger.info("zlm接入成功..."); |
| | | logger.info( "[ id: " + mediaServerConfig.getGeneralMediaServerId() + "] zlm接入成功..."); |
| | | if (autoConfig) saveZLMConfig(); |
| | | MediaServerConfig mediaInfo = redisCatchStorage.getMediaInfo(); |
| | | if (mediaInfo != null && System.currentTimeMillis() - mediaInfo.getUpdateTime() < 50){ |
| | | logger.info("zlm刚刚更新,忽略这次更新"); |
| | | logger.info("[ id: " + mediaServerConfig.getGeneralMediaServerId() + "]zlm刚刚更新,忽略这次更新"); |
| | | return; |
| | | } |
| | | mediaServerConfig.setLocalIP(mediaIp); |
| | |
| | | public void onDevicesFound(List<Device> devices) { |
| | | if (devices == null || devices.size() == 0) return; |
| | | for (Device device : devices){ |
| | | System.out.println(device.getHostName()); |
| | | logger.info(device.getHostName()); |
| | | deviceMap.put(device.getHostName(), device); |
| | | } |
| | | } |
| | |
| | | public void onDiscoveryFinished() { |
| | | ArrayList<String> result = new ArrayList<>(); |
| | | for (Device device : deviceMap.values()) { |
| | | System.out.println(device.getHostName()); |
| | | logger.info(device.getHostName()); |
| | | result.add(device.getHostName()); |
| | | } |
| | | callBack.run(0, result); |
| | |
| | | |
| | | @Override |
| | | public void onResponse(OnvifDevice onvifDevice, OnvifResponse response) { |
| | | System.out.println("[RESPONSE] " + onvifDevice.getHostName() |
| | | logger.info("[RESPONSE] " + onvifDevice.getHostName() |
| | | + "======" + response.getErrorCode() |
| | | + "======" + response.getErrorMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onError(OnvifDevice onvifDevice, int errorCode, String errorMessage) { |
| | | System.out.println("[ERROR] " + onvifDevice.getHostName() + "======" + errorCode + "=======" + errorMessage); |
| | | logger.info("[ERROR] " + onvifDevice.getHostName() + "======" + errorCode + "=======" + errorMessage); |
| | | callBack.run(errorCode, errorMessage); |
| | | } |
| | | }); |
| | |
| | | @Override |
| | | public void onMediaProfilesReceived(OnvifDevice device, List<OnvifMediaProfile> mediaProfiles) { |
| | | for (OnvifMediaProfile mediaProfile : mediaProfiles) { |
| | | System.out.println(mediaProfile.getName()); |
| | | System.out.println(mediaProfile.getToken()); |
| | | logger.info(mediaProfile.getName()); |
| | | logger.info(mediaProfile.getToken()); |
| | | if (mediaProfile.getName().equals("mainStream")) { |
| | | onvifManager.getMediaStreamURI(device, mediaProfile, (OnvifDevice onvifDevice, |
| | | OnvifMediaProfile profile, String uri) -> { |
| | |
| | | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.jdbc.datasource.DataSourceTransactionManager; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | @SuppressWarnings("rawtypes") |
| | | @Component |
| | | public class VideoManagerStoragerImpl implements IVideoManagerStorager { |
| | | |
| | | private Logger logger = LoggerFactory.getLogger(VideoManagerStoragerImpl.class); |
| | | |
| | | @Autowired |
| | | DataSourceTransactionManager dataSourceTransactionManager; |
| | | |
| | |
| | | return false; |
| | | } |
| | | device.setOnline(1); |
| | | System.out.println("更新设备在线"); |
| | | logger.info("更新设备在线: " + deviceId); |
| | | return deviceMapper.update(device) > 0; |
| | | } |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public synchronized boolean outline(String deviceId) { |
| | | System.out.println("更新设备离线: " + deviceId); |
| | | logger.info("更新设备离线: " + deviceId); |
| | | Device device = deviceMapper.getDeviceByDeviceId(deviceId); |
| | | if (device == null) return false; |
| | | device.setOnline(0); |
| | |
| | | @Override |
| | | public void updateMediaList(List<StreamPushItem> streamPushItems) { |
| | | if (streamPushItems == null || streamPushItems.size() == 0) return; |
| | | System.out.printf("updateMediaList: " + streamPushItems.size()); |
| | | logger.info("updateMediaList: " + streamPushItems.size()); |
| | | streamPushMapper.addAll(streamPushItems); |
| | | // TODO 待优化 |
| | | for (int i = 0; i < streamPushItems.size(); i++) { |
| | |
| | | import java.util.Base64; |
| | | |
| | | import com.genersoft.iot.vmp.gb28181.bean.BaiduPoint; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | public class GpsUtil { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(GpsUtil.class); |
| | | |
| | | public static BaiduPoint Wgs84ToBd09(String xx, String yy) { |
| | | |
| | | |
| | | try { |
| | | Socket s = new Socket("api.map.baidu.com", 80); |
| | | BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream(), "UTF-8")); |
| | |
| | | String json = ""; |
| | | String tmp = ""; |
| | | while ((tmp = br.readLine()) != null) { |
| | | // System.out.println(tmp); |
| | | // logger.info(tmp); |
| | | json += tmp; |
| | | } |
| | | |
| | |
| | | return bdPoint; |
| | | //return (new String(decode(x)) + "," + new String(decode(y))); |
| | | } else { |
| | | System.out.println("gps坐标无效!!"); |
| | | logger.info("gps坐标无效!!"); |
| | | } |
| | | out.close(); |
| | | br.close(); |
| | |
| | | streamId ); |
| | | String srcUrl = String.format("rtsp://%s:%s/rtp/%s", "127.0.0.1", mediaInfo.getRtspPort(), streamId); |
| | | JSONObject jsonObject = zlmresTfulUtils.addFFmpegSource(srcUrl, dstUrl, "1000000"); |
| | | System.out.println(jsonObject); |
| | | logger.info(jsonObject.toJSONString()); |
| | | JSONObject result = new JSONObject(); |
| | | if (jsonObject != null && jsonObject.getInteger("code") == 0) { |
| | | result.put("code", 0); |
| | |
| | | public ResponseEntity<String> playConvertStop(@PathVariable String key) { |
| | | |
| | | JSONObject jsonObject = zlmresTfulUtils.delFFmpegSource(key); |
| | | System.out.println(jsonObject); |
| | | logger.info(jsonObject.toJSONString()); |
| | | JSONObject result = new JSONObject(); |
| | | if (jsonObject != null && jsonObject.getInteger("code") == 0) { |
| | | result.put("code", 0); |