codecs

package
v1.8.10 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: MIT Imports: 7 Imported by: 342

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 AV1Packet added in v1.7.10

type AV1Packet struct {
	// Z: MUST be set to 1 if the first OBU element is an
	//    OBU fragment that is a continuation of an OBU fragment
	//    from the previous packet, and MUST be set to 0 otherwise.
	Z bool

	// Y: MUST be set to 1 if the last OBU element is an OBU fragment
	//    that will continue in the next packet, and MUST be set to 0 otherwise.
	Y bool

	// W: two bit field that describes the number of OBU elements in the packet.
	//    This field MUST be set equal to 0 or equal to the number of OBU elements
	//    contained in the packet. If set to 0, each OBU element MUST be preceded by
	//    a length field. If not set to 0 (i.e., W = 1, 2 or 3) the last OBU element
	//    MUST NOT be preceded by a length field. Instead, the length of the last OBU
	//    element contained in the packet can be calculated as follows:
	// Length of the last OBU element =
	//    length of the RTP payload
	//  - length of aggregation header
	//  - length of previous OBU elements including length fields
	W byte

	// N: MUST be set to 1 if the packet is the first packet of a coded video sequence, and MUST be set to 0 otherwise.
	N bool

	// Each AV1 RTP Packet is a collection of OBU Elements. Each OBU Element may be a full OBU, or just a fragment of one.
	// AV1Frame provides the tools to construct a collection of OBUs from a collection of OBU Elements
	OBUElements [][]byte
	// contains filtered or unexported fields
}

AV1Packet represents a depacketized AV1 RTP Packet

* 0 1 2 3 4 5 6 7 * +-+-+-+-+-+-+-+-+ * |Z|Y| W |N|-|-|-| * +-+-+-+-+-+-+-+-+ * https://aomediacodec.github.io/av1-rtp-spec/#44-av1-aggregation-header

func (*AV1Packet) IsPartitionTail added in v1.8.6

func (d *AV1Packet) IsPartitionTail(marker bool, _ []byte) bool

func (*AV1Packet) SetZeroAllocation added in v1.8.6

func (d *AV1Packet) SetZeroAllocation(zeroAllocation bool)

SetZeroAllocation enables Zero Allocation mode for the depacketizer By default the Depacketizers will allocate as they parse. These allocations are needed for Metadata and other optional values. If you don't need this information enabling SetZeroAllocation gives you higher performance at a reduced feature set.

func (*AV1Packet) Unmarshal added in v1.7.10

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

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

type AV1Payloader added in v1.7.10

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

AV1Payloader payloads AV1 packets

func (*AV1Payloader) Payload added in v1.7.10

func (p *AV1Payloader) Payload(mtu uint16, payload []byte) (payloads [][]byte)

Payload fragments a AV1 packet across one or more byte arrays See AV1Packet for description of AV1 Payload Header

type G711Payloader added in v1.1.4

type G711Payloader struct{}

G711Payloader payloads G711 packets

func (*G711Payloader) Payload added in v1.1.4

func (p *G711Payloader) Payload(mtu uint16, 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 uint16, payload []byte) [][]byte

Payload fragments an G722 packet across one or more byte arrays

type H264Packet added in v1.5.0

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 added in v1.6.4

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) IsPartitionHead added in v1.7.2

func (*H264Packet) IsPartitionHead(payload []byte) bool

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

func (*H264Packet) IsPartitionTail added in v1.7.2

func (d *H264Packet) IsPartitionTail(marker bool, _ []byte) bool

func (*H264Packet) SetZeroAllocation added in v1.8.6

func (d *H264Packet) SetZeroAllocation(zeroAllocation bool)

SetZeroAllocation enables Zero Allocation mode for the depacketizer By default the Depacketizers will allocate as they parse. These allocations are needed for Metadata and other optional values. If you don't need this information enabling SetZeroAllocation gives you higher performance at a reduced feature set.

func (*H264Packet) Unmarshal added in v1.5.0

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 deprecated added in v1.6.4

type H264PartitionHeadChecker struct{}

H264PartitionHeadChecker checks H264 partition head.

Deprecated: replaced by H264Packet.IsPartitionHead()

func (*H264PartitionHeadChecker) IsPartitionHead deprecated added in v1.6.4

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

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

Deprecated: replaced by H264Packet.IsPartitionHead()

type H264Payloader

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

H264Payloader payloads H264 packets

func (*H264Payloader) Payload

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

Payload fragments a H264 packet across one or more byte arrays

type H265AggregationPacket added in v1.7.1

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

H265AggregationPacket represents an Aggregation packet.

* 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | PayloadHdr (Type=48) | | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | * | | * | two or more aggregation units | * | | * | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | :...OPTIONAL RTP padding | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * Reference: https://datatracker.ietf.org/doc/html/rfc7798#section-4.4.2

func (*H265AggregationPacket) FirstUnit added in v1.7.1

FirstUnit returns the first Aggregated Unit of the packet.

func (*H265AggregationPacket) OtherUnits added in v1.7.1

func (p *H265AggregationPacket) OtherUnits() []H265AggregationUnit

OtherUnits returns the all the other Aggregated Unit of the packet (excluding the first one).

func (*H265AggregationPacket) Unmarshal added in v1.7.1

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

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

func (*H265AggregationPacket) WithDONL added in v1.7.1

func (p *H265AggregationPacket) WithDONL(value bool)

WithDONL can be called to specify whether or not DONL might be parsed. DONL may need to be parsed if `sprop-max-don-diff` is greater than 0 on the RTP stream.

type H265AggregationUnit added in v1.7.1

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

H265AggregationUnit represent the an Aggregation Unit in an AP, which is not the first one.

* 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * : DOND (cond) | NALU size | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | | * | NAL unit | * | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | : * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * Reference: https://datatracker.ietf.org/doc/html/rfc7798#section-4.4.2

func (H265AggregationUnit) DOND added in v1.7.1

func (u H265AggregationUnit) DOND() *uint8

DOND field plus 1 specifies the difference between the decoding order number values of the current aggregated NAL unit and the preceding aggregated NAL unit in the same AP.

func (H265AggregationUnit) NALUSize added in v1.7.1

func (u H265AggregationUnit) NALUSize() uint16

NALUSize represents the size, in bytes, of the NalUnit.

func (H265AggregationUnit) NalUnit added in v1.7.1

func (u H265AggregationUnit) NalUnit() []byte

NalUnit payload.

type H265AggregationUnitFirst added in v1.7.1

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

H265AggregationUnitFirst represent the First Aggregation Unit in an AP.

* 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * : DONL (conditional) | NALU size | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | NALU size | | * +-+-+-+-+-+-+-+-+ NAL unit | * | | * | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | : * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * Reference: https://datatracker.ietf.org/doc/html/rfc7798#section-4.4.2

func (H265AggregationUnitFirst) DONL added in v1.7.1

func (u H265AggregationUnitFirst) DONL() *uint16

DONL field, when present, specifies the value of the 16 least significant bits of the decoding order number of the aggregated NAL unit.

func (H265AggregationUnitFirst) NALUSize added in v1.7.1

func (u H265AggregationUnitFirst) NALUSize() uint16

NALUSize represents the size, in bytes, of the NalUnit.

func (H265AggregationUnitFirst) NalUnit added in v1.7.1

func (u H265AggregationUnitFirst) NalUnit() []byte

NalUnit payload.

type H265FragmentationUnitHeader added in v1.7.1

type H265FragmentationUnitHeader uint8

H265FragmentationUnitHeader is a H265 FU Header

* +---------------+ * |0|1|2|3|4|5|6|7| * +-+-+-+-+-+-+-+-+ * |S|E| FuType | * +---------------+ *

func (H265FragmentationUnitHeader) E added in v1.7.1

E represents the end of a fragmented NAL unit.

func (H265FragmentationUnitHeader) FuType added in v1.7.1

FuType MUST be equal to the field Type of the fragmented NAL unit.

func (H265FragmentationUnitHeader) S added in v1.7.1

S represents the start of a fragmented NAL unit.

type H265FragmentationUnitPacket added in v1.7.1

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

H265FragmentationUnitPacket represents a single Fragmentation Unit packet.

* 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | PayloadHdr (Type=49) | FU header | DONL (cond) | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-| * | DONL (cond) | | * |-+-+-+-+-+-+-+-+ | * | FU payload | * | | * | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | :...OPTIONAL RTP padding | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * Reference: https://datatracker.ietf.org/doc/html/rfc7798#section-4.4.3

func (*H265FragmentationUnitPacket) DONL added in v1.7.1

DONL returns the DONL of the packet.

func (*H265FragmentationUnitPacket) FuHeader added in v1.7.1

FuHeader returns the Fragmentation Unit Header of the packet.

func (*H265FragmentationUnitPacket) Payload added in v1.7.1

func (p *H265FragmentationUnitPacket) Payload() []byte

Payload returns the Fragmentation Unit packet payload.

func (*H265FragmentationUnitPacket) PayloadHeader added in v1.7.1

func (p *H265FragmentationUnitPacket) PayloadHeader() H265NALUHeader

PayloadHeader returns the NALU header of the packet.

func (*H265FragmentationUnitPacket) Unmarshal added in v1.7.1

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

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

func (*H265FragmentationUnitPacket) WithDONL added in v1.7.1

func (p *H265FragmentationUnitPacket) WithDONL(value bool)

WithDONL can be called to specify whether or not DONL might be parsed. DONL may need to be parsed if `sprop-max-don-diff` is greater than 0 on the RTP stream.

type H265NALUHeader added in v1.7.1

type H265NALUHeader uint16

H265NALUHeader is a H265 NAL Unit Header https://datatracker.ietf.org/doc/html/rfc7798#section-1.1.4

* +---------------+---------------+ * |0|1|2|3|4|5|6|7|0|1|2|3|4|5|6|7| * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * |F| Type | LayerID | TID | * +-------------+-----------------+ *

func (H265NALUHeader) F added in v1.7.1

func (h H265NALUHeader) F() bool

F is the forbidden bit, should always be 0.

func (H265NALUHeader) IsAggregationPacket added in v1.7.1

func (h H265NALUHeader) IsAggregationPacket() bool

IsAggregationPacket returns whether or not the packet is an Aggregation packet.

func (H265NALUHeader) IsFragmentationUnit added in v1.7.1

func (h H265NALUHeader) IsFragmentationUnit() bool

IsFragmentationUnit returns whether or not the packet is a Fragmentation Unit packet.

func (H265NALUHeader) IsPACIPacket added in v1.7.1

func (h H265NALUHeader) IsPACIPacket() bool

IsPACIPacket returns whether or not the packet is a PACI packet.

func (H265NALUHeader) IsTypeVCLUnit added in v1.7.1

func (h H265NALUHeader) IsTypeVCLUnit() bool

IsTypeVCLUnit returns whether or not the NAL Unit type is a VCL NAL unit.

func (H265NALUHeader) LayerID added in v1.7.1

func (h H265NALUHeader) LayerID() uint8

LayerID should always be 0 in non-3D HEVC context.

func (H265NALUHeader) TID added in v1.7.1

func (h H265NALUHeader) TID() uint8

TID is the temporal identifier of the NAL unit +1.

func (H265NALUHeader) Type added in v1.7.1

func (h H265NALUHeader) Type() uint8

Type of NAL Unit.

type H265PACIPacket added in v1.7.1

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

H265PACIPacket represents a single H265 PACI packet.

* 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | PayloadHdr (Type=50) |A| cType | PHSsize |F0..2|Y| * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Payload Header Extension Structure (PHES) | * |=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=| * | | * | PACI payload: NAL unit | * | . . . | * | | * | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | :...OPTIONAL RTP padding | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * Reference: https://datatracker.ietf.org/doc/html/rfc7798#section-4.4.4

func (*H265PACIPacket) A added in v1.7.1

func (p *H265PACIPacket) A() bool

A copies the F bit of the PACI payload NALU.

func (*H265PACIPacket) CType added in v1.7.1

func (p *H265PACIPacket) CType() uint8

CType copies the Type field of the PACI payload NALU.

func (*H265PACIPacket) F0 added in v1.7.1

func (p *H265PACIPacket) F0() bool

F0 indicates the presence of a Temporal Scalability support extension in the PHES.

func (*H265PACIPacket) F1 added in v1.7.1

func (p *H265PACIPacket) F1() bool

F1 must be zero, reserved for future extensions.

func (*H265PACIPacket) F2 added in v1.7.1

func (p *H265PACIPacket) F2() bool

F2 must be zero, reserved for future extensions.

func (*H265PACIPacket) PHES added in v1.7.1

func (p *H265PACIPacket) PHES() []byte

PHES contains header extensions. Its size is indicated by PHSsize.

func (*H265PACIPacket) PHSsize added in v1.7.1

func (p *H265PACIPacket) PHSsize() uint8

PHSsize indicates the size of the PHES field.

func (*H265PACIPacket) Payload added in v1.7.1

func (p *H265PACIPacket) Payload() []byte

Payload is a single NALU or NALU-like struct, not including the first two octets (header).

func (*H265PACIPacket) PayloadHeader added in v1.7.1

func (p *H265PACIPacket) PayloadHeader() H265NALUHeader

PayloadHeader returns the NAL Unit Header.

func (*H265PACIPacket) TSCI added in v1.7.1

func (p *H265PACIPacket) TSCI() *H265TSCI

TSCI returns the Temporal Scalability Control Information extension, if present.

func (*H265PACIPacket) Unmarshal added in v1.7.1

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

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

func (*H265PACIPacket) Y added in v1.7.1

func (p *H265PACIPacket) Y() bool

Y must be zero, reserved for future extensions.

type H265Packet added in v1.7.1

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

H265Packet represents a H265 packet, stored in the payload of an RTP packet.

func (*H265Packet) IsPartitionHead added in v1.7.8

func (*H265Packet) IsPartitionHead(payload []byte) bool

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

func (*H265Packet) IsPartitionTail added in v1.7.8

func (d *H265Packet) IsPartitionTail(marker bool, _ []byte) bool

func (*H265Packet) Packet added in v1.7.1

func (p *H265Packet) Packet() isH265Packet

Packet returns the populated packet. Must be casted to one of: - *H265SingleNALUnitPacket - *H265FragmentationUnitPacket - *H265AggregationPacket - *H265PACIPacket nolint:golint

func (*H265Packet) SetZeroAllocation added in v1.8.6

func (d *H265Packet) SetZeroAllocation(zeroAllocation bool)

SetZeroAllocation enables Zero Allocation mode for the depacketizer By default the Depacketizers will allocate as they parse. These allocations are needed for Metadata and other optional values. If you don't need this information enabling SetZeroAllocation gives you higher performance at a reduced feature set.

func (*H265Packet) Unmarshal added in v1.7.1

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

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

func (*H265Packet) WithDONL added in v1.7.1

func (p *H265Packet) WithDONL(value bool)

WithDONL can be called to specify whether or not DONL might be parsed. DONL may need to be parsed if `sprop-max-don-diff` is greater than 0 on the RTP stream.

type H265SingleNALUnitPacket added in v1.7.1

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

H265SingleNALUnitPacket represents a NALU packet, containing exactly one NAL unit.

* 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | PayloadHdr | DONL (conditional) | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | | * | NAL unit payload data | * | | * | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | :...OPTIONAL RTP padding | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * Reference: https://datatracker.ietf.org/doc/html/rfc7798#section-4.4.1

func (*H265SingleNALUnitPacket) DONL added in v1.7.1

func (p *H265SingleNALUnitPacket) DONL() *uint16

DONL returns the DONL of the packet.

func (*H265SingleNALUnitPacket) Payload added in v1.7.1

func (p *H265SingleNALUnitPacket) Payload() []byte

Payload returns the Fragmentation Unit packet payload.

func (*H265SingleNALUnitPacket) PayloadHeader added in v1.7.1

func (p *H265SingleNALUnitPacket) PayloadHeader() H265NALUHeader

PayloadHeader returns the NALU header of the packet.

func (*H265SingleNALUnitPacket) Unmarshal added in v1.7.1

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

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

func (*H265SingleNALUnitPacket) WithDONL added in v1.7.1

func (p *H265SingleNALUnitPacket) WithDONL(value bool)

WithDONL can be called to specify whether or not DONL might be parsed. DONL may need to be parsed if `sprop-max-don-diff` is greater than 0 on the RTP stream.

type H265TSCI added in v1.7.1

type H265TSCI uint32

H265TSCI is a Temporal Scalability Control Information header extension. Reference: https://datatracker.ietf.org/doc/html/rfc7798#section-4.5

func (H265TSCI) E added in v1.7.1

func (h H265TSCI) E() bool

E see RFC7798 for more details.

func (H265TSCI) IrapPicID added in v1.7.1

func (h H265TSCI) IrapPicID() uint8

IrapPicID see RFC7798 for more details.

func (H265TSCI) RES added in v1.7.1

func (h H265TSCI) RES() uint8

RES see RFC7798 for more details.

func (H265TSCI) S added in v1.7.1

func (h H265TSCI) S() bool

S see RFC7798 for more details.

func (H265TSCI) TL0PICIDX added in v1.7.1

func (h H265TSCI) TL0PICIDX() uint8

TL0PICIDX see RFC7798 for more details.

type OpusPacket

type OpusPacket struct {
	Payload []byte
	// contains filtered or unexported fields
}

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

func (*OpusPacket) IsPartitionHead added in v1.7.2

func (d *OpusPacket) IsPartitionHead(_ []byte) bool

func (*OpusPacket) IsPartitionTail added in v1.7.2

func (d *OpusPacket) IsPartitionTail(_ bool, _ []byte) bool

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 deprecated added in v1.2.0

type OpusPartitionHeadChecker struct{}

OpusPartitionHeadChecker checks Opus partition head.

Deprecated: replaced by OpusPacket.IsPartitionHead()

func (*OpusPartitionHeadChecker) IsPartitionHead deprecated added in v1.2.0

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

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

Deprecated: replaced by OpusPacket.IsPartitionHead()

type OpusPayloader

type OpusPayloader struct{}

OpusPayloader payloads Opus packets

func (*OpusPayloader) Payload

func (p *OpusPayloader) Payload(_ uint16, 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
	// contains filtered or unexported fields
}

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

func (*VP8Packet) IsPartitionHead added in v1.7.2

func (*VP8Packet) IsPartitionHead(payload []byte) bool

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

func (*VP8Packet) IsPartitionTail added in v1.7.2

func (d *VP8Packet) IsPartitionTail(marker bool, _ []byte) bool

func (*VP8Packet) SetZeroAllocation added in v1.8.6

func (d *VP8Packet) SetZeroAllocation(zeroAllocation bool)

SetZeroAllocation enables Zero Allocation mode for the depacketizer By default the Depacketizers will allocate as they parse. These allocations are needed for Metadata and other optional values. If you don't need this information enabling SetZeroAllocation gives you higher performance at a reduced feature set.

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 deprecated added in v1.2.0

type VP8PartitionHeadChecker struct{}

VP8PartitionHeadChecker checks VP8 partition head

Deprecated: replaced by VP8Packet.IsPartitionHead()

func (*VP8PartitionHeadChecker) IsPartitionHead deprecated added in v1.2.0

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

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

Deprecated: replaced by VP8Packet.IsPartitionHead()

type VP8Payloader

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

VP8Payloader payloads VP8 packets

func (*VP8Payloader) Payload

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

Payload fragments a VP8 packet across one or more byte arrays

type VP9Packet added in v1.3.0

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
	Z bool // Not a reference frame for upper spatial layers

	// 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
	// contains filtered or unexported fields
}

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

func (*VP9Packet) IsPartitionHead added in v1.7.2

func (*VP9Packet) IsPartitionHead(payload []byte) bool

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

func (*VP9Packet) IsPartitionTail added in v1.7.2

func (d *VP9Packet) IsPartitionTail(marker bool, _ []byte) bool

func (*VP9Packet) SetZeroAllocation added in v1.8.6

func (d *VP9Packet) SetZeroAllocation(zeroAllocation bool)

SetZeroAllocation enables Zero Allocation mode for the depacketizer By default the Depacketizers will allocate as they parse. These allocations are needed for Metadata and other optional values. If you don't need this information enabling SetZeroAllocation gives you higher performance at a reduced feature set.

func (*VP9Packet) Unmarshal added in v1.3.0

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 deprecated added in v1.3.0

type VP9PartitionHeadChecker struct{}

VP9PartitionHeadChecker checks VP9 partition head.

Deprecated: replaced by VP9Packet.IsPartitionHead()

func (*VP9PartitionHeadChecker) IsPartitionHead deprecated added in v1.3.0

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

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

Deprecated: replaced by VP9Packet.IsPartitionHead()

type VP9Payloader added in v1.3.0

type VP9Payloader struct {
	// whether to use flexible mode or non-flexible mode.
	FlexibleMode bool

	// 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 added in v1.3.0

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

Payload fragments an VP9 packet across one or more byte arrays

Directories

Path Synopsis
av1
frame
Package frame provides code to construct complete media frames from packetized media.
Package frame provides code to construct complete media frames from packetized media.
obu
Package obu implements tools for working with the Open Bitstream Unit.
Package obu implements tools for working with the Open Bitstream Unit.
Package vp9 contains a VP9 header parser.
Package vp9 contains a VP9 header parser.

Jump to

Keyboard shortcuts

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