formatprocessor

package
v0.0.0-...-e182c34 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package formatprocessor processes RTP packets into Units when can then be re-encoded heavily copied from https://github.com/bluenviron/mediamtx/blob/main/internal/formatprocessor/h264.go https://github.com/bluenviron/mediamtx/blob/main/internal/unit/h264.go & related package & the rest of that package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

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

Base contains fields shared across all units.

func (*Base) GetNTP

func (u *Base) GetNTP() time.Time

GetNTP implements Unit.

func (*Base) GetPTS

func (u *Base) GetPTS() time.Duration

GetPTS implements Unit.

func (*Base) GetRTPPackets

func (u *Base) GetRTPPackets() []*rtp.Packet

GetRTPPackets implements Unit.

type H264

type H264 struct {
	Base
	AU [][]byte
}

H264 is a H264 data unit.

type Processor

type Processor interface {
	// process a Unit.
	ProcessUnit(u Unit) error

	// process a RTP packet and convert it into a unit.
	ProcessRTPPacket(
		pkt *rtp.Packet,
		ntp time.Time,
		pts time.Duration,
		hasNonRTSPReaders bool,
	) (Unit, error)
}

Processor processes RTP packets & turns them into Units.

func New

func New(
	udpMaxPayloadSize int,
	forma format.Format,
	generateRTPPackets bool,
) (Processor, error)

New returns a new 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

	// returns the PTS of the unit.
	GetPTS() time.Duration
}

Unit is the elementary data unit routed across the server.

Jump to

Keyboard shortcuts

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