临时提交

This commit is contained in:
lin
2025-10-11 21:37:41 +08:00
parent da9aaadda0
commit 29099cbaa4
5 changed files with 44 additions and 13 deletions

View File

@@ -111,6 +111,9 @@ public class StreamContent {
@Schema(description = "拉流代理返回的KEY")
private String key;
@Schema(description = "使用的WVP ID")
private String serverId;
public StreamContent(StreamInfo streamInfo) {
if (streamInfo == null) {
return;
@@ -190,6 +193,7 @@ public class StreamContent {
this.progress = streamInfo.getProgress();
this.duration = streamInfo.getDuration();
this.key = streamInfo.getKey();
this.serverId = streamInfo.getServerId();
if (streamInfo.getDownLoadFilePath() != null) {
this.downLoadFilePath = streamInfo.getDownLoadFilePath();

View File

@@ -3,14 +3,12 @@ package com.genersoft.iot.vmp.web.custom;
import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.conf.security.JwtUtils;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
import com.genersoft.iot.vmp.service.bean.InviteErrorCode;
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
import com.genersoft.iot.vmp.web.custom.bean.CameraChannel;
import com.genersoft.iot.vmp.web.custom.bean.CameraStreamContent;
import com.genersoft.iot.vmp.web.custom.bean.IdsQueryParam;
import com.genersoft.iot.vmp.web.custom.bean.PolygonQueryParam;
import com.genersoft.iot.vmp.web.custom.bean.*;
import com.genersoft.iot.vmp.web.custom.service.CameraChannelService;
import com.github.pagehelper.PageInfo;
import io.swagger.v3.oas.annotations.Operation;
@@ -189,10 +187,12 @@ public class CameraChannelController {
log.info("[SY-播放摄像头] API调用deviceId{} deviceCode{} ",deviceId, deviceCode);
DeferredResult<WVPResult<CameraStreamContent>> result = new DeferredResult<>(userSetting.getPlayTimeout().longValue());
ErrorCallback<StreamInfo> callback = (code, msg, streamInfo) -> {
ErrorCallback<CameraStreamInfo> callback = (code, msg, cameraStreamInfo) -> {
if (code == InviteErrorCode.SUCCESS.getCode()) {
StreamInfo streamInfo = cameraStreamInfo.getStreamInfo();
CommonGBChannel channel = cameraStreamInfo.getChannel();
WVPResult<CameraStreamContent> wvpResult = WVPResult.success();
if (streamInfo != null) {
if (cameraStreamInfo.getStreamInfo() != null) {
if (userSetting.getUseSourceIpAsStreamIp()) {
streamInfo=streamInfo.clone();//深拷贝
String host;
@@ -208,7 +208,12 @@ public class CameraChannelController {
&& !"null".equalsIgnoreCase(streamInfo.getMediaServer().getTranscodeSuffix())) {
streamInfo.setStream(streamInfo.getStream() + "_" + streamInfo.getMediaServer().getTranscodeSuffix());
}
wvpResult.setData(new CameraStreamContent(streamInfo));
CameraStreamContent cameraStreamContent = new CameraStreamContent(streamInfo);
cameraStreamContent.setName(channel.getGbName());
cameraStreamContent.setControlType(
(channel.getGbPtzType() == 1 || channel.getGbPtzType() == 4 || channel.getGbPtzType() == 5) ? 1 : 0);
wvpResult.setData(cameraStreamContent);
}else {
wvpResult.setCode(code);
wvpResult.setMsg(msg);

View File

@@ -13,12 +13,10 @@ public class CameraStreamContent extends StreamContent {
super(streamInfo);
}
private String name;
// 0不可动1可动
private Integer controltype;
private Integer controlType;
}

View File

@@ -0,0 +1,22 @@
package com.genersoft.iot.vmp.web.custom.bean;
import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class CameraStreamInfo {
private CommonGBChannel channel;
private StreamInfo streamInfo;
public CameraStreamInfo(CommonGBChannel channel, StreamInfo streamInfo) {
this.channel = channel;
this.streamInfo = streamInfo;
}
}

View File

@@ -2,7 +2,6 @@ package com.genersoft.iot.vmp.web.custom.service;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.conf.DynamicTask;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
@@ -18,6 +17,7 @@ import com.genersoft.iot.vmp.utils.Coordtransform;
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
import com.genersoft.iot.vmp.web.custom.bean.CameraChannel;
import com.genersoft.iot.vmp.web.custom.bean.CameraGroup;
import com.genersoft.iot.vmp.web.custom.bean.CameraStreamInfo;
import com.genersoft.iot.vmp.web.custom.bean.Point;
import com.genersoft.iot.vmp.web.custom.conf.SyTokenManager;
import com.github.pagehelper.PageHelper;
@@ -231,10 +231,12 @@ public class CameraChannelService implements CommandLineRunner {
* @param deviceCode 通道对应的国标设备的编号
* @param callback 点播结果的回放
*/
public void play(String deviceId, String deviceCode, ErrorCallback<StreamInfo> callback) {
public void play(String deviceId, String deviceCode, ErrorCallback<CameraStreamInfo> callback) {
CommonGBChannel channel = channelMapper.queryGbChannelByChannelDeviceIdAndGbDeviceId(deviceId, deviceCode);
Assert.notNull(channel, "通道不存在");
channelPlayService.play(channel, null, userSetting.getRecordSip(), callback);
channelPlayService.play(channel, null, userSetting.getRecordSip(), (code, msg, data) -> {
callback.run(code, msg, new CameraStreamInfo(channel, data));
});
}
/**