encoder

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: MIT Imports: 3 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"
)

Variables

This section is empty.

Functions

func CreateDecode

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

BuildDecoder creates a decoder function for the specified codec

func CreateEncode

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

BuildEncoder creates an encoder function for the specified codec

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 media2.CodecConfig) media2.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 media2.CodecConfig) media2.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