atom

package
v0.0.0-...-55ea58c Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 License: MIT Imports: 6 Imported by: 5

Documentation

Index

Constants

View Source
const (
	// BoxHeaderSize Size of box header.
	BoxHeaderSize = 8
	UuidSize      = 16
)
View Source
const (
	TrackFlagEnabled   = 0x0001
	TrackFlagInMovie   = 0x0002
	TrackFlagInPreview = 0x0004
)

Flag constants.

Variables

This section is empty.

Functions

func GetDurationString

func GetDurationString(duration uint32, timescale uint32) string

GetDurationString Helper function to print a duration value in the form H:MM:SS.MS

Types

type Avc1Box

type Avc1Box struct {
	*Box
	Version byte
}

Avc1Box defines the avc1 box structure.

type Box

type Box struct {
	Name        string
	Size, Start int64
	Reader      *Mp4Reader
}

Box defines an Atom Box structure.

func (*Box) ReadBoxData

func (b *Box) ReadBoxData() []byte

ReadBoxData reads the box data from an atom box.

type EdtsBox

type EdtsBox struct {
	*Box
	Elst *ElstBox
}

EdtsBox - Edit Box Box Type: edts Container: Track Box (trak) Mandatory: No Quantity: Zero or one

type ElstBox

type ElstBox struct {
	*Box
	Version    uint32 // Version of this box.
	EntryCount uint32 // Integer that gives the number of entries.
	Entries    []elstEntry
}

ElstBox - Edit List Box Box Type: elst Container: Edit Box (edts) Mandatory: No Quantity: Zero or one

type Fixed16

type Fixed16 uint16

Fixed16 is an 8.8 Fixed Point Decimal notation

func (Fixed16) String

func (f Fixed16) String() string

type Fixed32

type Fixed32 uint32

Fixed32 is a 16.16 Fixed Point Decimal notation

type FtypBox

type FtypBox struct {
	*Box
	MajorBrand       string   // Brand identifer.
	MinorVersion     uint32   // Informative integer for the minor version of the major brand.
	CompatibleBrands []string // A list, to the end of the box, of brands.
}

FtypBox - File Type Box Box Type: ftyp Container: File Mandatory: Yes Quantity: Exactly one

type HdlrBox

type HdlrBox struct {
	*Box
	Version byte
	Flags   uint32
	Handler string
	Name    string
}

HdlrBox - Handler Reference Box Box Type: hdlr Container: Media Box (mdia) or Meta Box (meta) Mandatory: Yes Quantity: Exactly one

type HmhdBox

type HmhdBox struct {
	*Box
	Version    byte
	MaxPDUSize uint16
	AvgPDUSize uint16
	MaxBitrate uint32
	AvgBitrate uint32
}

HmhdBox - Hint Media Header Box Box Type: hmhd Container: Media Information Box (minf). Mandatory: Yes Quantity: Exactly one specific media header shall be present.

Contains general information, independent of the protocol, for hint tracks.

type MdatBox

type MdatBox struct {
	*Box
}

MdatBox - Media Data Box Box Type: mdat Container: File Mandatory: No Quantity: Any number.

A container box which can hold the actual media data for a presentation (mdat).

type MdhdBox

type MdhdBox struct {
	*Box
	Version          byte
	Flags            uint32
	CreationTime     uint32
	ModificationTime uint32
	Timescale        uint32
	Duration         uint32
	Language         uint16
	LanguageString   string
}

MdhdBox - Media Header Box Box Type: mdhd Container: Media Box (mdia) Mandatory: Yes Quantity: Any number.

The media header declares overall information that is media-independent, and relevant to characteristics of the media in a track.

type MdiaBox

type MdiaBox struct {
	*Box
	Hdlr *HdlrBox
	Mdhd *MdhdBox
	Minf *MinfBox
}

MdiaBox - Media Box Box Type: mdia Container: Track Box (trak) Mandatory: Yes Quantity: Exactly one. The media declaration container contains all the objects that declare information about the media data within a track.

type MinfBox

type MinfBox struct {
	*Box
	Vmhd *VmhdBox
	// Dinf *DinfBox
	Stbl *StblBox
	Hmhd *HmhdBox
}

MinfBox - Media Information Box Box Type: minf Container: Media Box (mdia) Mandatory: Yes Quantity: Exactly one.

This box contains all the objects that declare characteristics information of the media in the track.

type MoovBox

type MoovBox struct {
	*Box
	Mvhd  *MvhdBox
	Traks []*TrakBox

	IsFragmented bool // check for mvex box exists
}

MoovBox - Movie Box Box Type: moov Container: File Mandatory: Yes Quantity: Exactly one.

The metadata for a presentation is stored in the single Movie Box which occurs at the top-level of a file. Normally this box is close to the beginning or end of the file, though this is not required.

type Mp4Reader

type Mp4Reader struct {
	Reader io.ReaderAt
	Ftyp   *FtypBox
	Moov   *MoovBox
	Mdat   *MdatBox
	Uuids  []*UuidBox
	Size   int64

	IsFragmented bool
}

Mp4Reader defines an mp4 reader structure.

func (*Mp4Reader) Parse

func (m *Mp4Reader) Parse() error

Parse reads an MP4 reader for atom boxes.

func (*Mp4Reader) ReadBoxAt

func (m *Mp4Reader) ReadBoxAt(offset int64) (boxSize uint32, boxType string)

ReadBoxAt reads a box from an offset.

func (*Mp4Reader) ReadBytesAt

func (m *Mp4Reader) ReadBytesAt(n int64, offset int64) (word []byte)

ReadBytesAt reads a box at n and offset.

type MvhdBox

type MvhdBox struct {
	*Box
	Flags            uint32
	Version          uint8
	CreationTime     uint32
	ModificationTime uint32
	Timescale        uint32
	Duration         uint32
	Rate             Fixed32
	Volume           Fixed16
}

MvhdBox - Movie Header Box Box Type: mvhd Container: Movie Box (moov) Mandatory: Yes Quantity: Exactly one.

This box defines overall information which is media-independent, and relevant to the entire presentationconsidered as a whole.

type StblBox

type StblBox struct {
	*Box
	Stts *SttsBox
	Stsd *StsdBox
}

StblBox - Sample Table Box Box Type: stbl Container: Media Information Box (minf) Mandatory: Yes Quantity: Exactly one.

type StsdBox

type StsdBox struct {
	*Box
	Version byte
	Flags   uint32
	Avc1    *Avc1Box
}

StsdBox - Sample Description Box Box Type: stsd Container: Sample Table Box (stbl) Mandatory: Yes Quantity: Exactly one.

type SttsBox

type SttsBox struct {
	*Box
	Version      byte
	Flags        uint32
	EntryCount   uint32
	SampleCounts []uint32
	SampleDeltas []uint32
}

SttsBox - Decoding Time to Sample Box Box Type: stts Container: Sample Table Box (stbl) Mandatory: Yes Quantity: Exactly one.

type TkhdBox

type TkhdBox struct {
	*Box
	Version          byte
	Flags            uint32
	CreationTime     uint32
	ModificationTime uint32
	TrackID          uint32
	Duration         uint32
	Layer            uint16
	AlternateGroup   uint16
	Volume           Fixed16
	Matrix           []byte
	Width, Height    Fixed32
}

TkhdBox - Track Header Box Box Type: tkhd Container: Track Box (trak) Mandatory: Yes Quantity: Exactly one.

func (*TkhdBox) GetHeight

func (b *TkhdBox) GetHeight() Fixed32

GetHeight returns a calculated tkhd height.

func (*TkhdBox) GetWidth

func (b *TkhdBox) GetWidth() Fixed32

GetWidth returns a calculated tkhd width.

type TrakBox

type TrakBox struct {
	*Box

	Tkhd *TkhdBox
	Mdia *MdiaBox
	Edts *EdtsBox
}

TrakBox - Track Box Box Type: tkhd Container: Movie Box (moov) Mandatory: Yes Quantity: One or more.

type UuidBox

type UuidBox struct {
	*Box
	Uuid []byte
	Data []byte
}

UuidBox - Uuid Box Box Type: uuid

type VmhdBox

type VmhdBox struct {
	*Box
	Version      byte
	Flags        uint32
	GraphicsMode uint16
	OpColor      uint16
}

VmhdBox - Video Media Header Box Box Type: vmhd Container: Media Information Box (minf) Mandatory: Yes Quantity: Exactly one specific media header shall be present.

Jump to

Keyboard shortcuts

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