mp3lib

package module
v0.0.0-...-50ad4bf Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2019 License: Unlicense Imports: 5 Imported by: 0

README

MP3Lib

A simple Go library for parsing MP3 files. I built this library as the backend for MP3Cat, a command line utility for merging MP3 files.

Documentation

Overview

Package mp3lib is a simple library for parsing MP3 files.

Index

Constants

View Source
const (
	MPEGVersion2_5 = iota
	MPEGVersionReserved
	MPEGVersion2
	MPEGVersion1
)

MPEG version enum.

View Source
const (
	MPEGLayerReserved = iota
	MPEGLayerIII
	MPEGLayerII
	MPEGLayerI
)

MPEG layer enum.

View Source
const (
	Stereo = iota
	JointStereo
	DualChannel
	Mono
)

Channel mode enum.

View Source
const Version = "1.0.0"

Library version.

Variables

View Source
var DebugMode = false

Flag controlling the display of debugging information.

Functions

func IsVbriHeader

func IsVbriHeader(frame *MP3Frame) bool

IsVbriHeader returns true if the supplied frame is a Fraunhofer VBRI header.

func IsXingHeader

func IsXingHeader(frame *MP3Frame) bool

IsXingHeader returns true if the supplied frame is an Xing VBR header.

func NextObject

func NextObject(stream io.Reader) interface{}

NextObject loads the next recognised object from the input stream. Skips over unrecognised/garbage data. Returns *MP3Frame, *ID3v1Tag, *ID3v2Tag, or nil when the stream has been exhausted.

Types

type ID3v1Tag

type ID3v1Tag struct {
	RawBytes []byte
}

ID3v1Tag represents an ID3v1 metadata tag.

type ID3v2Tag

type ID3v2Tag struct {
	RawBytes []byte
}

ID3v2Tag represents an ID3v2 metadata tag.

func NextID3v2Tag

func NextID3v2Tag(stream io.Reader) *ID3v2Tag

NextID3v2Tag loads the next ID3v2 tag from the input stream, skipping all other data. Returns nil when the stream has been exhausted.

type MP3Frame

type MP3Frame struct {
	MPEGVersion   byte
	MPEGLayer     byte
	CrcProtection bool
	BitRate       int
	SamplingRate  int
	PaddingBit    bool
	PrivateBit    bool
	ChannelMode   byte
	ModeExtension byte
	CopyrightBit  bool
	OriginalBit   bool
	Emphasis      byte
	SampleCount   int
	FrameLength   int
	RawBytes      []byte
}

MP3Frame represents an individual frame parsed from an MP3 stream.

func NewXingHeader

func NewXingHeader(totalFrames, totalBytes uint32) *MP3Frame

NewXingHeader creates a new Xing header frame for a VBR file.

func NextFrame

func NextFrame(stream io.Reader) *MP3Frame

NextFrame loads the next MP3 frame from the input stream. Skips over ID3 tags and unrecognised/garbage data in the stream. Returns nil when the stream has been exhausted.

Jump to

Keyboard shortcuts

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