mirror of
https://github.com/aler9/gortsplib
synced 2025-10-06 23:52:46 +08:00
add StreamProtocol; fix docs
This commit is contained in:
3
auth.go
3
auth.go
@@ -20,7 +20,10 @@ func md5Hex(in string) string {
|
|||||||
type AuthMethod int
|
type AuthMethod int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
// basic authentication method
|
||||||
Basic AuthMethod = iota
|
Basic AuthMethod = iota
|
||||||
|
|
||||||
|
// digest authentication method
|
||||||
Digest
|
Digest
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -29,7 +29,7 @@ type Track struct {
|
|||||||
// track id
|
// track id
|
||||||
Id int
|
Id int
|
||||||
|
|
||||||
// track codec and info in SDP
|
// track codec and info in SDP format
|
||||||
Media *sdp.MediaDescription
|
Media *sdp.MediaDescription
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -11,28 +11,6 @@ const (
|
|||||||
interleavedFrameMagicByte = 0x24
|
interleavedFrameMagicByte = 0x24
|
||||||
)
|
)
|
||||||
|
|
||||||
// StreamType is the type of a stream.
|
|
||||||
type StreamType int
|
|
||||||
|
|
||||||
const (
|
|
||||||
// StreamTypeRtp is a stream that contains RTP packets
|
|
||||||
StreamTypeRtp StreamType = iota
|
|
||||||
|
|
||||||
// StreamTypeRtcp is a stream that contains RTCP packets
|
|
||||||
StreamTypeRtcp
|
|
||||||
)
|
|
||||||
|
|
||||||
func (st StreamType) String() string {
|
|
||||||
switch st {
|
|
||||||
case StreamTypeRtp:
|
|
||||||
return "RTP"
|
|
||||||
|
|
||||||
case StreamTypeRtcp:
|
|
||||||
return "RTCP"
|
|
||||||
}
|
|
||||||
return "UNKNOWN"
|
|
||||||
}
|
|
||||||
|
|
||||||
// InterleavedFrame is an object that allows to send and receive binary data
|
// InterleavedFrame is an object that allows to send and receive binary data
|
||||||
// within RTSP connections. It is used to send RTP and RTCP packets via TCP.
|
// within RTSP connections. It is used to send RTP and RTCP packets via TCP.
|
||||||
type InterleavedFrame struct {
|
type InterleavedFrame struct {
|
||||||
|
45
utils.go
45
utils.go
@@ -11,6 +11,51 @@ const (
|
|||||||
rtspMaxContentLength = 4096
|
rtspMaxContentLength = 4096
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// StreamProtocol is the protocol of a stream
|
||||||
|
type StreamProtocol int
|
||||||
|
|
||||||
|
const (
|
||||||
|
// invalid protocol
|
||||||
|
StreamProtocolInvalid StreamProtocol = iota
|
||||||
|
|
||||||
|
// UDP protocol
|
||||||
|
StreamProtocolUdp
|
||||||
|
|
||||||
|
// TCP protocol
|
||||||
|
StreamProtocolTcp
|
||||||
|
)
|
||||||
|
|
||||||
|
// String implements fmt.Stringer
|
||||||
|
func (sp StreamProtocol) String() string {
|
||||||
|
if sp == StreamProtocolUdp {
|
||||||
|
return "udp"
|
||||||
|
}
|
||||||
|
return "tcp"
|
||||||
|
}
|
||||||
|
|
||||||
|
// StreamType is the type of a stream.
|
||||||
|
type StreamType int
|
||||||
|
|
||||||
|
const (
|
||||||
|
// stream that contains RTP packets
|
||||||
|
StreamTypeRtp StreamType = iota + 1
|
||||||
|
|
||||||
|
// stream that contains RTCP packets
|
||||||
|
StreamTypeRtcp
|
||||||
|
)
|
||||||
|
|
||||||
|
// String implements fmt.Stringer
|
||||||
|
func (st StreamType) String() string {
|
||||||
|
switch st {
|
||||||
|
case StreamTypeRtp:
|
||||||
|
return "RTP"
|
||||||
|
|
||||||
|
case StreamTypeRtcp:
|
||||||
|
return "RTCP"
|
||||||
|
}
|
||||||
|
return "UNKNOWN"
|
||||||
|
}
|
||||||
|
|
||||||
func readBytesLimited(rb *bufio.Reader, delim byte, n int) ([]byte, error) {
|
func readBytesLimited(rb *bufio.Reader, delim byte, n int) ([]byte, error) {
|
||||||
for i := 1; i <= n; i++ {
|
for i := 1; i <= n; i++ {
|
||||||
byts, err := rb.Peek(i)
|
byts, err := rb.Peek(i)
|
||||||
|
Reference in New Issue
Block a user