forked from bluenviron/gortsplib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.go
190 lines (146 loc) · 6 KB
/
client.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
package liberrors
import (
"fmt"
"github.com/Coimbra1984/gortsplib/pkg/base"
)
// ErrClientTerminated is an error that can be returned by a client.
type ErrClientTerminated struct{}
// Error implements the error interface.
func (e ErrClientTerminated) Error() string {
return "terminated"
}
// ErrClientInvalidState is an error that can be returned by a client.
type ErrClientInvalidState struct {
AllowedList []fmt.Stringer
State fmt.Stringer
}
// Error implements the error interface.
func (e ErrClientInvalidState) Error() string {
return fmt.Sprintf("must be in state %v, while is in state %v",
e.AllowedList, e.State)
}
// ErrClientSessionHeaderInvalid is an error that can be returned by a client.
type ErrClientSessionHeaderInvalid struct {
Err error
}
// Error implements the error interface.
func (e ErrClientSessionHeaderInvalid) Error() string {
return fmt.Sprintf("invalid session header: %v", e.Err)
}
// ErrClientBadStatusCode is an error that can be returned by a client.
type ErrClientBadStatusCode struct {
Code base.StatusCode
Message string
}
// Error implements the error interface.
func (e ErrClientBadStatusCode) Error() string {
return fmt.Sprintf("bad status code: %d (%s)", e.Code, e.Message)
}
// ErrClientContentTypeMissing is an error that can be returned by a client.
type ErrClientContentTypeMissing struct{}
// Error implements the error interface.
func (e ErrClientContentTypeMissing) Error() string {
return "Content-Type header is missing"
}
// ErrClientContentTypeUnsupported is an error that can be returned by a client.
type ErrClientContentTypeUnsupported struct {
CT base.HeaderValue
}
// Error implements the error interface.
func (e ErrClientContentTypeUnsupported) Error() string {
return fmt.Sprintf("unsupported Content-Type header '%v'", e.CT)
}
// ErrClientCannotReadPublishAtSameTime is an error that can be returned by a client.
type ErrClientCannotReadPublishAtSameTime struct{}
// Error implements the error interface.
func (e ErrClientCannotReadPublishAtSameTime) Error() string {
return "cannot read and publish at the same time"
}
// ErrClientCannotSetupTracksDifferentURLs is an error that can be returned by a client.
type ErrClientCannotSetupTracksDifferentURLs struct{}
// Error implements the error interface.
func (e ErrClientCannotSetupTracksDifferentURLs) Error() string {
return "cannot setup tracks with different base URLs"
}
// ErrClientUDPPortsZero is an error that can be returned by a client.
type ErrClientUDPPortsZero struct{}
// Error implements the error interface.
func (e ErrClientUDPPortsZero) Error() string {
return "rtpPort and rtcpPort must be both zero or non-zero"
}
// ErrClientUDPPortsNotConsecutive is an error that can be returned by a client.
type ErrClientUDPPortsNotConsecutive struct{}
// Error implements the error interface.
func (e ErrClientUDPPortsNotConsecutive) Error() string {
return "rtcpPort must be rtpPort + 1"
}
// ErrClientServerPortsNotProvided is an error that can be returned by a client.
type ErrClientServerPortsNotProvided struct{}
// Error implements the error interface.
func (e ErrClientServerPortsNotProvided) Error() string {
return "server ports have not been provided. Use AnyPortEnable to communicate with this server"
}
// ErrClientTransportHeaderInvalid is an error that can be returned by a client.
type ErrClientTransportHeaderInvalid struct {
Err error
}
// Error implements the error interface.
func (e ErrClientTransportHeaderInvalid) Error() string {
return fmt.Sprintf("invalid transport header: %v", e.Err)
}
// ErrClientTransportHeaderInvalidDelivery is an error that can be returned by a client.
type ErrClientTransportHeaderInvalidDelivery struct{}
// Error implements the error interface.
func (e ErrClientTransportHeaderInvalidDelivery) Error() string {
return "transport header contains an invalid delivery value"
}
// ErrClientTransportHeaderNoPorts is an error that can be returned by a client.
type ErrClientTransportHeaderNoPorts struct{}
// Error implements the error interface.
func (e ErrClientTransportHeaderNoPorts) Error() string {
return "transport header does not contain ports"
}
// ErrClientTransportHeaderNoDestination is an error that can be returned by a client.
type ErrClientTransportHeaderNoDestination struct{}
// Error implements the error interface.
func (e ErrClientTransportHeaderNoDestination) Error() string {
return "transport header does not contain a destination"
}
// ErrClientTransportHeaderNoInterleavedIDs is an error that can be returned by a client.
type ErrClientTransportHeaderNoInterleavedIDs struct{}
// Error implements the error interface.
func (e ErrClientTransportHeaderNoInterleavedIDs) Error() string {
return "transport header does not contain interleaved IDs"
}
// ErrClientTransportHeaderInvalidInterleavedIDs is an error that can be returned by a client.
type ErrClientTransportHeaderInvalidInterleavedIDs struct{}
// Error implements the error interface.
func (e ErrClientTransportHeaderInvalidInterleavedIDs) Error() string {
return "invalid interleaved IDs"
}
// ErrClientTransportHeaderInterleavedIDsAlreadyUsed is an error that can be returned by a client.
type ErrClientTransportHeaderInterleavedIDsAlreadyUsed struct{}
// Error implements the error interface.
func (e ErrClientTransportHeaderInterleavedIDsAlreadyUsed) Error() string {
return "interleaved IDs already used"
}
// ErrClientUDPTimeout is an error that can be returned by a client.
type ErrClientUDPTimeout struct{}
// Error implements the error interface.
func (e ErrClientUDPTimeout) Error() string {
return "UDP timeout"
}
// ErrClientTCPTimeout is an error that can be returned by a client.
type ErrClientTCPTimeout struct{}
// Error implements the error interface.
func (e ErrClientTCPTimeout) Error() string {
return "TCP timeout"
}
// ErrClientRTPInfoInvalid is an error that can be returned by a client.
type ErrClientRTPInfoInvalid struct {
Err error
}
// Error implements the error interface.
func (e ErrClientRTPInfoInvalid) Error() string {
return fmt.Sprintf("invalid RTP-Info: %v", e.Err)
}