Versions in this module Expand all Collapse all v0 v0.1.1 Sep 7, 2026 v0.1.0 Sep 7, 2026 Changes in this version + const Audio + const Data + const DefFrameDur + const DefFramesPerSec + const Unknown + var DefaultResampleOptions []ResampleOption + func CodecEnabled(c CodecType) bool + func CodecEnabledByName(name string) bool + func CodecSetEnabled(name string, enabled bool) + func CodecsSetEnabled(codecs map[string]bool) + func DumpFramesPCM16(w io.WriteCloser, sampleRate int, frames []PCM16Sample) error + func MonoToStereo(dst, src PCM16Sample) + func OnRegister(fnc func(c CodecType)) + func Pipe[T ~[]E, E comparable](sampleRate int) (*PipeReader[T, E], *PipeWriter[T, E]) + func PlayAudio[T any](ctx context.Context, w Writer[T], sampleDur time.Duration, frames []T) error + func RegisterCodec(c CodecType) + func StereoToMono(dst, src PCM16Sample) + type AudioCodec interface + DecodeBytes func(w PCM16Writer) BytesWriter + EncodeBytes func(w BytesWriter) PCM16Writer + type AudioDecodeFunc func(w PCM16Writer) WriteCloser[S] + type AudioEncodeFunc func(w WriteCloser[S]) PCM16Writer + type AudioFrameCodec interface + Decode func(w PCM16Writer) WriteCloser[S] + Encode func(w WriteCloser[S]) PCM16Writer + type BytesFrame interface + type BytesWriter interface + Close func() error + String func() string + WriteRaw func(frame []byte) error + func DecodeBytes[S BytesFrame](w WriteCloser[S]) BytesWriter + func NewBytesWriter(w io.WriteCloser) BytesWriter + type Codec interface + Info func() CodecInfo + type CodecConfig struct + Channels int + Params CodecParams + SampleRate int + func (c *CodecConfig) Equals(c2 *CodecConfig) bool + type CodecInfo struct + RTPClockRate int + func (c *CodecInfo) Defaults() + func (c *CodecInfo) Equals(c2 *CodecInfo) bool + func (c CodecInfo) Info() CodecInfo + func (c CodecInfo) SDPFullName() string + func (c CodecInfo) String() string + type CodecParam struct + Key string + Val string + func (p CodecParam) String() string + type CodecParams []CodecParam + func (arr *CodecParams) Add(key, val string) + func (arr CodecParams) Equals(arr2 CodecParams) bool + func (arr CodecParams) Get(key string) (string, bool) + func (arr CodecParams) Has(key string) bool + func (arr CodecParams) HasParam(p2 CodecParam) bool + func (arr CodecParams) HasValue(key, val string) bool + func (arr CodecParams) String() string + type CodecSet struct + func GlobalCodecs() *CodecSet + func NewCodecSet() *CodecSet + func (s *CodecSet) IsEnabled(c CodecType) bool + func (s *CodecSet) IsEnabledByName(name string) bool + func (s *CodecSet) ListEnabled() []CodecType + func (s *CodecSet) NewSet() *CodecSet + func (s *CodecSet) SetEnabled(name string, enabled bool) + func (s *CodecSet) SetEnabledMap(codecs map[string]bool) + type CodecType interface + Info func() CodecTypeInfo + Offer func(s *CodecSet) []CodecInfo + SDPName func() string + Supports func(c CodecConfig) (CodecInfo, CreateFunc, bool) + func Codecs() []CodecType + func EnabledCodecs() []CodecType + func NewCodec(info CodecTypeInfo, offer OfferFunc, support SupportsFunc) CodecType + type CodecTypeInfo struct + FileExt string + Kind Kind + Name string + Priority int + RTPDefType byte + RTPIsStatic bool + func (c CodecTypeInfo) Info() CodecTypeInfo + func (c CodecTypeInfo) SDPName() string + func (c CodecTypeInfo) String() string + type CreateFunc func() Codec + func NewAudioCodecFunc[S BytesFrame](info CodecInfo, decode AudioDecodeFunc[S], encode AudioEncodeFunc[S]) CreateFunc + type Frame interface + CopyTo func(dst []byte) (int, error) + Size func() int + type FullFramesOption func(*fullFrameBuffer[T, S]) + func DropTailOnClose[T ~[]S, S sample]() FullFramesOption[T, S] + type Kind int + type MediaSampleWriter interface + WriteSample func(sample media.Sample) error + type MultiWriter []WriteCloser[T] + func (s MultiWriter[T]) Close() error + func (s MultiWriter[T]) SampleRate() int + func (s MultiWriter[T]) String() string + func (s MultiWriter[T]) WriteSample(sample T) error + type OfferFunc func(s *CodecSet) []CodecInfo + type PCM16GainWriter struct + func NewPCM16GainWriter(w PCM16Writer) *PCM16GainWriter + func (g *PCM16GainWriter) Close() error + func (g *PCM16GainWriter) SampleRate() int + func (g *PCM16GainWriter) SetGain(v float32) error + func (g *PCM16GainWriter) String() string + func (g *PCM16GainWriter) WriteSample(sample PCM16Sample) error + type PCM16Processor = Processor[PCM16Sample] + type PCM16Sample []int16 + func Resample(dst PCM16Sample, dstSampleRate int, src PCM16Sample, srcSampleRate int, ...) PCM16Sample + func (s *PCM16Sample) WriteSample(data PCM16Sample) error + func (s PCM16Sample) Clear() + func (s PCM16Sample) Close() error + func (s PCM16Sample) CopyTo(dst []byte) (int, error) + func (s PCM16Sample) Size() int + type PCM16Writer = WriteCloser[PCM16Sample] + func DumpFilePCM16(name string, sampleRate int) PCM16Writer + func DumpWriterPCM16(name string, w PCM16Writer) PCM16Writer + func NewPCM16BufferWriter(buf *PCM16Sample, sampleRate int) PCM16Writer + func NewPCM16FrameWriter(buf *[]PCM16Sample, sampleRate int) PCM16Writer + func ResampleWriter(w PCM16Writer, sampleRate int, opts ...ResampleOption) (w2 PCM16Writer) + type PipeReader struct + func (r *PipeReader[T, E]) Close() error + func (r *PipeReader[T, E]) CloseWithError(err error) error + func (r *PipeReader[T, E]) ReadSample(data T) (n int, err error) + type PipeWriter struct + func (w *PipeWriter[T, E]) Close() error + func (w *PipeWriter[T, E]) CloseWithError(err error) error + func (w *PipeWriter[T, E]) SampleRate() int + func (w *PipeWriter[T, E]) String() string + func (w *PipeWriter[T, E]) WriteSample(data T) (err error) + type Processor func(w WriteCloser[T]) WriteCloser[T] + type ReadCloser interface + Close func() error + type Reader interface + ReadSample func(buf T) (int, error) + func NewPCM16BufferReader(buf PCM16Sample) Reader[PCM16Sample] + type ResampleOption func(opts *resampleOptions) + func WithPredictableResample(enable bool) ResampleOption + func WithResampleDump(inputName, outputName string) ResampleOption + type SupportsFunc func(c CodecConfig) (CodecInfo, CreateFunc, bool) + type SwitchWriter struct + func NewSwitchWriter(sampleRate int) *SwitchWriter + func (s *SwitchWriter) Disable() + func (s *SwitchWriter) Enable() + func (s *SwitchWriter) Get() PCM16Writer + func (s *SwitchWriter) SampleRate() int + func (s *SwitchWriter) SetSampleRate(rate int) + func (s *SwitchWriter) String() string + func (s *SwitchWriter) Swap(w PCM16Writer) PCM16Writer + func (s *SwitchWriter) WriteSample(sample PCM16Sample) error + type WriteCloser interface + Close func() error + func DumpFile[T Frame](name, ext string, sampleRate int) WriteCloser[T] + func DumpWriter[T Frame](ext string, name string, w WriteCloser[T]) WriteCloser[T] + func EncodeBytes[S Frame](w BytesWriter, sampleRate int) WriteCloser[S] + func FromSampleWriter[T ~[]byte](w MediaSampleWriter, sampleRate int, sampleDur time.Duration) WriteCloser[T] + func FullFrames[T ~[]S, S sample](w WriteCloser[T], frameSize int, opts ...FullFramesOption[T, S]) WriteCloser[T] + func NewFileWriter[T Frame](w io.WriteCloser, sampleRate int) WriteCloser[T] + func NewFrameWriter[T ~[]S, S sample](buf *[]T, sampleRate int) WriteCloser[T] + func NopCloser[T any](w Writer[T]) WriteCloser[T] + type WriteCloserSwitch struct + func NewWriteCloserSwitch[T any](sampleRate int) *WriteCloserSwitch[T] + func (s *WriteCloserSwitch[T]) Close() error + func (s *WriteCloserSwitch[T]) Get() WriteCloser[T] + func (s *WriteCloserSwitch[T]) SampleRate() int + func (s *WriteCloserSwitch[T]) String() string + func (s *WriteCloserSwitch[T]) Swap(w WriteCloser[T]) WriteCloser[T] + func (s *WriteCloserSwitch[T]) WriteSample(sample T) error + type Writer interface + SampleRate func() int + String func() string + WriteSample func(sample T) error