优化编码信息的展示
This commit is contained in:
@@ -33,6 +33,10 @@ public class MediaInfo {
|
||||
private Integer width;
|
||||
@Schema(description = "视频高度")
|
||||
private Integer height;
|
||||
@Schema(description = "FPS")
|
||||
private Integer fps;
|
||||
@Schema(description = "丢包率")
|
||||
private Integer loss;
|
||||
@Schema(description = "音频编码类型")
|
||||
private String audioCodec;
|
||||
@Schema(description = "音频通道数")
|
||||
@@ -58,6 +62,7 @@ public class MediaInfo {
|
||||
@Schema(description = "服务ID")
|
||||
private String serverId;
|
||||
|
||||
|
||||
public static MediaInfo getInstance(JSONObject jsonObject, MediaServer mediaServer, String serverId) {
|
||||
MediaInfo mediaInfo = new MediaInfo();
|
||||
mediaInfo.setMediaServer(mediaServer);
|
||||
@@ -112,6 +117,13 @@ public class MediaInfo {
|
||||
Integer sampleRate = trackJson.getInteger("sample_rate");
|
||||
Integer height = trackJson.getInteger("height");
|
||||
Integer width = trackJson.getInteger("height");
|
||||
Integer fps = trackJson.getInteger("fps");
|
||||
Integer loss = trackJson.getInteger("loss");
|
||||
Integer frames = trackJson.getInteger("frames");
|
||||
Long keyFrames = trackJson.getLongValue("key_frames");
|
||||
Integer gop_interval_ms = trackJson.getInteger("gop_interval_ms");
|
||||
Long gop_size = trackJson.getLongValue("gop_size");
|
||||
|
||||
Long duration = trackJson.getLongValue("duration");
|
||||
if (channels != null) {
|
||||
mediaInfo.setAudioChannels(channels);
|
||||
@@ -125,6 +137,12 @@ public class MediaInfo {
|
||||
if (width != null) {
|
||||
mediaInfo.setWidth(width);
|
||||
}
|
||||
if (fps != null) {
|
||||
mediaInfo.setFps(fps);
|
||||
}
|
||||
if (loss != null) {
|
||||
mediaInfo.setLoss(loss);
|
||||
}
|
||||
if (duration > 0L) {
|
||||
mediaInfo.setDuration(duration);
|
||||
}
|
||||
|
||||
@@ -118,15 +118,6 @@ public class ZLMHttpHookListener {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* rtsp/rtmp流注册或注销时触发此事件;此事件对回复不敏感。
|
||||
*/
|
||||
// @ResponseBody
|
||||
// @PostMapping(value = "/on_stream_changed", produces = "application/json;charset=UTF-8")
|
||||
// public HookResult onStreamChanged(@RequestBody JSONObject param) {
|
||||
// System.out.println(11);
|
||||
// return HookResult.SUCCESS();
|
||||
// }
|
||||
/**
|
||||
* rtsp/rtmp流注册或注销时触发此事件;此事件对回复不敏感。
|
||||
*/
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||
import com.genersoft.iot.vmp.conf.security.JwtUtils;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IDeviceChannelService;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IDeviceService;
|
||||
import com.genersoft.iot.vmp.media.bean.MediaInfo;
|
||||
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
||||
import com.genersoft.iot.vmp.media.event.mediaServer.MediaServerChangeEvent;
|
||||
import com.genersoft.iot.vmp.media.service.IMediaServerService;
|
||||
@@ -162,6 +163,20 @@ public class ServerController {
|
||||
mediaServerService.delete(mediaServer);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取流信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "app", description = "应用名", required = true)
|
||||
@Parameter(name = "stream", description = "流ID", required = true)
|
||||
@Parameter(name = "mediaServerId", description = "流媒体ID", required = true)
|
||||
@GetMapping(value = "/media_server/media_info")
|
||||
@ResponseBody
|
||||
public MediaInfo getMediaInfo(String app, String stream, String mediaServerId) {
|
||||
MediaServer mediaServer = mediaServerService.getOne(mediaServerId);
|
||||
if (mediaServer == null) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "流媒体不存在");
|
||||
}
|
||||
return mediaServerService.getMediaInfo(mediaServer, app, stream);
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "重启服务", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@GetMapping(value = "/restart")
|
||||
|
||||
Reference in New Issue
Block a user