rename aac examples into mpeg4audio examples

This commit is contained in:
aler9
2022-11-14 15:59:49 +01:00
parent 3c358e9cfd
commit 402cae203e
3 changed files with 21 additions and 21 deletions

View File

@@ -45,7 +45,7 @@ Features:
* Utilities
* Parse RTSP elements: requests, responses, SDP
* Parse H264 elements and formats: RTP/H264, Annex-B, AVCC, anti-competition, DTS
* Parse AAC elements and formats: RTP/AAC, ADTS, MPEG-4 audio configurations
* Parse MPEG4-audio (AAC) elements and formats: RTP/MPEG4-audio, ADTS, MPEG4-audio configurations
## Table of contents
@@ -57,16 +57,16 @@ Features:
* [client-query](examples/client-query/main.go)
* [client-read](examples/client-read/main.go)
* [client-read-codec-aac](examples/client-read-codec-aac/main.go)
* [client-read-codec-h264](examples/client-read-codec-h264/main.go)
* [client-read-codec-h264-convert-to-jpeg](examples/client-read-codec-h264-convert-to-jpeg/main.go)
* [client-read-codec-h264-save-to-disk](examples/client-read-codec-h264-save-to-disk/main.go)
* [client-read-codec-mpeg4audio](examples/client-read-codec-mpeg4audio/main.go)
* [client-read-partial](examples/client-read-partial/main.go)
* [client-read-options](examples/client-read-options/main.go)
* [client-read-pause](examples/client-read-pause/main.go)
* [client-read-republish](examples/client-read-republish/main.go)
* [client-publish-codec-aac](examples/client-publish-codec-aac/main.go)
* [client-publish-codec-h264](examples/client-publish-codec-h264/main.go)
* [client-publish-codec-mpeg4audio](examples/client-publish-codec-mpeg4audio/main.go)
* [client-publish-codec-opus](examples/client-publish-codec-opus/main.go)
* [client-publish-codec-pcma](examples/client-publish-codec-pcma/main.go)
* [client-publish-codec-pcmu](examples/client-publish-codec-pcmu/main.go)

View File

@@ -10,19 +10,19 @@ import (
)
// This example shows how to
// 1. generate RTP/AAC packets with GStreamer
// 2. connect to a RTSP server, announce an AAC track
// 1. generate RTP/MPEG4-audio packets with GStreamer
// 2. connect to a RTSP server, announce an MPEG4-audio track
// 3. route the packets from GStreamer to the server
func main() {
// open a listener to receive RTP/AAC packets
// open a listener to receive RTP/MPEG4-audio packets
pc, err := net.ListenPacket("udp", "localhost:9000")
if err != nil {
panic(err)
}
defer pc.Close()
log.Println("Waiting for a RTP/AAC stream on UDP port 9000 - you can send one with GStreamer:\n" +
log.Println("Waiting for a RTP/MPEG4-audio stream on UDP port 9000 - you can send one with GStreamer:\n" +
"gst-launch-1.0 audiotestsrc freq=300 ! audioconvert ! audioresample ! audio/x-raw,rate=48000" +
" ! avenc_aac bitrate=128000 ! rtpmp4gpay ! udpsink host=127.0.0.1 port=9000")
@@ -34,7 +34,7 @@ func main() {
}
log.Println("stream connected")
// create an AAC track
// create an MPEG4-audio track
track := &gortsplib.TrackMPEG4Audio{
PayloadType: 96,
Config: &mpeg4audio.Config{

View File

@@ -10,8 +10,8 @@ import (
// This example shows how to
// 1. connect to a RTSP server and read all tracks on a path
// 2. check if there's an AAC track
// 3. get AAC AUs of that track
// 2. check if there's an MPEG4-audio track
// 3. get access units of that track
func main() {
c := gortsplib.Client{}
@@ -35,8 +35,8 @@ func main() {
panic(err)
}
// find the AAC track
aacTrack, aacTrackID := func() (*gortsplib.TrackMPEG4Audio, int) {
// find the MPEG4-audio track
mpeg4audioTrack, mpeg4audioTrackID := func() (*gortsplib.TrackMPEG4Audio, int) {
for i, track := range tracks {
if tt, ok := track.(*gortsplib.TrackMPEG4Audio); ok {
return tt, i
@@ -44,26 +44,26 @@ func main() {
}
return nil, -1
}()
if aacTrack == nil {
panic("AAC track not found")
if mpeg4audioTrack == nil {
panic("MPEG4-audio track not found")
}
// setup decoder
dec := &rtpmpeg4audio.Decoder{
SampleRate: aacTrack.Config.SampleRate,
SizeLength: aacTrack.SizeLength,
IndexLength: aacTrack.IndexLength,
IndexDeltaLength: aacTrack.IndexDeltaLength,
SampleRate: mpeg4audioTrack.Config.SampleRate,
SizeLength: mpeg4audioTrack.SizeLength,
IndexLength: mpeg4audioTrack.IndexLength,
IndexDeltaLength: mpeg4audioTrack.IndexDeltaLength,
}
dec.Init()
// called when a RTP packet arrives
c.OnPacketRTP = func(ctx *gortsplib.ClientOnPacketRTPCtx) {
if ctx.TrackID != aacTrackID {
if ctx.TrackID != mpeg4audioTrackID {
return
}
// decode AAC AUs from the RTP packet
// decode MPEG4-audio AUs from the RTP packet
aus, _, err := dec.Decode(ctx.Packet)
if err != nil {
return
@@ -71,7 +71,7 @@ func main() {
// print AUs
for _, au := range aus {
log.Printf("received AAC AU of size %d\n", len(au))
log.Printf("received MPEG4-audio AU of size %d\n", len(au))
}
}