add StreamProtocol; fix docs

This commit is contained in:
aler9
2020-07-19 17:42:53 +02:00
parent 6806ec79c0
commit 511d109e8d
4 changed files with 49 additions and 23 deletions

View File

@@ -20,7 +20,10 @@ func md5Hex(in string) string {
type AuthMethod int
const (
// basic authentication method
Basic AuthMethod = iota
// digest authentication method
Digest
)

View File

@@ -29,7 +29,7 @@ type Track struct {
// track id
Id int
// track codec and info in SDP
// track codec and info in SDP format
Media *sdp.MediaDescription
}

View File

@@ -11,28 +11,6 @@ const (
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
// within RTSP connections. It is used to send RTP and RTCP packets via TCP.
type InterleavedFrame struct {

View File

@@ -11,6 +11,51 @@ const (
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) {
for i := 1; i <= n; i++ {
byts, err := rb.Peek(i)