format

package
v0.0.0-...-69b8586 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2023 License: BSD-2-Clause Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const IdentifyPeekBytes = 16

Variables

This section is empty.

Functions

This section is empty.

Types

type AnalyzerChannel

type AnalyzerChannel chan *AnalyzerPacket

func MergeHasherChannels

func MergeHasherChannels(channels ...AnalyzerChannel) (channel AnalyzerChannel)

func NewAnalyzerChannel

func NewAnalyzerChannel(source audio.Source, err error) (audio.Source, AnalyzerChannel, error)

func NewHasherAudioGap

func NewHasherAudioGap(samples, sampleRate, channels, bitDepth int) (channel AnalyzerChannel)

func (AnalyzerChannel) AppendGap

func (c AnalyzerChannel) AppendGap(samples, sampleRate, channels, bitDepth int) (channel AnalyzerChannel)

func (AnalyzerChannel) PrependGap

func (c AnalyzerChannel) PrependGap(samples, sampleRate, channels, bitDepth int) (channel AnalyzerChannel)

func (AnalyzerChannel) SkipEndSamples

func (c AnalyzerChannel) SkipEndSamples(samples int) (channel AnalyzerChannel)

func (AnalyzerChannel) SkipEndSamplesMultiple

func (c AnalyzerChannel) SkipEndSamplesMultiple(wg *sync.WaitGroup, offset *atomic.Uint32, samples int) (channel AnalyzerChannel)

func (AnalyzerChannel) SkipStartSamples

func (c AnalyzerChannel) SkipStartSamples(samples int) (channel AnalyzerChannel)

func (AnalyzerChannel) Split

func (c AnalyzerChannel) Split(n int) (channels []AnalyzerChannel)

type AnalyzerDecoder

type AnalyzerDecoder interface {
	Decoder
	// OpenAnalyzer Opens a stream and decodes it into an audio.Source, and additionally copy AnalyzerPacket back
	OpenAnalyzer(r io.ReadSeekCloser) (audio.Source, AnalyzerChannel, error)
}

type AnalyzerPacket

type AnalyzerPacket struct {
	//Samples interleaved samples
	Samples    []int32
	Channels   int
	SampleRate int
	BitDepth   int
}

type Decoder

type Decoder interface {
	Format
	// Open a stream and decodes it into an audio.Source
	Open(r io.ReadSeekCloser) (audio.Source, error)

	// DecoderDescription returns a longer description of the backing libraries or versions
	DecoderDescription() string
}

type Encoder

type Encoder interface {
	Format
	// Encode Receives an audio.Source and encodes it into a writer. Some formats can do special operations if writer is also an io.Seeker
	Encode(source audio.Source, writer io.WriteCloser, options map[string]interface{}) error

	// EncoderDescription returns a longer description of the backing libraries or versions
	EncoderDescription() string
}

type Format

type Format interface {
	// Identify checks whether a format is of a type. peek includes a few first bytes, extension is the lowercase file extension without a dot.
	Identify(peek [IdentifyPeekBytes]byte, extension string) bool
	// Name returns the name of the codec or format
	Name() string
}

type WriteSeekCloser

type WriteSeekCloser interface {
	io.Writer
	io.Closer
	io.Seeker
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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