mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 07:06:58 +08:00
update docs
This commit is contained in:
@@ -11,7 +11,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 an AAC track
|
// 2. check if there's an AAC track
|
||||||
// 3. get AAC AUs of that track
|
// 3. get AAC AUs of that track
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@@ -16,8 +16,8 @@ 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 if there's a H264 track
|
||||||
// 3. convert H264 NALUs of that track into raw frames
|
// 3. convert H264 into raw frames
|
||||||
// 4. encode the frames into JPEG images and save them on disk
|
// 4. encode the frames into JPEG images and save them on disk
|
||||||
// This example requires the ffmpeg libraries, that can be installed in this way:
|
// This example requires the ffmpeg libraries, that can be installed in this way:
|
||||||
// apt install -y libavformat-dev libswscale-dev gcc pkg-config
|
// apt install -y libavformat-dev libswscale-dev gcc pkg-config
|
||||||
@@ -92,7 +92,7 @@ func main() {
|
|||||||
|
|
||||||
// send SPS and PPS to the decoder
|
// send SPS and PPS to the decoder
|
||||||
if h264tr.SPS() == nil || h264tr.PPS() == nil {
|
if h264tr.SPS() == nil || h264tr.PPS() == nil {
|
||||||
panic("SPS or PPS not provided by the SDP")
|
panic("SPS or PPS not present into the SDP")
|
||||||
}
|
}
|
||||||
h264dec.decode(h264tr.SPS())
|
h264dec.decode(h264tr.SPS())
|
||||||
h264dec.decode(h264tr.PPS())
|
h264dec.decode(h264tr.PPS())
|
||||||
|
@@ -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 if there's a H264 track
|
||||||
// 3. save the content of the H264 track to a file in MPEG-TS format
|
// 3. save the content of the H264 track to a file in MPEG-TS format
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@@ -67,7 +67,7 @@ func (e *mpegtsEncoder) encode(nalus [][]byte, pts time.Duration) error {
|
|||||||
e.startPTS = pts
|
e.startPTS = pts
|
||||||
}
|
}
|
||||||
|
|
||||||
// check whether there's an IDR
|
// check if there's an IDR
|
||||||
idrPresent := func() bool {
|
idrPresent := func() bool {
|
||||||
for _, nalu := range nalus {
|
for _, nalu := range nalus {
|
||||||
typ := h264.NALUType(nalu[0] & 0x1F)
|
typ := h264.NALUType(nalu[0] & 0x1F)
|
||||||
|
@@ -11,8 +11,8 @@ 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 an H264 track
|
// 2. check if there's an H264 track
|
||||||
// 3. convert H264 NALUs of that track into raw frames
|
// 3. convert H264 into raw frames
|
||||||
// This example requires the ffmpeg libraries, that can be installed in this way:
|
// This example requires the ffmpeg libraries, that can be installed in this way:
|
||||||
// apt install -y libavformat-dev libswscale-dev gcc pkg-config
|
// apt install -y libavformat-dev libswscale-dev gcc pkg-config
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ func main() {
|
|||||||
|
|
||||||
// send SPS and PPS to the decoder
|
// send SPS and PPS to the decoder
|
||||||
if h264tr.SPS() == nil || h264tr.PPS() == nil {
|
if h264tr.SPS() == nil || h264tr.PPS() == nil {
|
||||||
panic("SPS or PPS not provided by the SDP")
|
panic("SPS or PPS not present into the SDP")
|
||||||
}
|
}
|
||||||
h264dec.decode(h264tr.SPS())
|
h264dec.decode(h264tr.SPS())
|
||||||
h264dec.decode(h264tr.PPS())
|
h264dec.decode(h264tr.PPS())
|
||||||
|
@@ -125,7 +125,7 @@ func (st *ServerStream) readerAdd(
|
|||||||
|
|
||||||
switch transport {
|
switch transport {
|
||||||
case TransportUDP:
|
case TransportUDP:
|
||||||
// check whether client ports are already in use by another reader.
|
// check if client ports are already in use by another reader.
|
||||||
for r := range st.readersUnicast {
|
for r := range st.readersUnicast {
|
||||||
if *r.setuppedTransport == TransportUDP &&
|
if *r.setuppedTransport == TransportUDP &&
|
||||||
r.author.ip().Equal(ss.author.ip()) &&
|
r.author.ip().Equal(ss.author.ip()) &&
|
||||||
|
Reference in New Issue
Block a user