codec

package
v0.0.0-...-0bf383f Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AudioEncoderBuilder

type AudioEncoderBuilder interface {
	// RTPCodec represents the codec metadata
	RTPCodec() *RTPCodec
	// BuildAudioEncoder builds audio encoder by given media params and audio input
	BuildAudioEncoder(r audio.Reader, p prop.Media) (ReadCloser, error)
}

AudioEncoderBuilder is the interface that wraps basic operations that are necessary to build the audio encoder.

This interface is for codec implementors to provide codec specific params, but still giving generality for the users.

type BaseParams

type BaseParams struct {
	// Target bitrate in bps.
	BitRate int

	// Expected interval of the keyframes in frames.
	KeyFrameInterval int
}

BaseParams represents an codec's encoding properties

type RTPCodec

type RTPCodec struct {
	webrtc.RTPCodecParameters
	rtp.Payloader

	// Latency of static frame size codec.
	Latency time.Duration
}

RTPCodec wraps webrtc.RTPCodec. RTPCodec might extend webrtc.RTPCodec in the future.

func NewRTPH264Codec

func NewRTPH264Codec(clockrate uint32) *RTPCodec

NewRTPH264Codec is a helper to create an H264 codec

func NewRTPOpusCodec

func NewRTPOpusCodec(clockrate uint32) *RTPCodec

NewRTPOpusCodec is a helper to create an Opus codec

func NewRTPVP8Codec

func NewRTPVP8Codec(clockrate uint32) *RTPCodec

NewRTPVP8Codec is a helper to create an VP8 codec

func NewRTPVP9Codec

func NewRTPVP9Codec(clockrate uint32) *RTPCodec

NewRTPVP9Codec is a helper to create an VP9 codec

type ReadCloser

type ReadCloser interface {
	Read() (b []byte, release func(), err error)
	Close() error
	// SetBitRate sets current target bitrate, lower bitrate means smaller data will be transmitted
	// but this also means that the quality will also be lower.
	SetBitRate(int) error
	// ForceKeyFrame forces the next frame to be a keyframe, aka intra-frame.
	ForceKeyFrame() error
}

ReadCloser is an io.ReadCloser with methods for rate limiting: SetBitRate and ForceKeyFrame

type VideoEncoderBuilder

type VideoEncoderBuilder interface {
	// RTPCodec represents the codec metadata
	RTPCodec() *RTPCodec
	// BuildVideoEncoder builds video encoder by given media params and video input
	BuildVideoEncoder(r video.Reader, p prop.Media) (ReadCloser, error)
}

VideoEncoderBuilder is the interface that wraps basic operations that are necessary to build the video encoder.

This interface is for codec implementors to provide codec specific params, but still giving generality for the users.

Directories

Path Synopsis
Package vpx implements VP8 and VP9 encoder.
Package vpx implements VP8 and VP9 encoder.

Jump to

Keyboard shortcuts

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