decoder

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2020 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColorFormat

type ColorFormat int
const (
	ColorRGBA ColorFormat = iota
	ColorBGRA
)

type DecodedImage

type DecodedImage interface {
	IsKeyFrame() bool
	Width() uint32
	Height() uint32
	Plane(n int) []byte
	Stride(n int) int
	ToBytes(format ColorFormat) []byte
	ToRGBA() *image.RGBA
}

DecodedImage defines interface for images which decoded by encoded video frame.

type Frame

type Frame struct {
	Packets   []interface{}
	Timestamp uint32
}

type FrameBuilder

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

FrameBuilder contains all packets maxLate determines how long we should wait until we get a valid Frame The larger the value the less packet loss you will see, but higher latency

This is customized version of Pion's sample builder https://github.com/pion/webrtc/blob/master/pkg/media/samplebuilder/samplebuilder.go

func NewFrameBuilder

func NewFrameBuilder(maxLate uint16, depacketizer rtp.Depacketizer, checker rtp.PartitionHeadChecker, opts ...Option) *FrameBuilder

NewFrameBuilder constructs a new FrameBuilder

func (*FrameBuilder) Pop

func (s *FrameBuilder) Pop() *Frame

Pop scans buffer for valid samples, returns nil when no valid samples have been found

func (*FrameBuilder) PopWithTimestamp

func (s *FrameBuilder) PopWithTimestamp() *Frame

PopWithTimestamp scans buffer for valid samples and its RTP timestamp, returns nil, 0 when no valid samples have been found

func (*FrameBuilder) Push

func (s *FrameBuilder) Push(p *rtp.Packet)

Push adds a RTP Packet to the FrameBuilder

type Option

type Option func(o *FrameBuilder)

Option configures FrameBuilder

type VideoDecodeResult added in v0.3.0

type VideoDecodeResult struct {
	Image DecodedImage
	Err   error
}

VideoDecodeResult contains decoded image for each frame or error when decode failed.

type VideoDecoder added in v0.3.0

type VideoDecoder interface {
	NewFrameBuilder() *FrameBuilder
	Process(src <-chan *Frame) chan VideoDecodeResult
	Close() error
}

VideoDecoder defines interfaces for video decoder.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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