client: merge Client and ClientConn

This commit is contained in:
aler9
2021-11-01 00:15:50 +01:00
committed by Alessandro Ros
parent eef010a6e0
commit d1d766658b
18 changed files with 1917 additions and 1937 deletions

View File

@@ -28,16 +28,16 @@ func main() {
c := gortsplib.Client{}
// connect to the server and start reading all tracks
conn, err := c.DialRead(inputStream)
err := c.DialRead(inputStream)
if err != nil {
panic(err)
}
defer conn.Close()
defer c.Close()
// find the H264 track
var h264TrackID int = -1
var h264Conf *gortsplib.TrackConfigH264
for i, track := range conn.Tracks() {
for i, track := range c.Tracks() {
if track.IsH264() {
h264TrackID = i
h264Conf, err = track.ExtractConfigH264()
@@ -74,7 +74,7 @@ func main() {
mux.SetPCRPID(256)
// read packets
err = conn.ReadFrames(func(trackID int, streamType gortsplib.StreamType, payload []byte) {
err = c.ReadFrames(func(trackID int, streamType gortsplib.StreamType, payload []byte) {
if trackID != h264TrackID {
return
}