BIG rewrite stream info

This commit is contained in:
Alex X
2024-06-15 16:46:03 +03:00
parent ecfe802065
commit 96504e2fb0
88 changed files with 1043 additions and 854 deletions
+14 -2
View File
@@ -20,7 +20,13 @@ import (
var Timeout = time.Second * 5
func NewClient(uri string) *Conn {
return &Conn{uri: uri}
return &Conn{
Connection: core.Connection{
ID: core.NewID(),
FormatName: "rtsp",
},
uri: uri,
}
}
func (c *Conn) Dial() (err error) {
@@ -36,8 +42,10 @@ func (c *Conn) Dial() (err error) {
timeout = time.Second * time.Duration(c.Timeout)
}
conn, err = tcp.Dial(c.URL, timeout)
c.Protocol = "rtsp+tcp"
} else {
conn, err = websocket.Dial(c.Transport)
c.Protocol = "ws"
}
if err != nil {
return
@@ -53,6 +61,10 @@ func (c *Conn) Dial() (err error) {
c.sequence = 0
c.state = StateConn
c.Connection.RemoteAddr = conn.RemoteAddr().String()
c.Connection.Transport = conn
c.Connection.URL = c.uri
return nil
}
@@ -143,7 +155,7 @@ func (c *Conn) Describe() error {
}
}
c.sdp = string(res.Body) // for info
c.SDP = string(res.Body) // for info
medias, err := UnmarshalSDP(res.Body)
if err != nil {