Documentation ¶
Index ¶
- Constants
- func DecodeTfhd(hdr *boxHeader, startPos uint64, r io.Reader) (box, error)
- func DecodeTfhdSR(hdr *boxHeader, startPos uint64, sr mp4ff.SliceReader) (box, error)
- func DecodeTrafSR(hdr *boxHeader, startPos uint64, sr mp4ff.SliceReader) (box, error)
- func DecodeTrunSR(hdr *boxHeader, startPos uint64, sr mp4ff.SliceReader) (box, error)
- func DecryptSampleCenc(sample []byte, key []byte, iv []byte, subSamplePatterns []SubSamplePattern) ([]byte, error)
- type File
- type Fragment
- type FullSample
- type MediaSegment
- type SampleGroupEntry
- type SampleGroupEntryDecoder
- type SencBox
- type SubSamplePattern
- type TfhdBox
- func (t *TfhdBox) DefaultBaseIfMoof() bool
- func (t *TfhdBox) DurationIsEmpty() bool
- func (t *TfhdBox) Encode(w io.Writer) error
- func (t *TfhdBox) HasBaseDataOffset() bool
- func (t *TfhdBox) HasDefaultSampleDuration() bool
- func (t *TfhdBox) HasDefaultSampleFlags() bool
- func (t *TfhdBox) HasDefaultSampleSize() bool
- func (t *TfhdBox) HasSampleDescriptionIndex() bool
- type TrafBox
- type TrunBox
- func (t *TrunBox) AddSampleDefaultValues(tfhd *TfhdBox) (totalDur uint64)
- func (t *TrunBox) Encode(w io.Writer) error
- func (t *TrunBox) HasDataOffset() bool
- func (t *TrunBox) HasFirstSampleFlags() bool
- func (t *TrunBox) HasSampleCompositionTimeOffset() bool
- func (t *TrunBox) HasSampleDuration() bool
- func (t *TrunBox) HasSampleFlags() bool
- func (t *TrunBox) HasSampleSize() bool
- func (t *TrunBox) SampleCount() uint32
- func (t *TrunBox) SetFirstSampleFlags(flags uint32)
- func (t *TrunBox) SizeOfData() (totalSize uint64)
Constants ¶
const TrunDataOffsetPresentFlag uint32 = 0x01
const TrunFirstSampleFlagsPresentFlag uint32 = 0x04
const TrunSampleCompositionTimeOffsetPresentFlag uint32 = 0x800
const TrunSampleDurationPresentFlag uint32 = 0x100
const TrunSampleFlagsPresentFlag uint32 = 0x400
const TrunSampleSizePresentFlag uint32 = 0x200
Variables ¶
This section is empty.
Functions ¶
func DecodeTfhd ¶
DecodeTfhd - box-specific decode
func DecodeTfhdSR ¶
func DecodeTfhdSR(hdr *boxHeader, startPos uint64, sr mp4ff.SliceReader) (box, error)
DecodeTfhdSR - 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 DecryptSampleCenc ¶
func DecryptSampleCenc(sample []byte, key []byte, iv []byte, subSamplePatterns []SubSamplePattern) ([]byte, error)
DecryptSampleCenc - decrypt cenc-mode encrypted sample
Types ¶
type File ¶
type File struct { Segments []*MediaSegment // Media segments IsFragmented bool }
type Fragment ¶
type Fragment struct { Moof *moofBox Mdat *mdatBox Children []box // All top-level boxes in order // contains filtered or unexported fields }
Fragment - MP4 Fragment ([prft] + moof + mdat)
func (*Fragment) GetFullSamples ¶
func (f *Fragment) GetFullSamples() ([]FullSample, error)
GetFullSamples - Get full samples including media and accumulated time
type FullSample ¶
type FullSample struct { DecodeTime uint64 // Absolute decode time (offset + accumulated sample Dur) Data []byte // Sample data // contains filtered or unexported fields }
FullSample - include accumulated time and data. Times in mdhd timescale
type MediaSegment ¶
type MediaSegment struct { Fragments []*Fragment // contains filtered or unexported fields }
MediaSegment - MP4 Media Segment
type SampleGroupEntry ¶
type SampleGroupEntry interface { // Encode SampleGroupEntry to SliceWriter Encode(sw mp4ff.SliceWriter) // contains filtered or unexported methods }
SampleGroupEntry - like a box, but size and type are not in a header
type SampleGroupEntryDecoder ¶
type SampleGroupEntryDecoder func(name string, length uint32, sr mp4ff.SliceReader) (SampleGroupEntry, error)
SampleGroupEntryDecoder is function signature of the SampleGroupEntry Decode method
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
type SubSamplePattern ¶
SubSamplePattern - pattern of subsample encryption
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 ¶
CreateTfhd - Create a new TfdtBox with baseMediaDecodeTime
func (*TfhdBox) DefaultBaseIfMoof ¶
DefaultBaseIfMoof - interpreted flags value
func (*TfhdBox) DurationIsEmpty ¶
DurationIsEmpty - interpreted flags value
func (*TfhdBox) HasBaseDataOffset ¶
HasBaseDataOffset - interpreted flags value
func (*TfhdBox) HasDefaultSampleDuration ¶
HasDefaultSampleDuration - interpreted flags value
func (*TfhdBox) HasDefaultSampleFlags ¶
HasDefaultSampleFlags - interpreted flags value
func (*TfhdBox) HasDefaultSampleSize ¶
HasDefaultSampleSize - interpreted flags value
func (*TfhdBox) HasSampleDescriptionIndex ¶
HasSampleDescriptionIndex - interpreted flags value
type TrafBox ¶
type TrafBox struct { Children []box 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) ContainsSencBox ¶
ContainsSencBox - is there a senc box in traf and is it parsed If not parsed, call ParseReadSenc to parse it
func (*TrafBox) ParseReadSenc ¶
func (*TrafBox) RemoveEncryptionBoxes ¶
RemoveEncryptionBoxes - remove encryption boxes and return number of bytes removed
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 (*TrunBox) AddSampleDefaultValues ¶
AddSampleDefaultValues - add values from tfhd and trex boxes if needed Return total duration
func (*TrunBox) HasDataOffset ¶
HasDataOffset - interpreted dataOffsetPresent flag
func (*TrunBox) HasFirstSampleFlags ¶
HasFirstSampleFlags - interpreted firstSampleFlagsPresent flag
func (*TrunBox) HasSampleCompositionTimeOffset ¶
HasSampleCompositionTimeOffset - interpreted sampleCompositionTimeOffset flag
func (*TrunBox) HasSampleDuration ¶
HasSampleDuration - interpreted sampleDurationPresent flag
func (*TrunBox) HasSampleFlags ¶
HasSampleFlags - interpreted sampleFlagsPresent flag
func (*TrunBox) HasSampleSize ¶
HasSampleSize - interpreted sampleSizePresent flag
func (*TrunBox) SampleCount ¶
SampleCount - return how many samples are defined
func (*TrunBox) SetFirstSampleFlags ¶
SetFirstSampleFlags - set firstSampleFlags and bit indicating its presence
func (*TrunBox) SizeOfData ¶
SizeOfData - size of mediasamples in bytes