codecs

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: MIT Imports: 4 Imported by: 3

Documentation

Overview

Package codecs implements codec specific RTP payloader/depayloaders

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type G711Payloader

type G711Payloader struct{}

G711Payloader payloads G711 packets

func (*G711Payloader) Payload

func (p *G711Payloader) Payload(mtu int, payload []byte) [][]byte

Payload fragments an G711 packet across one or more byte arrays

type G722Payloader

type G722Payloader struct{}

G722Payloader payloads G722 packets

func (*G722Payloader) Payload

func (p *G722Payloader) Payload(mtu int, payload []byte) [][]byte

Payload fragments an G722 packet across one or more byte arrays

type H264Packet

type H264Packet struct {
	IsAVC bool
	// contains filtered or unexported fields
}

H264Packet represents the H264 header that is stored in the payload of an RTP Packet

func (*H264Packet) IsDetectedFinalPacketInSequence

func (p *H264Packet) IsDetectedFinalPacketInSequence(rtpPacketMarketBit bool) bool

IsDetectedFinalPacketInSequence returns true of the packet passed in has the marker bit set indicated the end of a packet sequence

func (*H264Packet) Unmarshal

func (p *H264Packet) Unmarshal(payload []byte) ([]byte, error)

Unmarshal parses the passed byte slice and stores the result in the H264Packet this method is called upon

type H264PartitionHeadChecker

type H264PartitionHeadChecker struct{}

H264PartitionHeadChecker checks H264 partition head

func (*H264PartitionHeadChecker) IsPartitionHead

func (*H264PartitionHeadChecker) IsPartitionHead(packet []byte) bool

IsPartitionHead checks if this is the head of a packetized nalu stream.

type H264Payloader

type H264Payloader struct{}

H264Payloader payloads H264 packets

func (*H264Payloader) Payload

func (p *H264Payloader) Payload(mtu int, payload []byte) [][]byte

Payload fragments a H264 packet across one or more byte arrays

type OpusPacket

type OpusPacket struct {
	Payload []byte
}

OpusPacket represents the Opus header that is stored in the payload of an RTP Packet

func (*OpusPacket) IsDetectedFinalPacketInSequence

func (p *OpusPacket) IsDetectedFinalPacketInSequence(rtpPacketMarketBit bool) bool

IsDetectedFinalPacketInSequence returns true as all opus packets are always final in a sequence

func (*OpusPacket) Unmarshal

func (p *OpusPacket) Unmarshal(packet []byte) ([]byte, error)

Unmarshal parses the passed byte slice and stores the result in the OpusPacket this method is called upon

type OpusPartitionHeadChecker

type OpusPartitionHeadChecker struct{}

OpusPartitionHeadChecker checks Opus partition head

func (*OpusPartitionHeadChecker) IsPartitionHead

func (*OpusPartitionHeadChecker) IsPartitionHead(packet []byte) bool

IsPartitionHead checks whether if this is a head of the Opus partition

type OpusPayloader

type OpusPayloader struct{}

OpusPayloader payloads Opus packets

func (*OpusPayloader) Payload

func (p *OpusPayloader) Payload(mtu int, payload []byte) [][]byte

Payload fragments an Opus packet across one or more byte arrays

type VP8Packet

type VP8Packet struct {
	// Required Header
	X   uint8 /* extended control bits present */
	N   uint8 /* when set to 1 this frame can be discarded */
	S   uint8 /* start of VP8 partition */
	PID uint8 /* partition index */

	// Extended control bits
	I uint8 /* 1 if PictureID is present */
	L uint8 /* 1 if TL0PICIDX is present */
	T uint8 /* 1 if TID is present */
	K uint8 /* 1 if KEYIDX is present */

	// Optional extension
	PictureID uint16 /* 8 or 16 bits, picture ID */
	TL0PICIDX uint8  /* 8 bits temporal level zero index */
	TID       uint8  /* 2 bits temporal layer index */
	Y         uint8  /* 1 bit layer sync bit */
	KEYIDX    uint8  /* 5 bits temporal key frame index */

	Payload []byte
}

VP8Packet represents the VP8 header that is stored in the payload of an RTP Packet

func (*VP8Packet) IsDetectedFinalPacketInSequence

func (p *VP8Packet) IsDetectedFinalPacketInSequence(rtpPacketMarketBit bool) bool

IsDetectedFinalPacketInSequence returns true of the packet passed in has the marker bit set indicated the end of a packet sequence

func (*VP8Packet) Unmarshal

func (p *VP8Packet) Unmarshal(payload []byte) ([]byte, error)

Unmarshal parses the passed byte slice and stores the result in the VP8Packet this method is called upon

type VP8PartitionHeadChecker

type VP8PartitionHeadChecker struct{}

VP8PartitionHeadChecker checks VP8 partition head

func (*VP8PartitionHeadChecker) IsPartitionHead

func (*VP8PartitionHeadChecker) IsPartitionHead(packet []byte) bool

IsPartitionHead checks whether if this is a head of the VP8 partition

type VP8Payloader

type VP8Payloader struct {
	EnablePictureID bool
	// contains filtered or unexported fields
}

VP8Payloader payloads VP8 packets

func (*VP8Payloader) Payload

func (p *VP8Payloader) Payload(mtu int, payload []byte) [][]byte

Payload fragments a VP8 packet across one or more byte arrays

type VP9Packet

type VP9Packet struct {
	// Required header
	I bool // PictureID is present
	P bool // Inter-picture predicted frame
	L bool // Layer indices is present
	F bool // Flexible mode
	B bool // Start of a frame
	E bool // End of a frame
	V bool // Scalability structure (SS) data present

	// Recommended headers
	PictureID uint16 // 7 or 16 bits, picture ID

	// Conditionally recommended headers
	TID uint8 // Temporal layer ID
	U   bool  // Switching up point
	SID uint8 // Spatial layer ID
	D   bool  // Inter-layer dependency used

	// Conditionally required headers
	PDiff     []uint8 // Reference index (F=1)
	TL0PICIDX uint8   // Temporal layer zero index (F=0)

	// Scalability structure headers
	NS      uint8 // N_S + 1 indicates the number of spatial layers present in the VP9 stream
	Y       bool  // Each spatial layer's frame resolution present
	G       bool  // PG description present flag.
	NG      uint8 // N_G indicates the number of pictures in a Picture Group (PG)
	Width   []uint16
	Height  []uint16
	PGTID   []uint8   // Temporal layer ID of pictures in a Picture Group
	PGU     []bool    // Switching up point of pictures in a Picture Group
	PGPDiff [][]uint8 // Reference indecies of pictures in a Picture Group

	Payload []byte
}

VP9Packet represents the VP9 header that is stored in the payload of an RTP Packet

func (*VP9Packet) IsDetectedFinalPacketInSequence

func (p *VP9Packet) IsDetectedFinalPacketInSequence(rtpPacketMarketBit bool) bool

IsDetectedFinalPacketInSequence returns true of the packet passed in has the marker bit set indicated the end of a packet sequence

func (*VP9Packet) Unmarshal

func (p *VP9Packet) Unmarshal(packet []byte) ([]byte, error)

Unmarshal parses the passed byte slice and stores the result in the VP9Packet this method is called upon

type VP9PartitionHeadChecker

type VP9PartitionHeadChecker struct{}

VP9PartitionHeadChecker checks VP9 partition head

func (*VP9PartitionHeadChecker) IsPartitionHead

func (*VP9PartitionHeadChecker) IsPartitionHead(packet []byte) bool

IsPartitionHead checks whether if this is a head of the VP9 partition

type VP9Payloader

type VP9Payloader struct {

	// InitialPictureIDFn is a function that returns random initial picture ID.
	InitialPictureIDFn func() uint16
	// contains filtered or unexported fields
}

VP9Payloader payloads VP9 packets

func (*VP9Payloader) Payload

func (p *VP9Payloader) Payload(mtu int, payload []byte) [][]byte

Payload fragments an VP9 packet across one or more byte arrays

Jump to

Keyboard shortcuts

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