mpg123

package
v0.0.0-...-da6c98f Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ENC_8           = C.MPG123_ENC_8
	ENC_16          = C.MPG123_ENC_16
	ENC_24          = C.MPG123_ENC_24
	ENC_32          = C.MPG123_ENC_32
	ENC_SIGNED      = C.MPG123_ENC_SIGNED
	ENC_FLOAT       = C.MPG123_ENC_FLOAT
	ENC_SIGNED_8    = C.MPG123_ENC_SIGNED_8
	ENC_UNSIGNED_8  = C.MPG123_ENC_UNSIGNED_8
	ENC_ULAW_8      = C.MPG123_ENC_ULAW_8
	ENC_ALAW_8      = C.MPG123_ENC_ALAW_8
	ENC_SIGNED_16   = C.MPG123_ENC_SIGNED_16
	ENC_UNSIGNED_16 = C.MPG123_ENC_UNSIGNED_16
	ENC_SIGNED_24   = C.MPG123_ENC_SIGNED_24
	ENC_UNSIGNED_24 = C.MPG123_ENC_UNSIGNED_24
	ENC_SIGNED_32   = C.MPG123_ENC_SIGNED_32
	ENC_UNSIGNED_32 = C.MPG123_ENC_UNSIGNED_32
	ENC_FLOAT_32    = C.MPG123_ENC_FLOAT_32
	ENC_FLOAT_64    = C.MPG123_ENC_FLOAT_64
	ENC_ANY         = C.MPG123_ENC_ANY

	ADD_FLAGS = C.MPG123_ADD_FLAGS
	QUIET     = C.MPG123_QUIET
)

All output encoding formats supported by mpg123

View Source
const (
	IN_MAX_BUFFER_SIZE  = 16384
	OUT_MAX_BUFFER_SIZE = 32768
)

Variables

View Source
var EOF = errors.New("EOF")

Functions

func ExitMpg123

func ExitMpg123()

func GetEncodingBitsPerSample

func GetEncodingBitsPerSample(encoding int) int

int mpg123_encsize ( int encoding )

func InitializeMpg123

func InitializeMpg123()

func SupportedDecoders

func SupportedDecoders() []string

const char** mpg123_supported_decoders(void)

Types

type Decoder

type Decoder struct {
	io.Seeker
	// contains filtered or unexported fields
}

Contains a handle for and mpg123 decoder instance

func NewDecoder

func NewDecoder(decoder string, params ...C.long) (*Decoder, error)

NewDecoder creates a new mpg123 decoder instance

func (*Decoder) Close

func (d *Decoder) Close() error

Close closes an input file if one was opened by mpg123

func (*Decoder) CurrentDecoder

func (d *Decoder) CurrentDecoder() string

const char* mpg123_current_decoder(mpg123_handle *mh)

func (*Decoder) Decode

func (d *Decoder) Decode(buf []byte) ([]byte, error)

Feed input chunk and get first chunk of decoded audio.

func (*Decoder) DecodeSamples

func (d *Decoder) DecodeSamples(samples int, audio []byte) (int, error)

func (*Decoder) DecoderReader

func (d *Decoder) DecoderReader(
	src io.Reader, fps int, channels int, encoding int,
) *DecoderReader

DecoderReader gives you an io.Reader for streaming-decoding. It performs a combination of Feed and Read, and relies on you to first call OpenFeed before invoking DecoderReader.Read.

func (*Decoder) Delete

func (d *Decoder) Delete()

Delete frees an mpg123 decoder instance

func (*Decoder) Feed

func (d *Decoder) Feed(buf []byte) error

Feed provides data bytes into the decoder

func (*Decoder) Format

func (d *Decoder) Format(rate int, channels int, encodings int)

Format sets the audio output format for decoder

func (*Decoder) FormatAll

func (d *Decoder) FormatAll()

FromatAll enables all decoder output formats (this is the default setting)

func (*Decoder) FormatNone

func (d *Decoder) FormatNone()

FormatNone disables all decoder output formats (used to specifying supported formats)

func (*Decoder) GetFormat

func (d *Decoder) GetFormat() (rate int, channels int, encoding int)

GetFormat returns current output format

func (*Decoder) GetLengthInPCMFrames

func (d *Decoder) GetLengthInPCMFrames() int

off_t mpg123_length(mpg123_handle * mh)

func (*Decoder) MonoDecoderReader

func (d *Decoder) MonoDecoderReader(src io.Reader, fps int, encoding int) *DecoderReader

MonoDecoderReader is an alias that gives you an io.Reader for decoding a stream that is known to be mono-channeled.

func (*Decoder) Open

func (d *Decoder) Open(file string) error

Open initializes a decoder for an mp3 file using a filename

func (*Decoder) OpenFeed

func (d *Decoder) OpenFeed() error

OpenFeed prepares a decoder for direct feeding via Feed(..)

func (*Decoder) OpenFile

func (d *Decoder) OpenFile(f *os.File) error

OpenFile binds to an fd from an open *os.File for decoding

func (*Decoder) Param

func (d *Decoder) Param(paramType int, value int64, fvalue float64) error

Param sets a specific parameter on an mpg123 handle.

func (*Decoder) Read

func (d *Decoder) Read(buf []byte) (int, error)

Read decodes data and into buf and returns number of bytes decoded.

func (*Decoder) ReadAudioFrames

func (d *Decoder) ReadAudioFrames(frames int, buf []byte) (int, error)

func (*Decoder) Seek

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

func (*Decoder) TellCurrentSample

func (d *Decoder) TellCurrentSample() int64

off_t mpg123_tell(mpg123_handle *mh)

type DecoderReader

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

DecoderReader is the way to decode streaming MP3

func (DecoderReader) Nuke

func (dr DecoderReader) Nuke()

Nuke kills our DecoderReader appropriately

func (*DecoderReader) Paranoid

func (dr *DecoderReader) Paranoid() *DecoderReader

Paranoid mode shuts off the decoder on a non-EOF error (handy if your input is a duplex network stream).

func (DecoderReader) Read

func (dr DecoderReader) Read(bytes []byte) (int, error)

Read duck-types DecoderReader into io.Reader.

Jump to

Keyboard shortcuts

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