Documentation ¶
Index ¶
- Constants
- Variables
- func AddAnyTypeBoxDef(payload IAnyType, boxType BoxType, versions ...uint8)
- func AddBoxDef(payload IBox, versions ...uint8)
- func Marshal(w io.Writer, src IImmutableBox) (n uint64, err error)
- func ReadBoxStructure(r io.ReadSeeker, handler ReadHandler, params ...interface{}) ([]interface{}, error)
- func ReadBoxStructureFromInternal(r io.ReadSeeker, bi *BoxInfo, handler ReadHandler, params ...interface{}) (interface{}, error)
- func Stringify(src IImmutableBox) (string, error)
- func StringifyWithIndent(src IImmutableBox, indent string) (string, error)
- func Unmarshal(r io.ReadSeeker, payloadSize uint64, dst IBox) (n uint64, err error)
- type AVCDecoderConfiguration
- func (avcc *AVCDecoderConfiguration) GetFieldLength(name string) uint
- func (avcc *AVCDecoderConfiguration) IsOptFieldEnabled(name string) bool
- func (avcc *AVCDecoderConfiguration) OnReadField(name string, r bitio.ReadSeeker, leftBits uint64) (rbits uint64, override bool, err error)
- func (avcc *AVCDecoderConfiguration) OnWriteField(name string, w bitio.Writer) (wbits uint64, override bool, err error)
- type AVCParameterSet
- type AlternativeStartupEntry
- type AlternativeStartupEntryL
- type AlternativeStartupEntryOpt
- type AnyTypeBox
- type AudioSampleEntry
- type BaseCustomFieldObject
- func (*BaseCustomFieldObject) BeforeUnmarshal(io.ReadSeeker, uint64) (uint64, bool, error)
- func (box *BaseCustomFieldObject) GetFieldLength(string) uint
- func (box *BaseCustomFieldObject) GetFieldSize(string) uint
- func (box *BaseCustomFieldObject) IsOptFieldEnabled(string) bool
- func (*BaseCustomFieldObject) IsPString(name string, bytes []byte, remainingSize uint64) bool
- func (*BaseCustomFieldObject) OnReadField(string, bitio.ReadSeeker, uint64) (uint64, bool, error)
- func (*BaseCustomFieldObject) OnWriteField(string, bitio.Writer) (uint64, bool, error)
- func (box *BaseCustomFieldObject) StringifyField(string, string, int) (string, bool)
- type Box
- type BoxInfo
- type BoxInfoWithPayload
- type BoxPath
- type BoxType
- func BoxTypeAny() BoxType
- func BoxTypeCo64() BoxType
- func BoxTypeColr() BoxType
- func BoxTypeCtts() BoxType
- func BoxTypeDinf() BoxType
- func BoxTypeDref() BoxType
- func BoxTypeEdts() BoxType
- func BoxTypeElst() BoxType
- func BoxTypeEmsg() BoxType
- func BoxTypeEsds() BoxType
- func BoxTypeFree() BoxType
- func BoxTypeFtyp() BoxType
- func BoxTypeHdlr() BoxType
- func BoxTypeIlst() BoxType
- func BoxTypeMdat() BoxType
- func BoxTypeMdhd() BoxType
- func BoxTypeMdia() BoxType
- func BoxTypeMehd() BoxType
- func BoxTypeMeta() BoxType
- func BoxTypeMfhd() BoxType
- func BoxTypeMfra() BoxType
- func BoxTypeMfro() BoxType
- func BoxTypeMinf() BoxType
- func BoxTypeMoof() BoxType
- func BoxTypeMoov() BoxType
- func BoxTypeMvex() BoxType
- func BoxTypeMvhd() BoxType
- func BoxTypePssh() BoxType
- func BoxTypeSbgp() BoxType
- func BoxTypeSchi() BoxType
- func BoxTypeSgpd() BoxType
- func BoxTypeSidx() BoxType
- func BoxTypeSinf() BoxType
- func BoxTypeSkip() BoxType
- func BoxTypeSmhd() BoxType
- func BoxTypeStbl() BoxType
- func BoxTypeStco() BoxType
- func BoxTypeStsc() BoxType
- func BoxTypeStsd() BoxType
- func BoxTypeStss() BoxType
- func BoxTypeStsz() BoxType
- func BoxTypeStts() BoxType
- func BoxTypeStyp() BoxType
- func BoxTypeTfdt() BoxType
- func BoxTypeTfhd() BoxType
- func BoxTypeTfra() BoxType
- func BoxTypeTkhd() BoxType
- func BoxTypeTraf() BoxType
- func BoxTypeTrak() BoxType
- func BoxTypeTrex() BoxType
- func BoxTypeTrun() BoxType
- func BoxTypeUdta() BoxType
- func BoxTypeUrl() BoxType
- func BoxTypeUrn() BoxType
- func BoxTypeVmhd() BoxType
- func StrToBoxType(code string) BoxType
- type Co64
- type Colr
- type CompatibleBrandElem
- type Ctts
- type CttsEntry
- type DecoderConfigDescriptor
- type Descriptor
- type Dinf
- type Dref
- type ESDescriptor
- type Edts
- type Elst
- type ElstEntry
- type Emsg
- type Esds
- type FraProbeInfo
- type Free
- type FreeSpace
- type Ftyp
- type FullBox
- type Hdlr
- type IAnyType
- type IBox
- type ICustomFieldObject
- type IImmutableBox
- type Ilst
- type Mdat
- type Mdhd
- type Mdia
- type Mehd
- type Meta
- type Mfhd
- type Mfra
- type Mfro
- type Minf
- type Moof
- type Moov
- type Mvex
- type Mvhd
- type PixelAspectRatioBox
- type Pssh
- type PsshKID
- type ReadHandle
- type ReadHandler
- type RollDistanceWithLength
- type SampleEntry
- type Sbgp
- type SbgpEntry
- type Schi
- type SegmentInfo
- type Sgpd
- type Sidx
- type SidxReference
- type Sinf
- type Skip
- type Smhd
- type Stbl
- type Stco
- type StringType
- type Stsc
- type StscEntry
- type Stsd
- type Stss
- type Stsz
- type Stts
- type SttsEntry
- type Styp
- type TemporalLevelEntry
- type TemporalLevelEntryL
- type Tfdt
- type Tfhd
- type Tfra
- type TfraEntry
- type Tkhd
- type TrackInfo
- type Traf
- type Trak
- type Trex
- type Trun
- type TrunEntry
- type Udta
- type Url
- type Urn
- type VisualRandomAccessEntry
- type VisualRandomAccessEntryL
- type VisualSampleEntry
- type Vmhd
Constants ¶
const ( SmallHeaderSize = 8 LargeHeaderSize = 16 )
const ( ESDescrTag = 0x03 DecoderConfigDescrTag = 0x04 DecSpecificInfoTag = 0x05 SLConfigDescrTag = 0x06 )
const ( AVCBaselineProfile uint8 = 66 // 0x42 AVCMainProfile uint8 = 77 // 0x4d AVCExtendedProfile uint8 = 88 // 0x58 AVCHighProfile uint8 = 100 // 0x64 AVCHigh10Profile uint8 = 110 // 0x6e AVCHigh422Profile uint8 = 122 // 0x7a )
const ( TfhdBaseDataOffsetPresent = 0x000001 TfhdSampleDescriptionIndexPresent = 0x000002 TfhdDefaultSampleDurationPresent = 0x000008 TfhdDefaultSampleSizePresent = 0x000010 TfhdDefaultSampleFlagsPresent = 0x000020 TfhdDurationIsEmpty = 0x010000 TfhdDefaultBaseIsMoof = 0x020000 )
const UrlSelfContained = 0x000001
const UrnSelfContained = 0x000001
Variables ¶
var ErrBoxInfoNotFound = errors.New("box info not found")
var ErrUnsupportedBoxVersion = errors.New("unsupported box version")
Functions ¶
func AddAnyTypeBoxDef ¶
func ReadBoxStructure ¶
func ReadBoxStructure(r io.ReadSeeker, handler ReadHandler, params ...interface{}) ([]interface{}, error)
func ReadBoxStructureFromInternal ¶
func ReadBoxStructureFromInternal(r io.ReadSeeker, bi *BoxInfo, handler ReadHandler, params ...interface{}) (interface{}, error)
func Stringify ¶
func Stringify(src IImmutableBox) (string, error)
func StringifyWithIndent ¶
func StringifyWithIndent(src IImmutableBox, indent string) (string, error)
Types ¶
type AVCDecoderConfiguration ¶
type AVCDecoderConfiguration struct { AnyTypeBox ConfigurationVersion uint8 `mp4:"size=8"` Profile uint8 `mp4:"size=8"` ProfileCompatibility uint8 `mp4:"size=8"` Level uint8 `mp4:"size=8"` Reserved uint8 `mp4:"size=6,const=63"` LengthSizeMinusOne uint8 `mp4:"size=2"` Reserved2 uint8 `mp4:"size=3,const=7"` NumOfSequenceParameterSets uint8 `mp4:"size=5"` SequenceParameterSets []AVCParameterSet `mp4:"len=dynamic"` NumOfPictureParameterSets uint8 `mp4:"size=8"` PictureParameterSets []AVCParameterSet `mp4:"len=dynamic"` HighProfileFieldsEnabled bool `mp4:"hidden"` Reserved3 uint8 `mp4:"size=6,opt=dynamic,const=63"` ChromaFormat uint8 `mp4:"size=2,opt=dynamic"` Reserved4 uint8 `mp4:"size=5,opt=dynamic,const=31"` BitDepthLumaMinus8 uint8 `mp4:"size=3,opt=dynamic"` Reserved5 uint8 `mp4:"size=5,opt=dynamic,const=31"` BitDepthChromaMinus8 uint8 `mp4:"size=3,opt=dynamic"` NumOfSequenceParameterSetExt uint8 `mp4:"size=8,opt=dynamic"` SequenceParameterSetsExt []AVCParameterSet `mp4:"len=dynamic,opt=dynamic"` }
func (*AVCDecoderConfiguration) GetFieldLength ¶ added in v0.3.0
func (avcc *AVCDecoderConfiguration) GetFieldLength(name string) uint
func (*AVCDecoderConfiguration) IsOptFieldEnabled ¶ added in v0.3.0
func (avcc *AVCDecoderConfiguration) IsOptFieldEnabled(name string) bool
func (*AVCDecoderConfiguration) OnReadField ¶ added in v0.3.0
func (avcc *AVCDecoderConfiguration) OnReadField(name string, r bitio.ReadSeeker, leftBits uint64) (rbits uint64, override bool, err error)
func (*AVCDecoderConfiguration) OnWriteField ¶ added in v0.3.0
type AVCParameterSet ¶ added in v0.3.0
type AVCParameterSet struct { BaseCustomFieldObject Length uint16 `mp4:"size=16"` NALUnit []byte `mp4:"size=8,len=dynamic"` }
func (*AVCParameterSet) GetFieldLength ¶ added in v0.3.0
func (s *AVCParameterSet) GetFieldLength(name string) uint
type AlternativeStartupEntry ¶ added in v0.3.0
type AlternativeStartupEntry struct { BaseCustomFieldObject RollCount uint16 `mp4:"size=16"` FirstOutputSample uint16 `mp4:"size=16"` SampleOffset []uint32 `mp4:"size=32,len=dynamic"` Opts []AlternativeStartupEntryOpt `mp4:"size=32"` }
func (*AlternativeStartupEntry) GetFieldLength ¶ added in v0.3.0
func (entry *AlternativeStartupEntry) GetFieldLength(name string) uint
type AlternativeStartupEntryL ¶ added in v0.3.0
type AlternativeStartupEntryL struct { DescriptionLength uint32 `mp4:"size=32"` AlternativeStartupEntry `mp4:"extend,size=dynamic"` }
func (*AlternativeStartupEntryL) GetFieldSize ¶ added in v0.3.0
func (entry *AlternativeStartupEntryL) GetFieldSize(name string) uint
type AlternativeStartupEntryOpt ¶ added in v0.3.0
type AnyTypeBox ¶
func (*AnyTypeBox) GetType ¶
func (e *AnyTypeBox) GetType() BoxType
func (*AnyTypeBox) SetType ¶
func (e *AnyTypeBox) SetType(boxType BoxType)
type AudioSampleEntry ¶
type AudioSampleEntry struct { SampleEntry `mp4:"extend"` EntryVersion uint16 `mp4:"size=16"` Reserved [3]uint16 `mp4:"size=16,const=0"` ChannelCount uint16 `mp4:"size=16"` SampleSize uint16 `mp4:"size=16"` PreDefined uint16 `mp4:"size=16"` Reserved2 uint16 `mp4:"size=16,const=0"` SampleRate uint32 `mp4:"size=32"` }
type BaseCustomFieldObject ¶
type BaseCustomFieldObject struct { }
func (*BaseCustomFieldObject) BeforeUnmarshal ¶
func (*BaseCustomFieldObject) BeforeUnmarshal(io.ReadSeeker, uint64) (uint64, bool, error)
func (*BaseCustomFieldObject) GetFieldLength ¶
func (box *BaseCustomFieldObject) GetFieldLength(string) uint
GetFieldLength returns length of dynamic field
func (*BaseCustomFieldObject) GetFieldSize ¶
func (box *BaseCustomFieldObject) GetFieldSize(string) uint
GetFieldSize returns size of dynamic field
func (*BaseCustomFieldObject) IsOptFieldEnabled ¶
func (box *BaseCustomFieldObject) IsOptFieldEnabled(string) bool
IsOptFieldEnabled check whether if the optional field is enabled
func (*BaseCustomFieldObject) IsPString ¶
func (*BaseCustomFieldObject) IsPString(name string, bytes []byte, remainingSize uint64) bool
func (*BaseCustomFieldObject) OnReadField ¶ added in v0.3.0
func (*BaseCustomFieldObject) OnReadField(string, bitio.ReadSeeker, uint64) (uint64, bool, error)
func (*BaseCustomFieldObject) OnWriteField ¶ added in v0.3.0
func (*BaseCustomFieldObject) StringifyField ¶
StringifyField returns field value as string
type Box ¶
type Box struct {
BaseCustomFieldObject
}
type BoxInfo ¶
type BoxInfo struct { // Offset specifies an offset of the box in a file. Offset uint64 // Size specifies size(bytes) of box. Size uint64 // HeaderSize specifies size(bytes) of common fields which are defined as "Box" class member at ISO/IEC 14496-12. HeaderSize uint64 // Type specifies box type which is represented by 4 characters. Type BoxType // ExtendToEOF is set true when Box.size is zero. It means that end of box equals to end of file. ExtendToEOF bool }
BoxInfo has common infomations of box
func ExtractBox ¶
func ExtractBoxes ¶
func ReadBoxInfo ¶
func ReadBoxInfo(r io.ReadSeeker) (*BoxInfo, error)
ReadBoxInfo reads common fields which are defined as "Box" class member at ISO/IEC 14496-12.
func WriteBoxInfo ¶
func WriteBoxInfo(w io.WriteSeeker, bi *BoxInfo) (*BoxInfo, error)
WriteBoxInfo writes common fields which are defined as "Box" class member at ISO/IEC 14496-12. This function ignores bi.Offset and returns BoxInfo which contains real Offset and recalculated Size/HeaderSize.
type BoxInfoWithPayload ¶
func ExtractBoxWithPayload ¶
func ExtractBoxWithPayload(r io.ReadSeeker, parent *BoxInfo, path BoxPath) ([]*BoxInfoWithPayload, error)
func ExtractBoxesWithPayload ¶
func ExtractBoxesWithPayload(r io.ReadSeeker, parent *BoxInfo, paths []BoxPath) ([]*BoxInfoWithPayload, error)
type BoxType ¶
type BoxType [4]byte
BoxType is mpeg box type
func BoxTypeAny ¶ added in v0.2.0
func BoxTypeAny() BoxType
func BoxTypeCo64 ¶ added in v0.3.0
func BoxTypeCo64() BoxType
func BoxTypeColr ¶ added in v0.3.0
func BoxTypeColr() BoxType
func BoxTypeCtts ¶
func BoxTypeCtts() BoxType
func BoxTypeDinf ¶
func BoxTypeDinf() BoxType
func BoxTypeDref ¶
func BoxTypeDref() BoxType
func BoxTypeEdts ¶
func BoxTypeEdts() BoxType
func BoxTypeElst ¶
func BoxTypeElst() BoxType
func BoxTypeEmsg ¶
func BoxTypeEmsg() BoxType
func BoxTypeEsds ¶
func BoxTypeEsds() BoxType
func BoxTypeFree ¶
func BoxTypeFree() BoxType
func BoxTypeFtyp ¶
func BoxTypeFtyp() BoxType
func BoxTypeHdlr ¶
func BoxTypeHdlr() BoxType
func BoxTypeIlst ¶ added in v0.3.0
func BoxTypeIlst() BoxType
func BoxTypeMdat ¶
func BoxTypeMdat() BoxType
func BoxTypeMdhd ¶
func BoxTypeMdhd() BoxType
func BoxTypeMdia ¶
func BoxTypeMdia() BoxType
func BoxTypeMehd ¶
func BoxTypeMehd() BoxType
func BoxTypeMeta ¶
func BoxTypeMeta() BoxType
func BoxTypeMfhd ¶
func BoxTypeMfhd() BoxType
func BoxTypeMfra ¶
func BoxTypeMfra() BoxType
func BoxTypeMfro ¶
func BoxTypeMfro() BoxType
func BoxTypeMinf ¶
func BoxTypeMinf() BoxType
func BoxTypeMoof ¶
func BoxTypeMoof() BoxType
func BoxTypeMoov ¶
func BoxTypeMoov() BoxType
func BoxTypeMvex ¶
func BoxTypeMvex() BoxType
func BoxTypeMvhd ¶
func BoxTypeMvhd() BoxType
func BoxTypePssh ¶
func BoxTypePssh() BoxType
func BoxTypeSbgp ¶
func BoxTypeSbgp() BoxType
func BoxTypeSchi ¶ added in v0.3.0
func BoxTypeSchi() BoxType
func BoxTypeSgpd ¶
func BoxTypeSgpd() BoxType
func BoxTypeSidx ¶ added in v0.2.0
func BoxTypeSidx() BoxType
func BoxTypeSinf ¶ added in v0.3.0
func BoxTypeSinf() BoxType
func BoxTypeSkip ¶
func BoxTypeSkip() BoxType
func BoxTypeSmhd ¶
func BoxTypeSmhd() BoxType
func BoxTypeStbl ¶
func BoxTypeStbl() BoxType
func BoxTypeStco ¶
func BoxTypeStco() BoxType
func BoxTypeStsc ¶
func BoxTypeStsc() BoxType
func BoxTypeStsd ¶
func BoxTypeStsd() BoxType
func BoxTypeStss ¶
func BoxTypeStss() BoxType
func BoxTypeStsz ¶
func BoxTypeStsz() BoxType
func BoxTypeStts ¶
func BoxTypeStts() BoxType
func BoxTypeStyp ¶ added in v0.2.0
func BoxTypeStyp() BoxType
func BoxTypeTfdt ¶
func BoxTypeTfdt() BoxType
func BoxTypeTfhd ¶
func BoxTypeTfhd() BoxType
func BoxTypeTfra ¶
func BoxTypeTfra() BoxType
func BoxTypeTkhd ¶
func BoxTypeTkhd() BoxType
func BoxTypeTraf ¶
func BoxTypeTraf() BoxType
func BoxTypeTrak ¶
func BoxTypeTrak() BoxType
func BoxTypeTrex ¶
func BoxTypeTrex() BoxType
func BoxTypeTrun ¶
func BoxTypeTrun() BoxType
func BoxTypeUdta ¶
func BoxTypeUdta() BoxType
func BoxTypeUrl ¶
func BoxTypeUrl() BoxType
func BoxTypeUrn ¶
func BoxTypeUrn() BoxType
func BoxTypeVmhd ¶
func BoxTypeVmhd() BoxType
func StrToBoxType ¶
func (BoxType) GetSupportedVersions ¶
func (BoxType) IsSupported ¶
func (BoxType) IsSupportedVersion ¶
type Co64 ¶ added in v0.3.0
type Co64 struct { FullBox `mp4:"extend"` EntryCount uint32 `mp4:"size=32"` ChunkOffset []uint64 `mp4:"size=64,len=dynamic"` }
func (*Co64) GetFieldLength ¶ added in v0.3.0
GetFieldLength returns length of dynamic field
type Colr ¶ added in v0.3.0
type Colr struct { Box ColourType [4]byte `mp4:"size=8,string"` ColourPrimaries uint16 `mp4:"size=16,opt=dynamic"` TransferCharacteristics uint16 `mp4:"size=16,opt=dynamic"` MatrixCoefficients uint16 `mp4:"size=16,opt=dynamic"` FullRangeFlag bool `mp4:"size=1,opt=dynamic"` Reserved uint8 `mp4:"size=7,opt=dynamic"` Profile []byte `mp4:"size=8,opt=dynamic"` }
func (*Colr) IsOptFieldEnabled ¶ added in v0.3.0
type CompatibleBrandElem ¶
type CompatibleBrandElem struct {
CompatibleBrand [4]byte `mp4:"size=8,string"`
}
type Ctts ¶
type Ctts struct { FullBox `mp4:"extend"` EntryCount uint32 `mp4:"size=32"` Entries []CttsEntry `mp4:"len=dynamic,size=64"` }
func (*Ctts) GetFieldLength ¶
GetFieldLength returns length of dynamic field
type DecoderConfigDescriptor ¶
type Descriptor ¶
type Descriptor struct { BaseCustomFieldObject Tag int8 `mp4:"size=8"` // must be 0x03 Size uint32 `mp4:"varint"` ESDescriptor *ESDescriptor `mp4:"extend,opt=dynamic"` DecoderConfigDescriptor *DecoderConfigDescriptor `mp4:"extend,opt=dynamic"` Data []byte `mp4:"size=8,opt=dynamic,len=dynamic"` }
func (*Descriptor) GetFieldLength ¶
func (ds *Descriptor) GetFieldLength(name string) uint
GetFieldLength returns length of dynamic field
func (*Descriptor) IsOptFieldEnabled ¶
func (ds *Descriptor) IsOptFieldEnabled(name string) bool
func (*Descriptor) StringifyField ¶
StringifyField returns field value as string
type ESDescriptor ¶
type ESDescriptor struct { BaseCustomFieldObject ESID uint16 `mp4:"size=16"` StreamDependenceFlag bool `mp4:"size=1"` UrlFlag bool `mp4:"size=1"` OcrStreamFlag bool `mp4:"size=1"` StreamPriority int8 `mp4:"size=5"` DependsOnESID uint16 `mp4:"size=16,opt=dynamic"` URLLength uint8 `mp4:"size=8,opt=dynamic"` URLString []byte `mp4:"size=8,len=dynamic,opt=dynamic,string"` OCRESID uint16 `mp4:"size=16,opt=dynamic"` }
func (*ESDescriptor) GetFieldLength ¶
func (esds *ESDescriptor) GetFieldLength(name string) uint
func (*ESDescriptor) IsOptFieldEnabled ¶
func (esds *ESDescriptor) IsOptFieldEnabled(name string) bool
type Elst ¶
type Elst struct { FullBox `mp4:"extend"` EntryCount uint32 `mp4:"size=32"` Entries []ElstEntry `mp4:"len=dynamic,size=dynamic"` }
Elst is ISOBMFF elst box type
func (*Elst) GetFieldLength ¶
GetFieldLength returns length of dynamic field
func (*Elst) GetFieldSize ¶
GetFieldSize returns size of dynamic field
type Emsg ¶
type Emsg struct { FullBox `mp4:"extend"` SchemeIdUri string `mp4:"string"` Value string `mp4:"string"` Timescale uint32 `mp4:"size=32"` PresentationTimeDelta uint32 `mp4:"size=32,ver=0"` PresentationTime uint64 `mp4:"size=64,ver=1"` EventDuration uint32 `mp4:"size=32"` Id uint32 `mp4:"size=32"` MessageData []byte `mp4:"size=8,string"` }
Emsg is ISOBMFF emsg box type
func (*Emsg) OnReadField ¶ added in v0.3.0
type Esds ¶
type Esds struct { FullBox `mp4:"extend"` Descriptors []Descriptor `mp4:"array"` }
Esds is ES descripter box
type FraProbeInfo ¶
type FraProbeInfo struct { Tracks []TrackInfo Segments []SegmentInfo }
func ProbeFra ¶
func ProbeFra(r io.ReadSeeker) (FraProbeInfo, error)
ProbeFra probes fragmented MP4 file
type Ftyp ¶
type Ftyp struct { Box MajorBrand [4]byte `mp4:"size=8,string"` MinorVersion uint32 `mp4:"size=32"` CompatibleBrands []CompatibleBrandElem `mp4:"size=32"` // reach to end of the box }
Ftyp is ISOBMFF ftyp box type
type FullBox ¶
type FullBox struct { BaseCustomFieldObject Version uint8 `mp4:"size=8"` Flags [3]byte `mp4:"size=8"` }
FullBox is ISOBMFF FullBox
func (*FullBox) GetVersion ¶
GetVersion returns the box version
func (*FullBox) RemoveFlag ¶
RemoveFlag removes the flag
func (*FullBox) SetVersion ¶
SetVersion sets the box version
type Hdlr ¶
type Hdlr struct { FullBox `mp4:"extend"` // Predefined corresponds to component_type of QuickTime. // pre_defined of ISO-14496 has always zero, // however component_type has "mhlr" or "dhlr". PreDefined uint32 `mp4:"size=32"` HandlerType [4]byte `mp4:"size=8,string"` Reserved [3]uint32 `mp4:"size=32,const=0"` Name string `mp4:"string=c_p"` Padding []byte `mp4:"size=8,const=0"` }
Hdlr is ISOBMFF hdlr box type
type IBox ¶
type IBox interface { IImmutableBox // SetVersion sets the box version SetVersion(uint8) // SetFlags sets the flags SetFlags(uint32) // AddFlag adds the flag AddFlag(uint32) // RemoveFlag removes the flag RemoveFlag(uint32) }
IBox is common interface of box
func UnmarshalAny ¶
type ICustomFieldObject ¶
type ICustomFieldObject interface { // GetFieldSize returns size of dynamic field GetFieldSize(string) uint // GetFieldLength returns length of dynamic field GetFieldLength(string) uint // IsOptFieldEnabled check whether if the optional field is enabled IsOptFieldEnabled(string) bool // StringifyField returns field value as string StringifyField(string, string, int) (string, bool) IsPString(name string, bytes []byte, remainingSize uint64) bool BeforeUnmarshal(r io.ReadSeeker, size uint64) (n uint64, override bool, err error) OnReadField(name string, r bitio.ReadSeeker, leftBits uint64) (rbits uint64, override bool, err error) OnWriteField(name string, w bitio.Writer) (wbits uint64, override bool, err error) }
type IImmutableBox ¶
type IImmutableBox interface { ICustomFieldObject // GetVersion returns the box version GetVersion() uint8 // GetFlags returns the flags GetFlags() uint32 // CheckFlag checks the flag status CheckFlag(uint32) bool // GetType returns the BoxType GetType() BoxType }
IImmutableBox is common interface of box
type Mdhd ¶
type Mdhd struct { FullBox `mp4:"extend"` CreationTimeV0 uint32 `mp4:"size=32,ver=0"` ModificationTimeV0 uint32 `mp4:"size=32,ver=0"` CreationTimeV1 uint64 `mp4:"size=64,ver=1"` ModificationTimeV1 uint64 `mp4:"size=64,ver=1"` Timescale uint32 `mp4:"size=32"` DurationV0 uint32 `mp4:"size=32,ver=0"` DurationV1 uint64 `mp4:"size=64,ver=1"` // Pad bool `mp4:"size=1"` Language [3]byte `mp4:"size=5,iso639-2"` // ISO-639-2/T language code PreDefined uint16 `mp4:"size=16"` }
Mdhd is ISOBMFF mdhd box type
type Mehd ¶
type Mehd struct { FullBox `mp4:"extend"` FragmentDurationV0 uint32 `mp4:"size=32,ver=0"` FragmentDurationV1 uint64 `mp4:"size=64,ver=1"` }
Mehd is ISOBMFF mehd box type
type Meta ¶
type Meta struct {
FullBox `mp4:"extend"`
}
Meta is ISOBMFF meta box type
func (*Meta) BeforeUnmarshal ¶
type Mvhd ¶
type Mvhd struct { FullBox `mp4:"extend"` CreationTimeV0 uint32 `mp4:"size=32,ver=0"` ModificationTimeV0 uint32 `mp4:"size=32,ver=0"` CreationTimeV1 uint64 `mp4:"size=64,ver=1"` ModificationTimeV1 uint64 `mp4:"size=64,ver=1"` Timescale uint32 `mp4:"size=32"` DurationV0 uint32 `mp4:"size=32,ver=0"` DurationV1 uint64 `mp4:"size=64,ver=1"` Rate int32 `mp4:"size=32"` // fixed-point 16.16 - template=0x00010000 Volume int16 `mp4:"size=16"` // template=0x0100 Reserved int16 `mp4:"size=16,const=0"` Reserved2 [2]uint32 `mp4:"size=32,const=0"` Matrix [9]int32 `mp4:"size=32,hex"` // template={ 0x00010000,0,0,0,0x00010000,0,0,0,0x40000000 } PreDefined [6]int32 `mp4:"size=32"` NextTrackID uint32 `mp4:"size=32"` }
Mvhd is ISOBMFF mvhd box type
func (*Mvhd) GetRateInt ¶ added in v0.3.0
GetRateInt returns value of rate as int16
type PixelAspectRatioBox ¶
type PixelAspectRatioBox struct { AnyTypeBox HSpacing uint32 `mp4:"size=32"` VSpacing uint32 `mp4:"size=32"` }
type Pssh ¶
type Pssh struct { FullBox `mp4:"extend"` SystemID [16]byte `mp4:"size=8"` KIDCount uint32 `mp4:"size=32,nver=0"` KIDs []PsshKID `mp4:"nver=0,len=dynamic,size=128"` DataSize int32 `mp4:"size=32"` Data []byte `mp4:"size=8,len=dynamic"` }
Pssh is ISOBMFF pssh box type
func (*Pssh) GetFieldLength ¶
GetFieldLength returns length of dynamic field
type ReadHandle ¶
type ReadHandler ¶
type ReadHandler func(handle *ReadHandle) (val interface{}, err error)
type RollDistanceWithLength ¶ added in v0.3.0
type SampleEntry ¶
type SampleEntry struct { AnyTypeBox Reserved [6]uint8 `mp4:"size=8,const=0"` DataReferenceIndex uint16 `mp4:"size=16"` }
type Sbgp ¶
type Sbgp struct { FullBox `mp4:"extend"` GroupingType uint32 `mp4:"size=32"` GroupingTypeParameter uint32 `mp4:"size=32,ver=1"` EntryCount uint32 `mp4:"size=32"` Entries []SbgpEntry `mp4:"len=dynamic,size=64"` }
func (*Sbgp) GetFieldLength ¶
type SegmentInfo ¶
type Sgpd ¶
type Sgpd struct { FullBox `mp4:"extend"` GroupingType [4]byte `mp4:"size=8,string"` DefaultLength uint32 `mp4:"size=32,ver=1"` DefaultSampleDescriptionIndex uint32 `mp4:"size=32,ver=2"` EntryCount uint32 `mp4:"size=32"` RollDistances []int16 `mp4:"size=16,opt=dynamic"` RollDistancesL []RollDistanceWithLength `mp4:"size=16,opt=dynamic"` AlternativeStartupEntries []AlternativeStartupEntry `mp4:"size=dynamic,len=dynamic,opt=dynamic"` AlternativeStartupEntriesL []AlternativeStartupEntryL `mp4:"len=dynamic,opt=dynamic"` VisualRandomAccessEntries []VisualRandomAccessEntry `mp4:"len=dynamic,opt=dynamic"` VisualRandomAccessEntriesL []VisualRandomAccessEntryL `mp4:"len=dynamic,opt=dynamic"` TemporalLevelEntries []TemporalLevelEntry `mp4:"len=dynamic,opt=dynamic"` TemporalLevelEntriesL []TemporalLevelEntryL `mp4:"len=dynamic,opt=dynamic"` Unsupported []byte `mp4:"size=8,opt=dynamic"` }
func (*Sgpd) GetFieldLength ¶ added in v0.3.0
func (*Sgpd) GetFieldSize ¶
func (*Sgpd) IsOptFieldEnabled ¶
type Sidx ¶ added in v0.2.0
type Sidx struct { FullBox `mp4:"extend"` ReferenceID uint32 `mp4:"size=32"` Timescale uint32 `mp4:"size=32"` EarliestPresentationTimeV0 uint32 `mp4:"size=32,ver=0"` FirstOffsetV0 uint32 `mp4:"size=32,ver=0"` EarliestPresentationTimeV1 uint64 `mp4:"size=64,nver=0"` FirstOffsetV1 uint64 `mp4:"size=64,nver=0"` Reserved uint16 `mp4:"size=16,const=0"` ReferenceCount uint16 `mp4:"size=16"` References []SidxReference `mp4:"size=96,len=dynamic"` }
func (*Sidx) GetFieldLength ¶ added in v0.2.0
type SidxReference ¶ added in v0.2.0
type Smhd ¶
type Smhd struct { FullBox `mp4:"extend"` Balance int16 `mp4:"size=16"` // fixed-point 8.8 template=0 Reserved uint16 `mp4:"size=16,const=0"` }
func (*Smhd) GetBalance ¶ added in v0.3.0
GetBalance returns value of width as float32
func (*Smhd) GetBalanceInt ¶ added in v0.3.0
GetBalanceInt returns value of width as int8
type Stco ¶
type Stco struct { FullBox `mp4:"extend"` EntryCount uint32 `mp4:"size=32"` ChunkOffset []uint32 `mp4:"size=32,len=dynamic"` }
Stco is ISOBMFF stco box type
func (*Stco) GetFieldLength ¶
GetFieldLength returns length of dynamic field
type Stsc ¶
type Stsc struct { FullBox `mp4:"extend"` EntryCount uint32 `mp4:"size=32"` Entries []StscEntry `mp4:"len=dynamic,size=96"` }
Stsc is ISOBMFF stsc box type
func (*Stsc) GetFieldLength ¶
GetFieldLength returns length of dynamic field
type Stss ¶
type Stss struct { FullBox `mp4:"extend"` EntryCount uint32 `mp4:"size=32"` SampleNumber []uint32 `mp4:"len=dynamic,size=32"` }
func (*Stss) GetFieldLength ¶
GetFieldLength returns length of dynamic field
type Stsz ¶
type Stsz struct { FullBox `mp4:"extend"` SampleSize uint32 `mp4:"size=32"` SampleCount uint32 `mp4:"size=32"` EntrySize []uint32 `mp4:"size=32,len=dynamic"` }
Stsz is ISOBMFF stsz box type
func (*Stsz) GetFieldLength ¶
GetFieldLength returns length of dynamic field
type Stts ¶
type Stts struct { FullBox `mp4:"extend"` EntryCount uint32 `mp4:"size=32"` Entries []SttsEntry `mp4:"len=dynamic,size=64"` }
Stts is ISOBMFF stts box type
func (*Stts) GetFieldLength ¶
GetFieldLength returns length of dynamic field
type Styp ¶ added in v0.2.0
type Styp struct { Box MajorBrand [4]byte `mp4:"size=8,string"` MinorVersion uint32 `mp4:"size=32"` CompatibleBrands []CompatibleBrandElem `mp4:"size=32"` // reach to end of the box }
type TemporalLevelEntry ¶
type TemporalLevelEntryL ¶ added in v0.3.0
type TemporalLevelEntryL struct { DescriptionLength uint32 `mp4:"size=32"` TemporalLevelEntry `mp4:"extend"` }
type Tfdt ¶
type Tfdt struct { FullBox `mp4:"extend"` BaseMediaDecodeTimeV0 uint32 `mp4:"size=32,ver=0"` BaseMediaDecodeTimeV1 uint64 `mp4:"size=64,ver=1"` }
Tfdt is ISOBMFF tfdt box type
type Tfhd ¶
type Tfhd struct { FullBox `mp4:"extend"` TrackID uint32 `mp4:"size=32"` // optional BaseDataOffset uint64 `mp4:"size=64,opt=0x000001"` SampleDescriptionIndex uint32 `mp4:"size=32,opt=0x000002"` DefaultSampleDuration uint32 `mp4:"size=32,opt=0x000008"` DefaultSampleSize uint32 `mp4:"size=32,opt=0x000010"` DefaultSampleFlags uint32 `mp4:"size=32,opt=0x000020,hex"` }
Tfhd is ISOBMFF tfhd box type
type Tfra ¶
type Tfra struct { FullBox `mp4:"extend"` TrackID uint32 `mp4:"size=32"` Reserved uint32 `mp4:"size=26,const=0"` LengthSizeOfTrafNum byte `mp4:"size=2"` LengthSizeOfTrunNum byte `mp4:"size=2"` LengthSizeOfSampleNum byte `mp4:"size=2"` NumberOfEntry uint32 `mp4:"size=32"` Entries []TfraEntry `mp4:"len=dynamic,size=dynamic"` }
Tfra is ISOBMFF tfra box type
func (*Tfra) GetFieldLength ¶
GetFieldLength returns length of dynamic field
func (*Tfra) GetFieldSize ¶
GetFieldSize returns size of dynamic field
type TfraEntry ¶
type TfraEntry struct { TimeV0 uint32 `mp4:"size=32,ver=0"` MoofOffsetV0 uint32 `mp4:"size=32,ver=0"` TimeV1 uint64 `mp4:"size=64,ver=1"` MoofOffsetV1 uint64 `mp4:"size=64,ver=1"` TrafNumber uint32 `mp4:"size=dynamic"` TrunNumber uint32 `mp4:"size=dynamic"` SampleNumber uint32 `mp4:"size=dynamic"` }
type Tkhd ¶
type Tkhd struct { FullBox `mp4:"extend"` // Version 0 CreationTimeV0 uint32 `mp4:"size=32,ver=0"` ModificationTimeV0 uint32 `mp4:"size=32,ver=0"` TrackIDV0 uint32 `mp4:"size=32,ver=0"` ReservedV0 uint32 `mp4:"size=32,ver=0,const=0"` DurationV0 uint32 `mp4:"size=32,ver=0"` // Version 1 CreationTimeV1 uint64 `mp4:"size=64,ver=1"` ModificationTimeV1 uint64 `mp4:"size=64,ver=1"` TrackIDV1 uint32 `mp4:"size=32,ver=1"` ReservedV1 uint32 `mp4:"size=32,ver=1,const=0"` DurationV1 uint64 `mp4:"size=64,ver=1"` // Reserved [2]uint32 `mp4:"size=32,const=0"` Layer int16 `mp4:"size=16"` // template=0 AlternateGroup int16 `mp4:"size=16"` // template=0 Volume int16 `mp4:"size=16"` // template={if track_is_audio 0x0100 else 0} Reserved2 uint16 `mp4:"size=16,const=0"` Matrix [9]int32 `mp4:"size=32,hex"` // template={ 0x00010000,0,0,0,0x00010000,0,0,0,0x40000000 }; Width uint32 `mp4:"size=32"` // fixed-point 16.16 Height uint32 `mp4:"size=32"` // fixed-point 16.16 }
Tkhd is ISOBMFF tkhd box type
func (*Tkhd) GetHeightInt ¶ added in v0.3.0
GetHeightInt returns value of height as uint16
func (*Tkhd) GetWidthInt ¶ added in v0.3.0
GetWidthInt returns value of width as uint16
type Trex ¶
type Trex struct { FullBox `mp4:"extend"` TrackID uint32 `mp4:"size=32"` DefaultSampleDescriptionIndex uint32 `mp4:"size=32"` DefaultSampleDuration uint32 `mp4:"size=32"` DefaultSampleSize uint32 `mp4:"size=32"` DefaultSampleFlags uint32 `mp4:"size=32,hex"` }
Trex is ISOBMFF trex box type
type Trun ¶
type Trun struct { FullBox `mp4:"extend"` SampleCount uint32 `mp4:"size=32"` // optional fields DataOffset int32 `mp4:"size=32,opt=0x000001"` FirstSampleFlags uint32 `mp4:"size=32,opt=0x000004,hex"` Entries []TrunEntry `mp4:"len=dynamic,size=dynamic"` }
Trun is ISOBMFF trun box type
func (*Trun) GetFieldLength ¶
GetFieldLength returns length of dynamic field
func (*Trun) GetFieldSize ¶
GetFieldSize returns size of dynamic field
type TrunEntry ¶
type TrunEntry struct { SampleDuration uint32 `mp4:"size=32,opt=0x000100"` SampleSize uint32 `mp4:"size=32,opt=0x000200"` SampleFlags uint32 `mp4:"size=32,opt=0x000400,hex"` SampleCompositionTimeOffsetV0 uint32 `mp4:"size=32,opt=0x000800,ver=0"` SampleCompositionTimeOffsetV1 int32 `mp4:"size=32,opt=0x000800,nver=0"` }
type Urn ¶
type VisualRandomAccessEntry ¶
type VisualRandomAccessEntryL ¶ added in v0.3.0
type VisualRandomAccessEntryL struct { DescriptionLength uint32 `mp4:"size=32"` VisualRandomAccessEntry `mp4:"extend"` }
type VisualSampleEntry ¶
type VisualSampleEntry struct { SampleEntry `mp4:"extend"` PreDefined uint16 `mp4:"size=16"` Reserved uint16 `mp4:"size=16,const=0"` PreDefined2 [3]uint32 `mp4:"size=32"` Width uint16 `mp4:"size=16"` Height uint16 `mp4:"size=16"` Horizresolution uint32 `mp4:"size=32"` Vertresolution uint32 `mp4:"size=32"` Reserved2 uint32 `mp4:"size=32,const=0"` FrameCount uint16 `mp4:"size=16"` Compressorname [32]byte `mp4:"size=8"` Depth uint16 `mp4:"size=16"` PreDefined3 int16 `mp4:"size=16"` }
func (*VisualSampleEntry) StringifyField ¶
StringifyField returns field value as string