webm

package
v0.0.0-...-a6981b9 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2012 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BadTC = time.Duration(-1000000000000000)
)
View Source
const (
	MAXSTREAMS = 16
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Audio

type Audio struct {
	SamplingFrequency       float64 `ebml:"B5" ebmldef:"8000.0"`
	OutputSamplingFrequency float64 `ebml:"78B5" ebmldeflink:"SamplingFrequency"`
	Channels                uint    `ebml:"9F" ebmldef:"1"`
	BitDepth                uint    `ebml:"6264"`
}

type AudioDecoder

type AudioDecoder struct {
	Chan chan Samples
	// contains filtered or unexported fields
}

func NewAudioDecoder

func NewAudioDecoder(track *TrackEntry) *AudioDecoder

func (*AudioDecoder) Close

func (d *AudioDecoder) Close()

func (*AudioDecoder) Decode

func (d *AudioDecoder) Decode(pkt *Packet) bool

type BlockGroup

type BlockGroup struct {
	Block          []byte   `ebml:"A1"`
	BlockDuration  uint     `ebml:"9B"`
	ReferenceBlock int      `ebml:"FB"`
	CodecState     []byte   `ebml:"A4"`
	Slices         []Slices `ebml:"8E"`
}

type Cluster

type Cluster struct {
	Timecode   uint       `ebml:"E7"`
	PrevSize   uint       `ebml:"AB"`
	Position   uint       `ebml:"A7"`
	BlockGroup BlockGroup `ebml:"A0" ebmlstop:"1"`
	// contains filtered or unexported fields
}

type CuePoint

type CuePoint struct {
	CueTime           int64               `ebml:"B3"`
	CueTrackPositions []CueTrackPositions `ebml:"B7"`
}

type CueTrackPositions

type CueTrackPositions struct {
	CueTrack           uint  `ebml:"F7"`
	CueClusterPosition int64 `ebml:"F1"`
	CueBlockNumber     uint  `ebml:"5378" ebmldef:"1"`
}

type Cues

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

type Decoder

type Decoder interface {
	Decode(*Packet) bool
	Close()
}

type Frame

type Frame struct {
	*image.YCbCr
	Timecode time.Duration
	Rebase   bool
	EOS      bool
}
type Header struct {
	EBMLVersion        uint   `ebml:"4286" ebmldef:"1"`
	EBMLReadVersion    uint   `ebml:"42f7" ebmldef:"1"`
	EBMLMaxIDLength    uint   `ebml:"42f2" ebmldef:"4"`
	EBMLMaxSizeLength  uint   `ebml:"42f3" ebmldef:"8"`
	DocType            string `ebml:"4282"`
	DocTypeVersion     uint   `ebml:"4287" ebmldef:"1"`
	DocTypeReadVersion uint   `ebml:"4285" ebmldef:"1"`
}

type Packet

type Packet struct {
	Data        []byte
	Timecode    time.Duration
	TrackNumber uint
	Invisible   bool
	Keyframe    bool
	Discardable bool
	Rebase      bool
}

type Reader

type Reader struct {
	Chan chan Packet
	// contains filtered or unexported fields
}

func Parse

func Parse(r io.ReadSeeker, m *WebM) (wr *Reader, err error)

func (*Reader) Seek

func (r *Reader) Seek(t time.Duration)

func (*Reader) Shutdown

func (r *Reader) Shutdown()

type Samples

type Samples struct {
	Data     []float32
	Timecode time.Duration
	Rebase   bool
	EOS      bool
}

type Seek

type Seek struct {
	SeekID       []byte `ebml:"53AB"`
	SeekPosition int64  `ebml:"53AC"`
}

type SeekHead

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

type Segment

type Segment struct {
	SeekHead           `ebml:"114D9B74" ebmlstop:"1"`
	SegmentInformation `ebml:"1549A966"`
	Tracks             `ebml:"1654AE6B"`
	Cues               `ebml:"1C53BB6B"`
	// contains filtered or unexported fields
}

type SegmentInformation

type SegmentInformation struct {
	TimecodeScale uint    `ebml:"2AD7B1" ebmldef:"1000000"`
	Duration      float64 `ebml:"4489"`
	DateUTC       []byte  `ebml:"4461"`
	MuxingApp     string  `ebml:"4D80"`
	WritingApp    string  `ebml:"5741"`
}

func (*SegmentInformation) GetDuration

func (s *SegmentInformation) GetDuration() time.Duration

type Slices

type Slices struct {
	TimeSlice []TimeSlice `ebml:"E8"`
}

type Splitter

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

func NewSplitter

func NewSplitter(ch <-chan Packet) *Splitter

func (*Splitter) Split

func (s *Splitter) Split(strms ...*Stream)

type Stream

type Stream struct {
	Track   *TrackEntry
	Decoder Decoder
}

func NewStream

func NewStream(track *TrackEntry) *Stream

func (*Stream) AudioChannel

func (s *Stream) AudioChannel() <-chan Samples

func (*Stream) VideoChannel

func (s *Stream) VideoChannel() <-chan Frame

type TimeSlice

type TimeSlice struct {
	LaceNumber uint `ebml:"CC" ebmldef:"0"`
}

type TrackEntry

type TrackEntry struct {
	TrackNumber     uint   `ebml:"D7"`
	TrackUID        uint64 `ebml:"73C5"`
	TrackType       uint   `ebml:"83"`
	FlagEnabled     uint   `ebml:"B9" ebmldef:"1"`
	FlagDefault     uint   `ebml:"88" ebmldef:"1"`
	FlagForced      uint   `ebml:"55AA" ebmldef:"0"`
	FlagLacing      uint   `ebml:"9C" ebmldef:"1"`
	DefaultDuration uint64 `ebml:"23E383"`
	Name            string `ebml:"536E"`
	Language        string `ebml:"22B59C" ebmldef:"eng"`
	CodecID         string `ebml:"86"`
	CodecPrivate    []byte `ebml:"63A2"`
	CodecName       string `ebml:"258688"`
	Video           `ebml:"E0"`
	Audio           `ebml:"E1"`
}

func (*TrackEntry) GetDefaultDuration

func (t *TrackEntry) GetDefaultDuration() time.Duration

func (*TrackEntry) IsAudio

func (t *TrackEntry) IsAudio() bool

func (*TrackEntry) IsVideo

func (t *TrackEntry) IsVideo() bool

type Tracks

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

type Video

type Video struct {
	FlagInterlaced  uint `ebml:"9A" ebmldef:"0"`
	StereoMode      uint `ebml:"53B8" ebmldef:"0"`
	PixelWidth      uint `ebml:"B0"`
	PixelHeight     uint `ebml:"BA"`
	PixelCropBottom uint `ebml:"54AA" ebmldef:"0"`
	PixelCropTop    uint `ebml:"54BB" ebmldef:"0"`
	PixelCropLeft   uint `ebml:"54CC" ebmldef:"0"`
	PixelCropRight  uint `ebml:"54DD" ebmldef:"0"`
	DisplayWidth    uint `ebml:"54B0" ebmldeflink:"PixelWidth"`
	DisplayHeight   uint `ebml:"54BA" ebmldeflink:"PixelHeight"`
	DisplayUnit     uint `ebml:"54B2" ebmldef:"0"`
	AspectRatioType uint `ebml:"54B3" ebmldef:"0"`
}

type VideoDecoder

type VideoDecoder struct {
	Chan chan Frame
	// contains filtered or unexported fields
}

func NewVideoDecoder

func NewVideoDecoder(track *TrackEntry) *VideoDecoder

func (*VideoDecoder) Close

func (d *VideoDecoder) Close()

func (*VideoDecoder) Decode

func (d *VideoDecoder) Decode(pkt *Packet) bool

type WebM

type WebM struct {
	Header  `ebml:"1a45dfa3"`
	Segment `ebml:"18538067"`
}

func (*WebM) FindFirstAudioTrack

func (w *WebM) FindFirstAudioTrack() *TrackEntry

func (*WebM) FindFirstVideoTrack

func (w *WebM) FindFirstVideoTrack() *TrackEntry

Jump to

Keyboard shortcuts

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