update docs

This commit is contained in:
aler9
2021-08-25 23:28:07 +02:00
parent d744a2e0d3
commit 359409aaf9
5 changed files with 11 additions and 11 deletions

View File

@@ -12,7 +12,7 @@ import (
// This example shows how to // This example shows how to
// 1. set additional client options // 1. set additional client options
// 2. generate RTP/H264 frames from a file with Gstreamer // 2. generate RTP/H264 frames from a file with Gstreamer
// 3. connect to a RTSP server, announce a H264 track // 3. connect to a RTSP server, announce an H264 track
// 4. write the frames to the server // 4. write the frames to the server
func main() { func main() {
@@ -35,7 +35,7 @@ func main() {
} }
fmt.Println("stream connected") fmt.Println("stream connected")
// create a H264 track // create an H264 track
track, err := gortsplib.NewTrackH264(96, &gortsplib.TrackConfigH264{sps, pps}) track, err := gortsplib.NewTrackH264(96, &gortsplib.TrackConfigH264{sps, pps})
if err != nil { if err != nil {
panic(err) panic(err)

View File

@@ -11,7 +11,7 @@ import (
// This example shows how to // This example shows how to
// 1. generate RTP/H264 frames from a file with Gstreamer // 1. generate RTP/H264 frames from a file with Gstreamer
// 2. connect to a RTSP server, announce a H264 track // 2. connect to a RTSP server, announce an H264 track
// 3. write the frames to the server for 5 seconds // 3. write the frames to the server for 5 seconds
// 4. pause for 5 seconds // 4. pause for 5 seconds
// 5. repeat // 5. repeat
@@ -36,7 +36,7 @@ func main() {
} }
fmt.Println("stream connected") fmt.Println("stream connected")
// create a H264 track // create an H264 track
track, err := gortsplib.NewTrackH264(96, &gortsplib.TrackConfigH264{sps, pps}) track, err := gortsplib.NewTrackH264(96, &gortsplib.TrackConfigH264{sps, pps})
if err != nil { if err != nil {
panic(err) panic(err)

View File

@@ -10,7 +10,7 @@ import (
// This example shows how to // This example shows how to
// 1. generate RTP/H264 frames from a file with Gstreamer // 1. generate RTP/H264 frames from a file with Gstreamer
// 2. connect to a RTSP server, announce a H264 track // 2. connect to a RTSP server, announce an H264 track
// 3. write the frames to the server // 3. write the frames to the server
func main() { func main() {
@@ -33,7 +33,7 @@ func main() {
} }
fmt.Println("stream connected") fmt.Println("stream connected")
// create a H264 track // create an H264 track
track, err := gortsplib.NewTrackH264(96, &gortsplib.TrackConfigH264{sps, pps}) track, err := gortsplib.NewTrackH264(96, &gortsplib.TrackConfigH264{sps, pps})
if err != nil { if err != nil {
panic(err) panic(err)

View File

@@ -9,7 +9,7 @@ import (
// This example shows how to // This example shows how to
// 1. connect to a RTSP server and read all tracks on a path // 1. connect to a RTSP server and read all tracks on a path
// 2. check whether there's a H264 track // 2. check whether there's an H264 track
// 3. get H264 NALUs of that track // 3. get H264 NALUs of that track
func main() { func main() {

View File

@@ -140,7 +140,7 @@ func (t *Track) ClockRate() (int, error) {
return 0, fmt.Errorf("attribute 'rtpmap' not found") return 0, fmt.Errorf("attribute 'rtpmap' not found")
} }
// NewTrackH264 initializes an H264 track from a SPS and PPS. // NewTrackH264 initializes an H264 track.
func NewTrackH264(payloadType uint8, conf *TrackConfigH264) (*Track, error) { func NewTrackH264(payloadType uint8, conf *TrackConfigH264) (*Track, error) {
spropParameterSets := base64.StdEncoding.EncodeToString(conf.SPS) + spropParameterSets := base64.StdEncoding.EncodeToString(conf.SPS) +
"," + base64.StdEncoding.EncodeToString(conf.PPS) "," + base64.StdEncoding.EncodeToString(conf.PPS)
@@ -171,7 +171,7 @@ func NewTrackH264(payloadType uint8, conf *TrackConfigH264) (*Track, error) {
}, nil }, nil
} }
// IsH264 checks whether the track is a H264 track. // IsH264 checks whether the track is an H264 track.
func (t *Track) IsH264() bool { func (t *Track) IsH264() bool {
if t.Media.MediaName.Media != "video" { if t.Media.MediaName.Media != "video" {
return false return false
@@ -190,7 +190,7 @@ func (t *Track) IsH264() bool {
return vals[1] == "H264/90000" return vals[1] == "H264/90000"
} }
// ExtractConfigH264 extracts the configuration from an H264 track. // ExtractConfigH264 extracts the configuration of an H264 track.
func (t *Track) ExtractConfigH264() (*TrackConfigH264, error) { func (t *Track) ExtractConfigH264() (*TrackConfigH264, error) {
v, ok := t.Media.Attribute("fmtp") v, ok := t.Media.Attribute("fmtp")
if !ok { if !ok {
@@ -302,7 +302,7 @@ func (t *Track) IsAAC() bool {
return strings.HasPrefix(strings.ToLower(vals[1]), "mpeg4-generic/") return strings.HasPrefix(strings.ToLower(vals[1]), "mpeg4-generic/")
} }
// ExtractConfigAAC extracts the configuration from an AAC track. // ExtractConfigAAC extracts the configuration of an AAC track.
func (t *Track) ExtractConfigAAC() (*TrackConfigAAC, error) { func (t *Track) ExtractConfigAAC() (*TrackConfigAAC, error) {
v, ok := t.Media.Attribute("fmtp") v, ok := t.Media.Attribute("fmtp")
if !ok { if !ok {