forked from bluenviron/gortsplib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mpeg1_audio.go
69 lines (53 loc) · 1.37 KB
/
mpeg1_audio.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package format //nolint:dupl
import (
"github.com/pion/rtp"
"github.com/bass3m/gortsplib/pkg/format/rtpmpeg1audio"
)
// MPEG1Audio is a RTP format for a MPEG-1/2 Audio codec.
// Specification: https://datatracker.ietf.org/doc/html/rfc2250
type MPEG1Audio struct{}
func (f *MPEG1Audio) unmarshal(_ *unmarshalContext) error {
return nil
}
// Codec implements Format.
func (f *MPEG1Audio) Codec() string {
return "MPEG-1/2 Audio"
}
// ClockRate implements Format.
func (f *MPEG1Audio) ClockRate() int {
return 90000
}
// PayloadType implements Format.
func (f *MPEG1Audio) PayloadType() uint8 {
return 14
}
// RTPMap implements Format.
func (f *MPEG1Audio) RTPMap() string {
return ""
}
// FMTP implements Format.
func (f *MPEG1Audio) FMTP() map[string]string {
return nil
}
// PTSEqualsDTS implements Format.
func (f *MPEG1Audio) PTSEqualsDTS(*rtp.Packet) bool {
return true
}
// CreateDecoder creates a decoder able to decode the content of the format.
func (f *MPEG1Audio) CreateDecoder() (*rtpmpeg1audio.Decoder, error) {
d := &rtpmpeg1audio.Decoder{}
err := d.Init()
if err != nil {
return nil, err
}
return d, nil
}
// CreateEncoder creates an encoder able to encode the content of the format.
func (f *MPEG1Audio) CreateEncoder() (*rtpmpeg1audio.Encoder, error) {
e := &rtpmpeg1audio.Encoder{}
err := e.Init()
if err != nil {
return nil, err
}
return e, nil
}