func DecryptSample(sample []byte, info *SampleEncryptionInfo, block cipher.Block)
--- Logic ---
--- Box ---
type Box struct { Moov *MoovBox Moof *MoofBox Mdat *MdatBox Sidx *SidxBox Pssh *PsshBox Raw []byte }
func Parse(data []byte) ([]Box, error)
func (b *Box) Encode() []byte
--- BoxHeader ---
type BoxHeader struct { Size uint32 Type [4]byte }
func (h *BoxHeader) Parse(data []byte) error
func (h *BoxHeader) Put(buffer []byte)
--- CO64 ---
type Co64Box struct { Header BoxHeader Offsets []uint64 }
func (b *Co64Box) Encode() []byte
type CttsBox struct { Header BoxHeader Entries []CttsEntry }
func (b *CttsBox) Encode() []byte
--- CTTS ---
type CttsEntry struct { SampleCount uint32 SampleOffset int32 }
--- ENC (Encrypted Sample Entry) ---
type EncBox struct { Header BoxHeader EntryHeader []byte Sinf *SinfBox RawChildren [][]byte }
func (b *EncBox) Encode() []byte
func (b *EncBox) Parse(data []byte) error
func (b *EncBox) Unprotect() error
--- FRMA ---
type FrmaBox struct { Header BoxHeader DataFormat [4]byte }
func (b *FrmaBox) Parse(data []byte) error
--- MDAT ---
type MdatBox struct { Header BoxHeader Payload []byte }
func (b *MdatBox) Parse(data []byte) error
--- MDHD ---
type MdhdBox struct { Header BoxHeader Version byte Flags [3]byte CreationTime uint64 ModificationTime uint64 Timescale uint32 Duration uint64 Language [2]byte Quality [2]byte }
func (b *MdhdBox) Encode() []byte
func (b *MdhdBox) Parse(data []byte) error
func (b *MdhdBox) SetDuration(duration uint64)
--- MDIA ---
type MdiaBox struct { Header BoxHeader Mdhd *MdhdBox Minf *MinfBox RawChildren [][]byte }
func (b *MdiaBox) Encode() []byte
func (b *MdiaBox) Parse(data []byte) error
--- MINF ---
type MinfBox struct { Header BoxHeader Stbl *StblBox RawChildren [][]byte }
func (b *MinfBox) Encode() []byte
func (b *MinfBox) Parse(data []byte) error
--- MOOF ---
type MoofBox struct { Header BoxHeader Traf *TrafBox Pssh []*PsshBox RawChildren [][]byte }
func (b *MoofBox) Parse(data []byte) error
--- MOOV ---
type MoovBox struct { Header BoxHeader Mvhd *MvhdBox Trak []*TrakBox Pssh []*PsshBox RawChildren [][]byte }
func FindMoov(boxes []Box) (*MoovBox, bool)
--- Finders ---
func (b *MoovBox) Encode() []byte
func (b *MoovBox) FindPssh(systemID []byte) (*PsshBox, bool)
func (b *MoovBox) IsAudio() bool
IsAudio checks the handler type within the first track to determine if it's audio.
func (b *MoovBox) Parse(data []byte) error
func (b *MoovBox) RemoveMvex()
func (b *MoovBox) RemovePssh()
--- MVHD ---
type MvhdBox struct { Header BoxHeader Version byte Flags [3]byte CreationTime uint64 ModificationTime uint64 Timescale uint32 Duration uint64 RemainingData []byte }
func (b *MvhdBox) Encode() []byte
func (b *MvhdBox) Parse(data []byte) error
func (b *MvhdBox) SetDuration(duration uint64)
--- PSSH ---
type PsshBox struct { Header BoxHeader Version byte Flags [3]byte SystemID [16]byte KIDs [][16]byte Data []byte }
func (b *PsshBox) Parse(data []byte) error
type RemuxSample struct { Size uint32 Duration uint32 IsSync bool CompositionTimeOffset int32 }
type Remuxer struct { Writer io.WriteSeeker Moov *MoovBox OnSample func(sample []byte, encInfo *SampleEncryptionInfo) // contains filtered or unexported fields }
func (r *Remuxer) AddSegment(segmentData []byte) error
func (r *Remuxer) Finish() error
func (r *Remuxer) Initialize(initSegment []byte) error
type SampleEncryptionInfo struct { IV []byte Subsamples []SubsampleInfo }
--- TRUN ---
type SampleInfo struct { Size uint32 Duration uint32 Flags uint32 CompositionTimeOffset int32 }
--- SCHI (Scheme Information) ---
type SchiBox struct { Header BoxHeader Tenc *TencBox RawChildren [][]byte }
func (b *SchiBox) Parse(data []byte) error
type SencBox struct { Header BoxHeader Flags uint32 Samples []SampleEncryptionInfo }
func (b *SencBox) Parse(data []byte) error
type SidxBox struct { Header BoxHeader Version byte Flags uint32 ReferenceID uint32 Timescale uint32 EarliestPresentationTime uint64 FirstOffset uint64 References []SidxReference }
func FindSidx(boxes []Box) (*SidxBox, bool)
func (b *SidxBox) Parse(data []byte) error
--- SIDX ---
type SidxReference struct { ReferenceType bool ReferencedSize uint32 SubsegmentDuration uint32 StartsWithSAP bool SAPType uint8 SAPDeltaTime uint32 }
--- SINF ---
type SinfBox struct { Header BoxHeader Frma *FrmaBox Schi *SchiBox RawChildren [][]byte }
func (b *SinfBox) Parse(data []byte) error
--- STBL ---
type StblBox struct { Header BoxHeader Stsd *StsdBox RawChildren [][]byte }
func (b *StblBox) Encode() []byte
func (b *StblBox) Parse(data []byte) error
--- STCO ---
type StcoBox struct { Header BoxHeader Offsets []uint32 }
func (b *StcoBox) Encode() []byte
type StscBox struct { Header BoxHeader Entries []StscEntry }
func (b *StscBox) Encode() []byte
--- STSC ---
type StscEntry struct { FirstChunk uint32 SamplesPerChunk uint32 SampleDescriptionIndex uint32 }
--- STSD ---
type StsdBox struct { Header BoxHeader HeaderFields [8]byte // Ver(1)+Flags(3)+EntryCount(4) EncChildren []*EncBox RawChildren [][]byte }
func (b *StsdBox) Encode() []byte
func (b *StsdBox) Parse(data []byte) error
func (b *StsdBox) Sinf() (*SinfBox, *BoxHeader, bool)
func (b *StsdBox) UnprotectAll() error
--- STSS ---
type StssBox struct { Header BoxHeader Indices []uint32 }
func (b *StssBox) Encode() []byte
--- STSZ ---
type StszBox struct { Header BoxHeader SampleSize uint32 SampleCount uint32 EntrySizes []uint32 }
func (b *StszBox) Encode() []byte
type SttsBox struct { Header BoxHeader Entries []SttsEntry }
func (b *SttsBox) Encode() []byte
--- STTS ---
type SttsEntry struct { SampleCount uint32 SampleDuration uint32 }
--- SENC ---
type SubsampleInfo struct { BytesOfClearData uint16 BytesOfProtectedData uint32 }
--- TENC --- TencBox defines the Track Encryption Box ('tenc'), which contains default encryption parameters for a track. Specification: ISO/IEC 23001-7
type TencBox struct { Header BoxHeader Version byte Flags uint32 DefaultIsProtected byte DefaultPerSampleIVSize byte DefaultKID [16]byte DefaultConstantIVSize byte // Present if DefaultIsProtected=1 and DefaultPerSampleIVSize=0 DefaultConstantIV []byte // Present if DefaultIsProtected=1 and DefaultPerSampleIVSize=0 }
func (b *TencBox) Parse(data []byte) error
--- TFHD ---
type TfhdBox struct { Header BoxHeader Flags uint32 TrackID uint32 BaseDataOffset uint64 SampleDescriptionIndex uint32 DefaultSampleDuration uint32 DefaultSampleSize uint32 DefaultSampleFlags uint32 }
func (b *TfhdBox) Parse(data []byte) error
--- TRAF ---
type TrafBox struct { Header BoxHeader Tfhd *TfhdBox Trun []*TrunBox Senc *SencBox Tenc *TencBox RawChildren [][]byte }
func (b *TrafBox) Parse(data []byte) error
--- TRAK ---
type TrakBox struct { Header BoxHeader Mdia *MdiaBox RawChildren [][]byte }
func (b *TrakBox) Encode() []byte
func (b *TrakBox) Parse(data []byte) error
func (b *TrakBox) RemoveEdts()
type TrunBox struct { Header BoxHeader Flags uint32 SampleCount uint32 DataOffset int32 FirstSampleFlags uint32 Samples []SampleInfo }
func (b *TrunBox) Parse(data []byte) error