util

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2016 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormSize

func FormSize(n uint32) []byte

FormSize transforms uint32 integer to byte slice with ID3v2 size (4 * 0b0xxxxxxx).

If size more than allowed (256MB), then panic occurs.

func ParseSize

func ParseSize(data []byte) uint32

ParseSize parses byte slice with ID3v2 size (4 * 0b0xxxxxxx) and returns uint32 integer.

If length of slice is more than 4 or if there is invalid size format (e.g. one byte in slice is like 0b1xxxxxxx), then panic occurs.

Types

type Encoding added in v0.5.1

type Encoding struct {
	Key              byte
	TerminationBytes []byte
}

Primitive for encoding.

If you are user of id3v2 library, all list of allowed encodings you can find in documentation in variables. For convenience, by default all frame constructors set UTF-8 encoding to frames. You can set by yourself encoding to frames via SetEncoding method. For example:

comm := id3v2.NewCommentFrame()
comm.SetEncoding(id3v2.ENISO)
comm.SetLanguage("eng")
comm.SetDescription(string([]byte{68, 101, 115, 99})) // "Desc" on ISO-8859-1
comm.SetText(string([]byte{84, 101, 120, 116})) // "Text" on ISO-8859-1
tag.AddCommentFrame(comm)

Jump to

Keyboard shortcuts

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