mirror of https://bitbucket.org/ausocean/av.git
protocol/rtsp: removed sdp stuff
We won't be using this, at least not initially, so it's being deleted.
This commit is contained in:
parent
cd7e2ce3f3
commit
6f4738a04c
|
@ -1,73 +0,0 @@
|
|||
package rtsp
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"errors"
|
||||
"io"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type SessionSection struct {
|
||||
Version int
|
||||
Originator string
|
||||
SessionName string
|
||||
SessionInformation string
|
||||
URI string
|
||||
Email string
|
||||
Phone string
|
||||
ConnectionInformation string
|
||||
BandwidthInformation string
|
||||
}
|
||||
|
||||
func ParseSdp(r io.Reader) (SessionSection, error) {
|
||||
var packet SessionSection
|
||||
s := bufio.NewScanner(r)
|
||||
for s.Scan() {
|
||||
parts := strings.SplitN(s.Text(), "=", 2)
|
||||
if len(parts) == 2 {
|
||||
if len(parts[0]) != 1 {
|
||||
return packet, errors.New("SDP only allows 1-character variables")
|
||||
}
|
||||
|
||||
switch parts[0] {
|
||||
// version
|
||||
case "v":
|
||||
ver, err := strconv.Atoi(parts[1])
|
||||
if err != nil {
|
||||
return packet, err
|
||||
}
|
||||
packet.Version = ver
|
||||
// owner/creator and session identifier
|
||||
case "o":
|
||||
// o=<username> <session id> <version> <network type> <address type> <address>
|
||||
// TODO: parse this
|
||||
packet.Originator = parts[1]
|
||||
// session name
|
||||
case "s":
|
||||
packet.SessionName = parts[1]
|
||||
// session information
|
||||
case "i":
|
||||
packet.SessionInformation = parts[1]
|
||||
// URI of description
|
||||
case "u":
|
||||
packet.URI = parts[1]
|
||||
// email address
|
||||
case "e":
|
||||
packet.Email = parts[1]
|
||||
// phone number
|
||||
case "p":
|
||||
packet.Phone = parts[1]
|
||||
// connection information - not required if included in all media
|
||||
case "c":
|
||||
// TODO: parse this
|
||||
packet.ConnectionInformation = parts[1]
|
||||
// bandwidth information
|
||||
case "b":
|
||||
// TODO: parse this
|
||||
packet.BandwidthInformation = parts[1]
|
||||
}
|
||||
}
|
||||
}
|
||||
return packet, nil
|
||||
}
|
Loading…
Reference in New Issue