zlm getMediaList api
This commit is contained in:
parent
ac2662b8ed
commit
431d6f90cb
@ -0,0 +1,29 @@
|
||||
package cn.skcks.docking.gb28181.media.dto.media;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class GetMediaList {
|
||||
/**
|
||||
* 筛选协议,例如 rtsp或rtmp
|
||||
*/
|
||||
private String schema;
|
||||
/**
|
||||
* 筛选虚拟主机,例如__defaultVhost__
|
||||
*/
|
||||
private String vhost;
|
||||
/**
|
||||
* 筛选应用名,例如 live
|
||||
*/
|
||||
private String app;
|
||||
/**
|
||||
* 筛选流id,例如 test
|
||||
*/
|
||||
private String stream;
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package cn.skcks.docking.gb28181.media.dto.media;
|
||||
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 客户端和服务器网络信息
|
||||
*/
|
||||
@Data
|
||||
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
|
||||
public class MediaOriginSock {
|
||||
private String identifier;
|
||||
private String localIp;
|
||||
private Integer localPort;
|
||||
private String peerIp;
|
||||
private Integer peerPort;
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package cn.skcks.docking.gb28181.media.dto.media;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class MediaResp {
|
||||
/**
|
||||
* 应用名
|
||||
*/
|
||||
private String app;
|
||||
/**
|
||||
* 本协议观看人数
|
||||
*/
|
||||
private Long readerCount;
|
||||
/**
|
||||
* 观看总人数,包括hls/rtsp/rtmp/http-flv/ws-flv
|
||||
*/
|
||||
private Long totalReaderCount;
|
||||
/**
|
||||
* 协议
|
||||
*/
|
||||
private String schema;
|
||||
/**
|
||||
* 流id
|
||||
*/
|
||||
private String stream;
|
||||
/**
|
||||
* 客户端和服务器网络信息
|
||||
*/
|
||||
private MediaOriginSock originSock;
|
||||
/**
|
||||
* <p>产生源类型</p>
|
||||
* unknown = 0,rtmp_push=1,rtsp_push=2,rtp_push=3,pull=4,ffmpeg_pull=5,mp4_vod=6,device_chn=7
|
||||
*/
|
||||
private Integer originType;
|
||||
private String originTypeStr;
|
||||
/**
|
||||
* 产生源的url
|
||||
*/
|
||||
private String originUrl;
|
||||
/**
|
||||
* GMT unix系统时间戳,单位秒
|
||||
*/
|
||||
private Long createStamp;
|
||||
/**
|
||||
* 存活时间,单位秒
|
||||
*/
|
||||
private Long aliveSecond;
|
||||
/**
|
||||
* 数据产生速度,单位byte/s
|
||||
*/
|
||||
private Long bytesSpeed;
|
||||
/**
|
||||
* 音视频轨道
|
||||
*/
|
||||
private List<MediaTrack> tracks;
|
||||
/**
|
||||
* 虚拟主机名
|
||||
*/
|
||||
private String vhost;
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package cn.skcks.docking.gb28181.media.dto.media;
|
||||
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
|
||||
public class MediaTrack {
|
||||
/**
|
||||
* 音频通道数
|
||||
*/
|
||||
private Integer channels;
|
||||
/**
|
||||
* H264 = 0, H265 = 1, AAC = 2, G711A = 3, G711U = 4
|
||||
*/
|
||||
private Integer codecId;
|
||||
/**
|
||||
* 编码类型名称
|
||||
*/
|
||||
private String codecIdName;
|
||||
/**
|
||||
* Video = 0, Audio = 1
|
||||
*/
|
||||
private Integer codecType;
|
||||
private Integer fps;
|
||||
/**
|
||||
* 累计接收帧数,不包含sei/aud/sps/pps等不能解码的帧
|
||||
*/
|
||||
private Long frames;
|
||||
/**
|
||||
* gop间隔时间,单位毫秒
|
||||
*/
|
||||
private Long gopIntervalMs;
|
||||
/**
|
||||
* gop大小,单位帧数
|
||||
*/
|
||||
private Long gopSize;
|
||||
/**
|
||||
* 累计接收关键帧数
|
||||
*/
|
||||
private Long keyFrames;
|
||||
/**
|
||||
* 轨道是否准备就绪
|
||||
*/
|
||||
private Boolean ready;
|
||||
/**
|
||||
* 视频高
|
||||
*/
|
||||
private Integer height;
|
||||
/**
|
||||
* 视频宽
|
||||
*/
|
||||
private Integer width;
|
||||
/**
|
||||
* 音频采样位数
|
||||
*/
|
||||
private Integer sampleBit;
|
||||
/**
|
||||
* 音频采样率
|
||||
*/
|
||||
private Integer sampleRate;
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
package cn.skcks.docking.gb28181.media.proxy;
|
||||
|
||||
import cn.skcks.docking.gb28181.media.dto.config.ServerConfig;
|
||||
import cn.skcks.docking.gb28181.media.dto.media.GetMediaList;
|
||||
import cn.skcks.docking.gb28181.media.dto.media.MediaResp;
|
||||
import cn.skcks.docking.gb28181.media.dto.proxy.*;
|
||||
import cn.skcks.docking.gb28181.media.dto.response.ZlmResponse;
|
||||
import cn.skcks.docking.gb28181.media.dto.rtp.*;
|
||||
@ -69,4 +71,7 @@ public interface ZlmMediaHttpClient {
|
||||
|
||||
@GetMapping("/index/api/delStreamProxy")
|
||||
ZlmResponse<DelStreamProxyResp> delStreamProxy(@RequestParam String secret, @RequestParam String key);
|
||||
|
||||
@PostMapping("/index/api/getMediaList")
|
||||
ZlmResponse<List<MediaResp>> getMediaList(@RequestParam String secret,@RequestBody GetMediaList params);
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package cn.skcks.docking.gb28181.media.proxy;
|
||||
|
||||
import cn.skcks.docking.gb28181.media.dto.config.ServerConfig;
|
||||
import cn.skcks.docking.gb28181.media.dto.media.GetMediaList;
|
||||
import cn.skcks.docking.gb28181.media.dto.media.MediaResp;
|
||||
import cn.skcks.docking.gb28181.media.dto.proxy.*;
|
||||
import cn.skcks.docking.gb28181.media.dto.response.ZlmResponse;
|
||||
import cn.skcks.docking.gb28181.media.dto.rtp.*;
|
||||
@ -86,7 +88,7 @@ public class ZlmMediaService {
|
||||
* <p>(可以使用close_streams接口关闭源直播流也可以停止推流)</p>
|
||||
* @param key addStreamPusherProxy 接口返回的key
|
||||
*/
|
||||
public ZlmResponse<DelStreamPusherProxyResp> delStreamPusherProxy(@RequestParam String key) {
|
||||
public ZlmResponse<DelStreamPusherProxyResp> delStreamPusherProxy(String key) {
|
||||
return exchange.delStreamPusherProxy(secret, key);
|
||||
}
|
||||
|
||||
@ -144,5 +146,12 @@ public class ZlmMediaService {
|
||||
public ZlmResponse<DelStreamProxyResp> delStreamProxy(String key){
|
||||
return exchange.delStreamProxy(secret, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能:获取流列表,可选筛选参数
|
||||
*/
|
||||
public ZlmResponse<List<MediaResp>> getMediaList(GetMediaList params){
|
||||
return exchange.getMediaList(secret, params);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,8 @@ import cn.skcks.docking.gb28181.media.config.ZlmMediaConfig;
|
||||
import cn.skcks.docking.gb28181.media.dto.config.FFMpegConfig;
|
||||
import cn.skcks.docking.gb28181.media.dto.config.HookConfig;
|
||||
import cn.skcks.docking.gb28181.media.dto.config.ServerConfig;
|
||||
import cn.skcks.docking.gb28181.media.dto.media.GetMediaList;
|
||||
import cn.skcks.docking.gb28181.media.dto.media.MediaResp;
|
||||
import cn.skcks.docking.gb28181.media.dto.proxy.*;
|
||||
import cn.skcks.docking.gb28181.media.dto.response.ZlmResponse;
|
||||
import cn.skcks.docking.gb28181.media.dto.response.ZlmResponseConvertor;
|
||||
@ -201,4 +203,14 @@ public class MediaServiceTest {
|
||||
ZlmResponse<DelStreamProxyResp> delStreamProxyRespZlmResponse = zlmMediaService.delStreamProxy(key);
|
||||
log.info("{}", delStreamProxyRespZlmResponse);
|
||||
}
|
||||
|
||||
@Test
|
||||
void getMediaListTest() {
|
||||
ZlmResponse<List<MediaResp>> mediaList = zlmMediaService.getMediaList(GetMediaList.builder().build());
|
||||
List<MediaResp> data = mediaList.getData();
|
||||
log.info("流数量 => {}", data.size());
|
||||
data.forEach((item) -> {
|
||||
log.info("\n{}", JsonUtils.toJson(item));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user