StreamInfo.java 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  1. package com.genersoft.iot.vmp.common;
  2. import io.swagger.v3.oas.annotations.media.Schema;
  3. import java.io.Serializable;
  4. @Schema(description = "流信息")
  5. public class StreamInfo implements Serializable, Cloneable{
  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 setFlv(StreamURL flv) {
  73. this.flv = flv;
  74. }
  75. public void setHttps_flv(StreamURL https_flv) {
  76. this.https_flv = https_flv;
  77. }
  78. public void setWs_flv(StreamURL ws_flv) {
  79. this.ws_flv = ws_flv;
  80. }
  81. public void setWss_flv(StreamURL wss_flv) {
  82. this.wss_flv = wss_flv;
  83. }
  84. public void setFmp4(StreamURL fmp4) {
  85. this.fmp4 = fmp4;
  86. }
  87. public void setHttps_fmp4(StreamURL https_fmp4) {
  88. this.https_fmp4 = https_fmp4;
  89. }
  90. public void setWs_fmp4(StreamURL ws_fmp4) {
  91. this.ws_fmp4 = ws_fmp4;
  92. }
  93. public void setWss_fmp4(StreamURL wss_fmp4) {
  94. this.wss_fmp4 = wss_fmp4;
  95. }
  96. public void setHls(StreamURL hls) {
  97. this.hls = hls;
  98. }
  99. public void setHttps_hls(StreamURL https_hls) {
  100. this.https_hls = https_hls;
  101. }
  102. public void setWs_hls(StreamURL ws_hls) {
  103. this.ws_hls = ws_hls;
  104. }
  105. public void setWss_hls(StreamURL wss_hls) {
  106. this.wss_hls = wss_hls;
  107. }
  108. public void setTs(StreamURL ts) {
  109. this.ts = ts;
  110. }
  111. public void setHttps_ts(StreamURL https_ts) {
  112. this.https_ts = https_ts;
  113. }
  114. public void setWs_ts(StreamURL ws_ts) {
  115. this.ws_ts = ws_ts;
  116. }
  117. public void setWss_ts(StreamURL wss_ts) {
  118. this.wss_ts = wss_ts;
  119. }
  120. public void setRtmp(StreamURL rtmp) {
  121. this.rtmp = rtmp;
  122. }
  123. public void setRtmps(StreamURL rtmps) {
  124. this.rtmps = rtmps;
  125. }
  126. public void setRtsp(StreamURL rtsp) {
  127. this.rtsp = rtsp;
  128. }
  129. public void setRtsps(StreamURL rtsps) {
  130. this.rtsps = rtsps;
  131. }
  132. public void setRtc(StreamURL rtc) {
  133. this.rtc = rtc;
  134. }
  135. public void setRtcs(StreamURL rtcs) {
  136. this.rtcs = rtcs;
  137. }
  138. public void setRtmp(String host, int port, int sslPort, String app, String stream, String callIdParam) {
  139. String file = String.format("%s/%s/%s", app, stream, callIdParam);
  140. this.rtmp = new StreamURL("rtmp", host, port, file);
  141. if (sslPort != 0) {
  142. this.rtmps = new StreamURL("rtmps", host, sslPort, file);
  143. }
  144. }
  145. public void setRtsp(String host, int port, int sslPort, String app, String stream, String callIdParam) {
  146. String file = String.format("%s/%s/%s", app, stream, callIdParam);
  147. this.rtsp = new StreamURL("rtsp", host, port, file);
  148. if (sslPort != 0) {
  149. this.rtsps = new StreamURL("rtsps", host, sslPort, file);
  150. }
  151. }
  152. public void setFlv(String host, int port, int sslPort, String app, String stream, String callIdParam) {
  153. String file = String.format("%s/%s.live.flv%s", app, stream, callIdParam);
  154. this.flv = new StreamURL("http", host, port, file);
  155. this.ws_flv = new StreamURL("ws", host, port, file);
  156. if (sslPort != 0) {
  157. this.https_flv = new StreamURL("https", host, sslPort, file);
  158. this.wss_flv = new StreamURL("wss", host, sslPort, file);
  159. }
  160. }
  161. public void setFmp4(String host, int port, int sslPort, String app, String stream, String callIdParam) {
  162. String file = String.format("%s/%s.live.mp4%s", app, stream, callIdParam);
  163. this.fmp4 = new StreamURL("http", host, port, file);
  164. this.ws_fmp4 = new StreamURL("ws", host, port, file);
  165. if (sslPort != 0) {
  166. this.https_fmp4 = new StreamURL("https", host, sslPort, file);
  167. this.wss_fmp4 = new StreamURL("wss", host, sslPort, file);
  168. }
  169. }
  170. public void setHls(String host, int port, int sslPort, String app, String stream, String callIdParam) {
  171. String file = String.format("%s/%s/hls.m3u8%s", app, stream, callIdParam);
  172. this.hls = new StreamURL("http", host, port, file);
  173. this.ws_hls = new StreamURL("ws", host, port, file);
  174. if (sslPort != 0) {
  175. this.https_hls = new StreamURL("https", host, sslPort, file);
  176. this.wss_hls = new StreamURL("wss", host, sslPort, file);
  177. }
  178. }
  179. public void setTs(String host, int port, int sslPort, String app, String stream, String callIdParam) {
  180. String file = String.format("%s/%s.live.ts%s", app, stream, callIdParam);
  181. this.ts = new StreamURL("http", host, port, file);
  182. this.ws_ts = new StreamURL("ws", host, port, file);
  183. if (sslPort != 0) {
  184. this.https_ts = new StreamURL("https", host, sslPort, file);
  185. this.wss_ts = new StreamURL("wss", host, sslPort, file);
  186. }
  187. }
  188. public void setRtc(String host, int port, int sslPort, String app, String stream, String callIdParam) {
  189. String file = String.format("index/api/webrtc?app=%s&stream=%s&type=play%s", app, stream, callIdParam);
  190. this.rtc = new StreamURL("http", host, port, file);
  191. if (sslPort != 0) {
  192. this.rtcs = new StreamURL("https", host, sslPort, file);
  193. }
  194. }
  195. public void channgeStreamIp(String localAddr) {
  196. this.flv.setHost(localAddr);
  197. this.ws_flv.setHost(localAddr);
  198. this.hls.setHost(localAddr);
  199. this.ws_hls.setHost(localAddr);
  200. this.ts.setHost(localAddr);
  201. this.ws_ts.setHost(localAddr);
  202. this.fmp4.setHost(localAddr);
  203. this.ws_fmp4.setHost(localAddr);
  204. this.rtc.setHost(localAddr);
  205. if (this.https_flv != null) {
  206. this.https_flv.setHost(localAddr);
  207. this.wss_flv.setHost(localAddr);
  208. this.https_hls.setHost(localAddr);
  209. this.wss_hls.setHost(localAddr);
  210. this.wss_ts.setHost(localAddr);
  211. this.https_fmp4.setHost(localAddr);
  212. this.wss_fmp4.setHost(localAddr);
  213. this.rtcs.setHost(localAddr);
  214. }
  215. this.rtsp.setHost(localAddr);
  216. if (this.rtsps != null) {
  217. this.rtsps.setHost(localAddr);
  218. }
  219. this.rtmp.setHost(localAddr);
  220. if (this.rtmps != null) {
  221. this.rtmps.setHost(localAddr);
  222. }
  223. }
  224. public static class TransactionInfo{
  225. public String callId;
  226. public String localTag;
  227. public String remoteTag;
  228. public String branch;
  229. }
  230. private TransactionInfo transactionInfo;
  231. public String getApp() {
  232. return app;
  233. }
  234. public void setApp(String app) {
  235. this.app = app;
  236. }
  237. public String getDeviceID() {
  238. return deviceID;
  239. }
  240. public void setDeviceID(String deviceID) {
  241. this.deviceID = deviceID;
  242. }
  243. public String getChannelId() {
  244. return channelId;
  245. }
  246. public void setChannelId(String channelId) {
  247. this.channelId = channelId;
  248. }
  249. public String getStream() {
  250. return stream;
  251. }
  252. public void setStream(String stream) {
  253. this.stream = stream;
  254. }
  255. public String getIp() {
  256. return ip;
  257. }
  258. public void setIp(String ip) {
  259. this.ip = ip;
  260. }
  261. public StreamURL getFlv() {
  262. return flv;
  263. }
  264. public StreamURL getHttps_flv() {
  265. return https_flv;
  266. }
  267. public StreamURL getWs_flv() {
  268. return ws_flv;
  269. }
  270. public StreamURL getWss_flv() {
  271. return wss_flv;
  272. }
  273. public StreamURL getFmp4() {
  274. return fmp4;
  275. }
  276. public StreamURL getHttps_fmp4() {
  277. return https_fmp4;
  278. }
  279. public StreamURL getWs_fmp4() {
  280. return ws_fmp4;
  281. }
  282. public StreamURL getWss_fmp4() {
  283. return wss_fmp4;
  284. }
  285. public StreamURL getHls() {
  286. return hls;
  287. }
  288. public StreamURL getHttps_hls() {
  289. return https_hls;
  290. }
  291. public StreamURL getWs_hls() {
  292. return ws_hls;
  293. }
  294. public StreamURL getWss_hls() {
  295. return wss_hls;
  296. }
  297. public StreamURL getTs() {
  298. return ts;
  299. }
  300. public StreamURL getHttps_ts() {
  301. return https_ts;
  302. }
  303. public StreamURL getWs_ts() {
  304. return ws_ts;
  305. }
  306. public StreamURL getWss_ts() {
  307. return wss_ts;
  308. }
  309. public StreamURL getRtmp() {
  310. return rtmp;
  311. }
  312. public StreamURL getRtmps() {
  313. return rtmps;
  314. }
  315. public StreamURL getRtsp() {
  316. return rtsp;
  317. }
  318. public StreamURL getRtsps() {
  319. return rtsps;
  320. }
  321. public StreamURL getRtc() {
  322. return rtc;
  323. }
  324. public StreamURL getRtcs() {
  325. return rtcs;
  326. }
  327. public String getMediaServerId() {
  328. return mediaServerId;
  329. }
  330. public void setMediaServerId(String mediaServerId) {
  331. this.mediaServerId = mediaServerId;
  332. }
  333. public Object getTracks() {
  334. return tracks;
  335. }
  336. public void setTracks(Object tracks) {
  337. this.tracks = tracks;
  338. }
  339. public String getStartTime() {
  340. return startTime;
  341. }
  342. public void setStartTime(String startTime) {
  343. this.startTime = startTime;
  344. }
  345. public String getEndTime() {
  346. return endTime;
  347. }
  348. public void setEndTime(String endTime) {
  349. this.endTime = endTime;
  350. }
  351. public double getProgress() {
  352. return progress;
  353. }
  354. public void setProgress(double progress) {
  355. this.progress = progress;
  356. }
  357. public boolean isPause() {
  358. return pause;
  359. }
  360. public void setPause(boolean pause) {
  361. this.pause = pause;
  362. }
  363. public TransactionInfo getTransactionInfo() {
  364. return transactionInfo;
  365. }
  366. public void setTransactionInfo(TransactionInfo transactionInfo) {
  367. this.transactionInfo = transactionInfo;
  368. }
  369. @Override
  370. public StreamInfo clone() {
  371. StreamInfo instance = null;
  372. try{
  373. instance = (StreamInfo)super.clone();
  374. }catch(CloneNotSupportedException e) {
  375. e.printStackTrace();
  376. }
  377. return instance;
  378. }
  379. }