bmff

package module
v0.0.0-...-b0eabe9 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2019 License: MIT Imports: 12 Imported by: 0

README

bmff

GoDoc

ISO Base Media File Format Parsing Library

This parses MP4 containers that adhere to the above specification.

Goals

  • Support a stream based input
  • Support a stream based output
  • Add emsg support for timed metadata insertion to existing files.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChunkLargeOffset

type ChunkLargeOffset struct {
	Entries []uint64
	// contains filtered or unexported fields
}

func (ChunkLargeOffset) Version

func (b ChunkLargeOffset) Version() int

type ChunkOffset

type ChunkOffset struct {
	Entries []uint32
	// contains filtered or unexported fields
}

func (ChunkOffset) Version

func (b ChunkOffset) Version() int

type CompactSampleSize

type CompactSampleSize struct {
	FieldSize uint8
	Entries   []uint16
	// contains filtered or unexported fields
}

func (CompactSampleSize) Version

func (b CompactSampleSize) Version() int

type CompositionOffset

type CompositionOffset struct {
	Entries []CompositionOffsetEntry
	// contains filtered or unexported fields
}

CompositionOffset provides the offset between decoding time and composition time.

func (CompositionOffset) Version

func (b CompositionOffset) Version() int

type CompositionOffsetEntry

type CompositionOffsetEntry interface {
	Samples() uint32
	Offset() int32
}

CompositionOffsetEntry represents a single entry

type CompositionOffsetEntryV0

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

CompositionOffsetEntryV0 represents a V0 entry, offset is unsigned

func (CompositionOffsetEntryV0) Offset

func (e CompositionOffsetEntryV0) Offset() int32

Offset returns the offset

func (CompositionOffsetEntryV0) Samples

func (e CompositionOffsetEntryV0) Samples() uint32

Samples returns the number of samples

type CompositionOffsetEntryV1

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

CompositionOffsetEntryV1 represents a V1 entry, offset is signed

func (CompositionOffsetEntryV1) Offset

func (e CompositionOffsetEntryV1) Offset() int32

Offset returns the offset

func (CompositionOffsetEntryV1) Samples

func (e CompositionOffsetEntryV1) Samples() uint32

Samples returns the number of samples

type Copyright struct {
	LanguageCode string
	Data         string
	// contains filtered or unexported fields
}

func (Copyright) Version

func (b Copyright) Version() int

type DataEntry

type DataEntry interface {
	Name() string
	Location() string
	InFile() bool
}

type DataEntryURL

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

func (*DataEntryURL) InFile

func (b *DataEntryURL) InFile() bool

func (*DataEntryURL) Location

func (b *DataEntryURL) Location() string

func (*DataEntryURL) Name

func (b *DataEntryURL) Name() string

func (DataEntryURL) Version

func (b DataEntryURL) Version() int

type DataEntryURN

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

func (*DataEntryURN) InFile

func (b *DataEntryURN) InFile() bool

func (*DataEntryURN) Location

func (b *DataEntryURN) Location() string

func (*DataEntryURN) Name

func (b *DataEntryURN) Name() string

func (DataEntryURN) Version

func (b DataEntryURN) Version() int

type DataInformation

type DataInformation struct {
	Reference *DataReference
	Unknown   []*box
	// contains filtered or unexported fields
}

func (DataInformation) Raw

func (b DataInformation) Raw() []byte

func (DataInformation) Size

func (b DataInformation) Size() uint64

func (DataInformation) Type

func (b DataInformation) Type() string

type DataReference

type DataReference struct {
	Entries []DataEntry
	// contains filtered or unexported fields
}

func (DataReference) Version

func (b DataReference) Version() int

type EditBox

type EditBox struct {
	EditList *EditList
	// contains filtered or unexported fields
}

func (EditBox) Raw

func (b EditBox) Raw() []byte

func (EditBox) Size

func (b EditBox) Size() uint64

func (EditBox) Type

func (b EditBox) Type() string

type EditList

type EditList struct {
	Versioned         EditLister
	MediaRate         int16
	MediaRateFraction int16
	// contains filtered or unexported fields
}

func (EditList) Version

func (b EditList) Version() int

type EditListV0

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

func (*EditListV0) MediaTime

func (b *EditListV0) MediaTime() int64

func (*EditListV0) SegmentDuration

func (b *EditListV0) SegmentDuration() uint64

type EditListV1

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

func (*EditListV1) MediaTime

func (b *EditListV1) MediaTime() int64

func (*EditListV1) SegmentDuration

func (b *EditListV1) SegmentDuration() uint64

type EditLister

type EditLister interface {
	SegmentDuration() uint64
	MediaTime() int64
}

type Extent

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

type File

type File struct {
	Type      *FileType
	Movie     *Movie
	MediaData []*box
	Metadata  *Metadata
	Free      []*box
	Unknown   []*box
	// contains filtered or unexported fields
}

func Parse

func Parse(src io.Reader) (*File, error)

type FileType

type FileType struct {
	MajorBrand       string
	MinorVersion     int
	CompatibleBrands []string
	// contains filtered or unexported fields
}

FileType is short-formed as 'ftyp'. Files written to this version of this specification must contain a file‐type box. For compatibility with an earlier version of this specification, files may be conformant to this specification and not contain a file-type box. Files with no file‐type box should be read as if they contained an FTYP box with Major_brand='mp41', minor_version=0, and the single compatible brand 'mp41'.

func (FileType) Raw

func (b FileType) Raw() []byte

func (FileType) Size

func (b FileType) Size() uint64

func (FileType) Type

func (b FileType) Type() string

type Handler

type Handler struct {
	Predefined  uint32
	HandlerType string
	Name        string
	// contains filtered or unexported fields
}

Handler is short-formed as 'hdlr'. This box within a Media Box declares media type of the track, and thus the process by which the media‐data in the track is presented. For example, a format for which the decoder delivers video would be stored in a video track, identified by being handled by a video handler. The documentation of the storage of a media format identifies the media type which that format uses. This box when present within a Meta Box, declares the structure or format of the 'meta' box contents. There is a general handler for metadata streams of any type; the specific format is identified by the sample entry, as for video or audio, for example.

func (Handler) Version

func (b Handler) Version() int

type HintMediaHeader

type HintMediaHeader struct {
	MaxPDUSize uint16
	AvgPDUSize uint16
	MaxBitrate uint32
	AvgBitrate uint32
	// contains filtered or unexported fields
}

func (HintMediaHeader) Version

func (b HintMediaHeader) Version() int

type IodsBox

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

func (IodsBox) Version

func (b IodsBox) Version() int

type ItemEntry

type ItemEntry struct {
	ID uint32

	Extents []Extent
	// contains filtered or unexported fields
}

type ItemLocation

type ItemLocation struct {
	Items []ItemEntry
	// contains filtered or unexported fields
}

func (ItemLocation) Version

func (b ItemLocation) Version() int

type Media

type Media struct {
	Header      *MediaHeader
	Handler     *Handler
	Information *MediaInformation
	Unknown     []*box
	// contains filtered or unexported fields
}

func (Media) Raw

func (b Media) Raw() []byte

func (Media) Size

func (b Media) Size() uint64

func (Media) Type

func (b Media) Type() string

type MediaHeader

type MediaHeader struct {
	TimeScale    uint32
	Duration     uint64
	LanguageCode string
	Predefined   uint16
	// contains filtered or unexported fields
}

func (*MediaHeader) CreationTime

func (b *MediaHeader) CreationTime() time.Time

CreationTime is when this track was created

func (*MediaHeader) ModificationTime

func (b *MediaHeader) ModificationTime() time.Time

ModificationTime is when this track was most recently edited

func (MediaHeader) Version

func (b MediaHeader) Version() int

type MediaInformation

type MediaInformation struct {
	DataInformation  *DataInformation
	NullMediaHeader  *NullMediaHeader
	VideoMediaHeader *VideoMediaHeader
	SoundMediaHeader *SoundMediaHeader
	HintMediaHeader  *HintMediaHeader
	SampleTable      *SampleTable
	Unknown          []*box
	// contains filtered or unexported fields
}

func (MediaInformation) Raw

func (b MediaInformation) Raw() []byte

func (MediaInformation) Size

func (b MediaInformation) Size() uint64

func (MediaInformation) Type

func (b MediaInformation) Type() string

type Metadata

type Metadata struct {
	Handler      *Handler
	ItemLocation *ItemLocation
	Unknown      []*box
	// contains filtered or unexported fields
}

func (Metadata) Version

func (b Metadata) Version() int

type Movie

type Movie struct {
	Header   *MovieHeader
	Tracks   []*TrakBox
	Iods     *IodsBox
	Metadata *Metadata
	UserData *UserData
	Unknown  []*box
	// contains filtered or unexported fields
}

The Movie Box is short-formed as the type 'moov'. The metadata for a presentation is stored in the single Movie Box which occurs at the top‐level of a file. Normally this box is close to the beginning or end of the file, though this is not required.

func (Movie) Raw

func (b Movie) Raw() []byte

func (Movie) Size

func (b Movie) Size() uint64

func (Movie) Type

func (b Movie) Type() string

type MovieHeader

type MovieHeader struct {
	CreationTime     uint64
	ModificationTime uint64
	TimeScale        uint32
	Duration         uint64
	NextTrackID      uint32
	Rate             fixed.Uint16_16
	Volume           fixed.Uint8_8
	Reserved         []byte
	Matrix           [9]int32
	Predefined       []byte
	// contains filtered or unexported fields
}

func (MovieHeader) Version

func (b MovieHeader) Version() int

type NullMediaHeader

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

func (NullMediaHeader) Version

func (b NullMediaHeader) Version() int

type SampleDependenciesTable

type SampleDependenciesTable struct {
	Entries []SampleDependencyEntry
	// contains filtered or unexported fields
}

func (SampleDependenciesTable) Version

func (b SampleDependenciesTable) Version() int

type SampleDependencyEntry

type SampleDependencyEntry struct {
	IsLeading           uint8
	SampleDependsOn     uint8
	SampleIsDependedOn  uint8
	SampleHasRedundancy uint8
}

type SampleDescription

type SampleDescription struct {
	Entries []*SampleEntry
	// contains filtered or unexported fields
}

func (SampleDescription) Version

func (b SampleDescription) Version() int

type SampleEntry

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

func (SampleEntry) Raw

func (b SampleEntry) Raw() []byte

func (SampleEntry) Size

func (b SampleEntry) Size() uint64

func (SampleEntry) Type

func (b SampleEntry) Type() string

type SampleSize

type SampleSize struct {
	DefaultSize uint32
	SampleCount uint32
	Entries     []uint32
	// contains filtered or unexported fields
}

func (SampleSize) Version

func (b SampleSize) Version() int

type SampleTable

type SampleTable struct {
	Ctts    *CompositionOffset
	Stsd    *SampleDescription
	Sdtp    *SampleDependenciesTable
	Stts    *TimeToSample
	Stsc    *SampleToChunk
	Stss    *SyncSample
	Stsz    *SampleSize
	Stz2    *CompactSampleSize
	Stsh    *ShadowSyncSample
	Stco    *ChunkOffset
	Co64    *ChunkLargeOffset
	Unknown []*box
	// contains filtered or unexported fields
}

func (SampleTable) Raw

func (b SampleTable) Raw() []byte

func (SampleTable) Size

func (b SampleTable) Size() uint64

func (SampleTable) Type

func (b SampleTable) Type() string

type SampleToChunk

type SampleToChunk struct {
	Entries []SampleToChunkEntry
	// contains filtered or unexported fields
}

func (SampleToChunk) Version

func (b SampleToChunk) Version() int

type SampleToChunkEntry

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

type ShadowSyncEntry

type ShadowSyncEntry struct {
	ShadowedSampleNumber uint32
	SyncSampleNumber     uint32
}

type ShadowSyncSample

type ShadowSyncSample struct {
	Entries []ShadowSyncEntry
	// contains filtered or unexported fields
}

func (ShadowSyncSample) Version

func (b ShadowSyncSample) Version() int

type SoundMediaHeader

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

func (SoundMediaHeader) Version

func (b SoundMediaHeader) Version() int

type SyncSample

type SyncSample struct {
	Entries []uint32
	// contains filtered or unexported fields
}

func (SyncSample) Version

func (b SyncSample) Version() int

type TimeToSample

type TimeToSample struct {
	Entries []TimeToSampleEntry
	// contains filtered or unexported fields
}

func (TimeToSample) Version

func (b TimeToSample) Version() int

type TimeToSampleEntry

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

type TrackHeader

type TrackHeader struct {
	TrackID        uint32
	Duration       uint64
	Layer          int16
	AlternateGroup int16
	Volume         int16
	Matrix         [9]int32
	Width          fixed.Uint16_16
	Height         fixed.Uint16_16
	// contains filtered or unexported fields
}

func (*TrackHeader) CreationTime

func (b *TrackHeader) CreationTime() time.Time

CreationTime is when this track was created

func (*TrackHeader) Enabled

func (b *TrackHeader) Enabled() bool

Enabled indicates that the track is present. A track which is not enabled should be treated as not present.

func (*TrackHeader) InMovie

func (b *TrackHeader) InMovie() bool

InMovie indicates that the track is used in the presentation

func (*TrackHeader) InPreview

func (b *TrackHeader) InPreview() bool

InPreview indiciates the track is used when previewing the presentation

func (*TrackHeader) ModificationTime

func (b *TrackHeader) ModificationTime() time.Time

ModificationTime is when this track was most recently edited

func (*TrackHeader) SizeIsAspectRatio

func (b *TrackHeader) SizeIsAspectRatio() bool

SizeIsAspectRatio indicates that the width and height values are not expressed in pixel units. The values have the same unit but the unit is not specified, the values are only an indication of the desired aspect ratio. If the aspect ratios of this track and other related tracks are not identical then the respective positioning is undefined, possibly defined by external contexts.

func (TrackHeader) Version

func (b TrackHeader) Version() int

type TrackReference

type TrackReference struct {
	TypeBoxes []*TrackReferenceType
	// contains filtered or unexported fields
}

TrackReference provides a reference from the containing track to another track in the presentation.

func (TrackReference) Raw

func (b TrackReference) Raw() []byte

func (TrackReference) Size

func (b TrackReference) Size() uint64

func (TrackReference) Type

func (b TrackReference) Type() string

type TrackReferenceType

type TrackReferenceType struct {
	TrackIDs []uint32
	// contains filtered or unexported fields
}

TrackReferenceType is a child from the `tref` box. It contains information such as: - `hint` will reference links from the containing hint track to the media data it hints. - `cdsc` links a descriptive or metadata track to the content it describes See ISO 14936-12 8.3.3.3 for additional definitions.

func (TrackReferenceType) Raw

func (b TrackReferenceType) Raw() []byte

func (TrackReferenceType) Size

func (b TrackReferenceType) Size() uint64

func (TrackReferenceType) Type

func (b TrackReferenceType) Type() string

type TrakBox

type TrakBox struct {
	Header    *TrackHeader
	Reference *TrackReference
	Media     *Media
	EditBox   *EditBox
	UserData  *UserData
	// contains filtered or unexported fields
}

func (TrakBox) Raw

func (b TrakBox) Raw() []byte

func (TrakBox) Size

func (b TrakBox) Size() uint64

func (TrakBox) Type

func (b TrakBox) Type() string

type UserData

type UserData struct {
	Copyright *Copyright
	Boxes     []*box
	// contains filtered or unexported fields
}

func (UserData) Raw

func (b UserData) Raw() []byte

func (UserData) Size

func (b UserData) Size() uint64

func (UserData) Type

func (b UserData) Type() string

type VideoMediaHeader

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

func (VideoMediaHeader) Version

func (b VideoMediaHeader) Version() int

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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