encoder

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	G722_RATE_DEFAULT = 64000
	G722_DEFAULT      = 0
)

G.722 constants

View Source
const (
	CodecPCM  = "pcm"
	CodecPCMU = "pcmu"
	CodecPCMA = "pcma"
	CodecG722 = "g722"
	CodecOPUS = "opus"
)

Variables

This section is empty.

Functions

func CreateDecode

func CreateDecode(src, pcm media.CodecConfig) (decode media.EncoderFunc, err error)

BuildDecoder creates a decoder function for the specified codec

func CreateEncode

func CreateEncode(src, pcm media.CodecConfig) (encode media.EncoderFunc, err error)

BuildEncoder creates an encoder function for the specified codec

func DecodePCMA added in v1.3.0

func DecodePCMA(alawData []byte) ([]byte, error)

DecodePCMA decodes G.711 A-law RTP payloads to 16-bit little-endian PCM mono.

func DecodePCMU added in v1.3.0

func DecodePCMU(ulawData []byte) ([]byte, error)

DecodePCMU decodes G.711 μ-law RTP payloads to 16-bit little-endian PCM mono.

func EncodePCMA

func EncodePCMA(pcmData []byte) ([]byte, error)

convertPCMToALaw converts PCM data to A-law encoding EncodePCMA encodes PCM data to PCMA format

func HasCodec

func HasCodec(name string) bool

IsCodecSupported checks if a codec is registered

func Pcm2pcma

func Pcm2pcma(pcmData []byte) ([]byte, error)

func PcmToPcm

func PcmToPcm(src, pcm media.CodecConfig) media.EncoderFunc

func RegisterCodec

func RegisterCodec(name string, encoderFactory, decoderFactory CodecFactory)

RegisterCodec registers a codec with encoder and decoder factories

func StripWavHeader

func StripWavHeader(data []byte) []byte

RemoveWavHeader removes WAV file header if present

Types

type CodecFactory

type CodecFactory func(src, pcm media.CodecConfig) media.EncoderFunc

CodecFactory defines function type for creating codec encoders/decoders

type G722Band0

type G722Band0 struct {
	// contains filtered or unexported fields
}

G.722 band structures

type G722Band1

type G722Band1 struct {
	// contains filtered or unexported fields
}

type G722Band2

type G722Band2 struct {
	// contains filtered or unexported fields
}

type G722Decoder

type G722Decoder struct {
	// contains filtered or unexported fields
}

G722Decoder G.722 decoder

func NewG722Decoder

func NewG722Decoder(rate, mode int) *G722Decoder

NewG722Decoder creates new G.722 decoder

func (*G722Decoder) Decode

func (d *G722Decoder) Decode(g722Data []byte) []byte

type G722Encoder

type G722Encoder struct {
	// contains filtered or unexported fields
}

G722Encoder G.722 encoder

func NewG722Encoder

func NewG722Encoder(rate, mode int) *G722Encoder

NewG722Encoder creates new G.722 encoder

func (*G722Encoder) Encode

func (e *G722Encoder) Encode(pcmData []byte) []byte

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL