forked from bluenviron/gortsplib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrack_mpeg2audio.go
48 lines (42 loc) · 946 Bytes
/
track_mpeg2audio.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package gortsplib //nolint:dupl
import (
psdp "github.com/pion/sdp/v3"
)
// TrackMPEG2Audio is a MPEG-1 or MPEG-2 audio track.
type TrackMPEG2Audio struct {
trackBase
}
func newTrackMPEG2AudioFromMediaDescription(
control string) (*TrackMPEG2Audio, error,
) {
return &TrackMPEG2Audio{
trackBase: trackBase{
control: control,
},
}, nil
}
// ClockRate returns the track clock rate.
func (t *TrackMPEG2Audio) ClockRate() int {
return 90000
}
func (t *TrackMPEG2Audio) clone() Track {
return &TrackMPEG2Audio{
trackBase: t.trackBase,
}
}
// MediaDescription returns the track media description in SDP format.
func (t *TrackMPEG2Audio) MediaDescription() *psdp.MediaDescription {
return &psdp.MediaDescription{
MediaName: psdp.MediaName{
Media: "audio",
Protos: []string{"RTP", "AVP"},
Formats: []string{"14"},
},
Attributes: []psdp.Attribute{
{
Key: "control",
Value: t.control,
},
},
}
}