StreamInfo.java 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. package com.genersoft.iot.vmp.common;
  2. import io.swagger.v3.oas.annotations.media.Schema;
  3. import java.net.URL;
  4. @Schema(description = "流信息")
  5. public class StreamInfo {
  6. @Schema(description = "应用名")
  7. private String app;
  8. @Schema(description = "流ID")
  9. private String stream;
  10. @Schema(description = "设备编号")
  11. private String deviceID;
  12. @Schema(description = "通道编号")
  13. private String channelId;
  14. @Schema(description = "IP")
  15. private String ip;
  16. @Schema(description = "HTTP-FLV流地址")
  17. private StreamURL flv;
  18. @Schema(description = "HTTPS-FLV流地址")
  19. private StreamURL https_flv;
  20. @Schema(description = "Websocket-FLV流地址")
  21. private StreamURL ws_flv;
  22. @Schema(description = "Websockets-FLV流地址")
  23. private StreamURL wss_flv;
  24. @Schema(description = "HTTP-FMP4流地址")
  25. private StreamURL fmp4;
  26. @Schema(description = "HTTPS-FMP4流地址")
  27. private StreamURL https_fmp4;
  28. @Schema(description = "Websocket-FMP4流地址")
  29. private StreamURL ws_fmp4;
  30. @Schema(description = "Websockets-FMP4流地址")
  31. private StreamURL wss_fmp4;
  32. @Schema(description = "HLS流地址")
  33. private StreamURL hls;
  34. @Schema(description = "HTTPS-HLS流地址")
  35. private StreamURL https_hls;
  36. @Schema(description = "Websocket-HLS流地址")
  37. private StreamURL ws_hls;
  38. @Schema(description = "Websockets-HLS流地址")
  39. private StreamURL wss_hls;
  40. @Schema(description = "HTTP-TS流地址")
  41. private StreamURL ts;
  42. @Schema(description = "HTTPS-TS流地址")
  43. private StreamURL https_ts;
  44. @Schema(description = "Websocket-TS流地址")
  45. private StreamURL ws_ts;
  46. @Schema(description = "Websockets-TS流地址")
  47. private StreamURL wss_ts;
  48. @Schema(description = "RTMP流地址")
  49. private StreamURL rtmp;
  50. @Schema(description = "RTMPS流地址")
  51. private StreamURL rtmps;
  52. @Schema(description = "RTSP流地址")
  53. private StreamURL rtsp;
  54. @Schema(description = "RTSPS流地址")
  55. private StreamURL rtsps;
  56. @Schema(description = "RTC流地址")
  57. private StreamURL rtc;
  58. @Schema(description = "RTCS流地址")
  59. private StreamURL rtcs;
  60. @Schema(description = "流媒体ID")
  61. private String mediaServerId;
  62. @Schema(description = "流编码信息")
  63. private Object tracks;
  64. @Schema(description = "开始时间")
  65. private String startTime;
  66. @Schema(description = "结束时间")
  67. private String endTime;
  68. @Schema(description = "进度(录像下载使用)")
  69. private double progress;
  70. @Schema(description = "是否暂停(录像回放使用)")
  71. private boolean pause;
  72. public void setRtmp(String host, int port, int sslPort, String app, String stream, String callIdParam) {
  73. String file = String.format("%s/%s/%s", app, stream, callIdParam);
  74. this.rtmp = new StreamURL("rtmp", host, port, file);
  75. if (sslPort != 0) {
  76. this.rtmps = new StreamURL("rtmps", host, sslPort, file);
  77. }
  78. }
  79. public void setRtsp(String host, int port, int sslPort, String app, String stream, String callIdParam) {
  80. String file = String.format("%s/%s/%s", app, stream, callIdParam);
  81. this.rtsp = new StreamURL("rtsp", host, port, file);
  82. if (sslPort != 0) {
  83. this.rtsps = new StreamURL("rtsps", host, sslPort, file);
  84. }
  85. }
  86. public void setFlv(String host, int port, int sslPort, String app, String stream, String callIdParam) {
  87. String file = String.format("%s/%s.live.flv%s", app, stream, callIdParam);
  88. this.flv = new StreamURL("http", host, port, file);
  89. this.ws_flv = new StreamURL("ws", host, port, file);
  90. if (sslPort != 0) {
  91. this.https_flv = new StreamURL("https", host, sslPort, file);
  92. this.wss_flv = new StreamURL("wss", host, sslPort, file);
  93. }
  94. }
  95. public void setFmp4(String host, int port, int sslPort, String app, String stream, String callIdParam) {
  96. String file = String.format("%s/%s.live.mp4%s", app, stream, callIdParam);
  97. this.fmp4 = new StreamURL("http", host, port, file);
  98. this.ws_fmp4 = new StreamURL("ws", host, port, file);
  99. if (sslPort != 0) {
  100. this.https_fmp4 = new StreamURL("https", host, sslPort, file);
  101. this.wss_fmp4 = new StreamURL("wss", host, sslPort, file);
  102. }
  103. }
  104. public void setHls(String host, int port, int sslPort, String app, String stream, String callIdParam) {
  105. String file = String.format("%s/%s/hls.m3u8%s", app, stream, callIdParam);
  106. this.hls = new StreamURL("http", host, port, file);
  107. this.ws_hls = new StreamURL("ws", host, port, file);
  108. if (sslPort != 0) {
  109. this.https_hls = new StreamURL("https", host, sslPort, file);
  110. this.wss_hls = new StreamURL("wss", host, sslPort, file);
  111. }
  112. }
  113. public void setTs(String host, int port, int sslPort, String app, String stream, String callIdParam) {
  114. String file = String.format("%s/%s.live.ts%s", app, stream, callIdParam);
  115. this.ts = new StreamURL("http", host, port, file);
  116. this.ws_ts = new StreamURL("ws", host, port, file);
  117. if (sslPort != 0) {
  118. this.https_ts = new StreamURL("https", host, sslPort, file);
  119. this.wss_ts = new StreamURL("wss", host, sslPort, file);
  120. }
  121. }
  122. public void setRtc(String host, int port, int sslPort, String app, String stream, String callIdParam) {
  123. String file = String.format("index/api/webrtc?app=%s&stream=%s&type=play%s", app, stream, callIdParam);
  124. this.rtc = new StreamURL("http", host, port, file);
  125. if (sslPort != 0) {
  126. this.rtcs = new StreamURL("https", host, sslPort, file);
  127. }
  128. }
  129. public void channgeStreamIp(String localAddr) {
  130. this.flv.setHost(localAddr);
  131. this.ws_flv.setHost(localAddr);
  132. this.hls.setHost(localAddr);
  133. this.ws_hls.setHost(localAddr);
  134. this.ts.setHost(localAddr);
  135. this.ws_ts.setHost(localAddr);
  136. this.fmp4.setHost(localAddr);
  137. this.ws_fmp4.setHost(localAddr);
  138. this.rtc.setHost(localAddr);
  139. if (this.https_flv != null) {
  140. this.https_flv.setHost(localAddr);
  141. this.wss_flv.setHost(localAddr);
  142. this.https_hls.setHost(localAddr);
  143. this.wss_hls.setHost(localAddr);
  144. this.wss_ts.setHost(localAddr);
  145. this.https_fmp4.setHost(localAddr);
  146. this.wss_fmp4.setHost(localAddr);
  147. this.rtcs.setHost(localAddr);
  148. }
  149. this.rtsp.setHost(localAddr);
  150. if (this.rtsps != null) {
  151. this.rtsps.setHost(localAddr);
  152. }
  153. this.rtmp.setHost(localAddr);
  154. if (this.rtmps != null) {
  155. this.rtmps.setHost(localAddr);
  156. }
  157. }
  158. public static class TransactionInfo{
  159. public String callId;
  160. public String localTag;
  161. public String remoteTag;
  162. public String branch;
  163. }
  164. private TransactionInfo transactionInfo;
  165. public String getApp() {
  166. return app;
  167. }
  168. public void setApp(String app) {
  169. this.app = app;
  170. }
  171. public String getDeviceID() {
  172. return deviceID;
  173. }
  174. public void setDeviceID(String deviceID) {
  175. this.deviceID = deviceID;
  176. }
  177. public String getChannelId() {
  178. return channelId;
  179. }
  180. public void setChannelId(String channelId) {
  181. this.channelId = channelId;
  182. }
  183. public String getStream() {
  184. return stream;
  185. }
  186. public void setStream(String stream) {
  187. this.stream = stream;
  188. }
  189. public String getIp() {
  190. return ip;
  191. }
  192. public void setIp(String ip) {
  193. this.ip = ip;
  194. }
  195. public StreamURL getFlv() {
  196. return flv;
  197. }
  198. public StreamURL getHttps_flv() {
  199. return https_flv;
  200. }
  201. public StreamURL getWs_flv() {
  202. return ws_flv;
  203. }
  204. public StreamURL getWss_flv() {
  205. return wss_flv;
  206. }
  207. public StreamURL getFmp4() {
  208. return fmp4;
  209. }
  210. public StreamURL getHttps_fmp4() {
  211. return https_fmp4;
  212. }
  213. public StreamURL getWs_fmp4() {
  214. return ws_fmp4;
  215. }
  216. public StreamURL getWss_fmp4() {
  217. return wss_fmp4;
  218. }
  219. public StreamURL getHls() {
  220. return hls;
  221. }
  222. public StreamURL getHttps_hls() {
  223. return https_hls;
  224. }
  225. public StreamURL getWs_hls() {
  226. return ws_hls;
  227. }
  228. public StreamURL getWss_hls() {
  229. return wss_hls;
  230. }
  231. public StreamURL getTs() {
  232. return ts;
  233. }
  234. public StreamURL getHttps_ts() {
  235. return https_ts;
  236. }
  237. public StreamURL getWs_ts() {
  238. return ws_ts;
  239. }
  240. public StreamURL getWss_ts() {
  241. return wss_ts;
  242. }
  243. public StreamURL getRtmp() {
  244. return rtmp;
  245. }
  246. public StreamURL getRtmps() {
  247. return rtmps;
  248. }
  249. public StreamURL getRtsp() {
  250. return rtsp;
  251. }
  252. public StreamURL getRtsps() {
  253. return rtsps;
  254. }
  255. public StreamURL getRtc() {
  256. return rtc;
  257. }
  258. public StreamURL getRtcs() {
  259. return rtcs;
  260. }
  261. public String getMediaServerId() {
  262. return mediaServerId;
  263. }
  264. public void setMediaServerId(String mediaServerId) {
  265. this.mediaServerId = mediaServerId;
  266. }
  267. public Object getTracks() {
  268. return tracks;
  269. }
  270. public void setTracks(Object tracks) {
  271. this.tracks = tracks;
  272. }
  273. public String getStartTime() {
  274. return startTime;
  275. }
  276. public void setStartTime(String startTime) {
  277. this.startTime = startTime;
  278. }
  279. public String getEndTime() {
  280. return endTime;
  281. }
  282. public void setEndTime(String endTime) {
  283. this.endTime = endTime;
  284. }
  285. public double getProgress() {
  286. return progress;
  287. }
  288. public void setProgress(double progress) {
  289. this.progress = progress;
  290. }
  291. public boolean isPause() {
  292. return pause;
  293. }
  294. public void setPause(boolean pause) {
  295. this.pause = pause;
  296. }
  297. public TransactionInfo getTransactionInfo() {
  298. return transactionInfo;
  299. }
  300. public void setTransactionInfo(TransactionInfo transactionInfo) {
  301. this.transactionInfo = transactionInfo;
  302. }
  303. }