Documentation ¶
Overview ¶
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
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
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.