add MP4A-LATM decoder and encoder (#299)

This commit is contained in:
Alessandro Ros
2023-06-01 20:07:47 +02:00
committed by GitHub
parent 84048960b4
commit 80cf861ec7
87 changed files with 1795 additions and 699 deletions

View File

@@ -97,24 +97,50 @@ func (f *LPCM) PTSEqualsDTS(*rtp.Packet) bool {
}
// CreateDecoder creates a decoder able to decode the content of the format.
//
// Deprecated: this has been replaced by CreateDecoder2() that can also return an error.
func (f *LPCM) CreateDecoder() *rtplpcm.Decoder {
d, _ := f.CreateDecoder2()
return d
}
// CreateDecoder2 creates a decoder able to decode the content of the format.
func (f *LPCM) CreateDecoder2() (*rtplpcm.Decoder, error) {
d := &rtplpcm.Decoder{
BitDepth: f.BitDepth,
SampleRate: f.SampleRate,
ChannelCount: f.ChannelCount,
}
d.Init()
return d
err := d.Init()
if err != nil {
return nil, err
}
return d, nil
}
// CreateEncoder creates an encoder able to encode the content of the format.
//
// Deprecated: this has been replaced by CreateEncoder2() that can also return an error.
func (f *LPCM) CreateEncoder() *rtplpcm.Encoder {
e, _ := f.CreateEncoder2()
return e
}
// CreateEncoder2 creates an encoder able to encode the content of the format.
func (f *LPCM) CreateEncoder2() (*rtplpcm.Encoder, error) {
e := &rtplpcm.Encoder{
PayloadType: f.PayloadTyp,
BitDepth: f.BitDepth,
SampleRate: f.SampleRate,
ChannelCount: f.ChannelCount,
}
e.Init()
return e
err := e.Init()
if err != nil {
return nil, err
}
return e, nil
}