Documentation
¶
Index ¶
- Constants
- type AVPacket
- type AudioSampleEntry
- type BaseDescriptor
- type BasicBox
- type BoxDecoder
- type BoxEncoder
- type BoxSize
- type ChunkLargeOffsetBox
- type ChunkOffsetBox
- type CompositionOffsetBox
- type EditListBox
- type FileTypeBox
- type FreeBox
- type FullBox
- type HandlerBox
- type HandlerType
- type HintMediaHeaderBox
- type HintSampleEntry
- type MP4_CODEC_TYPE
- type MP4_THFD_FLAG
- type MP4_TRUN_FALG
- type MediaHeaderBox
- type MovDemuxer
- type MovieFragmentHeaderBox
- type MovieHeaderBox
- type Movmuxer
- func (muxer *Movmuxer) AddAudioTrack(cid MP4_CODEC_TYPE, channelcount uint8, sampleBits uint8, sampleRate uint) uint32
- func (muxer *Movmuxer) AddVideoTrack(cid MP4_CODEC_TYPE) uint32
- func (muxer *Movmuxer) Write(track uint32, data []byte, pts uint64, dts uint64) error
- func (muxer *Movmuxer) WriteTrailer() (err error)
- type Mp4Info
- type SampleDescriptionBox
- type SampleEntry
- type SampleEntryType
- type SampleSizeBox
- type SampleToChunkBox
- type SegmentIndexBox
- type SoundMediaHeaderBox
- type TimeToSampleBox
- type TrackExtendsBox
- type TrackFragmentBaseMediaDecodeTimeBox
- type TrackFragmentHeaderBox
- type TrackFragmentRandomAccessBox
- type TrackHeaderBox
- type TrackInfo
- type TrackRunBox
- type VideoMediaHeaderBox
- type VisualSampleEntry
Constants ¶
View Source
const ( BasicBoxLen = 8 FullBoxLen = 12 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AVPacket ¶
type AVPacket struct {
Cid MP4_CODEC_TYPE
Data []byte
TrackId int
Pts uint64
Dts uint64
}
type AudioSampleEntry ¶
type AudioSampleEntry struct {
// contains filtered or unexported fields
}
func NewAudioSampleEntry ¶
func NewAudioSampleEntry(format [4]byte) *AudioSampleEntry
func (*AudioSampleEntry) Decode ¶
func (entry *AudioSampleEntry) Decode(r io.Reader) (offset int, err error)
func (*AudioSampleEntry) Encode ¶
func (entry *AudioSampleEntry) Encode() (int, []byte)
func (*AudioSampleEntry) Size ¶
func (entry *AudioSampleEntry) Size() uint64
type BaseDescriptor ¶
type BaseDescriptor struct {
// contains filtered or unexported fields
}
func (*BaseDescriptor) Decode ¶
func (base *BaseDescriptor) Decode(data []byte)
func (*BaseDescriptor) Encode ¶
func (base *BaseDescriptor) Encode() []byte
type BasicBox ¶
func NewBasicBox ¶
type BoxDecoder ¶
type BoxEncoder ¶
type ChunkLargeOffsetBox ¶
type ChunkLargeOffsetBox struct {
// contains filtered or unexported fields
}
func NewChunkLargeOffsetBox ¶
func NewChunkLargeOffsetBox() *ChunkLargeOffsetBox
func (*ChunkLargeOffsetBox) Decode ¶
func (co64 *ChunkLargeOffsetBox) Decode(r io.Reader) (offset int, err error)
func (*ChunkLargeOffsetBox) Encode ¶
func (co64 *ChunkLargeOffsetBox) Encode() (int, []byte)
func (*ChunkLargeOffsetBox) Size ¶
func (co64 *ChunkLargeOffsetBox) Size() uint64
type ChunkOffsetBox ¶
type ChunkOffsetBox struct {
// contains filtered or unexported fields
}
func NewChunkOffsetBox ¶
func NewChunkOffsetBox() *ChunkOffsetBox
func (*ChunkOffsetBox) Decode ¶
func (stco *ChunkOffsetBox) Decode(r io.Reader) (offset int, err error)
func (*ChunkOffsetBox) Encode ¶
func (stco *ChunkOffsetBox) Encode() (int, []byte)
func (*ChunkOffsetBox) Size ¶
func (stco *ChunkOffsetBox) Size() uint64
type CompositionOffsetBox ¶
type CompositionOffsetBox struct {
// contains filtered or unexported fields
}
func NewCompositionOffsetBox ¶
func NewCompositionOffsetBox() *CompositionOffsetBox
func (*CompositionOffsetBox) Decode ¶
func (ctts *CompositionOffsetBox) Decode(r io.Reader) (offset int, err error)
func (*CompositionOffsetBox) Encode ¶
func (ctts *CompositionOffsetBox) Encode() (int, []byte)
func (*CompositionOffsetBox) Size ¶
func (ctts *CompositionOffsetBox) Size() uint64
type EditListBox ¶
type EditListBox struct {
// contains filtered or unexported fields
}
func NewEditListBox ¶
func NewEditListBox(version uint32) *EditListBox
func (*EditListBox) Encode ¶
func (elst *EditListBox) Encode() (int, []byte)
type FileTypeBox ¶
type FileTypeBox struct {
Box *BasicBox
Major_brand uint32
Minor_version uint32
Compatible_brands []uint32
}
func NewFileTypeBox ¶
func NewFileTypeBox() *FileTypeBox
func (*FileTypeBox) Encode ¶
func (ftyp *FileTypeBox) Encode() (int, []byte)
func (*FileTypeBox) Size ¶
func (ftyp *FileTypeBox) Size() uint64
type FreeBox ¶
func NewFreeBox ¶
func NewFreeBox() *FreeBox
type FullBox ¶
func NewFullBox ¶
type HandlerBox ¶
type HandlerBox struct {
Box *FullBox
Handler_type HandlerType
Name string
}
func NewHandlerBox ¶
func NewHandlerBox(handlerType HandlerType, name string) *HandlerBox
func (*HandlerBox) Encode ¶
func (hdlr *HandlerBox) Encode() (int, []byte)
func (*HandlerBox) Size ¶
func (hdlr *HandlerBox) Size() uint64
type HandlerType ¶
type HandlerType [4]byte
type HintMediaHeaderBox ¶
type HintMediaHeaderBox struct {
Box *FullBox
MaxPDUsize uint16
AvgPDUsize uint16
Maxbitrate uint32
Avgbitrate uint32
}
func NewHintMediaHeaderBox ¶
func NewHintMediaHeaderBox() *HintMediaHeaderBox
func (*HintMediaHeaderBox) Decode ¶
func (hmhd *HintMediaHeaderBox) Decode(r io.Reader) (offset int, err error)
func (*HintMediaHeaderBox) Encode ¶
func (hmhd *HintMediaHeaderBox) Encode() (int, []byte)
func (*HintMediaHeaderBox) Size ¶
func (hmhd *HintMediaHeaderBox) Size() uint64
type HintSampleEntry ¶
type HintSampleEntry struct {
Entry *SampleEntry
Data byte
}
type MP4_CODEC_TYPE ¶
type MP4_CODEC_TYPE int
const ( MP4_CODEC_H264 MP4_CODEC_TYPE = iota + 1 MP4_CODEC_H265 MP4_CODEC_AAC MP4_CODEC_TYPE = iota + 100 MP4_CODEC_G711A MP4_CODEC_G711U )
type MP4_THFD_FLAG ¶
type MP4_THFD_FLAG uint32
const ( TF_FLAG_BASE_DATA_OFFSET MP4_THFD_FLAG = 0x000001 TF_FLAG_SAMPLE_DESCRIPTION_INDEX_PRESENT MP4_THFD_FLAG = 0x000002 TF_FLAG_DEFAULT_SAMPLE_DURATION_PRESENT MP4_THFD_FLAG = 0x000008 TF_FLAG_DEFAULT_SAMPLE_SIZE_PRESENT MP4_THFD_FLAG = 0x000010 TF_FLAG_DEAAULT_SAMPLE_FLAGS_PRESENT MP4_THFD_FLAG = 0x000020 TF_FLAG_DURATION_IS_EMPTY MP4_THFD_FLAG = 0x010000 TF_FLAG_DEAAULT_BASE_IS_MOOF MP4_THFD_FLAG = 0x020000 )
type MP4_TRUN_FALG ¶
type MP4_TRUN_FALG uint32
const ( TR_FLAG_DATA_OFFSET MP4_TRUN_FALG = 0x000001 TR_FLAG_DATA_FIRST_SAMPLE_FLAGS MP4_TRUN_FALG = 0x000004 TR_FLAG_DATA_SAMPLE_DURATION MP4_TRUN_FALG = 0x000100 TR_FLAG_DATA_SAMPLE_SIZE MP4_TRUN_FALG = 0x000200 TR_FLAG_DATA_SAMPLE_FLAGS MP4_TRUN_FALG = 0x000400 TR_FLAG_DATA_SAMPLE_COMPOSITION_TIME MP4_TRUN_FALG = 0x000800 )
type MediaHeaderBox ¶
type MediaHeaderBox struct {
Box *FullBox
Creation_time uint64
Modification_time uint64
Timescale uint32
Duration uint64
Pad uint8
Language [3]uint8
Pre_defined uint16
}
func NewMediaHeaderBox ¶
func NewMediaHeaderBox() *MediaHeaderBox
func (*MediaHeaderBox) Decode ¶
func (mdhd *MediaHeaderBox) Decode(r io.Reader) (offset int, err error)
func (*MediaHeaderBox) Encode ¶
func (mdhd *MediaHeaderBox) Encode() (int, []byte)
func (*MediaHeaderBox) Size ¶
func (mdhd *MediaHeaderBox) Size() uint64
type MovDemuxer ¶
type MovDemuxer struct {
// contains filtered or unexported fields
}
func CreateMp4Demuxer ¶
func CreateMp4Demuxer(r io.ReadSeeker) *MovDemuxer
func (*MovDemuxer) GetMp4Info ¶
func (demuxer *MovDemuxer) GetMp4Info() Mp4Info
func (*MovDemuxer) ReadHead ¶
func (demuxer *MovDemuxer) ReadHead() ([]TrackInfo, error)
func (*MovDemuxer) ReadPacket ¶
func (demuxer *MovDemuxer) ReadPacket() (*AVPacket, error)
/return error == io.EOF, means read mp4 file completed
type MovieFragmentHeaderBox ¶
func NewMovieFragmentHeaderBox ¶
func NewMovieFragmentHeaderBox(sequence uint32) *MovieFragmentHeaderBox
func (*MovieFragmentHeaderBox) Decode ¶
func (mfhd *MovieFragmentHeaderBox) Decode(r io.Reader) (offset int, err error)
func (*MovieFragmentHeaderBox) Encode ¶
func (mfhd *MovieFragmentHeaderBox) Encode() (int, []byte)
func (*MovieFragmentHeaderBox) Size ¶
func (mfhd *MovieFragmentHeaderBox) Size() uint64
type MovieHeaderBox ¶
type MovieHeaderBox struct {
Box *FullBox
Creation_time uint64
Modification_time uint64
Timescale uint32
Duration uint64
Rate uint32
Volume uint16
Matrix [9]uint32
Pre_defined [6]uint32
Next_track_ID uint32
}
func NewMovieHeaderBox ¶
func NewMovieHeaderBox() *MovieHeaderBox
func (*MovieHeaderBox) Decode ¶
func (mvhd *MovieHeaderBox) Decode(r io.Reader) (offset int, err error)
func (*MovieHeaderBox) Encode ¶
func (mvhd *MovieHeaderBox) Encode() (int, []byte)
func (*MovieHeaderBox) Size ¶
func (mvhd *MovieHeaderBox) Size() uint64
type Movmuxer ¶
type Movmuxer struct {
// contains filtered or unexported fields
}
func CreateMp4Muxer ¶
func CreateMp4Muxer(w io.WriteSeeker) *Movmuxer
func (*Movmuxer) AddAudioTrack ¶
func (*Movmuxer) AddVideoTrack ¶
func (muxer *Movmuxer) AddVideoTrack(cid MP4_CODEC_TYPE) uint32
func (*Movmuxer) WriteTrailer ¶
type SampleDescriptionBox ¶
type SampleDescriptionBox struct {
// contains filtered or unexported fields
}
func NewSampleDescriptionBox ¶
func NewSampleDescriptionBox() *SampleDescriptionBox
func (*SampleDescriptionBox) Decode ¶
func (stsd *SampleDescriptionBox) Decode(r io.Reader) (offset int, err error)
func (*SampleDescriptionBox) Encode ¶
func (entry *SampleDescriptionBox) Encode() (int, []byte)
func (*SampleDescriptionBox) Size ¶
func (stsd *SampleDescriptionBox) Size() uint64
type SampleEntry ¶
type SampleEntry struct {
// contains filtered or unexported fields
}
func NewSampleEntry ¶
func NewSampleEntry(format [4]byte) *SampleEntry
func (*SampleEntry) Encode ¶
func (entry *SampleEntry) Encode() (int, []byte)
func (*SampleEntry) Size ¶
func (entry *SampleEntry) Size() uint64
type SampleEntryType ¶
type SampleEntryType uint8
const ( SAMPLE_AUDIO SampleEntryType = iota SAMPLE_VIDEO )
type SampleSizeBox ¶
type SampleSizeBox struct {
// contains filtered or unexported fields
}
func NewSampleSizeBox ¶
func NewSampleSizeBox() *SampleSizeBox
func (*SampleSizeBox) Decode ¶
func (stsz *SampleSizeBox) Decode(r io.Reader) (offset int, err error)
func (*SampleSizeBox) Encode ¶
func (stsz *SampleSizeBox) Encode() (int, []byte)
func (*SampleSizeBox) Size ¶
func (stsz *SampleSizeBox) Size() uint64
type SampleToChunkBox ¶
type SampleToChunkBox struct {
// contains filtered or unexported fields
}
func NewSampleToChunkBox ¶
func NewSampleToChunkBox() *SampleToChunkBox
func (*SampleToChunkBox) Decode ¶
func (stsc *SampleToChunkBox) Decode(r io.Reader) (offset int, err error)
func (*SampleToChunkBox) Encode ¶
func (stsc *SampleToChunkBox) Encode() (int, []byte)
func (*SampleToChunkBox) Size ¶
func (stsc *SampleToChunkBox) Size() uint64
type SegmentIndexBox ¶
type SegmentIndexBox struct {
Box *FullBox
ReferenceID uint32
TimeScale uint32
EarliestPresentationTime uint64
FirstOffset uint64
ReferenceCount uint16
Entrys []sidxentry
}
func NewSegmentIndexBox ¶
func NewSegmentIndexBox() *SegmentIndexBox
func (*SegmentIndexBox) Decode ¶
func (sidx *SegmentIndexBox) Decode(r io.Reader) (offset int, err error)
func (*SegmentIndexBox) Encode ¶
func (sidx *SegmentIndexBox) Encode() (int, []byte)
func (*SegmentIndexBox) Size ¶
func (sidx *SegmentIndexBox) Size() uint64
type SoundMediaHeaderBox ¶
func NewSoundMediaHeaderBox ¶
func NewSoundMediaHeaderBox() *SoundMediaHeaderBox
func (*SoundMediaHeaderBox) Decode ¶
func (smhd *SoundMediaHeaderBox) Decode(r io.Reader) (offset int, err error)
func (*SoundMediaHeaderBox) Encode ¶
func (smhd *SoundMediaHeaderBox) Encode() (int, []byte)
func (*SoundMediaHeaderBox) Size ¶
func (smhd *SoundMediaHeaderBox) Size() uint64
type TimeToSampleBox ¶
type TimeToSampleBox struct {
// contains filtered or unexported fields
}
func NewTimeToSampleBox ¶
func NewTimeToSampleBox() *TimeToSampleBox
func (*TimeToSampleBox) Decode ¶
func (stts *TimeToSampleBox) Decode(r io.Reader) (offset int, err error)
func (*TimeToSampleBox) Encode ¶
func (stts *TimeToSampleBox) Encode() (int, []byte)
func (*TimeToSampleBox) Size ¶
func (stts *TimeToSampleBox) Size() uint64
type TrackExtendsBox ¶
type TrackExtendsBox struct {
Box *FullBox
TrackID uint32
DefaultSampleDescriptionIndex uint32
DefaultSampleDuration uint32
DefaultSampleSize uint32
DefaultSampleFlags uint32
}
func NewTrackExtendsBox ¶
func NewTrackExtendsBox(track uint32) *TrackExtendsBox
func (*TrackExtendsBox) Decode ¶
func (trex *TrackExtendsBox) Decode(r io.Reader) (offset int, err error)
func (*TrackExtendsBox) Encode ¶
func (trex *TrackExtendsBox) Encode() (int, []byte)
func (*TrackExtendsBox) Size ¶
func (trex *TrackExtendsBox) Size() uint64
type TrackFragmentBaseMediaDecodeTimeBox ¶
func NewTrackFragmentBaseMediaDecodeTimeBox ¶
func NewTrackFragmentBaseMediaDecodeTimeBox(fragStart uint64) *TrackFragmentBaseMediaDecodeTimeBox
func (*TrackFragmentBaseMediaDecodeTimeBox) Decode ¶
func (tfdt *TrackFragmentBaseMediaDecodeTimeBox) Decode(r io.Reader) (offset int, err error)
func (*TrackFragmentBaseMediaDecodeTimeBox) Encode ¶
func (tfdt *TrackFragmentBaseMediaDecodeTimeBox) Encode() (int, []byte)
func (*TrackFragmentBaseMediaDecodeTimeBox) Size ¶
func (tfdt *TrackFragmentBaseMediaDecodeTimeBox) Size() uint64
type TrackFragmentHeaderBox ¶
type TrackFragmentHeaderBox struct {
Box *FullBox
Track_ID uint32
BaseDataOffset uint64
SampleDescriptionIndex uint32
DefaultSampleDuration uint32
DefaultSampleSize uint32
DefaultSampleFlags uint32
}
func NewTrackFragmentHeaderBox ¶
func NewTrackFragmentHeaderBox(trackid uint32, tfFlags uint32) *TrackFragmentHeaderBox
func (*TrackFragmentHeaderBox) Decode ¶
func (tfhd *TrackFragmentHeaderBox) Decode(r io.Reader) (offset int, err error)
func (*TrackFragmentHeaderBox) Encode ¶
func (tfhd *TrackFragmentHeaderBox) Encode() (int, []byte)
func (*TrackFragmentHeaderBox) Size ¶
func (tfhd *TrackFragmentHeaderBox) Size() uint64
type TrackFragmentRandomAccessBox ¶
type TrackFragmentRandomAccessBox struct {
Box *FullBox
TrackID uint32
LengthSizeOfTrafNum uint8
LengthSizeOfTrunNum uint8
LengthSizeOfSampleNum uint8
NumberOfEntry uint32
FragEntrys *movtfra
}
func NewTrackFragmentRandomAccessBox ¶
func NewTrackFragmentRandomAccessBox(trackid uint32) *TrackFragmentRandomAccessBox
func (*TrackFragmentRandomAccessBox) Decode ¶
func (tfra *TrackFragmentRandomAccessBox) Decode(r io.Reader) (offset int, err error)
func (*TrackFragmentRandomAccessBox) Encode ¶
func (tfra *TrackFragmentRandomAccessBox) Encode() (int, []byte)
func (*TrackFragmentRandomAccessBox) Size ¶
func (tfra *TrackFragmentRandomAccessBox) Size() uint64
type TrackHeaderBox ¶
type TrackHeaderBox struct {
Box *FullBox
Creation_time uint64
Modification_time uint64
Track_ID uint32
Duration uint64
Layer uint16
Alternate_group uint16
Volume uint16
Matrix [9]uint32
Width uint32
Height uint32
}
func NewTrackHeaderBox ¶
func NewTrackHeaderBox() *TrackHeaderBox
func (*TrackHeaderBox) Decode ¶
func (tkhd *TrackHeaderBox) Decode(r io.Reader) (offset int, err error)
func (*TrackHeaderBox) Encode ¶
func (tkhd *TrackHeaderBox) Encode() (int, []byte)
func (*TrackHeaderBox) Size ¶
func (tkhd *TrackHeaderBox) Size() uint64
type TrackRunBox ¶
type TrackRunBox struct {
Box *FullBox
SampleCount uint32
Dataoffset int32
FirstSampleFlags uint32
EntryList *movtrun
}
func NewTrackRunBox ¶
func NewTrackRunBox() *TrackRunBox
func (*TrackRunBox) Encode ¶
func (trun *TrackRunBox) Encode() (int, []byte)
func (*TrackRunBox) Size ¶
func (trun *TrackRunBox) Size() uint64
type VideoMediaHeaderBox ¶
func NewVideoMediaHeaderBox ¶
func NewVideoMediaHeaderBox() *VideoMediaHeaderBox
func (*VideoMediaHeaderBox) Decode ¶
func (vmhd *VideoMediaHeaderBox) Decode(r io.Reader) (offset int, err error)
func (*VideoMediaHeaderBox) Encode ¶
func (vmhd *VideoMediaHeaderBox) Encode() (int, []byte)
func (*VideoMediaHeaderBox) Size ¶
func (vmhd *VideoMediaHeaderBox) Size() uint64
type VisualSampleEntry ¶
type VisualSampleEntry struct {
// contains filtered or unexported fields
}
func NewVisualSampleEntry ¶
func NewVisualSampleEntry(format [4]byte) *VisualSampleEntry
func (*VisualSampleEntry) Decode ¶
func (entry *VisualSampleEntry) Decode(r io.Reader) (offset int, err error)
func (*VisualSampleEntry) Encode ¶
func (entry *VisualSampleEntry) Encode() (int, []byte)
func (*VisualSampleEntry) Size ¶
func (entry *VisualSampleEntry) Size() uint64
Source Files
¶
- box.go
- ctts-box.go
- dinf-box.go
- edts-box.go
- esds-box.go
- free-box.go
- ftyp-box.go
- hdlr-box.go
- hmhd-box.go
- mdhd-box.go
- mdia-box.go
- mfhd-box.go
- minf-box.go
- mp4-codec.go
- mp4demuxer.go
- mp4muxer.go
- mp4table.go
- mvex-box.go
- mvhd-box.go
- sidx-box.go
- smhd-box.go
- stbl-box.go
- stco-box.go
- stsc-box.go
- stsd-box.go
- stsz-box.go
- stts-box.go
- tfdt-box.go
- tfhd-box.go
- tfra-box.go
- tkhd-box.go
- trak-box.go
- trex-box.go
- trun-box.go
- vmhd-box.go
Click to show internal directories.
Click to hide internal directories.