formatprocessor

package
v0.23.4 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package formatprocessor contains code to cleanup and normalize streams.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Processor

type Processor interface {
	// cleans and normalizes a data unit.
	Process(Unit, bool) error

	// wraps a RTP packet into a Unit.
	UnitForRTPPacket(pkt *rtp.Packet, ntp time.Time) Unit
}

Processor cleans and normalizes streams.

func New

func New(
	udpMaxPayloadSize int,
	forma formats.Format,
	generateRTPPackets bool,
	log logger.Writer,
) (Processor, error)

New allocates a Processor.

type Unit

type Unit interface {
	// returns RTP packets contained into the unit.
	GetRTPPackets() []*rtp.Packet

	// returns the NTP timestamp of the unit.
	GetNTP() time.Time
}

Unit is the elementary data unit routed across the server.

type UnitAV1

type UnitAV1 struct {
	RTPPackets []*rtp.Packet
	NTP        time.Time
	PTS        time.Duration
	OBUs       [][]byte
}

UnitAV1 is an AV1 data unit.

func (*UnitAV1) GetNTP

func (d *UnitAV1) GetNTP() time.Time

GetNTP implements Unit.

func (*UnitAV1) GetRTPPackets

func (d *UnitAV1) GetRTPPackets() []*rtp.Packet

GetRTPPackets implements Unit.

type UnitGeneric

type UnitGeneric struct {
	RTPPackets []*rtp.Packet
	NTP        time.Time
}

UnitGeneric is a generic data unit.

func (*UnitGeneric) GetNTP

func (d *UnitGeneric) GetNTP() time.Time

GetNTP implements Unit.

func (*UnitGeneric) GetRTPPackets

func (d *UnitGeneric) GetRTPPackets() []*rtp.Packet

GetRTPPackets implements Unit.

type UnitH264

type UnitH264 struct {
	RTPPackets []*rtp.Packet
	NTP        time.Time
	PTS        time.Duration
	AU         [][]byte
}

UnitH264 is a H264 data unit.

func (*UnitH264) GetNTP

func (d *UnitH264) GetNTP() time.Time

GetNTP implements Unit.

func (*UnitH264) GetRTPPackets

func (d *UnitH264) GetRTPPackets() []*rtp.Packet

GetRTPPackets implements Unit.

type UnitH265

type UnitH265 struct {
	RTPPackets []*rtp.Packet
	NTP        time.Time
	PTS        time.Duration
	AU         [][]byte
}

UnitH265 is a H265 data unit.

func (*UnitH265) GetNTP

func (d *UnitH265) GetNTP() time.Time

GetNTP implements Unit.

func (*UnitH265) GetRTPPackets

func (d *UnitH265) GetRTPPackets() []*rtp.Packet

GetRTPPackets implements Unit.

type UnitMPEG2Audio

type UnitMPEG2Audio struct {
	RTPPackets []*rtp.Packet
	NTP        time.Time
	PTS        time.Duration
	Frames     [][]byte
}

UnitMPEG2Audio is a MPEG-1/2 Audio data unit.

func (*UnitMPEG2Audio) GetNTP

func (d *UnitMPEG2Audio) GetNTP() time.Time

GetNTP implements Unit.

func (*UnitMPEG2Audio) GetRTPPackets

func (d *UnitMPEG2Audio) GetRTPPackets() []*rtp.Packet

GetRTPPackets implements Unit.

type UnitMPEG4AudioGeneric added in v0.23.4

type UnitMPEG4AudioGeneric struct {
	RTPPackets []*rtp.Packet
	NTP        time.Time
	PTS        time.Duration
	AUs        [][]byte
}

UnitMPEG4AudioGeneric is a MPEG-4 Audio data unit.

func (*UnitMPEG4AudioGeneric) GetNTP added in v0.23.4

func (d *UnitMPEG4AudioGeneric) GetNTP() time.Time

GetNTP implements Unit.

func (*UnitMPEG4AudioGeneric) GetRTPPackets added in v0.23.4

func (d *UnitMPEG4AudioGeneric) GetRTPPackets() []*rtp.Packet

GetRTPPackets implements Unit.

type UnitMPEG4AudioLATM added in v0.23.4

type UnitMPEG4AudioLATM struct {
	RTPPackets []*rtp.Packet
	NTP        time.Time
	PTS        time.Duration
	AU         []byte
}

UnitMPEG4AudioLATM is a MPEG-4 Audio data unit.

func (*UnitMPEG4AudioLATM) GetNTP added in v0.23.4

func (d *UnitMPEG4AudioLATM) GetNTP() time.Time

GetNTP implements Unit.

func (*UnitMPEG4AudioLATM) GetRTPPackets added in v0.23.4

func (d *UnitMPEG4AudioLATM) GetRTPPackets() []*rtp.Packet

GetRTPPackets implements Unit.

type UnitOpus

type UnitOpus struct {
	RTPPackets []*rtp.Packet
	NTP        time.Time
	PTS        time.Duration
	Frame      []byte
}

UnitOpus is a Opus data unit.

func (*UnitOpus) GetNTP

func (d *UnitOpus) GetNTP() time.Time

GetNTP implements Unit.

func (*UnitOpus) GetRTPPackets

func (d *UnitOpus) GetRTPPackets() []*rtp.Packet

GetRTPPackets implements Unit.

type UnitVP8

type UnitVP8 struct {
	RTPPackets []*rtp.Packet
	NTP        time.Time
	PTS        time.Duration
	Frame      []byte
}

UnitVP8 is a VP8 data unit.

func (*UnitVP8) GetNTP

func (d *UnitVP8) GetNTP() time.Time

GetNTP implements Unit.

func (*UnitVP8) GetRTPPackets

func (d *UnitVP8) GetRTPPackets() []*rtp.Packet

GetRTPPackets implements Unit.

type UnitVP9

type UnitVP9 struct {
	RTPPackets []*rtp.Packet
	NTP        time.Time
	PTS        time.Duration
	Frame      []byte
}

UnitVP9 is a VP9 data unit.

func (*UnitVP9) GetNTP

func (d *UnitVP9) GetNTP() time.Time

GetNTP implements Unit.

func (*UnitVP9) GetRTPPackets

func (d *UnitVP9) GetRTPPackets() []*rtp.Packet

GetRTPPackets implements Unit.

Jump to

Keyboard shortcuts

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