Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder decode the mp3 stream by minimp3
func NewDecoder ¶
NewDecoder creates and returns a new mp3 decoder with the default internal buffer size.
func (*Decoder) Bitrate ¶
Bitrate returns the mp3 bitrate of the last decoded frame. If no frames have been decoded yet, then it will return 0.
func (*Decoder) Channels ¶
Channels returns the number of channels of the last decoded frame. If no frames have been decoded yet, then it will return 0.
func (*Decoder) Read ¶
Read copies the decoded audio data from the internal buffer to p and returns the number of items copied. If the internal buffer is empty, then Read first tries to read mp3 data from the source and decode it. If len(p) == 0, then Read will return zero bytes, but if the internal buffer is empty, then before that it will still try to decode one frame and fill the internal buffer.
func (*Decoder) SampleRate ¶
SampleRate returns the sample rate of the last decoded frame. If no frames have been decoded yet, then it will return 0.
func (*Decoder) Seek ¶
Seek sets a new position for reading audio data. At least one decoded frame is required to set a new position. If there are no decoded frames, then Seek will return an error. The mp3 data source must support the io.Seeker interface. If the source doesn't support io.Seeker, then Seek will panic.