audio

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package audio reads metadata out of audio containers.

SniffContainer works out the format from the file's first bytes, and Parse hands the data to that format's reader — MP3/ID3, FLAC, Ogg, WAVE, AIFF, AAC, AC-3, WMA/ASF, or MP4 — which fills in a Report: the common fields every format shares, the raw per-format tables, and any warnings the reader could not act on. Ported from CyberChef's lib/AudioParsers.mjs, AudioBytes.mjs and AudioMetaSchema.mjs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(b []byte, r *Report, container string, maxText int)

Parse hands the file to the reader for its container, or notes that there is not one.

Types

type Container

type Container struct {
	Typ string
	// contains filtered or unexported fields
}

Container is what the opening bytes of a file say it is.

func SniffContainer

func SniffContainer(b []byte) Container

SniffContainer works out the container format from the file's first bytes. Some formats are named by a byte pattern at the very start, others by a four-character tag a little way in, so the two are looked for separately.

type Report

type Report struct {
	Root *jsonval.OMap
	// contains filtered or unexported fields
}

Report is the document the operation builds. The pieces a parser reaches into are held separately so that they can be added to without walking back down from the root, while the root keeps the order everything is written in.

func NewReport

func NewReport(filename string, byteLength int, c Container) *Report

NewReport builds the empty report a parser fills in.

Jump to

Keyboard shortcuts

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