api.proto 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. syntax = "proto3";
  2. package video.live.streamng.v1;
  3. option go_package = "v1";
  4. import "github.com/gogo/protobuf/gogoproto/gogo.proto";
  5. // EmptyStruct 空的message,对应真实service只返回error,没有具体返回值
  6. message EmptyStruct {
  7. }
  8. // ChangeSrcReq 切换上行
  9. message ChangeSrcReq {
  10. // 房间号
  11. int64 room_id = 1;
  12. // src
  13. int64 src = 2;
  14. // 来源平台
  15. string source = 3;
  16. // 操作人
  17. string operate_name = 4;
  18. // 原因
  19. string reason = 5;
  20. }
  21. // ClearStreamStatusReq 清理互推
  22. message ClearStreamStatusReq {
  23. // 房间号
  24. int64 room_id = 1;
  25. }
  26. // CloseReply CloseReply
  27. message CloseReply {
  28. }
  29. // CloseReq CloseReq
  30. message CloseReq {
  31. }
  32. // CreateOfficalStreamReply 创建流
  33. message CreateOfficalStreamReply {
  34. // 是否成功
  35. bool success = 1;
  36. }
  37. // CreateOfficalStreamReq 创建流
  38. message CreateOfficalStreamReq {
  39. // 流名
  40. string stream_name = 1;
  41. // key
  42. string key = 2;
  43. // 房间号
  44. int64 room_id = 3;
  45. // 是否线下测试
  46. string debug = 4;
  47. // 线下测试必传
  48. int64 uid = 5;
  49. }
  50. // AdapterStream 上行流信息
  51. message AdapterStream {
  52. // src
  53. int64 src = 1;
  54. // 房间号
  55. int64 room_id = 2 [(gogoproto.jsontag) = "room_id"];
  56. // 上行
  57. int64 up_rank = 3 [(gogoproto.jsontag) = "up_rank"];
  58. // 上行名称
  59. string src_name = 4 [(gogoproto.jsontag) = "src_name"];
  60. }
  61. // GetAdapterStreamByStreamNameReply 适配PHP代码
  62. message GetAdapterStreamByStreamNameReply {
  63. // 流名map流具体信息
  64. map<string, AdapterStream> list = 1;
  65. }
  66. // GetAdapterStreamByStreamNameReq 适配PHP代码
  67. message GetAdapterStreamByStreamNameReq {
  68. // 流名
  69. string stream_names = 1 [(gogoproto.jsontag) = "stream_names"];
  70. }
  71. // LineList 线路信息
  72. message LineList {
  73. // 上行
  74. int64 src = 1;
  75. // 是否被使用
  76. bool use = 2;
  77. // 描述
  78. string desc = 3;
  79. }
  80. // GetLineListByRoomIDReply 获取线路信息
  81. message GetLineListByRoomIDReply {
  82. // 线路信息, 多条
  83. repeated LineList list = 1;
  84. }
  85. // GetLineListByRoomIDReq 获取线路信息
  86. message GetLineListByRoomIDReq {
  87. // 房间号
  88. int64 room_id = 1;
  89. }
  90. // GetMultiScreenShotReply 获取批量截图
  91. message GetMultiScreenShotReply {
  92. // 房间号map截图地址
  93. map<int64, string> list = 1;
  94. }
  95. // GetMultiScreenShotReq 获取批量截图
  96. message GetMultiScreenShotReq {
  97. // 房间号
  98. string room_ids = 1;
  99. // 时间戳
  100. int64 ts = 2;
  101. // channel 是否为鉴黄
  102. string channel = 3;
  103. }
  104. // GetMultiStreamInfoReply 批量获取房间信息
  105. message GetMultiStreamInfoReply {
  106. // code
  107. int32 code = 1;
  108. // message
  109. string message = 2;
  110. // 房间号map流详细信息
  111. map<uint32, StreamFullInfo> data = 3;
  112. }
  113. // GetMultiStreamInfoReq 批量获取房间信息
  114. message GetMultiStreamInfoReq {
  115. // 房间号
  116. repeated uint32 room_ids = 1;
  117. }
  118. // GetOriginScreenShotPicReply 获取原图
  119. message GetOriginScreenShotPicReply {
  120. // 房间号map截图地址
  121. map<int64, string> list = 1;
  122. }
  123. // GetOriginScreenShotPicReq 获取原图
  124. message GetOriginScreenShotPicReq {
  125. // 房间号
  126. string room_ids = 1;
  127. // 时间戳
  128. int64 ts = 2;
  129. }
  130. // GetRoomIDByStreamNameReply 获取房间号
  131. message GetRoomIDByStreamNameReply {
  132. // 房间号
  133. int64 room_id = 1;
  134. }
  135. // GetRoomIDByStreamNameReq 获取房间号
  136. message GetRoomIDByStreamNameReq {
  137. // 流名
  138. string stream_name = 1;
  139. }
  140. // GetSingleScreeShotReply 获取单个截图
  141. message GetSingleScreeShotReply {
  142. // 截图列表
  143. repeated string list = 1;
  144. }
  145. // GetSingleScreeShotReq 获取单个截图
  146. message GetSingleScreeShotReq {
  147. // 房间号
  148. int64 room_id = 1;
  149. // 开始时间
  150. string start_time = 2;
  151. // 结束时间
  152. string end_time = 3;
  153. // channel
  154. string channel = 4;
  155. }
  156. // RoomSrcCheck 上行
  157. message RoomSrcCheck {
  158. // 上行
  159. int64 src = 1;
  160. // 是否被选择, 1或者0
  161. int32 checked = 2;
  162. // 上行名称
  163. string desc = 3;
  164. }
  165. // GetSrcByRoomIDReply 获取上行信息
  166. message GetSrcByRoomIDReply {
  167. // 上行列表
  168. repeated RoomSrcCheck list = 1;
  169. }
  170. // GetSrcByRoomIDReq 获取上行信息
  171. message GetSrcByRoomIDReq {
  172. // 房间号
  173. int64 room_id = 1;
  174. }
  175. // GetStreamInfoReply 获取单个流信息
  176. message GetStreamInfoReply {
  177. // code
  178. int32 code = 1;
  179. // message
  180. string message = 2;
  181. // 流详细信息
  182. StreamFullInfo data = 3;
  183. }
  184. // GetStreamInfoReq 获取单个流信息
  185. message GetStreamInfoReq {
  186. // 房间号
  187. uint32 room_id = 1;
  188. // 流名
  189. string stream_name = 2;
  190. }
  191. // GetStreamLastTimeReply 获取最后推流时间
  192. message GetStreamLastTimeReply {
  193. // 最后推流时间, -1 正在推流
  194. int64 last_time = 1;
  195. }
  196. // GetStreamLastTimeReq 获取最后推流时间
  197. message GetStreamLastTimeReq {
  198. // 房间号
  199. int64 room_id = 1;
  200. }
  201. // GetStreamNameByRoomIDReply 获取流名
  202. message GetStreamNameByRoomIDReply {
  203. // 流名
  204. string stream_name = 1;
  205. }
  206. // GetStreamNameByRoomIDReq 获取流名
  207. message GetStreamNameByRoomIDReq {
  208. // 房间号
  209. int64 room_id = 1;
  210. }
  211. // GetUpStreamRtmpReply 获取上行推流地址
  212. message GetUpStreamRtmpReply {
  213. // 上行推流地址
  214. UpStreamRtmp up = 1;
  215. }
  216. // GetUpStreamRtmpReq 获取上行推流地址
  217. message GetUpStreamRtmpReq {
  218. // 房间号
  219. int64 room_id = 1;
  220. // 免流
  221. string free_flow = 2;
  222. // ip
  223. string ip = 3;
  224. // 所在区域
  225. int64 area_id = 4;
  226. // 关注数
  227. int32 attentions = 5;
  228. // uid
  229. int64 uid = 6;
  230. // 平台
  231. string platform = 7;
  232. }
  233. // StreamBase 流基本信息
  234. message StreamBase {
  235. // 流名
  236. string stream_name = 1;
  237. // 默认上行
  238. uint32 default_upstream = 2 [(gogoproto.jsontag) = "default_upstream"];
  239. // 正在推流上行
  240. uint32 origin = 3;
  241. // 转推cdn
  242. repeated uint32 forward = 4;
  243. // 主流1或者备用流2
  244. uint32 type = 5;
  245. // 推流码
  246. string key = 6;
  247. // options
  248. uint32 options = 7;
  249. }
  250. // StreamFullInfo 流信息完整结构
  251. message StreamFullInfo {
  252. // 房间号
  253. uint32 room_id = 1;
  254. // 是否为冷热流
  255. uint32 hot = 2;
  256. // 流列表
  257. repeated StreamBase list = 3;
  258. }
  259. // PingReply PingReply
  260. message PingReply {
  261. }
  262. // PingReq PingReq
  263. message PingReq {
  264. }
  265. // UpStreamRtmp 上行推流地址详细信息
  266. message UpStreamRtmp {
  267. // 推流地址
  268. string addr = 1;
  269. // 推流码
  270. string code = 2;
  271. // new link
  272. string new_link = 3;
  273. }
  274. // StreamCutReq 切流
  275. message StreamCutReq {
  276. // 房间号
  277. int64 room_id = 1;
  278. // 切流时间
  279. int64 cut_time = 2;
  280. }
  281. // TimeTime 时间
  282. message TimeTime {
  283. }
  284. message CheckLiveStreamReq {
  285. repeated int64 room_id = 1;
  286. }
  287. message CheckLiveStreamReply {
  288. map<int64, bool> list = 1;
  289. }
  290. // Stream service
  291. service Stream {
  292. // GetSingleScreeShot
  293. rpc GetSingleScreeShot (GetSingleScreeShotReq) returns (GetSingleScreeShotReply);
  294. // GetMultiScreenShot
  295. rpc GetMultiScreenShot (GetMultiScreenShotReq) returns (GetMultiScreenShotReply);
  296. // GetOriginScreenShotPic
  297. rpc GetOriginScreenShotPic (GetOriginScreenShotPicReq) returns (GetOriginScreenShotPicReply);
  298. // CreateOfficeStream 创建正式流
  299. rpc CreateOfficalStream (CreateOfficalStreamReq) returns (CreateOfficalStreamReply);
  300. // GetStreamInfo 获取单个流信息
  301. rpc GetStreamInfo (GetStreamInfoReq) returns (GetStreamInfoReply);
  302. // GetMultiStreamInfo 批量获取流信息
  303. rpc GetMultiStreamInfo (GetMultiStreamInfoReq) returns (GetMultiStreamInfoReply);
  304. // ChangeSrc 切换cdn
  305. rpc ChangeSrc (ChangeSrcReq) returns (EmptyStruct);
  306. // GetStreamLastTime 得到流到最后推流时间;主流的推流时间up_rank = 1
  307. rpc GetStreamLastTime (GetStreamLastTimeReq) returns (GetStreamLastTimeReply);
  308. // GetStreamNameByRoomID 需要考虑备用流 + 考虑短号
  309. rpc GetStreamNameByRoomID (GetStreamNameByRoomIDReq) returns (GetStreamNameByRoomIDReply);
  310. // GetRoomIDByStreamName 查询房间号
  311. rpc GetRoomIDByStreamName (GetRoomIDByStreamNameReq) returns (GetRoomIDByStreamNameReply);
  312. // GetAdapterStreamByStreamName 适配结果输出, 此处也可以输入备用流, 该结果只输出直推上行
  313. rpc GetAdapterStreamByStreamName (GetAdapterStreamByStreamNameReq) returns (GetAdapterStreamByStreamNameReply);
  314. // GetSrcByRoomID
  315. rpc GetSrcByRoomID (GetSrcByRoomIDReq) returns (GetSrcByRoomIDReply);
  316. // GetLineListByRoomID
  317. rpc GetLineListByRoomID (GetLineListByRoomIDReq) returns (GetLineListByRoomIDReply);
  318. // GetUpStreamRtmp UpStream
  319. rpc GetUpStreamRtmp (GetUpStreamRtmpReq) returns (GetUpStreamRtmpReply);
  320. // StreamCut 切流的房间和时间, 内部调用
  321. rpc StreamCut (StreamCutReq) returns (EmptyStruct);
  322. // Ping Service
  323. rpc Ping (PingReq) returns (PingReply);
  324. // Close Service
  325. rpc Close (CloseReq) returns (CloseReply);
  326. // ClearRetweetRecord
  327. rpc ClearStreamStatus (ClearStreamStatusReq) returns (EmptyStruct);
  328. // CheckLiveStreamList
  329. rpc CheckLiveStreamList(CheckLiveStreamReq) returns (CheckLiveStreamReply);
  330. }