forked from q191201771/lal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
t_http_an__api.go
110 lines (90 loc) · 2.63 KB
/
t_http_an__api.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// Copyright 2020, Chef. All rights reserved.
// https://github.com/forkiss/lal
//
// Use of this source code is governed by a MIT-style license
// that can be found in the License file.
//
// Author: Chef (191201771@qq.com)
package base
// 文档见: https://pengrl.com/lal/#/HTTPAPI
// ----- request -------------------------------------------------------------------------------------------------------
const (
PullRetryNumForever = -1
PullRetryNumNever = 0
AutoStopPullAfterNoOutMsNever = -1
AutoStopPullAfterNoOutMsImmediately = 0
RtspModeTcp = 0
RtspModeUdp = 1
)
type ApiCtrlStartRelayPullReq struct {
Url string `json:"url"`
StreamName string `json:"stream_name"`
PullTimeoutMs int `json:"pull_timeout_ms"`
PullRetryNum int `json:"pull_retry_num"`
AutoStopPullAfterNoOutMs int `json:"auto_stop_pull_after_no_out_ms"`
RtspMode int `json:"rtsp_mode"`
}
type ApiCtrlKickSessionReq struct {
StreamName string `json:"stream_name"`
SessionId string `json:"session_id"`
}
type ApiCtrlStartRtpPubReq struct {
StreamName string `json:"stream_name"`
Port int `json:"port"`
TimeoutMs int `json:"timeout_ms"`
}
// ----- response ------------------------------------------------------------------------------------------------------
const (
ErrorCodeSucc = 0
DespSucc = "succ"
ErrorCodeGroupNotFound = 1001
DespGroupNotFound = "group not found"
ErrorCodeParamMissing = 1002
DespParamMissing = "param missing"
ErrorCodeSessionNotFound = 1003
DespSessionNotFound = "session not found"
ErrorCodeStartRelayPullFail = 2001
)
// HttpResponseBasic
//
// TODO(chef): 因为ILalserver会直接使用这个接口,所以重命名为ApiResponseBasic
//
type HttpResponseBasic struct {
ErrorCode int `json:"error_code"`
Desp string `json:"desp"`
}
type ApiStatLalInfo struct {
HttpResponseBasic
Data LalInfo `json:"data"`
}
type ApiStatAllGroup struct {
HttpResponseBasic
Data struct {
Groups []StatGroup `json:"groups"`
} `json:"data"`
}
type ApiStatGroup struct {
HttpResponseBasic
Data *StatGroup `json:"data"`
}
type ApiCtrlStartRelayPull struct {
HttpResponseBasic
Data struct {
StreamName string `json:"stream_name"`
SessionId string `json:"session_id"`
} `json:"data"`
}
type ApiCtrlStopRelayPull struct {
HttpResponseBasic
Data struct {
SessionId string `json:"session_id"`
} `json:"data"`
}
type ApiCtrlStartRtpPub struct {
HttpResponseBasic
Data struct {
StreamName string `json:"stream_name"`
SessionId string `json:"session_id"`
Port int `json:"port"`
}
}