package vorbis
import "github.com/jfreymuth/vorbis"
Package vorbis implements a vorbis decoder.
Note that this package only decodes raw vorbis packets, these packets are usually stored in a container format like ogg.
The vorbis specification is available at: https://xiph.org/vorbis/doc/Vorbis_I_spec.html
Index ¶
- func IsHeader(packet []byte) bool
- type Bitrate
- type CommentHeader
- type Decoder
- func (d *Decoder) BufferSize() int
- func (d *Decoder) Channels() int
- func (d *Decoder) Clear()
- func (d *Decoder) Decode(in []byte) ([]float32, error)
- func (d *Decoder) DecodeInto(in []byte, buffer []float32) ([]float32, error)
- func (d *Decoder) HeadersRead() bool
- func (d *Decoder) ReadHeader(header []byte) error
- func (d *Decoder) SampleRate() int
Functions ¶
func IsHeader ¶
IsHeader returns wether the packet is a vorbis header.
Types ¶
type Bitrate ¶
The Bitrate of a vorbis stream. Some or all of the fields can be zero.
type CommentHeader ¶
The CommentHeader of a vorbis stream.
type Decoder ¶
type Decoder struct { Bitrate Bitrate CommentHeader // contains filtered or unexported fields }
A Decoder stores the information necessary to decode a vorbis steam.
func (*Decoder) BufferSize ¶
BufferSize returns the highest amount of data that can be decoded from a single packet. The result is already multiplied with the number of channels. This will be zero if the headers have not been read yet.
func (*Decoder) Channels ¶
Channels returns the number of channels of the vorbis stream. This will be zero if the headers have not been read yet.
func (*Decoder) Clear ¶
func (d *Decoder) Clear()
Clear must be called between decoding two non-consecutive packets.
func (*Decoder) Decode ¶
Decode decodes a packet and returns the result as an interleaved float slice. The number of samples decoded varies and can be zero, but will be at most BufferSize()
func (*Decoder) DecodeInto ¶
DecodeInto decodes a packet and stores the result in the given buffer. The size of the buffer must be at least BufferSize(). The method will always return a slice of the buffer or nil.
func (*Decoder) HeadersRead ¶
HeadersRead returns wether the headers necessary for decoding have been read.
func (*Decoder) ReadHeader ¶
ReadHeader reads a vorbis header. Three headers (identification, comment, and setup) must be read before any samples can be decoded.
func (*Decoder) SampleRate ¶
SampleRate returns the sample rate of the vorbis stream. This will be zero if the headers have not been read yet.
Source Files ¶
bitreader.go codebook.go decode.go doc.go floor0.go floor1.go header.go huffman.go imdct.go inversedbtable.go residue.go setup.go vorbis.go window.go
- Version
- v1.0.2 (latest)
- Published
- Jan 30, 2021
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 1 month ago –
Tools for package owners.