Merge branch 'wvp-28181-2.0' into main-dev
# Conflicts: # src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java # src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java # src/main/java/com/genersoft/iot/vmp/gb28181/transmit/callback/DeferredResultHolder.java # src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommanderForPlatform.java # src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java # src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/InviteResponseProcessor.java # src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java # src/main/java/com/genersoft/iot/vmp/service/IPlayService.java # src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java # src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java # src/main/resources/all-application.yml # web_src/config/index.js # web_src/src/components/dialog/devicePlayer.vue
This commit is contained in:
@@ -102,7 +102,7 @@ public class MobilePositionController {
|
||||
public DeferredResult<MobilePosition> realTimePosition(@PathVariable String deviceId) {
|
||||
Device device = storager.queryVideoDevice(deviceId);
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
String key = DeferredResultHolder.CALLBACK_CMD_MOBILEPOSITION + deviceId;
|
||||
String key = DeferredResultHolder.CALLBACK_CMD_MOBILE_POSITION + deviceId;
|
||||
try {
|
||||
cmder.mobilePostitionQuery(device, event -> {
|
||||
RequestMessage msg = new RequestMessage();
|
||||
|
||||
@@ -466,10 +466,12 @@ public class DeviceQuery {
|
||||
@Operation(summary = "请求截图")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
public void getSnap(HttpServletResponse resp, @PathVariable String deviceId, @PathVariable String channelId) {
|
||||
@Parameter(name = "mark", description = "标识", required = false)
|
||||
public void getSnap(HttpServletResponse resp, @PathVariable String deviceId, @PathVariable String channelId, @RequestParam(required = false) String mark) {
|
||||
|
||||
try {
|
||||
final InputStream in = Files.newInputStream(new File("snap" + File.separator + deviceId + "_" + channelId + ".jpg").toPath());
|
||||
|
||||
final InputStream in = Files.newInputStream(new File("snap" + File.separator + deviceId + "_" + channelId + (mark == null? ".jpg": ("_" + mark + ".jpg"))).toPath());
|
||||
resp.setContentType(MediaType.IMAGE_PNG_VALUE);
|
||||
IOUtils.copy(in, resp.getOutputStream());
|
||||
} catch (IOException e) {
|
||||
|
||||
@@ -403,8 +403,12 @@ public class PlatformController {
|
||||
if (platform == null) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "平台未找到");
|
||||
}
|
||||
if (platformId.equals(parentId)) {
|
||||
parentId = platform.getDeviceGBId();
|
||||
// if (platformId.equals(parentId)) {
|
||||
// parentId = platform.getDeviceGBId();
|
||||
// }
|
||||
|
||||
if (platformId.equals(platform.getDeviceGBId())) {
|
||||
parentId = null;
|
||||
}
|
||||
|
||||
return storager.getChildrenCatalogByPlatform(platformId, parentId);
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.genersoft.iot.vmp.service.IPlayService;
|
||||
import com.genersoft.iot.vmp.service.bean.InviteErrorCode;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.*;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
|
||||
@@ -129,7 +130,7 @@ public class PlayController {
|
||||
if (data != null) {
|
||||
StreamInfo streamInfo = (StreamInfo)data;
|
||||
if (userSetting.getUseSourceIpAsStreamIp()) {
|
||||
streamInfo.channgeStreamIp(request.getLocalName());
|
||||
streamInfo.channgeStreamIp(request.getLocalAddr());
|
||||
}
|
||||
wvpResult.setData(new StreamContent(streamInfo));
|
||||
}
|
||||
@@ -146,8 +147,9 @@ public class PlayController {
|
||||
@Operation(summary = "停止点播")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "isSubStream", description = "是否子码流(true-子码流,false-主码流),默认为false", required = true)
|
||||
@GetMapping("/stop/{deviceId}/{channelId}")
|
||||
public JSONObject playStop(@PathVariable String deviceId, @PathVariable String channelId) {
|
||||
public JSONObject playStop(@PathVariable String deviceId, @PathVariable String channelId,boolean isSubStream) {
|
||||
|
||||
logger.debug(String.format("设备预览/回放停止API调用,streamId:%s_%s", deviceId, channelId ));
|
||||
|
||||
@@ -174,11 +176,12 @@ public class PlayController {
|
||||
}
|
||||
}
|
||||
inviteStreamService.removeInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, deviceId, channelId);
|
||||
|
||||
storager.stopPlay(deviceId, channelId);
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("deviceId", deviceId);
|
||||
json.put("channelId", channelId);
|
||||
json.put("isSubStream", isSubStream);
|
||||
return json;
|
||||
}
|
||||
|
||||
@@ -316,5 +319,36 @@ public class PlayController {
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
@Operation(summary = "获取截图")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "isSubStream", description = "是否子码流(true-子码流,false-主码流),默认为false", required = true)
|
||||
@GetMapping("/snap")
|
||||
public DeferredResult<String> getSnap(String deviceId, String channelId,boolean isSubStream) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("获取截图: {}/{}", deviceId, channelId);
|
||||
}
|
||||
|
||||
DeferredResult<String> result = new DeferredResult<>(3 * 1000L);
|
||||
String key = DeferredResultHolder.CALLBACK_CMD_SNAP + deviceId;
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
resultHolder.put(key, uuid, result);
|
||||
|
||||
RequestMessage message = new RequestMessage();
|
||||
message.setKey(key);
|
||||
message.setId(uuid);
|
||||
|
||||
String fileName = deviceId + "_" + channelId + "_" + DateUtil.getNowForUrl() + "jpg";
|
||||
playService.getSnap(deviceId, channelId, fileName, (code, msg, data) -> {
|
||||
if (code == InviteErrorCode.SUCCESS.getCode()) {
|
||||
message.setData(data);
|
||||
}else {
|
||||
message.setData(WVPResult.fail(code, msg));
|
||||
}
|
||||
resultHolder.invokeResult(message);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ public class PlaybackController {
|
||||
if (data != null) {
|
||||
StreamInfo streamInfo = (StreamInfo)data;
|
||||
if (userSetting.getUseSourceIpAsStreamIp()) {
|
||||
streamInfo.channgeStreamIp(request.getLocalName());
|
||||
streamInfo.channgeStreamIp(request.getLocalAddr());
|
||||
}
|
||||
wvpResult.setData(new StreamContent(streamInfo));
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ public class GBRecordController {
|
||||
if (data != null) {
|
||||
StreamInfo streamInfo = (StreamInfo)data;
|
||||
if (userSetting.getUseSourceIpAsStreamIp()) {
|
||||
streamInfo.channgeStreamIp(request.getLocalName());
|
||||
streamInfo.channgeStreamIp(request.getLocalAddr());
|
||||
}
|
||||
wvpResult.setData(new StreamContent(streamInfo));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user