webm

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: Apache-2.0 Imports: 5 Imported by: 38

Documentation

Overview

Package webm provides the WebM multimedia writer.

The package implements block data writer for multi-track WebM container.

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultEBMLHeader is the default EBML header used by BlockWriter.
	DefaultEBMLHeader = &EBMLHeader{
		EBMLVersion:        1,
		EBMLReadVersion:    1,
		EBMLMaxIDLength:    4,
		EBMLMaxSizeLength:  8,
		DocType:            "webm",
		DocTypeVersion:     4,
		DocTypeReadVersion: 2,
	}
	// DefaultSegmentInfo is the default Segment.Info used by BlockWriter.
	DefaultSegmentInfo = &Info{
		TimecodeScale: 1000000,
		MuxingApp:     "ebml-go.webm.BlockWriter",
		WritingApp:    "ebml-go.webm.BlockWriter",
	}
	// DefaultBlockInterceptor is the default BlockInterceptor used by BlockWriter.
	DefaultBlockInterceptor = mkvcore.MustBlockInterceptor(mkvcore.NewMultiTrackBlockSorter(mkvcore.WithMaxDelayedPackets(16), mkvcore.WithSortRule(mkvcore.BlockSorterDropOutdated)))
)

Functions

This section is empty.

Types

type Audio

type Audio struct {
	SamplingFrequency float64 `ebml:"SamplingFrequency"`
	Channels          uint64  `ebml:"Channels"`
}

Audio represents Audio element struct.

type BlockCloser added in v0.6.0

type BlockCloser interface {
	mkvcore.BlockCloser
}

BlockCloser is a WebM closer interface.

type BlockGroup added in v0.7.0

type BlockGroup struct {
	BlockDuration  uint64     `ebml:"BlockDuration,omitempty"`
	ReferenceBlock int64      `ebml:"ReferenceBlock,omitempty"`
	Block          ebml.Block `ebml:"Block"`
}

BlockGroup represents BlockGroup element struct.

type BlockReadCloser added in v0.6.0

type BlockReadCloser interface {
	mkvcore.BlockReadCloser
}

BlockReadCloser groups Reader and Closer.

type BlockReader added in v0.6.0

type BlockReader interface {
	mkvcore.BlockReader
}

BlockReader is a WebM block reader interface.

type BlockWriteCloser added in v0.6.0

type BlockWriteCloser interface {
	mkvcore.BlockWriteCloser
}

BlockWriteCloser groups Writer and Closer.

func NewSimpleBlockWriter added in v0.6.0

func NewSimpleBlockWriter(w0 io.WriteCloser, tracks []TrackEntry, opts ...mkvcore.BlockWriterOption) ([]BlockWriteCloser, error)

NewSimpleBlockWriter creates BlockWriteCloser for each track specified as tracks argument. Blocks will be written to WebM as EBML SimpleBlocks. Resultant WebM is written to given io.WriteCloser and will be closed automatically; don't close it by yourself. Frames written to each track must be sorted by their timestamp.

type BlockWriter added in v0.6.0

type BlockWriter interface {
	mkvcore.BlockWriter
}

BlockWriter is a WebM block writer interface.

type Cluster

type Cluster struct {
	Timecode    uint64       `ebml:"Timecode"`
	PrevSize    uint64       `ebml:"PrevSize,omitempty"`
	BlockGroup  []BlockGroup `ebml:"BlockGroup"`
	SimpleBlock []ebml.Block `ebml:"SimpleBlock"`
}

Cluster represents Cluster element struct.

type CuePoint added in v0.1.0

type CuePoint struct {
	CueTime           uint64             `ebml:"CueTime"`
	CueTrackPositions []CueTrackPosition `ebml:"CueTrackPositions"`
}

CuePoint represents CuePoint element struct.

type CueTrackPosition added in v0.1.0

type CueTrackPosition struct {
	CueTrack           uint64 `ebml:"CueTrack"`
	CueClusterPosition uint64 `ebml:"CueClusterPosition"`
	CueBlockNumber     uint64 `ebml:"CueBlockNumber,omitempty"`
}

CueTrackPosition represents CueTrackPosition element struct.

type Cues added in v0.1.0

type Cues struct {
	CuePoint []CuePoint `ebml:"CuePoint"`
}

Cues represents Cues element struct.

type EBMLHeader

type EBMLHeader struct {
	EBMLVersion        uint64 `ebml:"EBMLVersion"`
	EBMLReadVersion    uint64 `ebml:"EBMLReadVersion"`
	EBMLMaxIDLength    uint64 `ebml:"EBMLMaxIDLength"`
	EBMLMaxSizeLength  uint64 `ebml:"EBMLMaxSizeLength"`
	DocType            string `ebml:"EBMLDocType"`
	DocTypeVersion     uint64 `ebml:"EBMLDocTypeVersion"`
	DocTypeReadVersion uint64 `ebml:"EBMLDocTypeReadVersion"`
}

EBMLHeader represents EBML header struct.

type FrameWriter deprecated added in v0.0.2

type FrameWriter struct {
	mkvcore.BlockWriteCloser
}

FrameWriter is a backward compatibility wrapper of BlockWriteCloser.

Deprecated: This is exposed to keep compatibility with the old version. Use BlockWriteCloser interface instead.

func NewSimpleWriter deprecated added in v0.0.2

func NewSimpleWriter(w0 io.WriteCloser, tracks []TrackEntry, opts ...mkvcore.BlockWriterOption) ([]*FrameWriter, error)

NewSimpleWriter creates BlockWriteCloser for each track specified as tracks argument. Blocks will be written to WebM as EBML SimpleBlocks. Resultant WebM is written to given io.WriteCloser. io.WriteCloser will be closed automatically; don't close it by yourself.

Deprecated: This is exposed to keep compatibility with the old version. Use NewSimpleBlockWriter instead.

type Info

type Info struct {
	TimecodeScale uint64    `ebml:"TimecodeScale"`
	MuxingApp     string    `ebml:"MuxingApp,omitempty"`
	WritingApp    string    `ebml:"WritingApp,omitempty"`
	Duration      float64   `ebml:"Duration,omitempty"`
	DateUTC       time.Time `ebml:"DateUTC,omitempty"`
}

Info represents Info element struct.

type Seek added in v0.4.0

type Seek struct {
	SeekID       []byte `ebml:"SeekID"`
	SeekPosition uint64 `ebml:"SeekPosition"`
}

Seek represents Seek element struct.

type SeekHead

type SeekHead struct {
	Seek []Seek `ebml:"Seek"`
}

SeekHead represents SeekHead element struct.

type Segment

type Segment struct {
	SeekHead *SeekHead `ebml:"SeekHead"`
	Info     Info      `ebml:"Info"`
	Tracks   Tracks    `ebml:"Tracks"`
	Cluster  []Cluster `ebml:"Cluster"`
	Cues     *Cues     `ebml:"Cues"`
}

Segment represents Segment element struct.

type SegmentStream

type SegmentStream struct {
	SeekHead *SeekHead `ebml:"SeekHead"`
	Info     Info      `ebml:"Info"`
	Tracks   Tracks    `ebml:"Tracks"`
	Cluster  []Cluster `ebml:"Cluster,size=unknown"`
}

SegmentStream represents Segment element struct for streaming.

type TrackEntry

type TrackEntry struct {
	Name            string `ebml:"Name,omitempty"`
	TrackNumber     uint64 `ebml:"TrackNumber"`
	TrackUID        uint64 `ebml:"TrackUID"`
	CodecID         string `ebml:"CodecID"`
	CodecPrivate    []byte `ebml:"CodecPrivate,omitempty"`
	CodecDelay      uint64 `ebml:"CodecDelay,omitempty"`
	TrackType       uint64 `ebml:"TrackType"`
	DefaultDuration uint64 `ebml:"DefaultDuration,omitempty"`
	SeekPreRoll     uint64 `ebml:"SeekPreRoll,omitempty"`
	Audio           *Audio `ebml:"Audio"`
	Video           *Video `ebml:"Video"`
}

TrackEntry represents TrackEntry element struct.

type Tracks

type Tracks struct {
	TrackEntry []TrackEntry `ebml:"TrackEntry"`
}

Tracks represents Tracks element struct.

type Video

type Video struct {
	PixelWidth  uint64 `ebml:"PixelWidth"`
	PixelHeight uint64 `ebml:"PixelHeight"`
}

Video represents Video element struct.

Jump to

Keyboard shortcuts

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