Documentation
¶
Overview ¶
Package mp4 extracts ALAC audio tracks and sample tables from MP4/M4A containers.
Index ¶
Constants ¶
const ( // Bound the allocations made while reading a progressive track. MaxMovieSize = 16 << 20 MaxPacketSize = 4 << 20 MaxPackets = 1 << 20 )
Variables ¶
var ( ErrNoALACTrack = errors.New("mp4: no ALAC track found in container") ErrInvalidEntry = errors.New("mp4: invalid ALAC sample entry") ErrInvalidBoxSize = errors.New("mp4: invalid box size") ErrNoChunkOffset = errors.New("mp4: no chunk offset box (stco/co64)") ErrInvalidChunkOffset = errors.New("mp4: chunk offset beyond the seekable range") ErrInvalidCo64 = errors.New("mp4: invalid co64 payload") ErrNoStsc = errors.New("mp4: no stsc box") ErrInvalidStsc = errors.New("mp4: invalid stsc payload") ErrNoStsz = errors.New("mp4: no stsz box") ErrInvalidStsz = errors.New("mp4: invalid stsz payload") ErrTableTooLarge = errors.New("mp4: sample table larger than its box") )
MP4 container parsing error sentinels.
Functions ¶
Types ¶
type SampleInfo ¶
SampleInfo holds the byte offset and size of a single encoded ALAC packet within the MP4 container.
func FindALACTrack ¶
func FindALACTrack(ctx context.Context, reader io.ReadSeeker) ([]byte, []SampleInfo, error)
FindALACTrack walks the MP4 box tree to locate the first track containing an ALAC sample entry. It returns the magic cookie and a flat sample table.