minimp3

package module
v0.0.0-...-635616c Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2022 License: MIT Imports: 4 Imported by: 1

README

Golang binding for the minimp3 mp3 decoder: https://github.com/lieff/minimp3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DecoderFloat32

type DecoderFloat32 struct {
	// contains filtered or unexported fields
}

DecoderFloat32 decode the mp3 stream by minimp3

func NewDecoderFloat32

func NewDecoderFloat32(source io.Reader) *DecoderFloat32

NewDecoderFloat32 creates and returns a new mp3 decoder with the default internal buffer size.

func (*DecoderFloat32) Bitrate

func (d *DecoderFloat32) Bitrate() int

Bitrate returns the mp3 bitrate of the last decoded frame. If no frames have been decoded yet, then it will return 0.

func (*DecoderFloat32) Channels

func (d *DecoderFloat32) Channels() int

Channels returns the number of channels of the last decoded frame. If no frames have been decoded yet, then it will return 0.

func (*DecoderFloat32) Read

func (d *DecoderFloat32) Read(p []float32) (int, error)

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 (*DecoderFloat32) SampleRate

func (d *DecoderFloat32) SampleRate() int

SampleRate returns the sample rate of the last decoded frame. If no frames have been decoded yet, then it will return 0.

func (*DecoderFloat32) Seek

func (d *DecoderFloat32) Seek(offset int64, whence int) (int64, error)

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.

type DecoderInt16

type DecoderInt16 struct {
	// contains filtered or unexported fields
}

DecoderInt16 decode the mp3 stream by minimp3

func NewDecoderInt16

func NewDecoderInt16(source io.Reader) *DecoderInt16

NewDecoderInt16 creates and returns a new mp3 decoder with the default internal buffer size.

func (*DecoderInt16) Bitrate

func (d *DecoderInt16) Bitrate() int

Bitrate returns the mp3 bitrate of the last decoded frame. If no frames have been decoded yet, then it will return 0.

func (*DecoderInt16) Channels

func (d *DecoderInt16) Channels() int

Channels returns the number of channels of the last decoded frame. If no frames have been decoded yet, then it will return 0.

func (*DecoderInt16) Read

func (d *DecoderInt16) Read(p []int16) (int, error)

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 (*DecoderInt16) SampleRate

func (d *DecoderInt16) SampleRate() int

SampleRate returns the sample rate of the last decoded frame. If no frames have been decoded yet, then it will return 0.

func (*DecoderInt16) Seek

func (d *DecoderInt16) Seek(offset int64, whence int) (int64, error)

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.

Jump to

Keyboard shortcuts

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