Commit f6c48588daba63846a9e70ef10fe7af2fceab035

Authored by 648540858
1 parent 18898e98

支持支持主码流子码流切换

README.md
@@ -49,6 +49,7 @@ https://gitee.com/pan648540858/wvp-GB28181-pro.git @@ -49,6 +49,7 @@ https://gitee.com/pan648540858/wvp-GB28181-pro.git
49 - [X] 支持电子地图,支持接入WGS84和GCJ02两种坐标系,并且自动转化为合适的坐标系进行展示和分发 49 - [X] 支持电子地图,支持接入WGS84和GCJ02两种坐标系,并且自动转化为合适的坐标系进行展示和分发
50 - [X] 接入设备 50 - [X] 接入设备
51 - [X] 视频预览 51 - [X] 视频预览
  52 + - [X] 支持主码流子码流切换
52 - [X] 无限制接入路数,能接入多少设备只取决于你的服务器性能 53 - [X] 无限制接入路数,能接入多少设备只取决于你的服务器性能
53 - [X] 云台控制,控制设备转向,拉近,拉远 54 - [X] 云台控制,控制设备转向,拉近,拉远
54 - [X] 预置位查询,使用与设置 55 - [X] 预置位查询,使用与设置
src/main/java/com/genersoft/iot/vmp/common/InviteInfo.java
1 package com.genersoft.iot.vmp.common; 1 package com.genersoft.iot.vmp.common;
2 2
3 import com.genersoft.iot.vmp.service.bean.SSRCInfo; 3 import com.genersoft.iot.vmp.service.bean.SSRCInfo;
4 -import io.swagger.v3.oas.annotations.media.Schema;  
5 4
6 /** 5 /**
7 * 记录每次发送invite消息的状态 6 * 记录每次发送invite消息的状态
@@ -125,20 +124,4 @@ public class InviteInfo { @@ -125,20 +124,4 @@ public class InviteInfo {
125 this.streamMode = streamMode; 124 this.streamMode = streamMode;
126 } 125 }
127 126
128 -  
129 - /*=========================设备主子码流逻辑START====================*/  
130 - @Schema(description = "是否为子码流(true-是,false-主码流)")  
131 - private boolean subStream;  
132 -  
133 - public boolean isSubStream() {  
134 - return subStream;  
135 - }  
136 -  
137 - public void setSubStream(boolean subStream) {  
138 - this.subStream = subStream;  
139 - }  
140 -  
141 -  
142 -  
143 -  
144 } 127 }
src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java
@@ -453,19 +453,4 @@ public class Device { @@ -453,19 +453,4 @@ public class Device {
453 this.sipTransactionInfo = sipTransactionInfo; 453 this.sipTransactionInfo = sipTransactionInfo;
454 } 454 }
455 455
456 - /*======================设备主子码流逻辑START=========================*/  
457 - @Schema(description = "开启主子码流切换的开关(false-不开启,true-开启)")  
458 - private boolean switchPrimarySubStream;  
459 -  
460 - public boolean isSwitchPrimarySubStream() {  
461 - return switchPrimarySubStream;  
462 - }  
463 -  
464 - public void setSwitchPrimarySubStream(boolean switchPrimarySubStream) {  
465 - this.switchPrimarySubStream = switchPrimarySubStream;  
466 - }  
467 -  
468 - /*======================设备主子码流逻辑END=========================*/  
469 -  
470 -  
471 } 456 }
src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java
@@ -246,6 +246,10 @@ public class DeviceChannel { @@ -246,6 +246,10 @@ public class DeviceChannel {
246 @Schema(description = "GPS的更新时间") 246 @Schema(description = "GPS的更新时间")
247 private String gpsTime; 247 private String gpsTime;
248 248
  249 + @Schema(description = "码流标识,优先级高于设备中码流标识," +
  250 + "用于选择码流时组成码流标识。默认为null,不设置。可选值: stream/streamnumber/streamprofile/streamMode")
  251 + private String streamIdentification;
  252 +
249 public int getId() { 253 public int getId() {
250 return id; 254 return id;
251 } 255 }
@@ -574,4 +578,12 @@ public class DeviceChannel { @@ -574,4 +578,12 @@ public class DeviceChannel {
574 public void setGpsTime(String gpsTime) { 578 public void setGpsTime(String gpsTime) {
575 this.gpsTime = gpsTime; 579 this.gpsTime = gpsTime;
576 } 580 }
  581 +
  582 + public String getStreamIdentification() {
  583 + return streamIdentification;
  584 + }
  585 +
  586 + public void setStreamIdentification(String streamIdentification) {
  587 + this.streamIdentification = streamIdentification;
  588 + }
577 } 589 }
src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbSteamIdentification.java 0 → 100644
  1 +package com.genersoft.iot.vmp.gb28181.bean;
  2 +
  3 +/**
  4 + * 码流索引标识
  5 + */
  6 +public enum GbSteamIdentification {
  7 + /**
  8 + * 主码流 stream:0
  9 + * 子码流 stream:1s
  10 + */
  11 + streamMain("stream", new String[]{"0","1"}),
  12 + /**
  13 + * 国标28181-2022定义的方式
  14 + * 主码流 streamnumber:0
  15 + * 子码流 streamnumber:1
  16 + */
  17 + streamnumber("streamnumber", new String[]{"0","1"}),
  18 + /**
  19 + * 主码流 streamprofile:0
  20 + * 子码流 streamprofile:1
  21 + */
  22 + streamprofile("streamprofile", new String[]{"0","1"}),
  23 + /**
  24 + * 适用的品牌: TP-LINK
  25 + */
  26 + streamMode("streamMode", new String[]{"main","sub"}),
  27 + ;
  28 +
  29 + GbSteamIdentification(String value, String[] indexArray) {
  30 + this.value = value;
  31 + this.indexArray = indexArray;
  32 + }
  33 +
  34 + private String value;
  35 + private String[] indexArray;
  36 +
  37 + public String getValue() {
  38 + return value;
  39 + }
  40 +
  41 + public String[] getIndexArray() {
  42 + return indexArray;
  43 + }
  44 +}
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java
@@ -4,6 +4,7 @@ import com.genersoft.iot.vmp.common.StreamInfo; @@ -4,6 +4,7 @@ import com.genersoft.iot.vmp.common.StreamInfo;
4 import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException; 4 import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException;
5 import com.genersoft.iot.vmp.gb28181.bean.Device; 5 import com.genersoft.iot.vmp.gb28181.bean.Device;
6 import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm; 6 import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm;
  7 +import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
7 import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; 8 import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
8 import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe; 9 import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
9 import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; 10 import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
@@ -96,9 +97,9 @@ public interface ISIPCommander { @@ -96,9 +97,9 @@ public interface ISIPCommander {
96 /** 97 /**
97 * 请求预览视频流 98 * 请求预览视频流
98 * @param device 视频设备 99 * @param device 视频设备
99 - * @param channelId 预览通道 100 + * @param channel 预览通道
100 */ 101 */
101 - void playStreamCmd(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, Device device, String channelId, ZlmHttpHookSubscribe.Event event, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException; 102 + void playStreamCmd(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, Device device, DeviceChannel channel, ZlmHttpHookSubscribe.Event event, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException;
102 103
103 /** 104 /**
104 * 请求回放视频流 105 * 请求回放视频流
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
@@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException; @@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException;
8 import com.genersoft.iot.vmp.gb28181.SipLayer; 8 import com.genersoft.iot.vmp.gb28181.SipLayer;
9 import com.genersoft.iot.vmp.gb28181.bean.Device; 9 import com.genersoft.iot.vmp.gb28181.bean.Device;
10 import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm; 10 import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm;
  11 +import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
11 import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction; 12 import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction;
12 import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; 13 import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
13 import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; 14 import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
@@ -264,12 +265,12 @@ public class SIPCommander implements ISIPCommander { @@ -264,12 +265,12 @@ public class SIPCommander implements ISIPCommander {
264 * 请求预览视频流 265 * 请求预览视频流
265 * 266 *
266 * @param device 视频设备 267 * @param device 视频设备
267 - * @param channelId 预览通道 268 + * @param channel 预览通道
268 * @param event hook订阅 269 * @param event hook订阅
269 * @param errorEvent sip错误订阅 270 * @param errorEvent sip错误订阅
270 */ 271 */
271 @Override 272 @Override
272 - public void playStreamCmd(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, Device device, String channelId, 273 + public void playStreamCmd(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, Device device, DeviceChannel channel,
273 ZlmHttpHookSubscribe.Event event, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException { 274 ZlmHttpHookSubscribe.Event event, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException {
274 String stream = ssrcInfo.getStream(); 275 String stream = ssrcInfo.getStream();
275 276
@@ -293,7 +294,7 @@ public class SIPCommander implements ISIPCommander { @@ -293,7 +294,7 @@ public class SIPCommander implements ISIPCommander {
293 } 294 }
294 StringBuffer content = new StringBuffer(200); 295 StringBuffer content = new StringBuffer(200);
295 content.append("v=0\r\n"); 296 content.append("v=0\r\n");
296 - content.append("o=" + channelId + " 0 0 IN IP4 " + sdpIp + "\r\n"); 297 + content.append("o=" + channel.getChannelId() + " 0 0 IN IP4 " + sdpIp + "\r\n");
297 content.append("s=Play\r\n"); 298 content.append("s=Play\r\n");
298 content.append("c=IN IP4 " + sdpIp + "\r\n"); 299 content.append("c=IN IP4 " + sdpIp + "\r\n");
299 content.append("t=0 0\r\n"); 300 content.append("t=0 0\r\n");
@@ -344,20 +345,8 @@ public class SIPCommander implements ISIPCommander { @@ -344,20 +345,8 @@ public class SIPCommander implements ISIPCommander {
344 } 345 }
345 } 346 }
346 347
347 - if( device.isSwitchPrimarySubStream() ){  
348 - if("TP-LINK".equals(device.getManufacturer())){  
349 - if (device.isSwitchPrimarySubStream()){  
350 - content.append("a=streamMode:sub\r\n");  
351 - }else {  
352 - content.append("a=streamMode:main\r\n");  
353 - }  
354 - }else {  
355 - if (device.isSwitchPrimarySubStream()){  
356 - content.append("a=streamprofile:1\r\n");  
357 - }else {  
358 - content.append("a=streamprofile:0\r\n");  
359 - }  
360 - } 348 + if (!ObjectUtils.isEmpty(channel.getStreamIdentification())) {
  349 + content.append("a=" + channel.getStreamIdentification() + "\r\n");
361 } 350 }
362 351
363 content.append("y=" + ssrcInfo.getSsrc() + "\r\n");//ssrc 352 content.append("y=" + ssrcInfo.getSsrc() + "\r\n");//ssrc
@@ -366,16 +355,16 @@ public class SIPCommander implements ISIPCommander { @@ -366,16 +355,16 @@ public class SIPCommander implements ISIPCommander {
366 355
367 356
368 357
369 - Request request = headerProvider.createInviteRequest(device, channelId, content.toString(), SipUtils.getNewViaTag(), SipUtils.getNewFromTag(), null, ssrcInfo.getSsrc(),sipSender.getNewCallIdHeader(sipLayer.getLocalIp(device.getLocalIp()),device.getTransport())); 358 + Request request = headerProvider.createInviteRequest(device, channel.getChannelId(), content.toString(), SipUtils.getNewViaTag(), SipUtils.getNewFromTag(), null, ssrcInfo.getSsrc(),sipSender.getNewCallIdHeader(sipLayer.getLocalIp(device.getLocalIp()),device.getTransport()));
370 sipSender.transmitRequest(sipLayer.getLocalIp(device.getLocalIp()), request, (e -> { 359 sipSender.transmitRequest(sipLayer.getLocalIp(device.getLocalIp()), request, (e -> {
371 - streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream()); 360 + streamSession.remove(device.getDeviceId(), channel.getChannelId(), ssrcInfo.getStream());
372 mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc()); 361 mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
373 errorEvent.response(e); 362 errorEvent.response(e);
374 }), e -> { 363 }), e -> {
375 ResponseEvent responseEvent = (ResponseEvent) e.event; 364 ResponseEvent responseEvent = (ResponseEvent) e.event;
376 SIPResponse response = (SIPResponse) responseEvent.getResponse(); 365 SIPResponse response = (SIPResponse) responseEvent.getResponse();
377 String callId = response.getCallIdHeader().getCallId(); 366 String callId = response.getCallIdHeader().getCallId();
378 - streamSession.put(device.getDeviceId(), channelId, callId, stream, ssrcInfo.getSsrc(), mediaServerItem.getId(), response, 367 + streamSession.put(device.getDeviceId(), channel.getChannelId(), callId, stream, ssrcInfo.getSsrc(), mediaServerItem.getId(), response,
379 InviteSessionType.PLAY); 368 InviteSessionType.PLAY);
380 okEvent.response(e); 369 okEvent.response(e);
381 }); 370 });
src/main/java/com/genersoft/iot/vmp/service/IDeviceChannelService.java
@@ -87,4 +87,9 @@ public interface IDeviceChannelService { @@ -87,4 +87,9 @@ public interface IDeviceChannelService {
87 * 直接批量添加 87 * 直接批量添加
88 */ 88 */
89 void batchAddChannel(List<DeviceChannel> deviceChannels); 89 void batchAddChannel(List<DeviceChannel> deviceChannels);
  90 +
  91 + /**
  92 + * 修改通道的码流类型
  93 + */
  94 + void updateChannelStreamIdentification(DeviceChannel channel);
90 } 95 }
src/main/java/com/genersoft/iot/vmp/service/IPlayService.java
@@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.service; @@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.service;
3 import com.genersoft.iot.vmp.common.StreamInfo; 3 import com.genersoft.iot.vmp.common.StreamInfo;
4 import com.genersoft.iot.vmp.conf.exception.ServiceException; 4 import com.genersoft.iot.vmp.conf.exception.ServiceException;
5 import com.genersoft.iot.vmp.gb28181.bean.Device; 5 import com.genersoft.iot.vmp.gb28181.bean.Device;
  6 +import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
6 import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; 7 import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
7 import com.genersoft.iot.vmp.service.bean.ErrorCallback; 8 import com.genersoft.iot.vmp.service.bean.ErrorCallback;
8 import com.genersoft.iot.vmp.service.bean.SSRCInfo; 9 import com.genersoft.iot.vmp.service.bean.SSRCInfo;
@@ -16,7 +17,7 @@ import java.text.ParseException; @@ -16,7 +17,7 @@ import java.text.ParseException;
16 */ 17 */
17 public interface IPlayService { 18 public interface IPlayService {
18 19
19 - void play(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, Device device, String channelId, 20 + void play(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, Device device, DeviceChannel channelId,
20 ErrorCallback<Object> callback); 21 ErrorCallback<Object> callback);
21 SSRCInfo play(MediaServerItem mediaServerItem, String deviceId, String channelId, String ssrc, ErrorCallback<Object> callback); 22 SSRCInfo play(MediaServerItem mediaServerItem, String deviceId, String channelId, String ssrc, ErrorCallback<Object> callback);
22 23
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java
@@ -18,6 +18,7 @@ import org.slf4j.Logger; @@ -18,6 +18,7 @@ import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory; 18 import org.slf4j.LoggerFactory;
19 import org.springframework.beans.factory.annotation.Autowired; 19 import org.springframework.beans.factory.annotation.Autowired;
20 import org.springframework.stereotype.Service; 20 import org.springframework.stereotype.Service;
  21 +import org.springframework.util.ObjectUtils;
21 22
22 import java.util.ArrayList; 23 import java.util.ArrayList;
23 import java.util.HashMap; 24 import java.util.HashMap;
@@ -267,5 +268,16 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService { @@ -267,5 +268,16 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
267 } 268 }
268 } 269 }
269 270
270 - 271 + @Override
  272 + public void updateChannelStreamIdentification(DeviceChannel channel) {
  273 + assert !ObjectUtils.isEmpty(channel.getDeviceId());
  274 + assert !ObjectUtils.isEmpty(channel.getStreamIdentification());
  275 + if (ObjectUtils.isEmpty(channel.getStreamIdentification())) {
  276 + logger.info("[重置通道码流类型] 设备: {}, 码流: {}", channel.getDeviceId(), channel.getStreamIdentification());
  277 + }else {
  278 + logger.info("[更新通道码流类型] 设备: {}, 通道:{}, 码流: {}", channel.getDeviceId(), channel.getChannelId(),
  279 + channel.getStreamIdentification());
  280 + }
  281 + channelMapper.updateChannelStreamIdentification(channel);
  282 + }
271 } 283 }
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
@@ -5,7 +5,6 @@ import com.genersoft.iot.vmp.common.CommonCallback; @@ -5,7 +5,6 @@ import com.genersoft.iot.vmp.common.CommonCallback;
5 import com.genersoft.iot.vmp.common.VideoManagerConstants; 5 import com.genersoft.iot.vmp.common.VideoManagerConstants;
6 import com.genersoft.iot.vmp.conf.DynamicTask; 6 import com.genersoft.iot.vmp.conf.DynamicTask;
7 import com.genersoft.iot.vmp.conf.UserSetting; 7 import com.genersoft.iot.vmp.conf.UserSetting;
8 -import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException;  
9 import com.genersoft.iot.vmp.gb28181.bean.*; 8 import com.genersoft.iot.vmp.gb28181.bean.*;
10 import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; 9 import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
11 import com.genersoft.iot.vmp.gb28181.task.ISubscribeTask; 10 import com.genersoft.iot.vmp.gb28181.task.ISubscribeTask;
@@ -139,10 +138,6 @@ public class DeviceServiceImpl implements IDeviceService { @@ -139,10 +138,6 @@ public class DeviceServiceImpl implements IDeviceService {
139 } 138 }
140 sync(device); 139 sync(device);
141 }else { 140 }else {
142 -  
143 - if (deviceInDb != null) {  
144 - device.setSwitchPrimarySubStream(deviceInDb.isSwitchPrimarySubStream());  
145 - }  
146 if(!device.isOnLine()){ 141 if(!device.isOnLine()){
147 device.setOnLine(true); 142 device.setOnLine(true);
148 device.setCreateTime(now); 143 device.setCreateTime(now);
@@ -486,21 +481,6 @@ public class DeviceServiceImpl implements IDeviceService { @@ -486,21 +481,6 @@ public class DeviceServiceImpl implements IDeviceService {
486 logger.warn("更新设备时未找到设备信息"); 481 logger.warn("更新设备时未找到设备信息");
487 return; 482 return;
488 } 483 }
489 - if(deviceInStore.isSwitchPrimarySubStream() != device.isSwitchPrimarySubStream()){  
490 - //当修改设备的主子码流开关时,需要校验是否存在流,如果存在流则直接关闭  
491 - List<SsrcTransaction> ssrcTransactionForAll = streamSession.getSsrcTransactionForAll(device.getDeviceId(), null, null, null);  
492 - if(ssrcTransactionForAll != null){  
493 - for (SsrcTransaction ssrcTransaction: ssrcTransactionForAll) {  
494 - try {  
495 - cmder.streamByeCmd(device, ssrcTransaction.getChannelId(), ssrcTransaction.getStream(), null, null);  
496 - } catch (InvalidArgumentException | SsrcTransactionNotFoundException | ParseException | SipException e) {  
497 - throw new RuntimeException(e);  
498 - }  
499 - }  
500 - }  
501 - deviceChannelMapper.clearPlay(device.getDeviceId());  
502 - inviteStreamService.clearInviteInfo(device.getDeviceId());  
503 - }  
504 484
505 if (!ObjectUtils.isEmpty(device.getName())) { 485 if (!ObjectUtils.isEmpty(device.getName())) {
506 deviceInStore.setName(device.getName()); 486 deviceInStore.setName(device.getName());
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
@@ -15,21 +15,26 @@ import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException; @@ -15,21 +15,26 @@ import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException;
15 import com.genersoft.iot.vmp.gb28181.bean.*; 15 import com.genersoft.iot.vmp.gb28181.bean.*;
16 import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; 16 import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
17 import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; 17 import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
18 -import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; 18 +import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander;
19 import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; 19 import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform;
20 import com.genersoft.iot.vmp.gb28181.utils.SipUtils; 20 import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
21 import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; 21 import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
22 import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory; 22 import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
23 import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe; 23 import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
24 -import com.genersoft.iot.vmp.media.zlm.dto.*; 24 +import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory;
  25 +import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForRecordMp4;
  26 +import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange;
  27 +import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
25 import com.genersoft.iot.vmp.media.zlm.dto.hook.HookParam; 28 import com.genersoft.iot.vmp.media.zlm.dto.hook.HookParam;
26 import com.genersoft.iot.vmp.media.zlm.dto.hook.OnRecordMp4HookParam; 29 import com.genersoft.iot.vmp.media.zlm.dto.hook.OnRecordMp4HookParam;
27 import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam; 30 import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
28 import com.genersoft.iot.vmp.service.*; 31 import com.genersoft.iot.vmp.service.*;
29 -import com.genersoft.iot.vmp.service.bean.*; 32 +import com.genersoft.iot.vmp.service.bean.DownloadFileInfo;
  33 +import com.genersoft.iot.vmp.service.bean.ErrorCallback;
  34 +import com.genersoft.iot.vmp.service.bean.InviteErrorCode;
  35 +import com.genersoft.iot.vmp.service.bean.SSRCInfo;
30 import com.genersoft.iot.vmp.storager.IRedisCatchStorage; 36 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
31 import com.genersoft.iot.vmp.storager.IVideoManagerStorage; 37 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
32 -import com.genersoft.iot.vmp.storager.dao.CloudRecordServiceMapper;  
33 import com.genersoft.iot.vmp.utils.CloudRecordUtils; 38 import com.genersoft.iot.vmp.utils.CloudRecordUtils;
34 import com.genersoft.iot.vmp.utils.DateUtil; 39 import com.genersoft.iot.vmp.utils.DateUtil;
35 import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; 40 import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
@@ -63,7 +68,7 @@ public class PlayServiceImpl implements IPlayService { @@ -63,7 +68,7 @@ public class PlayServiceImpl implements IPlayService {
63 private IVideoManagerStorage storager; 68 private IVideoManagerStorage storager;
64 69
65 @Autowired 70 @Autowired
66 - private SIPCommander cmder; 71 + private ISIPCommander cmder;
67 72
68 @Autowired 73 @Autowired
69 private SIPCommanderFroPlatform sipCommanderFroPlatform; 74 private SIPCommanderFroPlatform sipCommanderFroPlatform;
@@ -96,13 +101,13 @@ public class PlayServiceImpl implements IPlayService { @@ -96,13 +101,13 @@ public class PlayServiceImpl implements IPlayService {
96 private IDeviceService deviceService; 101 private IDeviceService deviceService;
97 102
98 @Autowired 103 @Autowired
99 - private UserSetting userSetting; 104 + private IDeviceChannelService channelService;
100 105
101 @Autowired 106 @Autowired
102 - private DynamicTask dynamicTask; 107 + private UserSetting userSetting;
103 108
104 @Autowired 109 @Autowired
105 - private CloudRecordServiceMapper cloudRecordServiceMapper; 110 + private DynamicTask dynamicTask;
106 111
107 112
108 @Override 113 @Override
@@ -117,6 +122,11 @@ public class PlayServiceImpl implements IPlayService { @@ -117,6 +122,11 @@ public class PlayServiceImpl implements IPlayService {
117 logger.warn("[点播] 单端口收流时不支持TCP主动方式收流 deviceId: {},channelId:{}", deviceId, channelId); 122 logger.warn("[点播] 单端口收流时不支持TCP主动方式收流 deviceId: {},channelId:{}", deviceId, channelId);
118 throw new ControllerException(ErrorCode.ERROR100.getCode(), "单端口收流时不支持TCP主动方式收流"); 123 throw new ControllerException(ErrorCode.ERROR100.getCode(), "单端口收流时不支持TCP主动方式收流");
119 } 124 }
  125 + DeviceChannel channel = channelService.getOne(deviceId, channelId);
  126 + if (channel == null) {
  127 + logger.warn("[点播] 未找到通道 deviceId: {},channelId:{}", deviceId, channelId);
  128 + throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到通道");
  129 + }
120 InviteInfo inviteInfo = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, deviceId, channelId); 130 InviteInfo inviteInfo = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, deviceId, channelId);
121 if (inviteInfo != null ) { 131 if (inviteInfo != null ) {
122 if (inviteInfo.getStreamInfo() == null) { 132 if (inviteInfo.getStreamInfo() == null) {
@@ -165,13 +175,13 @@ public class PlayServiceImpl implements IPlayService { @@ -165,13 +175,13 @@ public class PlayServiceImpl implements IPlayService {
165 null); 175 null);
166 return null; 176 return null;
167 } 177 }
168 - play(mediaServerItem, ssrcInfo, device, channelId, callback); 178 + play(mediaServerItem, ssrcInfo, device, channel, callback);
169 return ssrcInfo; 179 return ssrcInfo;
170 } 180 }
171 181
172 182
173 @Override 183 @Override
174 - public void play(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, Device device, String channelId, 184 + public void play(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, Device device, DeviceChannel channel,
175 ErrorCallback<Object> callback) { 185 ErrorCallback<Object> callback) {
176 186
177 if (mediaServerItem == null || ssrcInfo == null) { 187 if (mediaServerItem == null || ssrcInfo == null) {
@@ -180,110 +190,109 @@ public class PlayServiceImpl implements IPlayService { @@ -180,110 +190,109 @@ public class PlayServiceImpl implements IPlayService {
180 null); 190 null);
181 return; 191 return;
182 } 192 }
183 - logger.info("[点播开始] deviceId: {}, channelId: {},码流类型:{}, 收流端口: {}, STREAM:{}, 收流模式:{}, SSRC: {}, SSRC校验:{}",  
184 - device.getDeviceId(), channelId, device.isSwitchPrimarySubStream() ? "辅码流" : "主码流", ssrcInfo.getPort(), ssrcInfo.getStream(), 193 + logger.info("[点播开始] deviceId: {}, channelId: {},码流类型:{}, 收流端口: {}, 码流:{}, 收流模式:{}, SSRC: {}, SSRC校验:{}",
  194 + device.getDeviceId(), channel.getChannelId(), channel.getStreamIdentification(), ssrcInfo.getPort(), ssrcInfo.getStream(),
185 device.getStreamMode(), ssrcInfo.getSsrc(), device.isSsrcCheck()); 195 device.getStreamMode(), ssrcInfo.getSsrc(), device.isSsrcCheck());
186 //端口获取失败的ssrcInfo 没有必要发送点播指令 196 //端口获取失败的ssrcInfo 没有必要发送点播指令
187 if (ssrcInfo.getPort() <= 0) { 197 if (ssrcInfo.getPort() <= 0) {
188 - logger.info("[点播端口分配异常],deviceId={},channelId={},ssrcInfo={}", device.getDeviceId(), channelId, ssrcInfo); 198 + logger.info("[点播端口分配异常],deviceId={},channelId={},ssrcInfo={}", device.getDeviceId(), channel.getChannelId(), ssrcInfo);
189 // 释放ssrc 199 // 释放ssrc
190 mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc()); 200 mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
191 - streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream()); 201 + streamSession.remove(device.getDeviceId(), channel.getChannelId(), ssrcInfo.getStream());
192 202
193 callback.run(InviteErrorCode.ERROR_FOR_RESOURCE_EXHAUSTION.getCode(), "点播端口分配异常", null); 203 callback.run(InviteErrorCode.ERROR_FOR_RESOURCE_EXHAUSTION.getCode(), "点播端口分配异常", null);
194 - inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channelId, null, 204 + inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channel.getChannelId(), null,
195 InviteErrorCode.ERROR_FOR_RESOURCE_EXHAUSTION.getCode(), "点播端口分配异常", null); 205 InviteErrorCode.ERROR_FOR_RESOURCE_EXHAUSTION.getCode(), "点播端口分配异常", null);
196 return; 206 return;
197 } 207 }
198 208
199 // 初始化redis中的invite消息状态 209 // 初始化redis中的invite消息状态
200 - InviteInfo inviteInfo = InviteInfo.getInviteInfo(device.getDeviceId(), channelId, ssrcInfo.getStream(), ssrcInfo, 210 + InviteInfo inviteInfo = InviteInfo.getInviteInfo(device.getDeviceId(), channel.getChannelId(), ssrcInfo.getStream(), ssrcInfo,
201 mediaServerItem.getSdpIp(), ssrcInfo.getPort(), device.getStreamMode(), InviteSessionType.PLAY, 211 mediaServerItem.getSdpIp(), ssrcInfo.getPort(), device.getStreamMode(), InviteSessionType.PLAY,
202 InviteSessionStatus.ready); 212 InviteSessionStatus.ready);
203 - inviteInfo.setSubStream(device.isSwitchPrimarySubStream());  
204 inviteStreamService.updateInviteInfo(inviteInfo); 213 inviteStreamService.updateInviteInfo(inviteInfo);
205 // 超时处理 214 // 超时处理
206 String timeOutTaskKey = UUID.randomUUID().toString(); 215 String timeOutTaskKey = UUID.randomUUID().toString();
207 dynamicTask.startDelay(timeOutTaskKey, () -> { 216 dynamicTask.startDelay(timeOutTaskKey, () -> {
208 // 执行超时任务时查询是否已经成功,成功了则不执行超时任务,防止超时任务取消失败的情况 217 // 执行超时任务时查询是否已经成功,成功了则不执行超时任务,防止超时任务取消失败的情况
209 - InviteInfo inviteInfoForTimeOut = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, device.getDeviceId(), channelId); 218 + InviteInfo inviteInfoForTimeOut = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, device.getDeviceId(), channel.getChannelId());
210 if (inviteInfoForTimeOut == null || inviteInfoForTimeOut.getStreamInfo() == null) { 219 if (inviteInfoForTimeOut == null || inviteInfoForTimeOut.getStreamInfo() == null) {
211 - logger.info("[点播超时] 收流超时 deviceId: {}, channelId: {},码流类型:{},端口:{}, SSRC: {}",  
212 - device.getDeviceId(), channelId, device.isSwitchPrimarySubStream() ? "辅码流" : "主码流", 220 + logger.info("[点播超时] 收流超时 deviceId: {}, channelId: {},码流:{},端口:{}, SSRC: {}",
  221 + device.getDeviceId(), channel.getChannelId(), channel.getStreamIdentification(),
213 ssrcInfo.getPort(), ssrcInfo.getSsrc()); 222 ssrcInfo.getPort(), ssrcInfo.getSsrc());
214 223
215 callback.run(InviteErrorCode.ERROR_FOR_STREAM_TIMEOUT.getCode(), InviteErrorCode.ERROR_FOR_STREAM_TIMEOUT.getMsg(), null); 224 callback.run(InviteErrorCode.ERROR_FOR_STREAM_TIMEOUT.getCode(), InviteErrorCode.ERROR_FOR_STREAM_TIMEOUT.getMsg(), null);
216 - inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channelId, null, 225 + inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channel.getChannelId(), null,
217 InviteErrorCode.ERROR_FOR_STREAM_TIMEOUT.getCode(), InviteErrorCode.ERROR_FOR_STREAM_TIMEOUT.getMsg(), null); 226 InviteErrorCode.ERROR_FOR_STREAM_TIMEOUT.getCode(), InviteErrorCode.ERROR_FOR_STREAM_TIMEOUT.getMsg(), null);
218 - inviteStreamService.removeInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, device.getDeviceId(), channelId); 227 + inviteStreamService.removeInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, device.getDeviceId(), channel.getChannelId());
219 228
220 try { 229 try {
221 - cmder.streamByeCmd(device, channelId, ssrcInfo.getStream(), null); 230 + cmder.streamByeCmd(device, channel.getChannelId(), ssrcInfo.getStream(), null);
222 } catch (InvalidArgumentException | ParseException | SipException | SsrcTransactionNotFoundException e) { 231 } catch (InvalidArgumentException | ParseException | SipException | SsrcTransactionNotFoundException e) {
223 logger.error("[点播超时], 发送BYE失败 {}", e.getMessage()); 232 logger.error("[点播超时], 发送BYE失败 {}", e.getMessage());
224 } finally { 233 } finally {
225 mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc()); 234 mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
226 mediaServerService.closeRTPServer(mediaServerItem, ssrcInfo.getStream()); 235 mediaServerService.closeRTPServer(mediaServerItem, ssrcInfo.getStream());
227 - streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream()); 236 + streamSession.remove(device.getDeviceId(), channel.getChannelId(), ssrcInfo.getStream());
228 mediaServerService.closeRTPServer(mediaServerItem, ssrcInfo.getStream()); 237 mediaServerService.closeRTPServer(mediaServerItem, ssrcInfo.getStream());
229 // 取消订阅消息监听 238 // 取消订阅消息监听
230 HookSubscribeForStreamChange hookSubscribe = HookSubscribeFactory.on_stream_changed("rtp", ssrcInfo.getStream(), true, "rtsp", mediaServerItem.getId()); 239 HookSubscribeForStreamChange hookSubscribe = HookSubscribeFactory.on_stream_changed("rtp", ssrcInfo.getStream(), true, "rtsp", mediaServerItem.getId());
231 subscribe.removeSubscribe(hookSubscribe); 240 subscribe.removeSubscribe(hookSubscribe);
232 } 241 }
233 }else { 242 }else {
234 - logger.info("[点播超时] 收流超时 deviceId: {}, channelId: {},码流类型:{},端口:{}, SSRC: {}",  
235 - device.getDeviceId(), channelId, device.isSwitchPrimarySubStream() ? "辅码流" : "主码流", 243 + logger.info("[点播超时] 收流超时 deviceId: {}, channelId: {},码流:{},端口:{}, SSRC: {}",
  244 + device.getDeviceId(), channel.getChannelId(), channel.getStreamIdentification(),
236 ssrcInfo.getPort(), ssrcInfo.getSsrc()); 245 ssrcInfo.getPort(), ssrcInfo.getSsrc());
237 246
238 mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc()); 247 mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
239 248
240 mediaServerService.closeRTPServer(mediaServerItem.getId(), ssrcInfo.getStream()); 249 mediaServerService.closeRTPServer(mediaServerItem.getId(), ssrcInfo.getStream());
241 - streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream()); 250 + streamSession.remove(device.getDeviceId(), channel.getChannelId(), ssrcInfo.getStream());
242 } 251 }
243 }, userSetting.getPlayTimeout()); 252 }, userSetting.getPlayTimeout());
244 253
245 try { 254 try {
246 - cmder.playStreamCmd(mediaServerItem, ssrcInfo, device, channelId, (mediaServerItemInuse, hookParam ) -> { 255 + cmder.playStreamCmd(mediaServerItem, ssrcInfo, device, channel, (mediaServerItemInuse, hookParam ) -> {
247 logger.info("收到订阅消息: " + hookParam); 256 logger.info("收到订阅消息: " + hookParam);
248 dynamicTask.stop(timeOutTaskKey); 257 dynamicTask.stop(timeOutTaskKey);
249 // hook响应 258 // hook响应
250 - StreamInfo streamInfo = onPublishHandlerForPlay(mediaServerItemInuse, hookParam, device.getDeviceId(), channelId); 259 + StreamInfo streamInfo = onPublishHandlerForPlay(mediaServerItemInuse, hookParam, device.getDeviceId(), channel.getChannelId());
251 if (streamInfo == null){ 260 if (streamInfo == null){
252 callback.run(InviteErrorCode.ERROR_FOR_STREAM_PARSING_EXCEPTIONS.getCode(), 261 callback.run(InviteErrorCode.ERROR_FOR_STREAM_PARSING_EXCEPTIONS.getCode(),
253 InviteErrorCode.ERROR_FOR_STREAM_PARSING_EXCEPTIONS.getMsg(), null); 262 InviteErrorCode.ERROR_FOR_STREAM_PARSING_EXCEPTIONS.getMsg(), null);
254 - inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channelId, null, 263 + inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channel.getChannelId(), null,
255 InviteErrorCode.ERROR_FOR_STREAM_PARSING_EXCEPTIONS.getCode(), 264 InviteErrorCode.ERROR_FOR_STREAM_PARSING_EXCEPTIONS.getCode(),
256 InviteErrorCode.ERROR_FOR_STREAM_PARSING_EXCEPTIONS.getMsg(), null); 265 InviteErrorCode.ERROR_FOR_STREAM_PARSING_EXCEPTIONS.getMsg(), null);
257 return; 266 return;
258 } 267 }
259 callback.run(InviteErrorCode.SUCCESS.getCode(), InviteErrorCode.SUCCESS.getMsg(), streamInfo); 268 callback.run(InviteErrorCode.SUCCESS.getCode(), InviteErrorCode.SUCCESS.getMsg(), streamInfo);
260 - inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channelId, null, 269 + inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channel.getChannelId(), null,
261 InviteErrorCode.SUCCESS.getCode(), 270 InviteErrorCode.SUCCESS.getCode(),
262 InviteErrorCode.SUCCESS.getMsg(), 271 InviteErrorCode.SUCCESS.getMsg(),
263 streamInfo); 272 streamInfo);
264 - logger.info("[点播成功] deviceId: {}, channelId:{}, 码流类型:{}", device.getDeviceId(), channelId,  
265 - device.isSwitchPrimarySubStream() ? "辅码流" : "主码流");  
266 - snapOnPlay(mediaServerItemInuse, device.getDeviceId(), channelId, ssrcInfo.getStream()); 273 + logger.info("[点播成功] deviceId: {}, channelId:{}, 码流类型:{}", device.getDeviceId(), channel.getChannelId(),
  274 + channel.getStreamIdentification());
  275 + snapOnPlay(mediaServerItemInuse, device.getDeviceId(), channel.getChannelId(), ssrcInfo.getStream());
267 }, (eventResult) -> { 276 }, (eventResult) -> {
268 // 处理收到200ok后的TCP主动连接以及SSRC不一致的问题 277 // 处理收到200ok后的TCP主动连接以及SSRC不一致的问题
269 - InviteOKHandler(eventResult, ssrcInfo, mediaServerItem, device, channelId, 278 + InviteOKHandler(eventResult, ssrcInfo, mediaServerItem, device, channel.getChannelId(),
270 timeOutTaskKey, callback, inviteInfo, InviteSessionType.PLAY); 279 timeOutTaskKey, callback, inviteInfo, InviteSessionType.PLAY);
271 }, (event) -> { 280 }, (event) -> {
272 - logger.info("[点播失败] deviceId: {}, channelId:{}, {}: {}", device.getDeviceId(), channelId, event.statusCode, event.msg); 281 + logger.info("[点播失败] deviceId: {}, channelId:{}, {}: {}", device.getDeviceId(), channel.getChannelId(), event.statusCode, event.msg);
273 dynamicTask.stop(timeOutTaskKey); 282 dynamicTask.stop(timeOutTaskKey);
274 mediaServerService.closeRTPServer(mediaServerItem, ssrcInfo.getStream()); 283 mediaServerService.closeRTPServer(mediaServerItem, ssrcInfo.getStream());
275 // 释放ssrc 284 // 释放ssrc
276 mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc()); 285 mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
277 286
278 - streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream()); 287 + streamSession.remove(device.getDeviceId(), channel.getChannelId(), ssrcInfo.getStream());
279 288
280 callback.run(InviteErrorCode.ERROR_FOR_SIGNALLING_ERROR.getCode(), 289 callback.run(InviteErrorCode.ERROR_FOR_SIGNALLING_ERROR.getCode(),
281 String.format("点播失败, 错误码: %s, %s", event.statusCode, event.msg), null); 290 String.format("点播失败, 错误码: %s, %s", event.statusCode, event.msg), null);
282 - inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channelId, null, 291 + inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channel.getChannelId(), null,
283 InviteErrorCode.ERROR_FOR_RESET_SSRC.getCode(), 292 InviteErrorCode.ERROR_FOR_RESET_SSRC.getCode(),
284 String.format("点播失败, 错误码: %s, %s", event.statusCode, event.msg), null); 293 String.format("点播失败, 错误码: %s, %s", event.statusCode, event.msg), null);
285 294
286 - inviteStreamService.removeInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, device.getDeviceId(), channelId); 295 + inviteStreamService.removeInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, device.getDeviceId(), channel.getChannelId());
287 }); 296 });
288 } catch (InvalidArgumentException | SipException | ParseException e) { 297 } catch (InvalidArgumentException | SipException | ParseException e) {
289 298
@@ -293,15 +302,15 @@ public class PlayServiceImpl implements IPlayService { @@ -293,15 +302,15 @@ public class PlayServiceImpl implements IPlayService {
293 // 释放ssrc 302 // 释放ssrc
294 mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc()); 303 mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
295 304
296 - streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream()); 305 + streamSession.remove(device.getDeviceId(), channel.getChannelId(), ssrcInfo.getStream());
297 306
298 callback.run(InviteErrorCode.ERROR_FOR_SIP_SENDING_FAILED.getCode(), 307 callback.run(InviteErrorCode.ERROR_FOR_SIP_SENDING_FAILED.getCode(),
299 InviteErrorCode.ERROR_FOR_SIP_SENDING_FAILED.getMsg(), null); 308 InviteErrorCode.ERROR_FOR_SIP_SENDING_FAILED.getMsg(), null);
300 - inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channelId, null, 309 + inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channel.getChannelId(), null,
301 InviteErrorCode.ERROR_FOR_SIP_SENDING_FAILED.getCode(), 310 InviteErrorCode.ERROR_FOR_SIP_SENDING_FAILED.getCode(),
302 InviteErrorCode.ERROR_FOR_SIP_SENDING_FAILED.getMsg(), null); 311 InviteErrorCode.ERROR_FOR_SIP_SENDING_FAILED.getMsg(), null);
303 312
304 - inviteStreamService.removeInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, device.getDeviceId(), channelId); 313 + inviteStreamService.removeInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, device.getDeviceId(), channel.getChannelId());
305 } 314 }
306 } 315 }
307 316
@@ -438,7 +447,7 @@ public class PlayServiceImpl implements IPlayService { @@ -438,7 +447,7 @@ public class PlayServiceImpl implements IPlayService {
438 447
439 @Override 448 @Override
440 public void playBack(String deviceId, String channelId, String startTime, 449 public void playBack(String deviceId, String channelId, String startTime,
441 - String endTime, ErrorCallback<Object> callback) { 450 + String endTime, ErrorCallback<Object> callback) {
442 Device device = storager.queryVideoDevice(deviceId); 451 Device device = storager.queryVideoDevice(deviceId);
443 if (device == null) { 452 if (device == null) {
444 logger.warn("[录像回放] 未找到设备 deviceId: {},channelId:{}", deviceId, channelId); 453 logger.warn("[录像回放] 未找到设备 deviceId: {},channelId:{}", deviceId, channelId);
@@ -463,8 +472,8 @@ public class PlayServiceImpl implements IPlayService { @@ -463,8 +472,8 @@ public class PlayServiceImpl implements IPlayService {
463 472
464 @Override 473 @Override
465 public void playBack(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, 474 public void playBack(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo,
466 - String deviceId, String channelId, String startTime,  
467 - String endTime, ErrorCallback<Object> callback) { 475 + String deviceId, String channelId, String startTime,
  476 + String endTime, ErrorCallback<Object> callback) {
468 if (mediaServerItem == null || ssrcInfo == null) { 477 if (mediaServerItem == null || ssrcInfo == null) {
469 callback.run(InviteErrorCode.ERROR_FOR_PARAMETER_ERROR.getCode(), 478 callback.run(InviteErrorCode.ERROR_FOR_PARAMETER_ERROR.getCode(),
470 InviteErrorCode.ERROR_FOR_PARAMETER_ERROR.getMsg(), 479 InviteErrorCode.ERROR_FOR_PARAMETER_ERROR.getMsg(),
@@ -881,7 +890,7 @@ public class PlayServiceImpl implements IPlayService { @@ -881,7 +890,7 @@ public class PlayServiceImpl implements IPlayService {
881 cmder.streamByeCmd(device, ssrcTransaction.getChannelId(), 890 cmder.streamByeCmd(device, ssrcTransaction.getChannelId(),
882 ssrcTransaction.getStream(), null); 891 ssrcTransaction.getStream(), null);
883 } catch (InvalidArgumentException | ParseException | SipException | 892 } catch (InvalidArgumentException | ParseException | SipException |
884 - SsrcTransactionNotFoundException e) { 893 + SsrcTransactionNotFoundException e) {
885 logger.error("[zlm离线]为正在使用此zlm的设备, 发送BYE失败 {}", e.getMessage()); 894 logger.error("[zlm离线]为正在使用此zlm的设备, 发送BYE失败 {}", e.getMessage());
886 } 895 }
887 } 896 }
@@ -1031,16 +1040,16 @@ public class PlayServiceImpl implements IPlayService { @@ -1031,16 +1040,16 @@ public class PlayServiceImpl implements IPlayService {
1031 1040
1032 MediaServerItem newMediaServerItem = getNewMediaServerItem(device); 1041 MediaServerItem newMediaServerItem = getNewMediaServerItem(device);
1033 play(newMediaServerItem, deviceId, channelId, null, (code, msg, data)->{ 1042 play(newMediaServerItem, deviceId, channelId, null, (code, msg, data)->{
1034 - if (code == InviteErrorCode.SUCCESS.getCode()) {  
1035 - InviteInfo inviteInfoForPlay = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, deviceId, channelId);  
1036 - if (inviteInfoForPlay != null && inviteInfoForPlay.getStreamInfo() != null) {  
1037 - getSnap(deviceId, channelId, fileName, errorCallback);  
1038 - }else {  
1039 - errorCallback.run(InviteErrorCode.FAIL.getCode(), InviteErrorCode.FAIL.getMsg(), null);  
1040 - }  
1041 - }else {  
1042 - errorCallback.run(InviteErrorCode.FAIL.getCode(), InviteErrorCode.FAIL.getMsg(), null);  
1043 - } 1043 + if (code == InviteErrorCode.SUCCESS.getCode()) {
  1044 + InviteInfo inviteInfoForPlay = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, deviceId, channelId);
  1045 + if (inviteInfoForPlay != null && inviteInfoForPlay.getStreamInfo() != null) {
  1046 + getSnap(deviceId, channelId, fileName, errorCallback);
  1047 + }else {
  1048 + errorCallback.run(InviteErrorCode.FAIL.getCode(), InviteErrorCode.FAIL.getMsg(), null);
  1049 + }
  1050 + }else {
  1051 + errorCallback.run(InviteErrorCode.FAIL.getCode(), InviteErrorCode.FAIL.getMsg(), null);
  1052 + }
1044 }); 1053 });
1045 } 1054 }
1046 1055
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
@@ -20,11 +20,11 @@ public interface DeviceChannelMapper { @@ -20,11 +20,11 @@ public interface DeviceChannelMapper {
20 @Insert("INSERT INTO wvp_device_channel (channel_id, device_id, name, manufacture, model, owner, civil_code, block, " + 20 @Insert("INSERT INTO wvp_device_channel (channel_id, device_id, name, manufacture, model, owner, civil_code, block, " +
21 "address, parental, parent_id, safety_way, register_way, cert_num, certifiable, err_code, secrecy, " + 21 "address, parental, parent_id, safety_way, register_way, cert_num, certifiable, err_code, secrecy, " +
22 "ip_address, port, password, ptz_type, status, stream_id, longitude, latitude, longitude_gcj02, latitude_gcj02, " + 22 "ip_address, port, password, ptz_type, status, stream_id, longitude, latitude, longitude_gcj02, latitude_gcj02, " +
23 - "longitude_wgs84, latitude_wgs84, has_audio, create_time, update_time, business_group_id, gps_time) " + 23 + "longitude_wgs84, latitude_wgs84, has_audio, create_time, update_time, business_group_id, gps_time, stream_identification) " +
24 "VALUES (#{channelId}, #{deviceId}, #{name}, #{manufacture}, #{model}, #{owner}, #{civilCode}, #{block}," + 24 "VALUES (#{channelId}, #{deviceId}, #{name}, #{manufacture}, #{model}, #{owner}, #{civilCode}, #{block}," +
25 "#{address}, #{parental}, #{parentId}, #{safetyWay}, #{registerWay}, #{certNum}, #{certifiable}, #{errCode}, #{secrecy}, " + 25 "#{address}, #{parental}, #{parentId}, #{safetyWay}, #{registerWay}, #{certNum}, #{certifiable}, #{errCode}, #{secrecy}, " +
26 "#{ipAddress}, #{port}, #{password}, #{PTZType}, #{status}, #{streamId}, #{longitude}, #{latitude}, #{longitudeGcj02}, " + 26 "#{ipAddress}, #{port}, #{password}, #{PTZType}, #{status}, #{streamId}, #{longitude}, #{latitude}, #{longitudeGcj02}, " +
27 - "#{latitudeGcj02}, #{longitudeWgs84}, #{latitudeWgs84}, #{hasAudio}, #{createTime}, #{updateTime}, #{businessGroupId}, #{gpsTime})") 27 + "#{latitudeGcj02}, #{longitudeWgs84}, #{latitudeWgs84}, #{hasAudio}, #{createTime}, #{updateTime}, #{businessGroupId}, #{gpsTime}, #{streamIdentification})")
28 int add(DeviceChannel channel); 28 int add(DeviceChannel channel);
29 29
30 @Update(value = {" <script>" + 30 @Update(value = {" <script>" +
@@ -60,6 +60,7 @@ public interface DeviceChannelMapper { @@ -60,6 +60,7 @@ public interface DeviceChannelMapper {
60 "<if test='latitudeWgs84 != null'>, latitude_wgs84=#{latitudeWgs84}</if>" + 60 "<if test='latitudeWgs84 != null'>, latitude_wgs84=#{latitudeWgs84}</if>" +
61 "<if test='businessGroupId != null'>, business_group_id=#{businessGroupId}</if>" + 61 "<if test='businessGroupId != null'>, business_group_id=#{businessGroupId}</if>" +
62 "<if test='gpsTime != null'>, gps_time=#{gpsTime}</if>" + 62 "<if test='gpsTime != null'>, gps_time=#{gpsTime}</if>" +
  63 + "<if test='streamIdentification != null'>, stream_identification=#{streamIdentification}</if>" +
63 "WHERE device_id=#{deviceId} AND channel_id=#{channelId}"+ 64 "WHERE device_id=#{deviceId} AND channel_id=#{channelId}"+
64 " </script>"}) 65 " </script>"})
65 int update(DeviceChannel channel); 66 int update(DeviceChannel channel);
@@ -102,6 +103,7 @@ public interface DeviceChannelMapper { @@ -102,6 +103,7 @@ public interface DeviceChannelMapper {
102 "dc.longitude_wgs84, " + 103 "dc.longitude_wgs84, " +
103 "dc.latitude_wgs84, " + 104 "dc.latitude_wgs84, " +
104 "dc.business_group_id, " + 105 "dc.business_group_id, " +
  106 + "dc.stream_identification, " +
105 "dc.gps_time " + 107 "dc.gps_time " +
106 "from " + 108 "from " +
107 "wvp_device_channel dc " + 109 "wvp_device_channel dc " +
@@ -241,7 +243,7 @@ public interface DeviceChannelMapper { @@ -241,7 +243,7 @@ public interface DeviceChannelMapper {
241 "(channel_id, device_id, name, manufacture, model, owner, civil_code, block, sub_count, " + 243 "(channel_id, device_id, name, manufacture, model, owner, civil_code, block, sub_count, " +
242 " address, parental, parent_id, safety_way, register_way, cert_num, certifiable, err_code, secrecy, " + 244 " address, parental, parent_id, safety_way, register_way, cert_num, certifiable, err_code, secrecy, " +
243 " ip_address,port,password,ptz_type,status,stream_id,longitude,latitude,longitude_gcj02,latitude_gcj02,"+ 245 " ip_address,port,password,ptz_type,status,stream_id,longitude,latitude,longitude_gcj02,latitude_gcj02,"+
244 - " longitude_wgs84,latitude_wgs84,has_audio,create_time,update_time,business_group_id,gps_time)"+ 246 + " longitude_wgs84,latitude_wgs84,has_audio,create_time,update_time,business_group_id,gps_time,stream_identification)"+
245 "values " + 247 "values " +
246 "<foreach collection='addChannels' index='index' item='item' separator=','> " + 248 "<foreach collection='addChannels' index='index' item='item' separator=','> " +
247 "(#{item.channelId}, #{item.deviceId}, #{item.name}, #{item.manufacture}, #{item.model}, " + 249 "(#{item.channelId}, #{item.deviceId}, #{item.name}, #{item.manufacture}, #{item.model}, " +
@@ -251,7 +253,7 @@ public interface DeviceChannelMapper { @@ -251,7 +253,7 @@ public interface DeviceChannelMapper {
251 "#{item.ipAddress}, #{item.port}, #{item.password}, #{item.PTZType}, #{item.status}, " + 253 "#{item.ipAddress}, #{item.port}, #{item.password}, #{item.PTZType}, #{item.status}, " +
252 "#{item.streamId}, #{item.longitude}, #{item.latitude},#{item.longitudeGcj02}, " + 254 "#{item.streamId}, #{item.longitude}, #{item.latitude},#{item.longitudeGcj02}, " +
253 "#{item.latitudeGcj02},#{item.longitudeWgs84}, #{item.latitudeWgs84}, #{item.hasAudio}, now(), now(), " + 255 "#{item.latitudeGcj02},#{item.longitudeWgs84}, #{item.latitudeWgs84}, #{item.hasAudio}, now(), now(), " +
254 - "#{item.businessGroupId}, #{item.gpsTime}) " + 256 + "#{item.businessGroupId}, #{item.gpsTime}, #{item.streamIdentification}) " +
255 "</foreach> " + 257 "</foreach> " +
256 "</script>") 258 "</script>")
257 int batchAdd(@Param("addChannels") List<DeviceChannel> addChannels); 259 int batchAdd(@Param("addChannels") List<DeviceChannel> addChannels);
@@ -349,6 +351,7 @@ public interface DeviceChannelMapper { @@ -349,6 +351,7 @@ public interface DeviceChannelMapper {
349 "<if test='item.latitudeWgs84 != null'>, latitude_wgs84=#{item.latitudeWgs84}</if>" + 351 "<if test='item.latitudeWgs84 != null'>, latitude_wgs84=#{item.latitudeWgs84}</if>" +
350 "<if test='item.businessGroupId != null'>, business_group_id=#{item.businessGroupId}</if>" + 352 "<if test='item.businessGroupId != null'>, business_group_id=#{item.businessGroupId}</if>" +
351 "<if test='item.gpsTime != null'>, gps_time=#{item.gpsTime}</if>" + 353 "<if test='item.gpsTime != null'>, gps_time=#{item.gpsTime}</if>" +
  354 + "<if test='item.streamIdentification != null'>, stream_identification=#{item.streamIdentification}</if>" +
352 "<if test='item.id > 0'>WHERE id=#{item.id}</if>" + 355 "<if test='item.id > 0'>WHERE id=#{item.id}</if>" +
353 "<if test='item.id == 0'>WHERE device_id=#{item.deviceId} AND channel_id=#{item.channelId}</if>" + 356 "<if test='item.id == 0'>WHERE device_id=#{item.deviceId} AND channel_id=#{item.channelId}</if>" +
354 "</foreach>" + 357 "</foreach>" +
@@ -542,4 +545,9 @@ public interface DeviceChannelMapper { @@ -542,4 +545,9 @@ public interface DeviceChannelMapper {
542 " </script>"}) 545 " </script>"})
543 List<DeviceChannel> getSubChannelsByDeviceId(@Param("deviceId") String deviceId, @Param("parentId") String parentId, @Param("onlyCatalog") boolean onlyCatalog); 546 List<DeviceChannel> getSubChannelsByDeviceId(@Param("deviceId") String deviceId, @Param("parentId") String parentId, @Param("onlyCatalog") boolean onlyCatalog);
544 547
  548 + @Update("<script>" +
  549 + "UPDATE wvp_device_channel SET stream_identification=#{streamIdentification} WHERE device_id=#{deviceId}" +
  550 + " <if test='channelId != null'> and channel_id = #{channelId} </if>" +
  551 + "</script>")
  552 + void updateChannelStreamIdentification(DeviceChannel channel);
545 } 553 }
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java
@@ -43,7 +43,6 @@ public interface DeviceMapper { @@ -43,7 +43,6 @@ public interface DeviceMapper {
43 "geo_coord_sys," + 43 "geo_coord_sys," +
44 "on_line," + 44 "on_line," +
45 "media_server_id," + 45 "media_server_id," +
46 - "switch_primary_sub_stream," +  
47 "(SELECT count(0) FROM wvp_device_channel WHERE device_id=wvp_device.device_id) as channel_count "+ 46 "(SELECT count(0) FROM wvp_device_channel WHERE device_id=wvp_device.device_id) as channel_count "+
48 " FROM wvp_device WHERE device_id = #{deviceId}") 47 " FROM wvp_device WHERE device_id = #{deviceId}")
49 Device getDeviceByDeviceId(String deviceId); 48 Device getDeviceByDeviceId(String deviceId);
@@ -159,7 +158,6 @@ public interface DeviceMapper { @@ -159,7 +158,6 @@ public interface DeviceMapper {
159 "geo_coord_sys,"+ 158 "geo_coord_sys,"+
160 "on_line,"+ 159 "on_line,"+
161 "media_server_id,"+ 160 "media_server_id,"+
162 - "switch_primary_sub_stream switchPrimarySubStream,"+  
163 "(SELECT count(0) FROM wvp_device_channel WHERE device_id=de.device_id) as channel_count " + 161 "(SELECT count(0) FROM wvp_device_channel WHERE device_id=de.device_id) as channel_count " +
164 "FROM wvp_device de" + 162 "FROM wvp_device de" +
165 "<if test=\"onLine != null\"> where on_line=${onLine}</if>"+ 163 "<if test=\"onLine != null\"> where on_line=${onLine}</if>"+
@@ -249,7 +247,6 @@ public interface DeviceMapper { @@ -249,7 +247,6 @@ public interface DeviceMapper {
249 "<if test=\"ssrcCheck != null\">, ssrc_check=#{ssrcCheck}</if>" + 247 "<if test=\"ssrcCheck != null\">, ssrc_check=#{ssrcCheck}</if>" +
250 "<if test=\"asMessageChannel != null\">, as_message_channel=#{asMessageChannel}</if>" + 248 "<if test=\"asMessageChannel != null\">, as_message_channel=#{asMessageChannel}</if>" +
251 "<if test=\"geoCoordSys != null\">, geo_coord_sys=#{geoCoordSys}</if>" + 249 "<if test=\"geoCoordSys != null\">, geo_coord_sys=#{geoCoordSys}</if>" +
252 - "<if test=\"switchPrimarySubStream != null\">, switch_primary_sub_stream=#{switchPrimarySubStream}</if>" +  
253 "<if test=\"mediaServerId != null\">, media_server_id=#{mediaServerId}</if>" + 250 "<if test=\"mediaServerId != null\">, media_server_id=#{mediaServerId}</if>" +
254 "WHERE device_id=#{deviceId}"+ 251 "WHERE device_id=#{deviceId}"+
255 " </script>"}) 252 " </script>"})
@@ -267,8 +264,7 @@ public interface DeviceMapper { @@ -267,8 +264,7 @@ public interface DeviceMapper {
267 "as_message_channel,"+ 264 "as_message_channel,"+
268 "geo_coord_sys,"+ 265 "geo_coord_sys,"+
269 "on_line,"+ 266 "on_line,"+
270 - "media_server_id,"+  
271 - "switch_primary_sub_stream"+ 267 + "media_server_id"+
272 ") VALUES (" + 268 ") VALUES (" +
273 "#{deviceId}," + 269 "#{deviceId}," +
274 "#{name}," + 270 "#{name}," +
@@ -281,8 +277,7 @@ public interface DeviceMapper { @@ -281,8 +277,7 @@ public interface DeviceMapper {
281 "#{asMessageChannel}," + 277 "#{asMessageChannel}," +
282 "#{geoCoordSys}," + 278 "#{geoCoordSys}," +
283 "#{onLine}," + 279 "#{onLine}," +
284 - "#{mediaServerId}," +  
285 - "#{switchPrimarySubStream}" + 280 + "#{mediaServerId}" +
286 ")") 281 ")")
287 void addCustomDevice(Device device); 282 void addCustomDevice(Device device);
288 283
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java
@@ -264,6 +264,14 @@ public class DeviceQuery { @@ -264,6 +264,14 @@ public class DeviceQuery {
264 deviceChannelService.updateChannel(deviceId, channel); 264 deviceChannelService.updateChannel(deviceId, channel);
265 } 265 }
266 266
  267 + @Operation(summary = "修改通道的码流类型", security = @SecurityRequirement(name = JwtUtils.HEADER))
  268 + @Parameter(name = "deviceId", description = "设备国标编号", required = true)
  269 + @Parameter(name = "channel", description = "通道信息", required = true)
  270 + @PostMapping("/channel/stream/identification/update/")
  271 + public void updateChannelStreamIdentification(DeviceChannel channel){
  272 + deviceChannelService.updateChannelStreamIdentification(channel);
  273 + }
  274 +
267 /** 275 /**
268 * 修改数据流传输模式 276 * 修改数据流传输模式
269 * @param deviceId 设备id 277 * @param deviceId 设备id
web_src/src/components/channelList.vue
@@ -13,24 +13,30 @@ @@ -13,24 +13,30 @@
13 prefix-icon="el-icon-search" v-model="searchSrt" clearable></el-input> 13 prefix-icon="el-icon-search" v-model="searchSrt" clearable></el-input>
14 14
15 通道类型: 15 通道类型:
16 - <el-select size="mini" @change="search" style="margin-right: 1rem;" v-model="channelType" placeholder="请选择" 16 + <el-select size="mini" @change="search" style="width: 8rem; margin-right: 1rem;" v-model="channelType" placeholder="请选择"
17 default-first-option> 17 default-first-option>
18 <el-option label="全部" value=""></el-option> 18 <el-option label="全部" value=""></el-option>
19 <el-option label="设备" value="false"></el-option> 19 <el-option label="设备" value="false"></el-option>
20 <el-option label="子目录" value="true"></el-option> 20 <el-option label="子目录" value="true"></el-option>
21 </el-select> 21 </el-select>
22 在线状态: 22 在线状态:
23 - <el-select size="mini" style="margin-right: 1rem;" @change="search" v-model="online" placeholder="请选择" 23 + <el-select size="mini" style="width: 8rem; margin-right: 1rem;" @change="search" v-model="online" placeholder="请选择"
24 default-first-option> 24 default-first-option>
25 <el-option label="全部" value=""></el-option> 25 <el-option label="全部" value=""></el-option>
26 <el-option label="在线" value="true"></el-option> 26 <el-option label="在线" value="true"></el-option>
27 <el-option label="离线" value="false"></el-option> 27 <el-option label="离线" value="false"></el-option>
28 </el-select> 28 </el-select>
29 - 清晰度:  
30 - <el-select size="mini" style="margin-right: 1rem;" @change="search" v-model="isSubStream" placeholder="请选择"  
31 - default-first-option>  
32 - <el-option label="原画" :value="false"></el-option>  
33 - <el-option label="流畅" :value="true"></el-option> 29 + 码流类型重置:
  30 + <el-select size="mini" style="width: 16rem; margin-right: 1rem;" @change="subStreamChange" v-model="subStream"
  31 + placeholder="请选择码流类型" default-first-option >
  32 + <el-option label="stream:0(主码流)" value="stream:0"></el-option>
  33 + <el-option label="stream:1(子码流)" value="stream:1"></el-option>
  34 + <el-option label="streamnumber:0(主码流-2022)" value="streamnumber:0"></el-option>
  35 + <el-option label="streamnumber:1(子码流-2022)" value="streamnumber:1"></el-option>
  36 + <el-option label="streamprofile:0(主码流-大华)" value="streamprofile:0"></el-option>
  37 + <el-option label="streamprofile:1(子码流-大华)" value="streamprofile:1"></el-option>
  38 + <el-option label="streamMode:main(主码流-水星+TP-LINK)" value="streamMode:main"></el-option>
  39 + <el-option label="streamMode:sub(子码流-水星+TP-LINK)" value="streamMode:sub"></el-option>
34 </el-select> 40 </el-select>
35 </div> 41 </div>
36 <el-button icon="el-icon-refresh-right" circle size="mini" @click="refresh()"></el-button> 42 <el-button icon="el-icon-refresh-right" circle size="mini" @click="refresh()"></el-button>
@@ -46,11 +52,11 @@ @@ -46,11 +52,11 @@
46 <el-main style="padding: 5px;"> 52 <el-main style="padding: 5px;">
47 <el-table ref="channelListTable" :data="deviceChannelList" :height="winHeight" style="width: 100%" 53 <el-table ref="channelListTable" :data="deviceChannelList" :height="winHeight" style="width: 100%"
48 header-row-class-name="table-header"> 54 header-row-class-name="table-header">
49 - <el-table-column prop="channelId" label="通道编号" min-width="200"> 55 + <el-table-column prop="channelId" label="通道编号" min-width="180">
50 </el-table-column> 56 </el-table-column>
51 - <el-table-column prop="deviceId" label="设备编号" min-width="200"> 57 + <el-table-column prop="deviceId" label="设备编号" min-width="180">
52 </el-table-column> 58 </el-table-column>
53 - <el-table-column prop="name" label="通道名称" min-width="200"> 59 + <el-table-column prop="name" label="通道名称" min-width="180">
54 <template v-slot:default="scope"> 60 <template v-slot:default="scope">
55 <el-input 61 <el-input
56 v-show="scope.row.edit" 62 v-show="scope.row.edit"
@@ -63,7 +69,7 @@ @@ -63,7 +69,7 @@
63 <span v-show="!scope.row.edit">{{ scope.row.name }}</span> 69 <span v-show="!scope.row.edit">{{ scope.row.name }}</span>
64 </template> 70 </template>
65 </el-table-column> 71 </el-table-column>
66 - <el-table-column label="快照" min-width="120"> 72 + <el-table-column label="快照" min-width="100">
67 <template v-slot:default="scope"> 73 <template v-slot:default="scope">
68 <el-image 74 <el-image
69 :src="getSnap(scope.row)" 75 :src="getSnap(scope.row)"
@@ -77,11 +83,11 @@ @@ -77,11 +83,11 @@
77 </el-image> 83 </el-image>
78 </template> 84 </template>
79 </el-table-column> 85 </el-table-column>
80 - <el-table-column prop="subCount" label="子节点数" min-width="120"> 86 + <el-table-column prop="subCount" label="子节点数" min-width="100">
81 </el-table-column> 87 </el-table-column>
82 - <el-table-column prop="manufacture" label="厂家" min-width="120"> 88 + <el-table-column prop="manufacture" label="厂家" min-width="100">
83 </el-table-column> 89 </el-table-column>
84 - <el-table-column label="位置信息" min-width="200"> 90 + <el-table-column label="位置信息" min-width="120">
85 <template v-slot:default="scope"> 91 <template v-slot:default="scope">
86 <el-input 92 <el-input
87 v-show="scope.row.edit" 93 v-show="scope.row.edit"
@@ -94,7 +100,7 @@ @@ -94,7 +100,7 @@
94 <span v-show="!scope.row.edit">{{ scope.row.location }}</span> 100 <span v-show="!scope.row.edit">{{ scope.row.location }}</span>
95 </template> 101 </template>
96 </el-table-column> 102 </el-table-column>
97 - <el-table-column prop="PTZType" label="云台类型" min-width="120"> 103 + <el-table-column prop="PTZType" label="云台类型" min-width="100">
98 <template v-slot:default="scope"> 104 <template v-slot:default="scope">
99 <el-select v-show="scope.row.edit" v-model="scope.row.PTZType" 105 <el-select v-show="scope.row.edit" v-model="scope.row.PTZType"
100 placeholder="云台类型" filterable> 106 placeholder="云台类型" filterable>
@@ -108,13 +114,28 @@ @@ -108,13 +114,28 @@
108 <div v-show="!scope.row.edit">{{ scope.row.PTZTypeText }}</div> 114 <div v-show="!scope.row.edit">{{ scope.row.PTZTypeText }}</div>
109 </template> 115 </template>
110 </el-table-column> 116 </el-table-column>
111 - <el-table-column label="开启音频" min-width="120"> 117 + <el-table-column label="开启音频" min-width="100">
112 <template slot-scope="scope"> 118 <template slot-scope="scope">
113 <el-switch @change="updateChannel(scope.row)" v-model="scope.row.hasAudio" active-color="#409EFF"> 119 <el-switch @change="updateChannel(scope.row)" v-model="scope.row.hasAudio" active-color="#409EFF">
114 </el-switch> 120 </el-switch>
115 </template> 121 </template>
116 </el-table-column> 122 </el-table-column>
117 - <el-table-column label="状态" min-width="120"> 123 + <el-table-column label="码流类型" min-width="180">
  124 + <template slot-scope="scope">
  125 + <el-select size="mini" style="margin-right: 1rem;" @change="channelSubStreamChange(scope.row)" v-model="scope.row.streamIdentification"
  126 + placeholder="请选择码流类型" default-first-option >
  127 + <el-option label="stream:0(主码流)" value="stream:0"></el-option>
  128 + <el-option label="stream:1(子码流)" value="stream:1"></el-option>
  129 + <el-option label="streamnumber:0(主码流-2022)" value="streamnumber:0"></el-option>
  130 + <el-option label="streamnumber:1(子码流-2022)" value="streamnumber:1"></el-option>
  131 + <el-option label="streamprofile:0(主码流-大华)" value="streamprofile:0"></el-option>
  132 + <el-option label="streamprofile:1(子码流-大华)" value="streamprofile:1"></el-option>
  133 + <el-option label="streamMode:main(主码流-水星+TP-LINK)" value="streamMode:main"></el-option>
  134 + <el-option label="streamMode:sub(子码流-水星+TP-LINK)" value="streamMode:sub"></el-option>
  135 + </el-select>
  136 + </template>
  137 + </el-table-column>
  138 + <el-table-column label="状态" min-width="100">
118 <template slot-scope="scope"> 139 <template slot-scope="scope">
119 <div slot="reference" class="name-wrapper"> 140 <div slot="reference" class="name-wrapper">
120 <el-tag size="medium" v-if="scope.row.status === true">在线</el-tag> 141 <el-tag size="medium" v-if="scope.row.status === true">在线</el-tag>
@@ -122,8 +143,6 @@ @@ -122,8 +143,6 @@
122 </div> 143 </div>
123 </template> 144 </template>
124 </el-table-column> 145 </el-table-column>
125 -  
126 -  
127 <el-table-column label="操作" min-width="340" fixed="right"> 146 <el-table-column label="操作" min-width="340" fixed="right">
128 <template slot-scope="scope"> 147 <template slot-scope="scope">
129 <el-button size="medium" v-bind:disabled="device == null || device.online === 0" icon="el-icon-video-play" 148 <el-button size="medium" v-bind:disabled="device == null || device.online === 0" icon="el-icon-video-play"
@@ -213,7 +232,7 @@ export default { @@ -213,7 +232,7 @@ export default {
213 searchSrt: "", 232 searchSrt: "",
214 channelType: "", 233 channelType: "",
215 online: "", 234 online: "",
216 - isSubStream: false, 235 + subStream: "",
217 winHeight: window.innerHeight - 200, 236 winHeight: window.innerHeight - 200,
218 currentPage: 1, 237 currentPage: 1,
219 count: 15, 238 count: 15,
@@ -495,6 +514,43 @@ export default { @@ -495,6 +514,43 @@ export default {
495 console.log(JSON.stringify(res)); 514 console.log(JSON.stringify(res));
496 }); 515 });
497 }, 516 },
  517 + subStreamChange: function () {
  518 + this.$confirm('确定重置所有通道的码流类型?', '提示', {
  519 + confirmButtonText: '确定',
  520 + cancelButtonText: '取消',
  521 + type: 'warning'
  522 + }).then(() => {
  523 + this.$axios({
  524 + method: 'post',
  525 + url: `/api/device/query/channel/stream/identification/update/`,
  526 + params: {
  527 + deviceId: this.deviceId,
  528 + streamIdentification: this.subStream
  529 + }
  530 + }).then((res)=> {
  531 + console.log(JSON.stringify(res));
  532 + this.initData()
  533 + }).finally(()=>{
  534 + this.subStream = ""
  535 + })
  536 + }).catch(() => {
  537 + this.subStream = ""
  538 + });
  539 +
  540 + },
  541 + channelSubStreamChange: function (row) {
  542 + this.$axios({
  543 + method: 'post',
  544 + url: `/api/device/query/channel/stream/identification/update/`,
  545 + params: {
  546 + deviceId: this.deviceId,
  547 + channelId: row.channelId,
  548 + streamIdentification: row.streamIdentification
  549 + }
  550 + }).then(function (res) {
  551 + console.log(JSON.stringify(res));
  552 + });
  553 + },
498 refresh: function () { 554 refresh: function () {
499 this.initData(); 555 this.initData();
500 }, 556 },
web_src/src/components/dialog/deviceEdit.vue
@@ -58,12 +58,6 @@ @@ -58,12 +58,6 @@
58 <el-form-item v-if="form.subscribeCycleForMobilePosition > 0" label="移动位置报送间隔" prop="subscribeCycleForCatalog" > 58 <el-form-item v-if="form.subscribeCycleForMobilePosition > 0" label="移动位置报送间隔" prop="subscribeCycleForCatalog" >
59 <el-input v-model="form.mobilePositionSubmissionInterval" clearable ></el-input> 59 <el-input v-model="form.mobilePositionSubmissionInterval" clearable ></el-input>
60 </el-form-item> 60 </el-form-item>
61 - <el-form-item label="主子码流开关" prop="switchPrimarySubStream" >  
62 - <el-select v-model="form.switchPrimarySubStream" style="float: left; width: 100%" >  
63 - <el-option key="true" label="开启" :value="true"></el-option>  
64 - <el-option key="false" label="关闭" :value="false"></el-option>  
65 - </el-select>  
66 - </el-form-item>  
67 <el-form-item label="其他选项"> 61 <el-form-item label="其他选项">
68 <el-checkbox label="SSRC校验" v-model="form.ssrcCheck" style="float: left"></el-checkbox> 62 <el-checkbox label="SSRC校验" v-model="form.ssrcCheck" style="float: left"></el-checkbox>
69 <el-checkbox label="作为消息通道" v-model="form.asMessageChannel" style="float: left"></el-checkbox> 63 <el-checkbox label="作为消息通道" v-model="form.asMessageChannel" style="float: left"></el-checkbox>
数据库/2.7.0/初始化-mysql-2.7.0.sql 0 → 100644
  1 +/*建表*/
  2 +create table wvp_device (
  3 + id serial primary key ,
  4 + device_id character varying(50) not null ,
  5 + name character varying(255),
  6 + manufacturer character varying(255),
  7 + model character varying(255),
  8 + firmware character varying(255),
  9 + transport character varying(50),
  10 + stream_mode character varying(50),
  11 + on_line bool default false,
  12 + register_time character varying(50),
  13 + keepalive_time character varying(50),
  14 + ip character varying(50),
  15 + create_time character varying(50),
  16 + update_time character varying(50),
  17 + port integer,
  18 + expires integer,
  19 + subscribe_cycle_for_catalog integer DEFAULT 0,
  20 + subscribe_cycle_for_mobile_position integer DEFAULT 0,
  21 + mobile_position_submission_interval integer DEFAULT 5,
  22 + subscribe_cycle_for_alarm integer DEFAULT 0,
  23 + host_address character varying(50),
  24 + charset character varying(50),
  25 + ssrc_check bool default false,
  26 + geo_coord_sys character varying(50),
  27 + media_server_id character varying(50),
  28 + custom_name character varying(255),
  29 + sdp_ip character varying(50),
  30 + local_ip character varying(50),
  31 + password character varying(255),
  32 + as_message_channel bool default false,
  33 + keepalive_interval_time integer,
  34 + switch_primary_sub_stream bool default false,
  35 + broadcast_push_after_ack bool default false,
  36 + constraint uk_device_device unique (device_id)
  37 +);
  38 +
  39 +create table wvp_device_alarm (
  40 + id serial primary key ,
  41 + device_id character varying(50) not null,
  42 + channel_id character varying(50) not null,
  43 + alarm_priority character varying(50),
  44 + alarm_method character varying(50),
  45 + alarm_time character varying(50),
  46 + alarm_description character varying(255),
  47 + longitude double precision,
  48 + latitude double precision,
  49 + alarm_type character varying(50),
  50 + create_time character varying(50) not null
  51 +);
  52 +
  53 +create table wvp_device_channel (
  54 + id serial primary key ,
  55 + channel_id character varying(50) not null,
  56 + name character varying(255),
  57 + custom_name character varying(255),
  58 + manufacture character varying(50),
  59 + model character varying(50),
  60 + owner character varying(50),
  61 + civil_code character varying(50),
  62 + block character varying(50),
  63 + address character varying(50),
  64 + parent_id character varying(50),
  65 + safety_way integer,
  66 + register_way integer,
  67 + cert_num character varying(50),
  68 + certifiable integer,
  69 + err_code integer,
  70 + end_time character varying(50),
  71 + secrecy character varying(50),
  72 + ip_address character varying(50),
  73 + port integer,
  74 + password character varying(255),
  75 + ptz_type integer,
  76 + custom_ptz_type integer,
  77 + status bool default false,
  78 + longitude double precision,
  79 + custom_longitude double precision,
  80 + latitude double precision,
  81 + custom_latitude double precision,
  82 + stream_id character varying(255),
  83 + device_id character varying(50) not null,
  84 + parental character varying(50),
  85 + has_audio bool default false,
  86 + create_time character varying(50) not null,
  87 + update_time character varying(50) not null,
  88 + sub_count integer,
  89 + longitude_gcj02 double precision,
  90 + latitude_gcj02 double precision,
  91 + longitude_wgs84 double precision,
  92 + latitude_wgs84 double precision,
  93 + business_group_id character varying(50),
  94 + gps_time character varying(50),
  95 + stream_identification character varying(50),
  96 + constraint uk_wvp_device_channel_unique_device_channel unique (device_id, channel_id)
  97 +);
  98 +
  99 +create table wvp_device_mobile_position (
  100 + id serial primary key,
  101 + device_id character varying(50) not null,
  102 + channel_id character varying(50) not null,
  103 + device_name character varying(255),
  104 + time character varying(50),
  105 + longitude double precision,
  106 + latitude double precision,
  107 + altitude double precision,
  108 + speed double precision,
  109 + direction double precision,
  110 + report_source character varying(50),
  111 + longitude_gcj02 double precision,
  112 + latitude_gcj02 double precision,
  113 + longitude_wgs84 double precision,
  114 + latitude_wgs84 double precision,
  115 + create_time character varying(50)
  116 +);
  117 +
  118 +create table wvp_gb_stream (
  119 + gb_stream_id serial primary key,
  120 + app character varying(255) not null,
  121 + stream character varying(255) not null,
  122 + gb_id character varying(50) not null,
  123 + name character varying(255),
  124 + longitude double precision,
  125 + latitude double precision,
  126 + stream_type character varying(50),
  127 + media_server_id character varying(50),
  128 + create_time character varying(50),
  129 + constraint uk_gb_stream_unique_gb_id unique (gb_id),
  130 + constraint uk_gb_stream_unique_app_stream unique (app, stream)
  131 +);
  132 +
  133 +create table wvp_log (
  134 + id serial primary key ,
  135 + name character varying(50),
  136 + type character varying(50),
  137 + uri character varying(200),
  138 + address character varying(50),
  139 + result character varying(50),
  140 + timing bigint,
  141 + username character varying(50),
  142 + create_time character varying(50)
  143 +);
  144 +
  145 +create table wvp_media_server (
  146 + id character varying(255) primary key ,
  147 + ip character varying(50),
  148 + hook_ip character varying(50),
  149 + sdp_ip character varying(50),
  150 + stream_ip character varying(50),
  151 + http_port integer,
  152 + http_ssl_port integer,
  153 + rtmp_port integer,
  154 + rtmp_ssl_port integer,
  155 + rtp_proxy_port integer,
  156 + rtsp_port integer,
  157 + rtsp_ssl_port integer,
  158 + auto_config bool default false,
  159 + secret character varying(50),
  160 + rtp_enable bool default false,
  161 + rtp_port_range character varying(50),
  162 + send_rtp_port_range character varying(50),
  163 + record_assist_port integer,
  164 + default_server bool default false,
  165 + create_time character varying(50),
  166 + update_time character varying(50),
  167 + hook_alive_interval integer,
  168 + record_path character varying(255),
  169 + record_day integer default 7,
  170 + constraint uk_media_server_unique_ip_http_port unique (ip, http_port)
  171 +);
  172 +
  173 +create table wvp_platform (
  174 + id serial primary key ,
  175 + enable bool default false,
  176 + name character varying(255),
  177 + server_gb_id character varying(50),
  178 + server_gb_domain character varying(50),
  179 + server_ip character varying(50),
  180 + server_port integer,
  181 + device_gb_id character varying(50),
  182 + device_ip character varying(50),
  183 + device_port character varying(50),
  184 + username character varying(255),
  185 + password character varying(50),
  186 + expires character varying(50),
  187 + keep_timeout character varying(50),
  188 + transport character varying(50),
  189 + character_set character varying(50),
  190 + catalog_id character varying(50),
  191 + ptz bool default false,
  192 + rtcp bool default false,
  193 + status bool default false,
  194 + start_offline_push bool default false,
  195 + administrative_division character varying(50),
  196 + catalog_group integer,
  197 + create_time character varying(50),
  198 + update_time character varying(50),
  199 + as_message_channel bool default false,
  200 + auto_push_channel bool default false,
  201 + constraint uk_platform_unique_server_gb_id unique (server_gb_id)
  202 +);
  203 +
  204 +create table wvp_platform_catalog (
  205 + id character varying(50),
  206 + platform_id character varying(50),
  207 + name character varying(255),
  208 + parent_id character varying(50),
  209 + civil_code character varying(50),
  210 + business_group_id character varying(50),
  211 + constraint uk_platform_catalog_id_platform_id unique (id, platform_id)
  212 +);
  213 +
  214 +create table wvp_platform_gb_channel (
  215 + id serial primary key ,
  216 + platform_id character varying(50),
  217 + catalog_id character varying(50),
  218 + device_channel_id integer,
  219 + constraint uk_platform_gb_channel_platform_id_catalog_id_device_channel_id unique (platform_id, catalog_id, device_channel_id)
  220 +);
  221 +
  222 +create table wvp_platform_gb_stream (
  223 + id serial primary key,
  224 + platform_id character varying(50),
  225 + catalog_id character varying(50),
  226 + gb_stream_id integer,
  227 + constraint uk_platform_gb_stream_platform_id_catalog_id_gb_stream_id unique (platform_id, catalog_id, gb_stream_id)
  228 +);
  229 +
  230 +create table wvp_stream_proxy (
  231 + id serial primary key,
  232 + type character varying(50),
  233 + app character varying(255),
  234 + stream character varying(255),
  235 + url character varying(255),
  236 + src_url character varying(255),
  237 + dst_url character varying(255),
  238 + timeout_ms integer,
  239 + ffmpeg_cmd_key character varying(255),
  240 + rtp_type character varying(50),
  241 + media_server_id character varying(50),
  242 + enable_audio bool default false,
  243 + enable_mp4 bool default false,
  244 + enable bool default false,
  245 + status boolean,
  246 + enable_remove_none_reader bool default false,
  247 + create_time character varying(50),
  248 + name character varying(255),
  249 + update_time character varying(50),
  250 + stream_key character varying(255),
  251 + enable_disable_none_reader bool default false,
  252 + constraint uk_stream_proxy_app_stream unique (app, stream)
  253 +);
  254 +
  255 +create table wvp_stream_push (
  256 + id serial primary key,
  257 + app character varying(255),
  258 + stream character varying(255),
  259 + total_reader_count character varying(50),
  260 + origin_type integer,
  261 + origin_type_str character varying(50),
  262 + create_time character varying(50),
  263 + alive_second integer,
  264 + media_server_id character varying(50),
  265 + server_id character varying(50),
  266 + push_time character varying(50),
  267 + status bool default false,
  268 + update_time character varying(50),
  269 + push_ing bool default false,
  270 + self bool default false,
  271 + constraint uk_stream_push_app_stream unique (app, stream)
  272 +);
  273 +create table wvp_cloud_record (
  274 + id serial primary key,
  275 + app character varying(255),
  276 + stream character varying(255),
  277 + call_id character varying(255),
  278 + start_time bigint,
  279 + end_time bigint,
  280 + media_server_id character varying(50),
  281 + file_name character varying(255),
  282 + folder character varying(255),
  283 + file_path character varying(255),
  284 + collect bool default false,
  285 + file_size bigint,
  286 + time_len bigint,
  287 + constraint uk_stream_push_app_stream_path unique (app, stream, file_path)
  288 +);
  289 +
  290 +create table wvp_user (
  291 + id serial primary key,
  292 + username character varying(255),
  293 + password character varying(255),
  294 + role_id integer,
  295 + create_time character varying(50),
  296 + update_time character varying(50),
  297 + push_key character varying(50),
  298 + constraint uk_user_username unique (username)
  299 +);
  300 +
  301 +create table wvp_user_role (
  302 + id serial primary key,
  303 + name character varying(50),
  304 + authority character varying(50),
  305 + create_time character varying(50),
  306 + update_time character varying(50)
  307 +);
  308 +create table wvp_resources_tree (
  309 + id serial primary key ,
  310 + is_catalog bool default true,
  311 + device_channel_id integer ,
  312 + gb_stream_id integer,
  313 + name character varying(255),
  314 + parentId integer,
  315 + path character varying(255)
  316 +);
  317 +
  318 +
  319 +/*初始数据*/
  320 +INSERT INTO wvp_user VALUES (1, 'admin','21232f297a57a5a743894a0e4a801fc3',1,'2021-04-13 14:14:57','2021-04-13 14:14:57','3e80d1762a324d5b0ff636e0bd16f1e3');
  321 +INSERT INTO wvp_user_role VALUES (1, 'admin','0','2021-04-13 14:14:57','2021-04-13 14:14:57');
  322 +
  323 +
  324 +
数据库/2.7.0/初始化-postgresql-kingbase-2.7.0.sql 0 → 100644
  1 +/*建表*/
  2 +create table wvp_device (
  3 + id serial primary key ,
  4 + device_id character varying(50) not null ,
  5 + name character varying(255),
  6 + manufacturer character varying(255),
  7 + model character varying(255),
  8 + firmware character varying(255),
  9 + transport character varying(50),
  10 + stream_mode character varying(50),
  11 + on_line bool default false,
  12 + register_time character varying(50),
  13 + keepalive_time character varying(50),
  14 + ip character varying(50),
  15 + create_time character varying(50),
  16 + update_time character varying(50),
  17 + port integer,
  18 + expires integer,
  19 + subscribe_cycle_for_catalog integer DEFAULT 0,
  20 + subscribe_cycle_for_mobile_position integer DEFAULT 0,
  21 + mobile_position_submission_interval integer DEFAULT 5,
  22 + subscribe_cycle_for_alarm integer DEFAULT 0,
  23 + host_address character varying(50),
  24 + charset character varying(50),
  25 + ssrc_check bool default false,
  26 + geo_coord_sys character varying(50),
  27 + media_server_id character varying(50),
  28 + custom_name character varying(255),
  29 + sdp_ip character varying(50),
  30 + local_ip character varying(50),
  31 + password character varying(255),
  32 + as_message_channel bool default false,
  33 + keepalive_interval_time integer,
  34 + switch_primary_sub_stream bool default false,
  35 + broadcast_push_after_ack bool default false,
  36 + constraint uk_device_device unique (device_id)
  37 +);
  38 +
  39 +create table wvp_device_alarm (
  40 + id serial primary key ,
  41 + device_id character varying(50) not null,
  42 + channel_id character varying(50) not null,
  43 + alarm_priority character varying(50),
  44 + alarm_method character varying(50),
  45 + alarm_time character varying(50),
  46 + alarm_description character varying(255),
  47 + longitude double precision,
  48 + latitude double precision,
  49 + alarm_type character varying(50),
  50 + create_time character varying(50) not null
  51 +);
  52 +
  53 +create table wvp_device_channel (
  54 + id serial primary key ,
  55 + channel_id character varying(50) not null,
  56 + name character varying(255),
  57 + custom_name character varying(255),
  58 + manufacture character varying(50),
  59 + model character varying(50),
  60 + owner character varying(50),
  61 + civil_code character varying(50),
  62 + block character varying(50),
  63 + address character varying(50),
  64 + parent_id character varying(50),
  65 + safety_way integer,
  66 + register_way integer,
  67 + cert_num character varying(50),
  68 + certifiable integer,
  69 + err_code integer,
  70 + end_time character varying(50),
  71 + secrecy character varying(50),
  72 + ip_address character varying(50),
  73 + port integer,
  74 + password character varying(255),
  75 + ptz_type integer,
  76 + custom_ptz_type integer,
  77 + status bool default false,
  78 + longitude double precision,
  79 + custom_longitude double precision,
  80 + latitude double precision,
  81 + custom_latitude double precision,
  82 + stream_id character varying(255),
  83 + device_id character varying(50) not null,
  84 + parental character varying(50),
  85 + has_audio bool default false,
  86 + create_time character varying(50) not null,
  87 + update_time character varying(50) not null,
  88 + sub_count integer,
  89 + longitude_gcj02 double precision,
  90 + latitude_gcj02 double precision,
  91 + longitude_wgs84 double precision,
  92 + latitude_wgs84 double precision,
  93 + business_group_id character varying(50),
  94 + gps_time character varying(50),
  95 + stream_identification character varying(50),
  96 + constraint uk_wvp_device_channel_unique_device_channel unique (device_id, channel_id)
  97 +);
  98 +
  99 +create table wvp_device_mobile_position (
  100 + id serial primary key,
  101 + device_id character varying(50) not null,
  102 + channel_id character varying(50) not null,
  103 + device_name character varying(255),
  104 + time character varying(50),
  105 + longitude double precision,
  106 + latitude double precision,
  107 + altitude double precision,
  108 + speed double precision,
  109 + direction double precision,
  110 + report_source character varying(50),
  111 + longitude_gcj02 double precision,
  112 + latitude_gcj02 double precision,
  113 + longitude_wgs84 double precision,
  114 + latitude_wgs84 double precision,
  115 + create_time character varying(50)
  116 +);
  117 +
  118 +create table wvp_gb_stream (
  119 + gb_stream_id serial primary key,
  120 + app character varying(255) not null,
  121 + stream character varying(255) not null,
  122 + gb_id character varying(50) not null,
  123 + name character varying(255),
  124 + longitude double precision,
  125 + latitude double precision,
  126 + stream_type character varying(50),
  127 + media_server_id character varying(50),
  128 + create_time character varying(50),
  129 + constraint uk_gb_stream_unique_gb_id unique (gb_id),
  130 + constraint uk_gb_stream_unique_app_stream unique (app, stream)
  131 +);
  132 +
  133 +create table wvp_log (
  134 + id serial primary key ,
  135 + name character varying(50),
  136 + type character varying(50),
  137 + uri character varying(200),
  138 + address character varying(50),
  139 + result character varying(50),
  140 + timing bigint,
  141 + username character varying(50),
  142 + create_time character varying(50)
  143 +);
  144 +
  145 +create table wvp_media_server (
  146 + id character varying(255) primary key ,
  147 + ip character varying(50),
  148 + hook_ip character varying(50),
  149 + sdp_ip character varying(50),
  150 + stream_ip character varying(50),
  151 + http_port integer,
  152 + http_ssl_port integer,
  153 + rtmp_port integer,
  154 + rtmp_ssl_port integer,
  155 + rtp_proxy_port integer,
  156 + rtsp_port integer,
  157 + rtsp_ssl_port integer,
  158 + auto_config bool default false,
  159 + secret character varying(50),
  160 + rtp_enable bool default false,
  161 + rtp_port_range character varying(50),
  162 + send_rtp_port_range character varying(50),
  163 + record_assist_port integer,
  164 + default_server bool default false,
  165 + create_time character varying(50),
  166 + update_time character varying(50),
  167 + hook_alive_interval integer,
  168 + record_path character varying(255),
  169 + record_day integer default 7,
  170 + constraint uk_media_server_unique_ip_http_port unique (ip, http_port)
  171 +);
  172 +
  173 +create table wvp_platform (
  174 + id serial primary key ,
  175 + enable bool default false,
  176 + name character varying(255),
  177 + server_gb_id character varying(50),
  178 + server_gb_domain character varying(50),
  179 + server_ip character varying(50),
  180 + server_port integer,
  181 + device_gb_id character varying(50),
  182 + device_ip character varying(50),
  183 + device_port character varying(50),
  184 + username character varying(255),
  185 + password character varying(50),
  186 + expires character varying(50),
  187 + keep_timeout character varying(50),
  188 + transport character varying(50),
  189 + character_set character varying(50),
  190 + catalog_id character varying(50),
  191 + ptz bool default false,
  192 + rtcp bool default false,
  193 + status bool default false,
  194 + start_offline_push bool default false,
  195 + administrative_division character varying(50),
  196 + catalog_group integer,
  197 + create_time character varying(50),
  198 + update_time character varying(50),
  199 + as_message_channel bool default false,
  200 + auto_push_channel bool default false,
  201 + constraint uk_platform_unique_server_gb_id unique (server_gb_id)
  202 +);
  203 +
  204 +create table wvp_platform_catalog (
  205 + id character varying(50),
  206 + platform_id character varying(50),
  207 + name character varying(255),
  208 + parent_id character varying(50),
  209 + civil_code character varying(50),
  210 + business_group_id character varying(50),
  211 + constraint uk_platform_catalog_id_platform_id unique (id, platform_id)
  212 +);
  213 +
  214 +create table wvp_platform_gb_channel (
  215 + id serial primary key ,
  216 + platform_id character varying(50),
  217 + catalog_id character varying(50),
  218 + device_channel_id integer,
  219 + constraint uk_platform_gb_channel_platform_id_catalog_id_device_channel_id unique (platform_id, catalog_id, device_channel_id)
  220 +);
  221 +
  222 +create table wvp_platform_gb_stream (
  223 + id serial primary key,
  224 + platform_id character varying(50),
  225 + catalog_id character varying(50),
  226 + gb_stream_id integer,
  227 + constraint uk_platform_gb_stream_platform_id_catalog_id_gb_stream_id unique (platform_id, catalog_id, gb_stream_id)
  228 +);
  229 +
  230 +create table wvp_stream_proxy (
  231 + id serial primary key,
  232 + type character varying(50),
  233 + app character varying(255),
  234 + stream character varying(255),
  235 + url character varying(255),
  236 + src_url character varying(255),
  237 + dst_url character varying(255),
  238 + timeout_ms integer,
  239 + ffmpeg_cmd_key character varying(255),
  240 + rtp_type character varying(50),
  241 + media_server_id character varying(50),
  242 + enable_audio bool default false,
  243 + enable_mp4 bool default false,
  244 + enable bool default false,
  245 + status boolean,
  246 + enable_remove_none_reader bool default false,
  247 + create_time character varying(50),
  248 + name character varying(255),
  249 + update_time character varying(50),
  250 + stream_key character varying(255),
  251 + enable_disable_none_reader bool default false,
  252 + constraint uk_stream_proxy_app_stream unique (app, stream)
  253 +);
  254 +
  255 +create table wvp_stream_push (
  256 + id serial primary key,
  257 + app character varying(255),
  258 + stream character varying(255),
  259 + total_reader_count character varying(50),
  260 + origin_type integer,
  261 + origin_type_str character varying(50),
  262 + create_time character varying(50),
  263 + alive_second integer,
  264 + media_server_id character varying(50),
  265 + server_id character varying(50),
  266 + push_time character varying(50),
  267 + status bool default false,
  268 + update_time character varying(50),
  269 + push_ing bool default false,
  270 + self bool default false,
  271 + constraint uk_stream_push_app_stream unique (app, stream)
  272 +);
  273 +create table wvp_cloud_record (
  274 + id serial primary key,
  275 + app character varying(255),
  276 + stream character varying(255),
  277 + call_id character varying(255),
  278 + start_time int8,
  279 + end_time int8,
  280 + media_server_id character varying(50),
  281 + file_name character varying(255),
  282 + folder character varying(255),
  283 + file_path character varying(255),
  284 + collect bool default false,
  285 + file_size int8,
  286 + time_len int8,
  287 + constraint uk_stream_push_app_stream_path unique (app, stream, file_path)
  288 +);
  289 +
  290 +create table wvp_user (
  291 + id serial primary key,
  292 + username character varying(255),
  293 + password character varying(255),
  294 + role_id integer,
  295 + create_time character varying(50),
  296 + update_time character varying(50),
  297 + push_key character varying(50),
  298 + constraint uk_user_username unique (username)
  299 +);
  300 +
  301 +create table wvp_user_role (
  302 + id serial primary key,
  303 + name character varying(50),
  304 + authority character varying(50),
  305 + create_time character varying(50),
  306 + update_time character varying(50)
  307 +);
  308 +create table wvp_resources_tree (
  309 + id serial primary key ,
  310 + is_catalog bool default true,
  311 + device_channel_id integer ,
  312 + gb_stream_id integer,
  313 + name character varying(255),
  314 + parentId integer,
  315 + path character varying(255)
  316 +);
  317 +
  318 +
  319 +/*初始数据*/
  320 +INSERT INTO wvp_user VALUES (1, 'admin','21232f297a57a5a743894a0e4a801fc3',1,'2021-04-13 14:14:57','2021-04-13 14:14:57','3e80d1762a324d5b0ff636e0bd16f1e3');
  321 +INSERT INTO wvp_user_role VALUES (1, 'admin','0','2021-04-13 14:14:57','2021-04-13 14:14:57');
  322 +
  323 +
  324 +
数据库/2.7.0/更新-mysql-2.7.0.sql 0 → 100644
  1 +alter table wvp_device_channel
  2 + add stream_identification character varying(50);
  3 +
  4 +alter table wvp_device
  5 + drop switch_primary_sub_stream;
0 \ No newline at end of file 6 \ No newline at end of file
数据库/2.7.0/更新-postgresql-kingbase-2.7.0.sql 0 → 100644
  1 +alter table wvp_device_channel
  2 + add stream_identification character varying(50);
  3 +
  4 +alter table wvp_device
  5 + drop switch_primary_sub_stream;
0 \ No newline at end of file 6 \ No newline at end of file