diff --git a/auth.go b/auth.go index a7cb0128..1439a0f8 100644 --- a/auth.go +++ b/auth.go @@ -20,7 +20,10 @@ func md5Hex(in string) string { type AuthMethod int const ( + // basic authentication method Basic AuthMethod = iota + + // digest authentication method Digest ) diff --git a/conn-client.go b/conn-client.go index f05fb4ee..84815e61 100644 --- a/conn-client.go +++ b/conn-client.go @@ -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 } diff --git a/interleaved-frame.go b/interleaved-frame.go index 45adab1c..e6094a22 100644 --- a/interleaved-frame.go +++ b/interleaved-frame.go @@ -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 { diff --git a/utils.go b/utils.go index b147a402..05319069 100644 --- a/utils.go +++ b/utils.go @@ -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)