chunker

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2021 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BufferStatus added in v0.5.0

type BufferStatus struct {
	// Tmin and Tmax denote the lowest and highest wall clock time in the buffer
	Tmin, Tmax time.Time

	// Tahead is the length of the buffer (in milliseconds) added but not yet available for reading
	Tahead float32

	// Tbehind is the length of the buffer (in milliseconds) available for reading as of the current time
	Tbehind float32

	// BufferSize is the size (in bytes) added but not yet available for reading
	BufferSize int

	// TotalSize is the total size (in bytes) of the buffer
	TotalSize int
}

type ChunkStream

type ChunkStream interface {
	io.Reader
}

A ChunkStream wraps a single read session initiated from a Chunker

type Chunker

type Chunker interface {
	wavreader.Writer
	NewStream() (ChunkStream, error)
	NewStreamWithOffset(time.Duration) (ChunkStream, error)

	// SetAssociatedData allows one to store arbitrary data at this time index
	SetAssociatedData(interface{})

	// GetAssociatedData retrieves the most recent data stored at or before the current time index
	GetAssociatedData() (interface{}, error)
}

A Chunker is a buffered writer that breaks up audio into chunks made available for reading later.

func NewMP3

func NewMP3() (Chunker, error)

type MP3ChunkConfig added in v0.4.0

type MP3ChunkConfig struct {
	Context context.Context
	Audio   wavreader.Config
}

func (MP3ChunkConfig) NewMP3 added in v0.4.0

func (m MP3ChunkConfig) NewMP3() (Chunker, error)

type Statuser added in v0.5.0

type Statuser interface {
	BufferStatus() BufferStatus
}

type WAVChunkConfig added in v0.5.0

type WAVChunkConfig struct {
	StreamFormat wavreader.StreamFormat
	ReadAhead    time.Duration
	ReadBehind   time.Duration
}

func (WAVChunkConfig) New added in v0.5.0

func (c WAVChunkConfig) New() (Chunker, error)

Jump to

Keyboard shortcuts

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