mp4

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2022 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package mp4 parse a MP4 file to retrieve creation date, length, and other details found in the stream. References: - https://xhelmboyx.tripod.com/formats/mp4-layout.txt - https://www.programmersought.com/article/92132468003/ - https://github.com/exiftool/exiftool/blob/master/lib/Image/ExifTool/QuickTime.pm

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Atom

type Atom struct {
	Path     string // Path is the dot separated code of the parents and of this atom (ex: moov.trak.hvdt)
	Code     string // Code is the 4 chars code used in MP4 specifications
	IsParent bool   // IsParent is TRUE when the Atom type is reconised to have children. The payload should not be read in this case.

	Size uint64 // Size is the total size of the Atom, including children (in bytes)
	// contains filtered or unexported fields
}

Atom is a chunk in a MP4 files, structured as a tree

type AtomDecoder

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

AtomDecoder reads an MP4 file to extract Atom

func NewAtomDecoder

func NewAtomDecoder(reader io.Reader) *AtomDecoder

NewAtomDecoder will start parsing an MP4 files

func (*AtomDecoder) Next

func (d *AtomDecoder) Next() (*Atom, *PayloadIterator, error)

Next reads and returns the next Atom (or children Atom). It will consume any payload not yet read. It will return (nil, nil, io.EOF) when the file has been read fully.

type Parser

type Parser struct {
	Debug bool
}

func (*Parser) ReadDetails

func (p *Parser) ReadDetails(reader io.Reader, options backup.DetailsReaderOptions) (*backup.MediaDetails, error)

func (*Parser) Supports

func (p *Parser) Supports(media backup.FoundMedia, mediaType backup.MediaType) bool

type PayloadIterator

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

PayloadIterator is used to get content of the Atom as a []byte

func (*PayloadIterator) HasNext

func (p *PayloadIterator) HasNext() bool

HasNext returns TRUE if some payload remains within the Atom.

func (*PayloadIterator) Next

func (p *PayloadIterator) Next(size int) ([]byte, error)

Next will read the Atom payload if any. Beware: it will read children as payload which might break AtomDecoder if used on an improper Atom.

Jump to

Keyboard shortcuts

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