mp4

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: May 31, 2022 License: OSL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EncModeSegment - only encode boxes that are part of Init and MediaSegments
	EncModeSegment = EncFragFileMode(0)
	// EncModeBoxTree - encode all boxes in file tree
	EncModeBoxTree = EncFragFileMode(1)
)
View Source
const (
	// OptimizeNone - no optimization
	OptimizeNone = EncOptimize(0)
	// OptimizeTrun - optimize trun box by moving default values to tfhd
	OptimizeTrun = EncOptimize(1 << 0)
)
View Source
const (
	UUIDPlayReady = "9a04f079-9840-4286-ab92-e65be0885f95"
	UUIDWidevine  = "edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"
	UUIDFairPlay  = "94CE86FB-07FF-4F43-ADB8-93D2FA968CA2"
	UUID_VCAS     = "9a27dd82-fde2-4725-8cbc-4234aa06ec09"
)

UUIDs for different DRM systems

View Source
const DefaultTrakID = 1

DefaultTrakID - trakID used when generating new fragmented content

View Source
const NonSyncSampleFlags uint32 = 0x00010000

NonSyncSampleFlags - flags for non-sync sample

View Source
const SyncSampleFlags uint32 = 0x02000000

SyncSampleFlags - flags for I-frame or other sync sample

View Source
const TrunDataOffsetPresentFlag uint32 = 0x01
View Source
const TrunFirstSampleFlagsPresentFlag uint32 = 0x04
View Source
const TrunSampleCompositionTimeOffsetPresentFlag uint32 = 0x800
View Source
const TrunSampleDurationPresentFlag uint32 = 0x100
View Source
const TrunSampleFlagsPresentFlag uint32 = 0x400
View Source
const TrunSampleSizePresentFlag uint32 = 0x200
View Source
const UseSubSampleEncryption = 0x2

UseSubSampleEncryption - flag for subsample encryption

Variables

View Source
var AC3SampleRates = []int{48000, 44100, 32000}

AC3SampleRates - Sample rates as defined in ETSI TS 102 366 V1.4.1 (2017) section 4.4.1.3 Signaled in fscod - Sample rate code - 2 bits

Functions

func DecryptBytesCTR

func DecryptBytesCTR(data []byte, key []byte, iv []byte) ([]byte, error)

DecryptBytesCTR - decrypt or encrypt sample using CTR mode, provided key, iv and sumsamplePattern

func DecryptSampleCenc

func DecryptSampleCenc(sample []byte, key []byte, iv []byte, subSamplePatterns []SubSamplePattern) ([]byte, error)

DecryptSampleCenc - decrypt cenc-mode encrypted sample

func EncodeContainer

func EncodeContainer(c ContainerBox, w io.Writer) error

EncodeContainer - marshal container c to w

func EncodeHeader

func EncodeHeader(b Box, w io.Writer) error

EncodeHeader - encode a box header to a writer

func EncodeHeaderSW

func EncodeHeaderSW(b Box, sw mp4ff.SliceWriter) error

EncodeHeaderSW - encode a box header to a SliceWriter

func EncodeHeaderWithSize

func EncodeHeaderWithSize(boxType string, boxSize uint64, largeSize bool, w io.Writer) error

EncodeHeaderWithSize - encode a box header to a writer and allow for largeSize

func EncodeHeaderWithSizeSW

func EncodeHeaderWithSizeSW(boxType string, boxSize uint64, largeSize bool, sw mp4ff.SliceWriter) error

EncodeHeaderWithSize - encode a box header to a writer and allow for largeSize

Types

type AlstSampleGroupEntry

type AlstSampleGroupEntry struct {
	RollCount         uint16
	FirstOutputSample uint16
	SampleOffset      []uint32
	NumOutputSamples  []uint16
	NumTotalSamples   []uint16
}

AlstSampleGroupEntry - Alternative Startup Entry "alst"

ISO/IEC 14496-12 Ed. 6 2020 Section 10.3 - AlternativeStartupEntry

func (*AlstSampleGroupEntry) Encode

func (s *AlstSampleGroupEntry) Encode(sw mp4ff.SliceWriter)

Encode SampleGroupEntry to SliceWriter

func (*AlstSampleGroupEntry) Info

func (s *AlstSampleGroupEntry) Info(w io.Writer, specificBoxLevels, indent, indentStep string) (err error)

Info - write box info to w

func (*AlstSampleGroupEntry) Size

func (s *AlstSampleGroupEntry) Size() uint64

Size of sample group entry

func (*AlstSampleGroupEntry) Type

func (s *AlstSampleGroupEntry) Type() string

Type - GroupingType SampleGroupEntry (uint32 according to spec)

type AudioSampleEntryBox

type AudioSampleEntryBox struct {
	DataReferenceIndex uint16
	ChannelCount       uint16
	SampleSize         uint16
	SampleRate         uint16 // Integer part
	Esds               *EsdsBox
	Dac3               *Dac3Box
	Dec3               *Dec3Box
	Sinf               *SinfBox
	Children           []Box
	// contains filtered or unexported fields
}

AudioSampleEntryBox according to ISO/IEC 14496-12

type Box

type Box interface {
	// Type of box, normally 4 asccii characters, but is uint32 according to spec
	Type() string
	// Size of box including header and all children if any
	Size() uint64
	// Encode box to writer
	Encode(w io.Writer) error
}

Box is the general interface to any ISOBMFF box or similar

func DecodeBox

func DecodeBox(startPos uint64, r io.Reader) (Box, error)

DecodeBox decodes a box

func DecodeBoxSR

func DecodeBoxSR(startPos uint64, sr mp4ff.SliceReader) (Box, error)

DecodeBoxSR - decode a box from SliceReader

func DecodeClapSR

func DecodeClapSR(hdr BoxHeader, startPos uint64, sr mp4ff.SliceReader) (Box, error)

DecodeClapSR - box-specific decode

func DecodeContainerChildren

func DecodeContainerChildren(hdr BoxHeader, startPos, endPos uint64, r io.Reader) ([]Box, error)

DecodeContainerChildren decodes a container box

func DecodeContainerChildrenSR

func DecodeContainerChildrenSR(hdr BoxHeader, startPos, endPos uint64, sr mp4ff.SliceReader) ([]Box, error)

DecodeContainerChildren decodes a container box

func DecodeDinf

func DecodeDinf(hdr BoxHeader, startPos uint64, r io.Reader) (Box, error)

DecodeDinf - box-specific decode

func DecodeDinfSR

func DecodeDinfSR(hdr BoxHeader, startPos uint64, sr mp4ff.SliceReader) (Box, error)

DecodeDinfSR - box-specific decode

func DecodeElng

func DecodeElng(hdr BoxHeader, startPos uint64, r io.Reader) (Box, error)

DecodeElng - box-specific decode

func DecodeElngSR

func DecodeElngSR(hdr BoxHeader, startPos uint64, sr mp4ff.SliceReader) (Box, error)

DecodeElngSR - box-specific decode

func DecodeEsds

func DecodeEsds(hdr BoxHeader, startPos uint64, r io.Reader) (Box, error)

DecodeEsds - box-specific decode

func DecodeEsdsSR

func DecodeEsdsSR(hdr BoxHeader, startPos uint64, sr mp4ff.SliceReader) (Box, error)

DecodeEsdsSR - box-specific decode

func DecodeMdat

func DecodeMdat(hdr BoxHeader, startPos uint64, r io.Reader) (Box, error)

DecodeMdat - box-specific decode

func DecodeMfro

func DecodeMfro(hdr BoxHeader, startPos uint64, r io.Reader) (Box, error)

DecodeMfro - box-specific decode

func DecodeMfroSR

func DecodeMfroSR(hdr BoxHeader, startPos uint64, sr mp4ff.SliceReader) (Box, error)

DecodeMfroSR - box-specific decode

func DecodeMoof

func DecodeMoof(hdr BoxHeader, startPos uint64, r io.Reader) (Box, error)

DecodeMoof - box-specific decode

func DecodeMoofSR

func DecodeMoofSR(hdr BoxHeader, startPos uint64, sr mp4ff.SliceReader) (Box, error)

DecodeMoofSR - box-specific decode

func DecodeNmhd

func DecodeNmhd(hdr BoxHeader, startPos uint64, r io.Reader) (Box, error)

DecodeNmhd - box-specific decode

func DecodeNmhdSR

func DecodeNmhdSR(hdr BoxHeader, startPos uint64, sr mp4ff.SliceReader) (Box, error)

DecodeNmhdSR - box-specific decode

func DecodePsshSR

func DecodePsshSR(hdr BoxHeader, startPos uint64, sr mp4ff.SliceReader) (Box, error)

DecodePsshSR - box-specific decode

func DecodeSaioSR

func DecodeSaioSR(hdr BoxHeader, startPos uint64, sr mp4ff.SliceReader) (Box, error)

DecodeSaioSR - box-specific decode

func DecodeSaizSR

func DecodeSaizSR(hdr BoxHeader, startPos uint64, sr mp4ff.SliceReader) (Box, error)

DecodeSaizSR - box-specific decode

func DecodeSbgp

func DecodeSbgp(hdr BoxHeader, startPos uint64, r io.Reader) (Box, error)

DecodeSbgp - box-specific decode

func DecodeSbgpSR

func DecodeSbgpSR(hdr BoxHeader, startPos uint64, sr mp4ff.SliceReader) (Box, error)

DecodeSbgpSR - box-specific decode

func DecodeSenc

func DecodeSenc(hdr BoxHeader, startPos uint64, r io.Reader) (Box, error)

DecodeSenc - box-specific decode

func DecodeSencSR

func DecodeSencSR(hdr BoxHeader, startPos uint64, sr mp4ff.SliceReader) (Box, error)

DecodeSencSR - box-specific decode

func DecodeSgpdSR

func DecodeSgpdSR(hdr BoxHeader, startPos uint64, sr mp4ff.SliceReader) (Box, error)

DecodeSgpdSR - box-specific decode

func DecodeStco

func DecodeStco(hdr BoxHeader, startPos uint64, r io.Reader) (Box, error)

DecodeStco - box-specific decode

func DecodeStcoSR

func DecodeStcoSR(hdr BoxHeader, startPos uint64, sr mp4ff.SliceReader) (Box, error)

DecodeStcoSR - box-specific decode

func DecodeStpp

func DecodeStpp(hdr BoxHeader, startPos uint64, r io.Reader) (Box, error)

DecodeStpp - Decode XMLSubtitleSampleEntry (stpp)

func DecodeStppSR

func DecodeStppSR(hdr BoxHeader, startPos uint64, sr mp4ff.SliceReader) (Box, error)

DecodeStppSR - Decode XMLSubtitleSampleEntry (stpp)

func DecodeTfdtSR

func DecodeTfdtSR(hdr BoxHeader, startPos uint64, sr mp4ff.SliceReader) (Box, error)

DecodeTfdtSR - box-specific decode

func DecodeTfhd

func DecodeTfhd(hdr BoxHeader, startPos uint64, r io.Reader) (Box, error)

DecodeTfhd - box-specific decode

func DecodeTfhdSR

func DecodeTfhdSR(hdr BoxHeader, startPos uint64, sr mp4ff.SliceReader) (Box, error)

DecodeTfhdSR - box-specific decode

func DecodeTraf

func DecodeTraf(hdr BoxHeader, startPos uint64, r io.Reader) (Box, error)

DecodeTraf - box-specific decode

func DecodeTrafSR

func DecodeTrafSR(hdr BoxHeader, startPos uint64, sr mp4ff.SliceReader) (Box, error)

DecodeTrafSR - box-specific decode

func DecodeTrunSR

func DecodeTrunSR(hdr BoxHeader, startPos uint64, sr mp4ff.SliceReader) (Box, error)

DecodeTrun - box-specific decode

func DecodeUnknown

func DecodeUnknown(hdr BoxHeader, startPos uint64, r io.Reader) (Box, error)

DecodeUnknown - decode an unknown box

func DecodeUnknownSR

func DecodeUnknownSR(hdr BoxHeader, startPos uint64, sr mp4ff.SliceReader) (Box, error)

DecodeUnknown - decode an unknown box

type BoxDecoder

type BoxDecoder func(hdr BoxHeader, startPos uint64, r io.Reader) (Box, error)

BoxDecoder is function signature of the Box Decode method

type BoxDecoderSR

type BoxDecoderSR func(hdr BoxHeader, startPos uint64, sw mp4ff.SliceReader) (Box, error)

BoxDecoderSR is function signature of the Box DecodeSR method

type BoxHeader

type BoxHeader struct {
	Name   string
	Size   uint64
	Hdrlen int
}

BoxHeader - 8 or 16 bytes depending on size

func DecodeHeader

func DecodeHeader(r io.Reader) (BoxHeader, error)

DecodeHeader decodes a box header (size + box type + possiible largeSize)

func DecodeHeaderSR

func DecodeHeaderSR(sr mp4ff.SliceReader) (BoxHeader, error)

DecodeHeaderSR - decode a box header (size + box type + possible largeSize) from sr

type BoxStructure

type BoxStructure interface {
	Encode(w io.Writer) error
}

BoxStructure represent a box or similar entity such as a Segment

type BtrtBox

type BtrtBox struct {
	BufferSizeDB uint32
	MaxBitrate   uint32
	AvgBitrate   uint32
}

BtrtBox - BitRateBox - ISO/IEC 14496-12 Section 8.5.2.2

func (*BtrtBox) Encode

func (b *BtrtBox) Encode(w io.Writer) error

Encode - write box to w

func (*BtrtBox) EncodeSW

func (b *BtrtBox) EncodeSW(sw mp4ff.SliceWriter) error

EncodeSW - box-specific encode to slicewriter

func (*BtrtBox) Size

func (b *BtrtBox) Size() uint64

Size - return calculated size

func (*BtrtBox) Type

func (b *BtrtBox) Type() string

Type - return box type

type CTooBox

type CTooBox struct {
	Children []Box
}

CTooBox - ©too box defines the ffmpeg encoding tool information

type ClapBox

type ClapBox struct {
	CleanApertureWidthN  uint32
	CleanApertureWidthD  uint32
	CleanApertureHeightN uint32
	CleanApertureHeightD uint32
	HorizOffN            uint32
	HorizOffD            uint32
	VertOffN             uint32
	VertOffD             uint32
}

ClapBox - Clean Aperture Box, ISO/IEC 14496-12 2020 Sec. 12.1.4

func (*ClapBox) Encode

func (b *ClapBox) Encode(w io.Writer) error

Encode - write box to w

func (*ClapBox) EncodeSW

func (b *ClapBox) EncodeSW(sw mp4ff.SliceWriter) error

EncodeSW - box-specific encode to slicewriter

func (*ClapBox) Size

func (b *ClapBox) Size() uint64

Size - calculated size of box

func (*ClapBox) Type

func (b *ClapBox) Type() string

Type - box type

type Co64Box

type Co64Box struct {
	Version     byte
	Flags       uint32
	ChunkOffset []uint64
}

Co64Box - Chunk Large Offset Box

Contained in : Sample Table box (stbl)

64-bit version of StcoBox

func (*Co64Box) Size

func (b *Co64Box) Size() uint64

Size - box-specific size

func (*Co64Box) Type

func (b *Co64Box) Type() string

Type - box-specific type

type ContainerBox

type ContainerBox interface {
	Encode(w io.Writer) error
	GetChildren() []Box
	Size() uint64
	Type() string
}

ContainerBox is interface for ContainerBoxes

type CslgBox

type CslgBox struct {
	Version                      byte
	Flags                        uint32
	CompositionToDTSShift        int64
	LeastDecodeToDisplayDelta    int64
	GreatestDecodeToDisplayDelta int64
	CompositionStartTime         int64
	CompositionEndTime           int64
}

CslgBox - CompositionToDecodeBox -ISO/IEC 14496-12 2015 Sec. 8.6.1.4

Contained in: Sample Table Box (stbl) or Track Extension Properties Box (trep)

type CttsBox

type CttsBox struct {
	Version      byte
	Flags        uint32
	SampleCount  []uint32
	SampleOffset []int32 // int32 to handle version 1
}

CttsBox - Composition Time to Sample Box (ctts - optional)

Contained in: Sample Table Box (stbl)

type Dac3Box

type Dac3Box struct {
	FSCod       byte
	BSID        byte
	BSMod       byte
	ACMod       byte
	LFEOn       byte
	BitRateCode byte
}

Dac3Box - AC3SpecificBox from ETSI TS 102 366 V1.4.1 F.4 (2017)

type DataBox

type DataBox struct {
	Data []byte
}

DataBox - data box used by ffmpeg for providing information.

func (*DataBox) Size

func (b *DataBox) Size() uint64

Size - calculated size of box

func (*DataBox) Type

func (b *DataBox) Type() string

Type - box type

type DataRange

type DataRange struct {
	Offset uint64
	Size   uint64
}

DataRange is a range for sample data in a file relative to file start

type Dec3Box

type Dec3Box struct {
	DataRate  uint16
	NumIndSub uint16
	EC3Subs   []EC3Sub
	Reserved  []byte
}

Dec3Box - AC3SpecificBox from ETSI TS 102 366 V1.4.1 F.4 (2017)

type DecFileMode

type DecFileMode byte

DecFileMode - mode for decoding file

const (
	// DecModeNormal - read Mdat data into memory during file decoding.
	DecModeNormal DecFileMode = iota
	// DecModeLazyMdat - do not read mdat data into memory.
	// Thus, decode process requires less memory and faster.
	DecModeLazyMdat
)

type DinfBox

type DinfBox struct {
	Dref     *DrefBox
	Children []Box
}

DinfBox - Data Information Box (dinf - mandatory)

Contained in : Media Information Box (minf) or Meta Box (meta)

func (*DinfBox) AddChild

func (d *DinfBox) AddChild(box Box)

AddChild - Add a child box

func (*DinfBox) Encode

func (d *DinfBox) Encode(w io.Writer) error

Encode - write dinf container to w

func (*DinfBox) GetChildren

func (d *DinfBox) GetChildren() []Box

GetChildren - list of child boxes

func (*DinfBox) Size

func (d *DinfBox) Size() uint64

Size - box-specific size

func (*DinfBox) Type

func (d *DinfBox) Type() string

Type - box-specific type

type DrefBox

type DrefBox struct {
	Version    byte
	Flags      uint32
	EntryCount uint32
	Children   []Box
}

DrefBox - Data Reference Box (dref - mandatory)

Contained id: Data Information Box (dinf)

Defines the location of the media data. If the data for the track is located in the same file it contains nothing useful.

func (*DrefBox) AddChild

func (d *DrefBox) AddChild(box Box)

AddChild - Add a child box and update EntryCount

func (*DrefBox) Encode

func (d *DrefBox) Encode(w io.Writer) error

Encode - write dref box to w including children

func (*DrefBox) Size

func (d *DrefBox) Size() uint64

Size - calculated size of box

func (*DrefBox) Type

func (d *DrefBox) Type() string

Type - box type

type EC3Sub

type EC3Sub struct {
	FSCod     byte
	BSID      byte
	ASVC      byte
	BSMod     byte
	ACMod     byte
	LFEOn     byte
	NumDepSub byte
	ChanLoc   uint16
}

EC3Sub - Enhanced AC-3 substream information

type EdtsBox

type EdtsBox struct {
	Elst     []*ElstBox
	Children []Box
}

EdtsBox - Edit Box (edts - optional)

Contained in: Track Box ("trak")

The edit box maps the presentation timeline to the media-time line

func (*EdtsBox) AddChild

func (e *EdtsBox) AddChild(child Box)

AddChild - Add a child box and update EntryCount

func (*EdtsBox) Encode

func (b *EdtsBox) Encode(w io.Writer) error

Encode - write edts container to w

func (*EdtsBox) GetChildren

func (b *EdtsBox) GetChildren() []Box

GetChildren - list of child boxes

func (*EdtsBox) Size

func (b *EdtsBox) Size() uint64

Size - calculated size of box

func (*EdtsBox) Type

func (b *EdtsBox) Type() string

Type - box type

type ElngBox

type ElngBox struct {
	Language string
}

ElngBox - Extended Language Box

func CreateElng

func CreateElng(language string) *ElngBox

CreateElng - Create an Extended Language Box

func (*ElngBox) Encode

func (b *ElngBox) Encode(w io.Writer) error

Encode - write box to w

func (*ElngBox) EncodeSW

func (b *ElngBox) EncodeSW(sw mp4ff.SliceWriter) error

EncodeSW - box-specific encode to slicewriter

func (*ElngBox) Info

func (b *ElngBox) Info(w io.Writer, specificBoxLevels, indent, indentStep string) error

Info - write box-specific information

func (*ElngBox) Size

func (b *ElngBox) Size() uint64

Size - calculated size of box

func (*ElngBox) Type

func (b *ElngBox) Type() string

Type - box type

type ElstBox

type ElstBox struct {
	Version byte
	Flags   uint32
	Entries []ElstEntry
}

ElstBox - Edit List Box (elst - optional)

Contained in : Edit Box (edts)

type ElstEntry

type ElstEntry struct {
	SegmentDuration   uint64
	MediaTime         int64
	MediaRateInteger  int16
	MediaRateFraction int16
}

type EmsgBox

type EmsgBox struct {
	Version               byte
	Flags                 uint32
	TimeScale             uint32
	PresentationTimeDelta uint32
	PresentationTime      uint64
	EventDuration         uint32
	ID                    uint32
	SchemeIDURI           string
	Value                 string
}

EmsgBox - DASHEventMessageBox as defined in ISO/IEC 23009-1

func (*EmsgBox) Size

func (b *EmsgBox) Size() uint64

Size - calculated size of box

func (*EmsgBox) Type

func (b *EmsgBox) Type() string

Type - box type

type EncFragFileMode

type EncFragFileMode byte

EncFragFileMode - mode for writing file

type EncOptimize

type EncOptimize uint32

EncOptimize - encoder optimization mode

type EsdsBox

type EsdsBox struct {
	Version               byte
	Flags                 uint32
	EsDescrTag            byte
	EsID                  uint16
	FlagsAndPriority      byte
	DecoderConfigDescrTag byte
	ObjectType            byte
	StreamType            byte
	BufferSizeDB          uint32
	MaxBitrate            uint32
	AvgBitrate            uint32
	DecSpecificInfoTag    byte
	DecConfig             []byte
	SLConfigDescrTag      byte
	SLConfigValue         byte
	// contains filtered or unexported fields
}

EsdsBox as used for MPEG-audio, see ISO 14496-1 Section 7.2.6.6 for DecoderConfigDescriptor

func (*EsdsBox) Encode

func (e *EsdsBox) Encode(w io.Writer) error

Encode - write box to w

func (*EsdsBox) EncodeSW

func (e *EsdsBox) EncodeSW(sw mp4ff.SliceWriter) error

EncodeSW - box-specific encode to slicewriter

func (*EsdsBox) Info

func (e *EsdsBox) Info(w io.Writer, specificBoxLevels, indent, indentStep string) error

Info - write box-specific information

func (*EsdsBox) Size

func (e *EsdsBox) Size() uint64

Size - calculated size of box

func (*EsdsBox) Type

func (e *EsdsBox) Type() string

Type - box type

type File

type File struct {
	Segments []*MediaSegment // Media segments
	// contains filtered or unexported fields
}

func DecodeFile

func DecodeFile(r io.Reader) (*File, error)

func NewFile

func NewFile() *File

NewFile - create MP4 file

func (*File) AddChild

func (f *File) AddChild(box Box, boxStartPos uint64)

AddChild - add child with start position

func (*File) AddMediaSegment

func (f *File) AddMediaSegment(m *MediaSegment)

AddMediaSegment - add a mediasegment to file f

func (*File) IsFragmented

func (f *File) IsFragmented() bool

IsFragmented - is file made of multiple segments (Mp4 fragments)

func (*File) LastSegment

func (f *File) LastSegment() *MediaSegment

LastSegment - Currently last segment

type Fixed16

type Fixed16 uint16

Fixed16 - An 8.8 fixed point number

type Fixed32

type Fixed32 uint32

Fixed32 - A 16.16 fixed point number

type Fragment

type Fragment struct {
	Moof     *MoofBox
	Mdat     *MdatBox
	Children []Box // All top-level boxes in order

	EncOptimize EncOptimize // Bit field with optimizations being done at encoding
	// contains filtered or unexported fields
}

Fragment - MP4 Fragment ([prft] + moof + mdat)

func NewFragment

func NewFragment() *Fragment

NewFragment - New empty one-track MP4 Fragment

func (*Fragment) AddChild

func (f *Fragment) AddChild(b Box)

AddChild - Add a top-level box to Fragment

func (*Fragment) AddFullSample

func (f *Fragment) AddFullSample(s FullSample)

AddFullSample - add a full sample to the first (and only) trun of a track AddFullSampleToTrack is the more general function

func (*Fragment) AddSample

func (f *Fragment) AddSample(s Sample, baseMediaDecodeTime uint64)

AddSample - add a sample to the first (and only) trun of a track AddSampleToTrack is the more general function

func (*Fragment) AddSampleInterval

func (f *Fragment) AddSampleInterval(sItvl SampleInterval) error

AddSampleInterval - add SampleInterval for a fragment with only one track

func (*Fragment) AddSamples

func (f *Fragment) AddSamples(ss []Sample, baseMediaDecodeTime uint64)

AddSamples - add a slice of Sample to the first (and only) trun of a track

func (*Fragment) Encode

func (f *Fragment) Encode(w io.Writer) error

Encode - write fragment via writer

func (*Fragment) GetChildren

func (f *Fragment) GetChildren() []Box

GetChildren - return children boxes

func (*Fragment) GetFullSamples

func (f *Fragment) GetFullSamples(trex *TrexBox) ([]FullSample, error)

GetFullSamples - Get full samples including media and accumulated time

func (*Fragment) GetSampleInterval

func (f *Fragment) GetSampleInterval(trex *TrexBox, startSampleNr, endSampleNr uint32) (SampleInterval, error)

GetSampleInterval - get SampleInterval for a fragment with only one track

func (*Fragment) GetSampleNrFromTime

func (f *Fragment) GetSampleNrFromTime(trex *TrexBox, sampleTime uint64) (uint32, error)

GetSampleNrFromTime - look up sample number from a specified time. Return error if no matching time

func (*Fragment) SetTrunDataOffsets

func (f *Fragment) SetTrunDataOffsets()

SetTrunDataOffsets - set DataOffset in trun depending on size and writeOrder

func (*Fragment) Size

func (f *Fragment) Size() uint64

Size - return size of fragment including all boxes. Be aware that TrafBox.OptimizeTfhdTrun() can change size

type FreeBox

type FreeBox struct {
	Name string
	// contains filtered or unexported fields
}

FreeBox - Free Space Box (free or skip)

func (*FreeBox) Size

func (b *FreeBox) Size() uint64

Size - calculated size of box

func (*FreeBox) Type

func (b *FreeBox) Type() string

Type - box type

type FrmaBox

type FrmaBox struct {
	DataFormat string // uint32 - original box type
}

FrmaBox - Original Format Box

type FtypBox

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

FtypBox - File Type Box (ftyp - mandatory in full file/init segment)

func (*FtypBox) MajorBrand

func (b *FtypBox) MajorBrand() string

MajorBrand - major brand (4 chars)

func (*FtypBox) MinorVersion

func (b *FtypBox) MinorVersion() uint32

MinorVersion - minor version

func (*FtypBox) Size

func (b *FtypBox) Size() uint64

Size - return calculated size

func (*FtypBox) Type

func (b *FtypBox) Type() string

Type - return box type

type FullSample

type FullSample struct {
	Sample
	DecodeTime uint64 // Absolute decode time (offset + accumulated sample Dur)
	Data       []byte // Sample data
}

FullSample - include accumulated time and data. Times in mdhd timescale

type HdlrBox

type HdlrBox struct {
	Version              byte
	Flags                uint32
	PreDefined           uint32
	HandlerType          string
	Name                 string // Null-terminated UTF-8 string according to ISO/IEC 14496-12 Sec. 8.4.3.3
	LacksNullTermination bool   // This should be true, but we allow false as well
}

HdlrBox - Handler Reference Box (hdlr - mandatory)

Contained in: Media Box (mdia) or Meta Box (meta)

This box describes the type of data contained in the trak. HandlerType can be : "vide" (video track), "soun" (audio track), "subt" (subtitle track) Other types are: "hint" (hint track), "meta" (timed Metadata track), "auxv" (auxiliary video track). clcp (Closed Captions (QuickTime))

type IlstBox

type IlstBox struct {
	Children []Box
}

IlstBox - iTunes Metadata Item List Atom (ilst) See https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/Metadata/Metadata.html

type Informer

type Informer interface {
	// Info - write details via Info method
	//   spedificBoxLevels is a comma-separated list box:level or all:level where level >= 0.
	//   Higher levels give more details. 0 is default
	//   indent is indent at this box level.
	//   indentStep is how much to indent at each level
	Info(w io.Writer, specificBoxLevels, indent, indentStep string) error
}

Informer - write box, segment or file details

type InitializationVector

type InitializationVector []byte

InitializationVector (8 or 16 bytes)

type MdatBox

type MdatBox struct {
	StartPos  uint64
	Data      []byte
	DataParts [][]byte

	LargeSize bool
	// contains filtered or unexported fields
}

MdatBox - Media Data Box (mdat) The mdat box contains media chunks/samples. DataParts is to be able to gather output data without new allocations

func (*MdatBox) AddSampleData

func (m *MdatBox) AddSampleData(s []byte)

AddSampleData - a sample data to an mdat box

func (*MdatBox) AddSampleDataPart

func (m *MdatBox) AddSampleDataPart(s []byte)

AddSampleDataPart - add a data part (for output)

func (*MdatBox) DataLength

func (m *MdatBox) DataLength() uint64

DataLength - length of data stored in box either as one or multiple parts

func (*MdatBox) Encode

func (m *MdatBox) Encode(w io.Writer) error

Encode - write box to w. If m.lazyDataSize > 0, the mdat data needs to be written separately

func (*MdatBox) HeaderSize

func (m *MdatBox) HeaderSize() uint64

HeaderSize - 8 or 16 (bytes) depending o whether largeSize is used

func (*MdatBox) Info

func (m *MdatBox) Info(w io.Writer, specificBoxLevels, indent, indentStep string) error

Info - write box-specific information

func (*MdatBox) IsLazy

func (m *MdatBox) IsLazy() bool

IsLazy - is the mdat data handled lazily (with separate writer/reader).

func (*MdatBox) PayloadAbsoluteOffset

func (m *MdatBox) PayloadAbsoluteOffset() uint64

PayloadAbsoluteOffset - position of mdat payload start (works after header)

func (*MdatBox) Size

func (m *MdatBox) Size() uint64

Size - return calculated size, depending on largeSize set or not

func (*MdatBox) Type

func (m *MdatBox) Type() string

Type - return box type

type MdhdBox

type MdhdBox struct {
	Version          byte // Only version 0
	Flags            uint32
	CreationTime     uint64 // Typically not set
	ModificationTime uint64 // Typically not set
	Timescale        uint32 // Media timescale for this track
	Duration         uint64 // Trak duration, 0 for fragmented files
	Language         uint16 // Three-letter ISO-639-2/T language code
}

MdhdBox - Media Header Box (mdhd - mandatory)

Contained in : Media Box (mdia)

Timescale defines the timescale used for this track. Language is a ISO-639-2/T language code stored as 1bit padding + [3]int5

func (*MdhdBox) Encode

func (m *MdhdBox) Encode(w io.Writer) error

Encode - write box to w

func (*MdhdBox) EncodeSW

func (m *MdhdBox) EncodeSW(sw mp4ff.SliceWriter) error

EncodeSW - box-specific encode to slicewriter

func (*MdhdBox) GetLanguage

func (m *MdhdBox) GetLanguage() string

GetLanguage - Get three-byte language string

func (*MdhdBox) SetLanguage

func (m *MdhdBox) SetLanguage(lang string)

SetLanguage - Set three-byte language string

func (*MdhdBox) Size

func (m *MdhdBox) Size() uint64

Size - calculated size of box

func (*MdhdBox) Type

func (m *MdhdBox) Type() string

Type - box type

type MdiaBox

type MdiaBox struct {
	Mdhd     *MdhdBox
	Hdlr     *HdlrBox
	Elng     *ElngBox
	Minf     *MinfBox
	Children []Box
}

MdiaBox - Media Box (mdia)

Contained in : Track Box (trak) Contains all information about the media data.

type MediaSegment

type MediaSegment struct {
	Styp        *StypBox
	Sidx        *SidxBox // Sidx for a segment
	Fragments   []*Fragment
	EncOptimize EncOptimize
}

MediaSegment - MP4 Media Segment

func NewMediaSegment

func NewMediaSegment() *MediaSegment

NewMediaSegment - create empty MediaSegment with CMAF styp box

func (*MediaSegment) AddFragment

func (s *MediaSegment) AddFragment(f *Fragment)

AddFragment - Add a fragment to a MediaSegment

func (*MediaSegment) Encode

func (s *MediaSegment) Encode(w io.Writer) error

Encode - Write MediaSegment via writer

func (*MediaSegment) LastFragment

func (s *MediaSegment) LastFragment() *Fragment

LastFragment - Currently last fragment

func (*MediaSegment) Size

func (s *MediaSegment) Size() uint64

Size - return size of media segment

type MehdBox

type MehdBox struct {
	Version          byte
	Flags            uint32
	FragmentDuration int64
}

MehdBox - Movie Extends Header Box Optional, provides overall duration of a fragmented movie

type MetaBox

type MetaBox struct {
	Version  byte
	Flags    uint32
	Hdlr     *HdlrBox
	Children []Box
}

MetaBox - MetaBox meta ISO/IEC 14496-12 Ed. 6 2020 Section 8.11

type MfhdBox

type MfhdBox struct {
	Version        byte
	Flags          uint32
	SequenceNumber uint32
}

MfhdBox - Media Fragment Header Box (mfhd)

Contained in : Movie Fragment box (moof))

func CreateMfhd

func CreateMfhd(sequenceNumber uint32) *MfhdBox

CreateMfhd - create an MfhdBox

func (*MfhdBox) Encode

func (m *MfhdBox) Encode(w io.Writer) error

Encode - write box to w

func (*MfhdBox) EncodeSW

func (m *MfhdBox) EncodeSW(sw mp4ff.SliceWriter) error

EncodeSW - box-specific encode to slicewriter

func (*MfhdBox) Size

func (m *MfhdBox) Size() uint64

Size - calculated size of box

func (*MfhdBox) Type

func (m *MfhdBox) Type() string

Type - box type

type MfroBox

type MfroBox struct {
	Version    byte
	Flags      uint32
	ParentSize uint32
}

MfroBox - Movie Fragment Random Access Offset Box (mfro) Contained in : MfraBox (mfra)

func (*MfroBox) Encode

func (b *MfroBox) Encode(w io.Writer) error

Encode - write box to w

func (*MfroBox) EncodeSW

func (b *MfroBox) EncodeSW(sw mp4ff.SliceWriter) error

EncodeSW - box-specific encode to slicewriter

func (*MfroBox) Info

func (b *MfroBox) Info(w io.Writer, specificBoxLevels, indent, indentStep string) error

Info - write box-specific information

func (*MfroBox) Size

func (b *MfroBox) Size() uint64

Size - return calculated size

func (*MfroBox) Type

func (b *MfroBox) Type() string

Type - return box type

type MinfBox

type MinfBox struct {
	Vmhd     *VmhdBox
	Smhd     *SmhdBox
	Sthd     *SthdBox
	Dinf     *DinfBox
	Stbl     *StblBox
	Children []Box
}

MinfBox - Media Information Box (minf - mandatory)

Contained in : Media Box (mdia)

type MoofBox

type MoofBox struct {
	StartPos uint64
	Children []Box
	Trafs    []*TrafBox

	Pssh  *PsshBox
	Psshs []*PsshBox
	Traf  *TrafBox // The first traf child box
}

MoofBox - Movie Fragment Box (moof)

Contains all meta-data. To be able to stream a file, the moov box should be placed before the mdat box.

func (*MoofBox) AddChild

func (m *MoofBox) AddChild(b Box) error

AddChild - add child box

func (*MoofBox) Encode

func (m *MoofBox) Encode(w io.Writer) error

Encode - write moof after updating trun dataoffset

func (*MoofBox) GetChildren

func (m *MoofBox) GetChildren() []Box

GetChildren - list of child boxes

func (*MoofBox) RemovePsshs

func (m *MoofBox) RemovePsshs()

func (*MoofBox) Size

func (m *MoofBox) Size() uint64

Size - returns calculated size

func (*MoofBox) Type

func (m *MoofBox) Type() string

Type - returns box type

type MoovBox

type MoovBox struct {
	Children []Box
	Mvex     *MvexBox
	Pssh     *PsshBox
	Psshs    []*PsshBox
	StartPos uint64
	Trak     *TrakBox // The first trak box
	Traks    []*TrakBox
}

MoovBox - Movie Box (moov - mandatory)

Contains all meta-data. To be able to stream a file, the moov box should be placed before the mdat box.

type MvexBox

type MvexBox struct {
	Mehd     *MehdBox
	Trex     *TrexBox
	Trexs    []*TrexBox
	Children []Box
}

MvexBox - MovieExtendsBox (mevx)

Contained in : Movie Box (moov)

Its presence signals a fragmented asset

type NmhdBox

type NmhdBox struct {
	Version byte
	Flags   uint32
}

NmhdBox - Null Media Header Box (nmhd - often used instead of sthd for subtitle tracks)

func (*NmhdBox) Encode

func (b *NmhdBox) Encode(w io.Writer) error

Encode - write box to w

func (*NmhdBox) EncodeSW

func (b *NmhdBox) EncodeSW(sw mp4ff.SliceWriter) error

EncodeSW - box-specific encode to slicewriter

func (*NmhdBox) Info

func (b *NmhdBox) Info(w io.Writer, specificBoxLevels, indent, indentStep string) error

Info - write box-specific information

func (*NmhdBox) Size

func (b *NmhdBox) Size() uint64

Size - calculated size of box

func (*NmhdBox) Type

func (b *NmhdBox) Type() string

Type - box-specific type

type PaspBox

type PaspBox struct {
	HSpacing uint32
	VSpacing uint32
}

PaspBox - Pixel Aspect Ratio Box, ISO/IEC 14496-12 2020 Sec. 12.1.4

type PiffData

type PiffData []byte

type PsshBox

type PsshBox struct {
	Version  byte
	Flags    uint32
	SystemID UUID
	KIDs     []UUID
	Data     []byte
}

PsshBox - Protection System Specific Header Box Defined in ISO/IEC 23001-7 Secion 8.1

func (*PsshBox) Encode

func (b *PsshBox) Encode(w io.Writer) error

Encode - write box to w

func (*PsshBox) EncodeSW

func (b *PsshBox) EncodeSW(sw mp4ff.SliceWriter) error

EncodeSW - box-specific encode to slicewriter

func (*PsshBox) Size

func (b *PsshBox) Size() uint64

Size - return calculated size

func (*PsshBox) Type

func (b *PsshBox) Type() string

Type - return box type

type RapSampleGroupEntry

type RapSampleGroupEntry struct {
	NumLeadingSamplesKnown uint8
	NumLeadingSamples      uint8
}

RapSampleGroupEntry - Random Access Point "rap "

ISO/IEC 14496-12 Ed. 6 2020 Section 10.4 - VisualRandomAccessEntry

func (*RapSampleGroupEntry) Encode

func (s *RapSampleGroupEntry) Encode(sw mp4ff.SliceWriter)

Encode SampleGroupEntry to SliceWriter

func (*RapSampleGroupEntry) Info

func (s *RapSampleGroupEntry) Info(w io.Writer, specificBoxLevels, indent, indentStep string) (err error)

Info - write box info to w

func (*RapSampleGroupEntry) Size

func (s *RapSampleGroupEntry) Size() uint64

Size of sample group entry

func (*RapSampleGroupEntry) Type

func (s *RapSampleGroupEntry) Type() string

Type - GroupingType SampleGroupEntry (uint32 according to spec)

type RollSampleGroupEntry

type RollSampleGroupEntry struct {
	RollDistance int16
}

RollSampleGroupEntry - Gradual Decoding Refresh "roll"

ISO/IEC 14496-12 Ed. 6 2020 Section 10.1

VisualRollRecoveryEntry / AudioRollRecoveryEntry / AudioPreRollEntry

func (*RollSampleGroupEntry) Encode

func (s *RollSampleGroupEntry) Encode(sw mp4ff.SliceWriter)

Encode SampleGroupEntry to SliceWriter

func (*RollSampleGroupEntry) Info

func (s *RollSampleGroupEntry) Info(w io.Writer, specificBoxLevels, indent, indentStep string) (err error)

Info - write box info to w

func (*RollSampleGroupEntry) Size

func (s *RollSampleGroupEntry) Size() uint64

Size of sample group entry

func (*RollSampleGroupEntry) Type

func (s *RollSampleGroupEntry) Type() string

Type - GroupingType SampleGroupEntry (uint32 according to spec)

type SaioBox

type SaioBox struct {
	Version              byte
	Flags                uint32
	AuxInfoType          string // Used for Common Encryption Scheme (4-bytes uint32 according to spec)
	AuxInfoTypeParameter uint32
	Offset               []int64
}

SaioBox - Sample Auxiliary Information Offsets Box (saiz) (in stbl or traf box)

func (*SaioBox) Encode

func (b *SaioBox) Encode(w io.Writer) error

Encode - write box to w

func (*SaioBox) EncodeSW

func (b *SaioBox) EncodeSW(sw mp4ff.SliceWriter) error

EncodeSW - box-specific encode to slicewriter

func (*SaioBox) Size

func (b *SaioBox) Size() uint64

Size - return calculated size

func (*SaioBox) Type

func (b *SaioBox) Type() string

Type - return box type

type SaizBox

type SaizBox struct {
	Version               byte
	Flags                 uint32
	AuxInfoType           string // Used for Common Encryption Scheme (4-bytes uint32 according to spec)
	AuxInfoTypeParameter  uint32
	SampleCount           uint32
	SampleInfo            []byte
	DefaultSampleInfoSize byte
}

SaizBox - Sample Auxiliary Information Sizes Box (saiz) (in stbl or traf box)

func (*SaizBox) Encode

func (b *SaizBox) Encode(w io.Writer) error

Encode - write box to w

func (*SaizBox) EncodeSW

func (b *SaizBox) EncodeSW(sw mp4ff.SliceWriter) error

EncodeSW - box-specific encode to slicewriter

func (*SaizBox) Size

func (b *SaizBox) Size() uint64

Size - return calculated size

func (*SaizBox) Type

func (b *SaizBox) Type() string

Type - return box type

type Sample

type Sample struct {
	Flags                 uint32 // interpreted as SampleFlags
	Dur                   uint32 // Sample duration in mdhd timescale
	Size                  uint32 // Size of sample data
	CompositionTimeOffset int32  // Signed composition time offset
}

Sample - sample as used in trun box (mdhd timescale)

func (*Sample) IsSync

func (s *Sample) IsSync() bool

IsSync - check sync by masking flags including dependsOn

type SampleFlags

type SampleFlags struct {
	IsLeading                 byte
	SampleDependsOn           byte
	SampleIsDependedOn        byte
	SampleHasRedundancy       byte
	SamplePaddingValue        byte
	SampleIsNonSync           bool
	SampleDegradationPriority uint16
}

SampleFlags according to 14496-12 Sec. 8.8.3.1

func DecodeSampleFlags

func DecodeSampleFlags(u uint32) SampleFlags

DecodeSampleFlags - decode a uint32 flags field

func (SampleFlags) Encode

func (sf SampleFlags) Encode() uint32

Encode - convert sampleflags to uint32 bit pattern

type SampleGroupEntry

type SampleGroupEntry interface {
	// Type - GroupingType SampleGroupEntry (uint32 according to spec)
	Type() string // actually
	// Size of SampleGroup Entry
	Size() uint64
	// Encode SampleGroupEntry to SliceWriter
	Encode(sw mp4ff.SliceWriter)
	// Info - description of content.
	Info(w io.Writer, specificBoxLevels, indent, indentStep string) (err error)
}

SampleGroupEntry - like a box, but size and type are not in a header

func DecodeAlstSampleGroupEntry

func DecodeAlstSampleGroupEntry(name string, length uint32, sr mp4ff.SliceReader) (SampleGroupEntry, error)

DecodeAlstSampleGroupEntry - decode ALST Sample Group Entry

func DecodeRapSampleGroupEntry

func DecodeRapSampleGroupEntry(name string, length uint32, sr mp4ff.SliceReader) (SampleGroupEntry, error)

DecodeRapSampleGroupEntry - decode Rap Sample Sample Group Entry

func DecodeSeigSampleGroupEntry

func DecodeSeigSampleGroupEntry(name string, length uint32, sr mp4ff.SliceReader) (SampleGroupEntry, error)

DecodeSeigSampleGroupEntry - decode Common Encryption Sample Group Entry

func DecodeUnknownSampleGroupEntry

func DecodeUnknownSampleGroupEntry(name string, length uint32, sr mp4ff.SliceReader) (SampleGroupEntry, error)

DecodeUnknownSampleGroupEntry - decode an unknown sample group entry

type SampleGroupEntryDecoder

type SampleGroupEntryDecoder func(name string, length uint32, sr mp4ff.SliceReader) (SampleGroupEntry, error)

SampleGroupEntryDecoder is function signature of the SampleGroupEntry Decode method

type SampleInterval

type SampleInterval struct {
	FirstDecodeTime uint64
	Samples         []Sample
	OffsetInMdat    uint32 // Offset relative start of mdat box
	Size            uint32 // total size of all samples in interval
	Data            []byte // If set, should be relevant mdat range
}

SampleInterval - an interval of samples including reference to or concatenated binary media data

type SbgpBox

type SbgpBox struct {
	Version                 byte
	Flags                   uint32
	GroupingType            string // uint32, but takes values such as seig
	GroupingTypeParameter   uint32
	SampleCounts            []uint32
	GroupDescriptionIndices []uint32 // Starts at 65537 inside fragment, see Section 8.9.4
}

SbgpBox - Sample To Group Box, ISO/IEC 14496-12 6'th edition 2020 Section 8.9.2

func (*SbgpBox) Encode

func (b *SbgpBox) Encode(w io.Writer) error

Encode - write box to w

func (*SbgpBox) EncodeSW

func (b *SbgpBox) EncodeSW(sw mp4ff.SliceWriter) error

EncodeSW - box-specific encode to slicewriter

func (*SbgpBox) Size

func (b *SbgpBox) Size() uint64

Size - return calculated size

func (*SbgpBox) Type

func (b *SbgpBox) Type() string

Type - return box type

type SchiBox

type SchiBox struct {
	Tenc     *TencBox
	Children []Box
}

SchiBox - Schema Information Box

func (*SchiBox) GetChildren

func (b *SchiBox) GetChildren() []Box

GetChildren - list of child boxes

func (*SchiBox) Size

func (b *SchiBox) Size() uint64

Size - calculated size of box

func (*SchiBox) Type

func (b *SchiBox) Type() string

Type - box type

type SchmBox

type SchmBox struct {
	Version       byte
	Flags         uint32
	SchemeType    string // 4CC represented as uint32
	SchemeVersion uint32
	SchemeURI     string // Absolute null-terminated URL
}

SchmBox - Scheme Type Box

type SdtpBox

type SdtpBox struct {
	Version byte
	Flags   uint32
	Entries []SdtpEntry
}

SdtpBox - Sample Dependency Box (sdtp - optional)

ISO/IEC 14496-12 Ed. 6 2020 Section 8.6.4 Contained in Sample Table Box (stbl)

Table to determine whether a sample depends or is depended on by other samples

type SdtpEntry

type SdtpEntry uint8

SdtpEntry (uint8)

ISO/IEC 14496-12 Ed. 6 2020 Section 8.6.4.2

type SeigSampleGroupEntry

type SeigSampleGroupEntry struct {
	CryptByteBlock  byte
	SkipByteBlock   byte
	IsProtected     byte
	PerSampleIVSize byte
	KID             UUID
	// ConstantIVSize byte given by len(ConstantIV)
	ConstantIV []byte
}

SeigSampleGroupEntry - CencSampleEncryptionInformationGroupEntry as defined in CEF ISO/IEC 23001-7 3rd edition 2016

func (*SeigSampleGroupEntry) ConstantIVSize

func (s *SeigSampleGroupEntry) ConstantIVSize() byte

ConstantIVSize - non-zero if protected and perSampleIVSize == 0

func (*SeigSampleGroupEntry) Encode

func (s *SeigSampleGroupEntry) Encode(sw mp4ff.SliceWriter)

Encode SampleGroupEntry to SliceWriter

func (*SeigSampleGroupEntry) Info

func (s *SeigSampleGroupEntry) Info(w io.Writer, specificBoxLevels, indent, indentStep string) (err error)

Info - write box info to w

func (*SeigSampleGroupEntry) Size

func (s *SeigSampleGroupEntry) Size() uint64

Size of SampleGroup Entry

func (*SeigSampleGroupEntry) Type

func (s *SeigSampleGroupEntry) Type() string

Type - GroupingType SampleGroupEntry (uint32 according to spec)

type SencBox

type SencBox struct {
	Version byte

	Flags       uint32
	SampleCount uint32
	StartPos    uint64

	IVs        []InitializationVector // 8 or 16 bytes if present
	SubSamples [][]SubSamplePattern
	// contains filtered or unexported fields
}

SencBox - Sample Encryption Box (senc) (in trak or traf box) Should only be decoded after saio and saiz provide relevant offset and sizes Here we make a two-step decode, with first step reading, and other parsing. See ISO/IEC 23001-7 Section 7.2 and CMAF specification Full Box + SampleCount

func CreateSencBox

func CreateSencBox() *SencBox

CreateSencBox - create an empty SencBox

func (*SencBox) AddSample

func (s *SencBox) AddSample(sample SencSample) error

AddSample - add a senc sample with possible IV and subsamples

func (*SencBox) Encode

func (s *SencBox) Encode(w io.Writer) error

Encode - write box to w

func (*SencBox) EncodeSW

func (s *SencBox) EncodeSW(sw mp4ff.SliceWriter) error

EncodeSW - box-specific encode to slicewriter

func (*SencBox) GetPerSampleIVSize

func (s *SencBox) GetPerSampleIVSize() int

GetPerSampleIVSize - return perSampleIVSize

func (*SencBox) ParseReadBox

func (s *SencBox) ParseReadBox(perSampleIVSize byte, saiz *SaizBox) error

ParseReadBox - second phase when perSampleIVSize should be known from tenc or sgpd boxes if perSampleIVSize is 0, we try to find the appropriate error given data length

func (*SencBox) Size

func (s *SencBox) Size() uint64

Size - box-specific type

func (*SencBox) Type

func (s *SencBox) Type() string

Type - box-specific type

type SencSample

type SencSample struct {
	IV         InitializationVector // 0,8,16 byte length
	SubSamples []SubSamplePattern
}

SencSample - sample in SencBox

type SgpdBox

type SgpdBox struct {
	Version                      byte
	Flags                        uint32
	GroupingType                 string // uint32, but takes values such as seig
	DefaultLength                uint32
	DefaultGroupDescriptionIndex uint32
	DescriptionLengths           []uint32
	SampleGroupEntries           []SampleGroupEntry
}

SgpdBox - Sample Group Description Box, ISO/IEC 14496-12 6'th edition 2020 Section 8.9.3 Version 0 is deprecated

func (*SgpdBox) Encode

func (b *SgpdBox) Encode(w io.Writer) error

Encode - write box to w

func (*SgpdBox) EncodeSW

func (b *SgpdBox) EncodeSW(sw mp4ff.SliceWriter) error

EncodeSW - box-specific encode to slicewriter

func (*SgpdBox) Size

func (b *SgpdBox) Size() uint64

Size - return calculated size

func (*SgpdBox) Type

func (b *SgpdBox) Type() string

Type - return box type

type SidxBox

type SidxBox struct {
	Version                  byte
	Flags                    uint32
	ReferenceID              uint32
	Timescale                uint32
	EarliestPresentationTime uint64
	FirstOffset              uint64
	SidxRefs                 []SidxRef
}

SidxBox - SegmentIndexBox

type SidxRef

type SidxRef struct {
	ReferencedSize     uint32
	SubSegmentDuration uint32
	SAPDeltaTime       uint32
	ReferenceType      uint8 // 1-bit
	StartsWithSAP      uint8 // 1-bit
	SAPType            uint8
}

SidxRef - reference as used inside SidxBox

type SinfBox

type SinfBox struct {
	Frma     *FrmaBox // Mandatory
	Schm     *SchmBox // Optional
	Schi     *SchiBox // Optional
	Children []Box
}

SinfBox - Protection Scheme Information Box according to ISO/IEC 23001-7

func (*SinfBox) Encode

func (b *SinfBox) Encode(w io.Writer) error

Encode - write minf container to w

func (*SinfBox) GetChildren

func (b *SinfBox) GetChildren() []Box

GetChildren - list of child boxes

func (*SinfBox) Size

func (b *SinfBox) Size() uint64

Size - calculated size of box

func (*SinfBox) Type

func (b *SinfBox) Type() string

Type - box type

type SmhdBox

type SmhdBox struct {
	Version byte
	Flags   uint32
	Balance uint16 // should be int16
}

SmhdBox - Sound Media Header Box (smhd - mandatory for sound tracks)

Contained in : Media Information Box (minf)

func (*SmhdBox) Encode

func (b *SmhdBox) Encode(w io.Writer) error

Encode - write box to w

func (*SmhdBox) EncodeSW

func (b *SmhdBox) EncodeSW(sw mp4ff.SliceWriter) error

EncodeSW - box-specific encode to slicewriter

func (*SmhdBox) Size

func (b *SmhdBox) Size() uint64

Size - calculated size of box

func (*SmhdBox) Type

func (b *SmhdBox) Type() string

Type - box type

type StblBox

type StblBox struct {
	Children []Box
	Co64     *Co64Box
	Ctts     *CttsBox
	Saio     *SaioBox
	Saiz     *SaizBox
	Sbgp     *SbgpBox   // The first
	Sbgps    []*SbgpBox // All
	Sdtp     *SdtpBox
	Sgpd     *SgpdBox   // The first
	Sgpds    []*SgpdBox // All
	Stco     *StcoBox
	Stsd     *StsdBox
	Stss     *StssBox
	Stsz     *StszBox
	Stts     *SttsBox
	Subs     *SubsBox
}

StblBox - Sample Table Box (stbl - mandatory)

Contained in : Media Information Box (minf)

The table contains all information relevant to data samples (times, chunks, sizes, ...)

func (*StblBox) GetChildren

func (s *StblBox) GetChildren() []Box

GetChildren - list of child boxes

func (*StblBox) Size

func (s *StblBox) Size() uint64

Size - box-specific size

func (*StblBox) Type

func (s *StblBox) Type() string

Type - box-specific type

type StcoBox

type StcoBox struct {
	Version     byte
	Flags       uint32
	ChunkOffset []uint32
}

StcoBox - Chunk Offset Box (stco - mandatory)

Contained in : Sample Table box (stbl)

The table contains the offsets (starting at the beginning of the file) for each chunk of data for the current track. A chunk contains samples, the table defining the allocation of samples to each chunk is stsc.

func (*StcoBox) Encode

func (b *StcoBox) Encode(w io.Writer) error

Encode - write box to w

func (*StcoBox) EncodeSW

func (b *StcoBox) EncodeSW(sw mp4ff.SliceWriter) error

EncodeSW - box-specific encode to slicewriter

func (*StcoBox) GetOffset

func (b *StcoBox) GetOffset(chunkNr int) (uint64, error)

GetOffset - get offset for 1-based chunkNr.

func (*StcoBox) Size

func (b *StcoBox) Size() uint64

Size - box-specific size

func (*StcoBox) Type

func (b *StcoBox) Type() string

Type - box-specific type

type SthdBox

type SthdBox struct {
	Version byte
	Flags   uint32
}

SthdBox - Subtitle Media Header Box (sthd - for subtitle tracks)

type StppBox

type StppBox struct {
	Namespace          string   // Mandatory
	SchemaLocation     string   // Optional
	AuxiliaryMimeTypes string   // Required if auxiliary types present
	Btrt               *BtrtBox // Optional
	Children           []Box
	DataReferenceIndex uint16
}

StppBox - XMLSubtitleSampleEntryr Box (stpp)

Contained in : Media Information Box (minf)

func NewStppBox

func NewStppBox(namespace, schemaLocation, auxiliaryMimeTypes string) *StppBox

NewStppBox - Create new stpp box namespace, schemaLocation and auxiliaryMimeType are space-separated utf8-lists without zero-termination schemaLocation and auxiliaryMimeTypes are optional

func (*StppBox) AddChild

func (b *StppBox) AddChild(child Box)

AddChild - add a child box (avcC normally, but clap and pasp could be part of visual entry)

func (*StppBox) Encode

func (b *StppBox) Encode(w io.Writer) error

Encode - write box to w

func (*StppBox) Size

func (b *StppBox) Size() uint64

Size - return calculated size

func (*StppBox) Type

func (b *StppBox) Type() string

Type - return box type

type StsdBox

type StsdBox struct {
	Version     byte
	Flags       uint32
	SampleCount uint32
	AvcX        *VisualSampleEntryBox
	HvcX        *VisualSampleEntryBox
	Mp4a        *AudioSampleEntryBox
	AC3         *AudioSampleEntryBox
	EC3         *AudioSampleEntryBox
	Children    []Box
}

StsdBox - Sample Description Box (stsd - manatory) See ISO/IEC 14496-12 Section 8.5.2.2 Full Box + SampleCount All Children are sampleEntries

type StssBox

type StssBox struct {
	Version      byte
	Flags        uint32
	SampleNumber []uint32
}

StssBox - Sync Sample Box (stss - optional)

Contained in : Sample Table box (stbl)

This lists all sync samples (key frames for video tracks) in the data. If absent, all samples are sync samples.

type StszBox

type StszBox struct {
	Version           byte
	Flags             uint32
	SampleUniformSize uint32
	SampleNumber      uint32
	SampleSize        []uint32
}

StszBox - Sample Size Box (stsz - mandatory)

Contained in : Sample Table box (stbl)

For each track, either stsz of the more compact stz2 must be present. stz2 variant is not supported.

This table lists the size of each sample. If all samples have the same size, it can be defined in the SampleUniformSize attribute.

type SttsBox

type SttsBox struct {
	Version         byte
	Flags           uint32
	SampleCount     []uint32
	SampleTimeDelta []uint32
}

SttsBox - Decoding Time to Sample Box (stts - mandatory)

This table contains the duration in time units for each sample.

  • SampleCount : the number of consecutive samples having the same duration
  • SampleTimeDelta : duration in time units

type StypBox

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

StypBox - Segment Type Box (styp)

type SubSamplePattern

type SubSamplePattern struct {
	BytesOfClearData     uint16
	BytesOfProtectedData uint32
}

SubSamplePattern - pattern of subsample encryption

type SubsBox

type SubsBox struct {
	Version byte
	Flags   uint32
	Entries []SubsEntry
}

SubsBox - SubSampleInformationBox

type SubsEntry

type SubsEntry struct {
	SampleDelta uint32
	SubSamples  []SubsSample
}

SubsEntry - entry in SubsBox

type SubsSample

type SubsSample struct {
	SubsampleSize           uint32
	CodecSpecificParameters uint32
	SubsamplePriority       uint8
	Discardable             uint8
}

SubsSample - sample in SubsEntry

type TencBox

type TencBox struct {
	Version                byte
	Flags                  uint32
	DefaultCryptByteBlock  byte
	DefaultSkipByteBlock   byte
	DefaultIsProtected     byte
	DefaultPerSampleIVSize byte
	DefaultKID             UUID
	// DefaultConstantIVSize  byte given by len(DefaultConstantIV)
	DefaultConstantIV []byte
}

TencBox - Track Encryption Box Defined in ISO/IEC 23001-7 Secion 8.2

type TfdtBox

type TfdtBox struct {
	Version             byte
	Flags               uint32
	BaseMediaDecodeTime uint64
}

TfdtBox - Track Fragment Decode Time (tfdt)

Contained in : Track Fragment box (traf)

func (*TfdtBox) Encode

func (t *TfdtBox) Encode(w io.Writer) error

Encode - write box to w

func (*TfdtBox) EncodeSW

func (t *TfdtBox) EncodeSW(sw mp4ff.SliceWriter) error

EncodeSW - box-specific encode to slicewriter

func (*TfdtBox) SetBaseMediaDecodeTime

func (t *TfdtBox) SetBaseMediaDecodeTime(bTime uint64)

SetBaseMediaDecodeTime - Set time of TfdtBox

func (*TfdtBox) Size

func (t *TfdtBox) Size() uint64

Size - return calculated size

func (*TfdtBox) Type

func (t *TfdtBox) Type() string

Type - return box type

type TfhdBox

type TfhdBox struct {
	Version                byte
	Flags                  uint32
	TrackID                uint32
	BaseDataOffset         uint64
	SampleDescriptionIndex uint32
	DefaultSampleDuration  uint32
	DefaultSampleSize      uint32
	DefaultSampleFlags     uint32
}

TfhdBox - Track Fragment Header Box (tfhd)

Contained in : Track Fragment box (traf))

func CreateTfhd

func CreateTfhd(trackID uint32) *TfhdBox

CreateTfhd - Create a new TfdtBox with baseMediaDecodeTime

func (*TfhdBox) DefaultBaseIfMoof

func (t *TfhdBox) DefaultBaseIfMoof() bool

DefaultBaseIfMoof - interpreted flags value

func (*TfhdBox) DurationIsEmpty

func (t *TfhdBox) DurationIsEmpty() bool

DurationIsEmpty - interpreted flags value

func (*TfhdBox) Encode

func (t *TfhdBox) Encode(w io.Writer) error

Encode - write box to w

func (*TfhdBox) EncodeSW

func (t *TfhdBox) EncodeSW(sw mp4ff.SliceWriter) error

EncodeSW - box-specific encode to slicewriter

func (*TfhdBox) HasBaseDataOffset

func (t *TfhdBox) HasBaseDataOffset() bool

HasBaseDataOffset - interpreted flags value

func (*TfhdBox) HasDefaultSampleDuration

func (t *TfhdBox) HasDefaultSampleDuration() bool

HasDefaultSampleDuration - interpreted flags value

func (*TfhdBox) HasDefaultSampleFlags

func (t *TfhdBox) HasDefaultSampleFlags() bool

HasDefaultSampleFlags - interpreted flags value

func (*TfhdBox) HasDefaultSampleSize

func (t *TfhdBox) HasDefaultSampleSize() bool

HasDefaultSampleSize - interpreted flags value

func (*TfhdBox) HasSampleDescriptionIndex

func (t *TfhdBox) HasSampleDescriptionIndex() bool

HasSampleDescriptionIndex - interpreted flags value

func (*TfhdBox) Size

func (t *TfhdBox) Size() uint64

Size - returns calculated size

func (*TfhdBox) Type

func (t *TfhdBox) Type() string

Type - returns box type

type TfraBox

type TfraBox struct {
	Version               byte
	Flags                 uint32
	TrackID               uint32
	LengthSizeOfTrafNum   byte
	LengthSizeOfTrunNum   byte
	LengthSizeOfSampleNum byte
	Entries               []TfraEntry
}

TfraBox - Track Fragment Random Access Box (tfra) Contained it MfraBox (mfra)

type TfraEntry

type TfraEntry struct {
	Time        int64
	MoofOffset  int64
	TrafNumber  uint32
	TrunNumber  uint32
	SampleDelta uint32
}

TfraEntry - reference as used inside TfraBox

type TfrfData

type TfrfData struct {
	Version                   byte
	Flags                     uint32
	FragmentCount             byte
	FragmentAbsoluteTimes     []uint64
	FragmentAbsoluteDurations []uint64
}

TfrfData - MSS TfrfBox data after UUID part Defined in MSS-SSTR v20180912 section 2.2.4.5

type TfxdData

type TfxdData struct {
	Version                  byte
	Flags                    uint32
	FragmentAbsoluteTime     uint64
	FragmentAbsoluteDuration uint64
}

TfxdData - MSS TfxdBox data after UUID part Defined in MSS-SSTR v20180912 section 2.2.4.4

type TkhdBox

type TkhdBox struct {
	Version          byte
	Flags            uint32
	CreationTime     uint64
	ModificationTime uint64
	TrackID          uint32
	Duration         uint64
	Layer            int16
	AlternateGroup   int16 // should be int16
	Volume           Fixed16
	Width, Height    Fixed32
}

TkhdBox - Track Header Box (tkhd - mandatory)

This box describes the track. Duration is measured in time units (according to the time scale defined in the movie header box). Duration is 0 for fragmented files.

Volume (relevant for audio tracks) is a fixed point number (8 bits + 8 bits). Full volume is 1.0. Width and Height (relevant for video tracks) are fixed point numbers (16 bits + 16 bits). Video pixels are not necessarily square.

func (*TkhdBox) Size

func (b *TkhdBox) Size() uint64

Size - calculated size of box

func (*TkhdBox) Type

func (b *TkhdBox) Type() string

Type - box type

type TopBoxInfo

type TopBoxInfo struct {
	// Type - box type
	Type string
	// Size - box size
	Size uint64
	// StartPos - where in file does box start
	StartPos uint64
}

TopBoxInfo - information about a top-level box

type TrafBox

type TrafBox struct {
	Children []Box
	Saio     *SaioBox
	Saiz     *SaizBox
	Sbgp     *SbgpBox
	Senc     *SencBox
	Sgpd     *SgpdBox
	Tfdt     *TfdtBox
	Tfhd     *TfhdBox
	Trun     *TrunBox // The first TrunBox
	Truns    []*TrunBox
}

TrafBox - Track Fragment Box (traf)

Contained in : Movie Fragment Box (moof)

func (*TrafBox) AddChild

func (t *TrafBox) AddChild(b Box) error

AddChild - add child box

func (*TrafBox) ContainsSencBox

func (t *TrafBox) ContainsSencBox() (ok, parsed bool)

ContainsSencBox - is there a senc box in traf and is it parsed If not parsed, call ParseReadSenc to parse it

func (*TrafBox) Encode

func (t *TrafBox) Encode(w io.Writer) error

Encode - write box to w

func (*TrafBox) GetChildren

func (t *TrafBox) GetChildren() []Box

GetChildren - list of child boxes

func (*TrafBox) OptimizeTfhdTrun

func (t *TrafBox) OptimizeTfhdTrun() error

OptimizeTfhdTrun - optimize trun by default values in tfhd box Only look at first trun, even if there is more than one Don't optimize again, if already done so that no data is present

func (*TrafBox) ParseReadSenc

func (t *TrafBox) ParseReadSenc(defaultIVSize byte, moofStartPos uint64) error

func (*TrafBox) RemoveEncryptionBoxes

func (t *TrafBox) RemoveEncryptionBoxes() uint64

RemoveEncryptionBoxes - remove encryption boxes and return number of bytes removed

func (*TrafBox) Size

func (t *TrafBox) Size() uint64

Size - return calculated size

func (*TrafBox) Type

func (t *TrafBox) Type() string

Type - return box type

type TrakBox

type TrakBox struct {
	Tkhd     *TkhdBox
	Edts     *EdtsBox
	Mdia     *MdiaBox
	Children []Box
}

TrakBox - Track Box (tkhd - mandatory)

Contained in : Movie Box (moov)

A media file can contain one or more tracks.

type TrefBox

type TrefBox struct {
	Children []Box
}

TrefBox - // TrackReferenceBox - ISO/IEC 14496-12 Ed. 9 Sec. 8.3

type TrefTypeBox

type TrefTypeBox struct {
	Name     string
	TrackIDs []uint32
}

TrefTypeBox - TrackReferenceTypeBox - ISO/IEC 14496-12 Ed. 9 Sec. 8.3 Name can be one of hint, cdsc, font, hind, vdep, vplx, subt (ISO/IEC 14496-12) dpnd, ipir, mpod, sync (ISO/IEC 14496-14)

type TrepBox

type TrepBox struct {
	Version  byte
	Flags    uint32
	TrackID  uint32
	Children []Box
}

TrepBox - Track Extension Properties Box (trep) Contained in mvex

type TrexBox

type TrexBox struct {
	Version                       byte
	Flags                         uint32
	TrackID                       uint32
	DefaultSampleDescriptionIndex uint32
	DefaultSampleDuration         uint32
	DefaultSampleSize             uint32
	DefaultSampleFlags            uint32
}

TrexBox - Track Extends Box

Contained in : Mvex Box (mvex)

type TrunBox

type TrunBox struct {
	Version byte
	Flags   uint32

	DataOffset int32

	Samples []Sample
	// contains filtered or unexported fields
}

TrunBox - Track Fragment Run Box (trun)

Contained in : Track Fragmnet Box (traf)

func CreateTrun

func CreateTrun(writeOrderNr uint32) *TrunBox

CreateTrun - create a TrunBox for filling up with samples

func (*TrunBox) AddFullSample

func (t *TrunBox) AddFullSample(s *FullSample)

AddFullSample - add Sample part of FullSample

func (*TrunBox) AddSample

func (t *TrunBox) AddSample(s Sample)

AddSample - add a Sample

func (*TrunBox) AddSampleDefaultValues

func (t *TrunBox) AddSampleDefaultValues(tfhd *TfhdBox, trex *TrexBox) (totalDur uint64)

AddSampleDefaultValues - add values from tfhd and trex boxes if needed Return total duration

func (*TrunBox) AddSamples

func (t *TrunBox) AddSamples(s []Sample)

AddSamples - add a a slice of Sample

func (*TrunBox) Duration

func (t *TrunBox) Duration(defaultSampleDuration uint32) uint64

Duration - calculate total duration of all samples given defaultSampleDuration

func (*TrunBox) Encode

func (t *TrunBox) Encode(w io.Writer) error

Encode - write box to w

func (*TrunBox) EncodeSW

func (t *TrunBox) EncodeSW(sw mp4ff.SliceWriter) error

EncodeSW - box-specific encode to slicewriter

func (*TrunBox) FirstSampleFlags

func (t *TrunBox) FirstSampleFlags() (flags uint32, present bool)

FirstSampleFlags - return firstSampleFlags and indicator if present

func (*TrunBox) GetFullSamples

func (t *TrunBox) GetFullSamples(offsetInMdat uint32, baseDecodeTime uint64, mdat *MdatBox) []FullSample

GetFullSamples - get all sample data including accumulated time and binary media data offsetInMdat is offset in mdat data (data normally starts 8 or 16 bytes after start of mdat box) baseDecodeTime is decodeTime in tfdt in track timescale (timescale in mfhd) To fill missing individual values from tfhd and trex defaults, call trun.AddSampleDefaultValues() before this call

func (*TrunBox) GetSampleInterval

func (t *TrunBox) GetSampleInterval(startSampleNr, endSampleNr uint32, baseDecodeTime uint64,
	mdat *MdatBox, offsetInMdat uint32) (SampleInterval, error)

GetSampleInterval - get sample interval [startSampleNr, endSampleNr] (1-based and inclusive) This includes mdat data (if not lazy), in which case only offsetInMdat is given. baseDecodeTime is decodeTime in tfdt in track timescale (timescale from mfhd). To fill missing individual values from tfhd and trex defaults, call AddSampleDefaultValues() before this call.

func (*TrunBox) GetSampleNrForRelativeTime

func (t *TrunBox) GetSampleNrForRelativeTime(deltaTime uint64, defaultSampleDuration uint32) (uint32, error)

GetSampleNrForRelativeTime - get sample number for exact relative time (calculated from summing durations)

func (*TrunBox) GetSampleRange

func (t *TrunBox) GetSampleRange(startSampleNr, endSampleNr uint32) []Sample

GetSampleRange - get a one-based range of samples To fill missing individual values from tfhd and trex defaults, call AddSampleDefaultValues() before this call

func (*TrunBox) GetSamples

func (t *TrunBox) GetSamples() []Sample

GetSamples - get all trun sample data To fill missing individual values from tfhd and trex defaults, call AddSampleDefaultValues() before this call

func (*TrunBox) HasDataOffset

func (t *TrunBox) HasDataOffset() bool

HasDataOffset - interpreted dataOffsetPresent flag

func (*TrunBox) HasFirstSampleFlags

func (t *TrunBox) HasFirstSampleFlags() bool

HasFirstSampleFlags - interpreted firstSampleFlagsPresent flag

func (*TrunBox) HasSampleCompositionTimeOffset

func (t *TrunBox) HasSampleCompositionTimeOffset() bool

HasSampleCompositionTimeOffset - interpreted sampleCompositionTimeOffset flag

func (*TrunBox) HasSampleDuration

func (t *TrunBox) HasSampleDuration() bool

HasSampleDuration - interpreted sampleDurationPresent flag

func (*TrunBox) HasSampleFlags

func (t *TrunBox) HasSampleFlags() bool

HasSampleFlags - interpreted sampleFlagsPresent flag

func (*TrunBox) HasSampleSize

func (t *TrunBox) HasSampleSize() bool

HasSampleSize - interpreted sampleSizePresent flag

func (*TrunBox) RemoveFirstSampleFlags

func (t *TrunBox) RemoveFirstSampleFlags()

RemoveFirstSampleFlags - remove firstSampleFlags and its indicator

func (*TrunBox) SampleCount

func (t *TrunBox) SampleCount() uint32

SampleCount - return how many samples are defined

func (*TrunBox) SetFirstSampleFlags

func (t *TrunBox) SetFirstSampleFlags(flags uint32)

SetFirstSampleFlags - set firstSampleFlags and bit indicating its presence

func (*TrunBox) Size

func (t *TrunBox) Size() uint64

Size - return calculated size

func (*TrunBox) SizeOfData

func (t *TrunBox) SizeOfData() (totalSize uint64)

SizeOfData - size of mediasamples in bytes

func (*TrunBox) Type

func (t *TrunBox) Type() string

Type - return box type

type UUID

type UUID []byte

UUID - 16-byte KeyID or SystemID

func (UUID) String

func (u UUID) String() string

type UUIDBox

type UUIDBox struct {
	PIFF    PiffData
	SubType string
	Tfrf    *TfrfData
	Tfxd    *TfxdData
	UUID    string // 16 bytes
}

UUIDBox - Used as container for MSS boxes tfxd and tfrf

type UdtaBox

type UdtaBox struct {
	Children []Box
}

UdtaBox - User Data Box is a container for User Data

Contained in : moov, trak, moof, or traf

type UnknownBox

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

UnknownBox - box that we don't know how to parse

func (*UnknownBox) Encode

func (b *UnknownBox) Encode(w io.Writer) error

Encode - write box to w

func (*UnknownBox) EncodeSW

func (b *UnknownBox) EncodeSW(sw mp4ff.SliceWriter) error

EncodeSW - box-specific encode to slicewriter

func (*UnknownBox) Size

func (b *UnknownBox) Size() uint64

Size - return calculated size

func (*UnknownBox) Type

func (b *UnknownBox) Type() string

Type - return box type

type UnknownSampleGroupEntry

type UnknownSampleGroupEntry struct {
	Name   string
	Length uint32
	Data   []byte
}

UnknownSampleGroupEntry - unknown or not implemented SampleGroupEntry

func (*UnknownSampleGroupEntry) Encode

Encode SampleGroupEntry to SliceWriter

func (*UnknownSampleGroupEntry) Info

func (s *UnknownSampleGroupEntry) Info(w io.Writer, specificBoxLevels, indent, indentStep string) (err error)

Info - write box info to w

func (*UnknownSampleGroupEntry) Size

func (s *UnknownSampleGroupEntry) Size() uint64

Size of SampleGroup Entry

func (*UnknownSampleGroupEntry) Type

func (s *UnknownSampleGroupEntry) Type() string

Type - GroupingType SampleGroupEntry (uint32 according to spec)

type VisualSampleEntryBox

type VisualSampleEntryBox struct {
	DataReferenceIndex uint16
	Width              uint16
	Height             uint16
	Horizresolution    uint32
	Vertresolution     uint32
	FrameCount         uint16
	CompressorName     string
	Btrt               *BtrtBox
	Clap               *ClapBox
	Pasp               *PaspBox
	Sinf               *SinfBox
	Children           []Box
	// contains filtered or unexported fields
}

VisualSampleEntryBox - Video Sample Description box (avc1/avc3)

func (*VisualSampleEntryBox) Encode

func (b *VisualSampleEntryBox) Encode(w io.Writer) error

Encode - write box to w

func (*VisualSampleEntryBox) SetType

func (b *VisualSampleEntryBox) SetType(name string)

SetType - set the type (name) of the box

func (*VisualSampleEntryBox) Size

func (b *VisualSampleEntryBox) Size() uint64

Size - return calculated size

func (*VisualSampleEntryBox) Type

func (b *VisualSampleEntryBox) Type() string

Type - return box type

type VmhdBox

type VmhdBox struct {
	Version      byte
	Flags        uint32
	GraphicsMode uint16
	OpColor      [3]uint16
}

VmhdBox - Video Media Header Box (vhmd - mandatory for video tracks)

Contained in : Media Information Box (minf)

Jump to

Keyboard shortcuts

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